mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
The same way we allow defining a custom template/style path we now allow this for languages too.
This will allow applications to define their own language folder for certain parts for example. Callable by $user->set_custom_lang_path({new_path}) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8782 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
6c763cd8b6
commit
d7fa3f83ce
@ -97,12 +97,13 @@
|
||||
<li>[Fix] Added VST - Venezuela Standard Time (Bug #30545).</li>
|
||||
<li>[Fix] Close DB connections in file.php.</li>
|
||||
<li>[Change] Set headers to allow browsers to better cache attachments (Mylek pointed this out)</li>
|
||||
<li>[Change] Hide parameters if they equal the default (Bug #31185)</li>
|
||||
<li>[Change] Hide parameters if they equal the default in viewforum/viewtopic (Bug #31185)</li>
|
||||
<li>[Change] Various improvements to group listings (Bugs #32155, #32145, #32085, #26675, #26265)</li>
|
||||
<li>[Fix] Correctly return results for nested cached queries (Bug #31445 - Patch by faw).</li>
|
||||
<li>[Feature] Allow setting custom language path through $user->set_custom_lang_path(). $user->lang_path now also do not include the user language, but only the path.</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<a name="v301"></a><h3>1.ii. Changes since 3.0.1</h3>
|
||||
|
||||
|
@ -97,7 +97,7 @@ function recalc_btree($sql_id, $sql_table, $module_class = '')
|
||||
$item_data['left_id'] = $row['right_id'] + 1;
|
||||
$item_data['right_id'] = $row['right_id'] + 2;
|
||||
}
|
||||
|
||||
|
||||
$sql = "UPDATE $sql_table
|
||||
SET left_id = {$item_data['left_id']}, right_id = {$item_data['right_id']}
|
||||
WHERE $sql_id = " . $item_data[$sql_id];
|
||||
@ -916,7 +916,7 @@ function delete_attachments($mode, $ids, $resync = true)
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$remaining[] = $row['post_msg_id'];
|
||||
$remaining[] = $row['post_msg_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@ -940,7 +940,7 @@ function delete_attachments($mode, $ids, $resync = true)
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$remaining[] = $row['post_msg_id'];
|
||||
$remaining[] = $row['post_msg_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@ -978,7 +978,7 @@ function delete_attachments($mode, $ids, $resync = true)
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$remaining[] = $row['topic_id'];
|
||||
$remaining[] = $row['topic_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@ -1015,7 +1015,7 @@ function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = true)
|
||||
. $where;
|
||||
$db->sql_query($sql);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
$sql = 'SELECT t.topic_id
|
||||
FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TABLE . ' t2
|
||||
@ -1213,7 +1213,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
|
||||
AND t1.forum_id = t2.forum_id";
|
||||
$db->sql_query($sql);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
$sql = 'SELECT t1.topic_id
|
||||
FROM ' .TOPICS_TABLE . ' t1, ' . TOPICS_TABLE . " t2
|
||||
@ -2369,7 +2369,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
|
||||
$log_type = LOG_USERS;
|
||||
$sql_forum = 'AND l.reportee_id = ' . (int) $user_id;
|
||||
break;
|
||||
|
||||
|
||||
case 'users':
|
||||
$log_type = LOG_USERS;
|
||||
$sql_forum = '';
|
||||
@ -2379,7 +2379,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
|
||||
$log_type = LOG_CRITICAL;
|
||||
$sql_forum = '';
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -2637,7 +2637,7 @@ function update_foes($group_id = false, $user_id = false)
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($users))
|
||||
{
|
||||
{
|
||||
$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('zebra_id', $users) . '
|
||||
AND foe = 1';
|
||||
@ -2717,7 +2717,7 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
|
||||
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_REMIND'];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$users[] = $row;
|
||||
}
|
||||
|
||||
@ -2897,7 +2897,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
|
||||
@fputs($fsock, "GET $directory/$filename HTTP/1.1\r\n");
|
||||
@fputs($fsock, "HOST: $host\r\n");
|
||||
@fputs($fsock, "Connection: close\r\n\r\n");
|
||||
|
||||
|
||||
$file_info = '';
|
||||
$get_info = false;
|
||||
|
||||
@ -2936,7 +2936,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $file_info;
|
||||
}
|
||||
|
||||
@ -2972,7 +2972,7 @@ function tidy_warnings()
|
||||
$sql = 'DELETE FROM ' . WARNINGS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('warning_id', $warning_list);
|
||||
$db->sql_query($sql);
|
||||
|
||||
|
||||
foreach ($user_list as $user_id => $value)
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . " SET user_warnings = user_warnings - $value
|
||||
@ -3034,7 +3034,7 @@ function add_permission_language()
|
||||
// Now search in acp and mods folder for permissions_ files.
|
||||
foreach (array('acp/', 'mods/') as $path)
|
||||
{
|
||||
$dh = @opendir($user->lang_path . $path);
|
||||
$dh = @opendir($user->lang_path . $user->lang_name . '/' . $path);
|
||||
|
||||
if ($dh)
|
||||
{
|
||||
|
@ -818,11 +818,11 @@ class p_master
|
||||
{
|
||||
global $user, $phpEx;
|
||||
|
||||
if (file_exists($user->lang_path . 'mods'))
|
||||
if (file_exists($user->lang_path . $user->lang_name . '/mods'))
|
||||
{
|
||||
$add_files = array();
|
||||
|
||||
$dir = @opendir($user->lang_path . 'mods');
|
||||
$dir = @opendir($user->lang_path . $user->lang_name . '/mods');
|
||||
|
||||
if ($dir)
|
||||
{
|
||||
|
@ -52,10 +52,10 @@ class search_backend
|
||||
|
||||
$words = array();
|
||||
|
||||
if (file_exists("{$user->lang_path}/search_ignore_words.$phpEx"))
|
||||
if (file_exists("{$user->lang_path}{$user->lang_name}/search_ignore_words.$phpEx"))
|
||||
{
|
||||
// include the file containing ignore words
|
||||
include("{$user->lang_path}/search_ignore_words.$phpEx");
|
||||
include("{$user->lang_path}{$user->lang_name}/search_ignore_words.$phpEx");
|
||||
}
|
||||
|
||||
$this->ignore_words = $words;
|
||||
@ -74,10 +74,10 @@ class search_backend
|
||||
|
||||
$synonyms = array();
|
||||
|
||||
if (file_exists("{$user->lang_path}/search_synonyms.$phpEx"))
|
||||
if (file_exists("{$user->lang_path}{$user->lang_name}/search_synonyms.$phpEx"))
|
||||
{
|
||||
// include the file containing synonyms
|
||||
include("{$user->lang_path}/search_synonyms.$phpEx");
|
||||
include("{$user->lang_path}{$user->lang_name}/search_synonyms.$phpEx");
|
||||
}
|
||||
|
||||
$this->match_synonym = array_keys($synonyms);
|
||||
|
@ -1382,7 +1382,7 @@ class user extends session
|
||||
var $timezone;
|
||||
var $dst;
|
||||
|
||||
var $lang_name;
|
||||
var $lang_name = false;
|
||||
var $lang_id = false;
|
||||
var $lang_path;
|
||||
var $img_lang;
|
||||
@ -1392,6 +1392,32 @@ class user extends session
|
||||
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10);
|
||||
var $keyvalues = array();
|
||||
|
||||
/**
|
||||
* Constructor to set the lang path
|
||||
*/
|
||||
function user()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
|
||||
$this->lang_path = $phpbb_root_path . 'language/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to set custom language path (able to use directory outside of phpBB)
|
||||
*
|
||||
* @param string $lang_path New language path used.
|
||||
* @access public
|
||||
*/
|
||||
function set_custom_lang_path($lang_path)
|
||||
{
|
||||
$this->lang_path = $lang_path;
|
||||
|
||||
if (substr($this->lang_path, -1) != '/')
|
||||
{
|
||||
$this->lang_path .= '/';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup basic user-specific items (style, language, ...)
|
||||
*/
|
||||
@ -1401,8 +1427,7 @@ class user extends session
|
||||
|
||||
if ($this->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
$this->lang_name = (file_exists($phpbb_root_path . 'language/' . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']);
|
||||
$this->lang_path = $phpbb_root_path . 'language/' . $this->lang_name . '/';
|
||||
$this->lang_name = (file_exists($this->lang_path . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']);
|
||||
|
||||
$this->date_format = $this->data['user_dateformat'];
|
||||
$this->timezone = $this->data['user_timezone'] * 3600;
|
||||
@ -1411,7 +1436,6 @@ class user extends session
|
||||
else
|
||||
{
|
||||
$this->lang_name = basename($config['default_lang']);
|
||||
$this->lang_path = $phpbb_root_path . 'language/' . $this->lang_name . '/';
|
||||
$this->date_format = $config['default_dateformat'];
|
||||
$this->timezone = $config['board_timezone'] * 3600;
|
||||
$this->dst = $config['board_dst'] * 3600;
|
||||
@ -1431,10 +1455,9 @@ class user extends session
|
||||
$accept_lang = substr($accept_lang, 0, 2) . '_' . strtoupper(substr($accept_lang, 3, 2));
|
||||
$accept_lang = basename($accept_lang);
|
||||
|
||||
if (file_exists($phpbb_root_path . 'language/' . $accept_lang . "/common.$phpEx"))
|
||||
if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx"))
|
||||
{
|
||||
$this->lang_name = $config['default_lang'] = $accept_lang;
|
||||
$this->lang_path = $phpbb_root_path . 'language/' . $accept_lang . '/';
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -1443,10 +1466,9 @@ class user extends session
|
||||
$accept_lang = substr($accept_lang, 0, 2);
|
||||
$accept_lang = basename($accept_lang);
|
||||
|
||||
if (file_exists($phpbb_root_path . 'language/' . $accept_lang . "/common.$phpEx"))
|
||||
if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx"))
|
||||
{
|
||||
$this->lang_name = $config['default_lang'] = $accept_lang;
|
||||
$this->lang_path = $phpbb_root_path . 'language/' . $accept_lang . '/';
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1458,9 +1480,9 @@ class user extends session
|
||||
// We include common language file here to not load it every time a custom language file is included
|
||||
$lang = &$this->lang;
|
||||
|
||||
if ((@include $this->lang_path . "common.$phpEx") === false)
|
||||
if ((@include $this->lang_path . $this->lang_name . "/common.$phpEx") === false)
|
||||
{
|
||||
die('Language file ' . $this->lang_name . "/common.$phpEx" . " couldn't be opened.");
|
||||
die('Language file ' . $this->lang_path . $this->lang_name . "/common.$phpEx" . " couldn't be opened.");
|
||||
}
|
||||
|
||||
$this->add_lang($lang_set);
|
||||
@ -1830,12 +1852,10 @@ class user extends session
|
||||
{
|
||||
global $phpEx;
|
||||
|
||||
// Make sure the language path is set (if the user setup did not happen it is not set)
|
||||
if (!$this->lang_path)
|
||||
// Make sure the language name is set (if the user setup did not happen it is not set)
|
||||
if (!$this->lang_name)
|
||||
{
|
||||
global $phpbb_root_path, $config;
|
||||
|
||||
$this->lang_path = $phpbb_root_path . 'language/' . basename($config['default_lang']) . '/';
|
||||
$this->lang_name = basename($config['default_lang']);
|
||||
}
|
||||
|
||||
// $lang == $this->lang
|
||||
@ -1845,11 +1865,11 @@ class user extends session
|
||||
{
|
||||
if ($use_help && strpos($lang_file, '/') !== false)
|
||||
{
|
||||
$language_filename = $this->lang_path . substr($lang_file, 0, stripos($lang_file, '/') + 1) . 'help_' . substr($lang_file, stripos($lang_file, '/') + 1) . '.' . $phpEx;
|
||||
$language_filename = $this->lang_path . $this->lang_name . '/' . substr($lang_file, 0, stripos($lang_file, '/') + 1) . 'help_' . substr($lang_file, stripos($lang_file, '/') + 1) . '.' . $phpEx;
|
||||
}
|
||||
else
|
||||
{
|
||||
$language_filename = $this->lang_path . (($use_help) ? 'help_' : '') . $lang_file . '.' . $phpEx;
|
||||
$language_filename = $this->lang_path . $this->lang_name . '/' . (($use_help) ? 'help_' : '') . $lang_file . '.' . $phpEx;
|
||||
}
|
||||
|
||||
if ((@include $language_filename) === false)
|
||||
|
@ -43,7 +43,7 @@ class ucp_register
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
$change_lang = request_var('change_lang', '');
|
||||
$user_lang = request_var('lang', $user->lang_name);
|
||||
|
||||
|
||||
if ($agreed)
|
||||
{
|
||||
add_form_key('ucp_register');
|
||||
@ -58,7 +58,7 @@ class ucp_register
|
||||
{
|
||||
$use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang);
|
||||
|
||||
if (file_exists($phpbb_root_path . 'language/' . $use_lang . '/'))
|
||||
if (file_exists($user->lang_path . $use_lang . '/'))
|
||||
{
|
||||
if ($change_lang)
|
||||
{
|
||||
@ -69,7 +69,6 @@ class ucp_register
|
||||
}
|
||||
|
||||
$user->lang_name = $lang = $use_lang;
|
||||
$user->lang_path = $phpbb_root_path . 'language/' . $lang . '/';
|
||||
$user->lang = array();
|
||||
$user->add_lang(array('common', 'ucp'));
|
||||
}
|
||||
@ -471,7 +470,7 @@ class ucp_register
|
||||
if (!$change_lang || !$confirm_id)
|
||||
{
|
||||
$user->confirm_gc(CONFIRM_REG);
|
||||
|
||||
|
||||
$sql = 'SELECT COUNT(session_id) AS attempts
|
||||
FROM ' . CONFIRM_TABLE . "
|
||||
WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
|
||||
|
Loading…
x
Reference in New Issue
Block a user