Merge of the language-specific custom path change Revision #r8782

git-svn-id: file:///svn/phpbb/trunk@8786 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2008-08-24 10:04:15 +00:00
parent 8174462e89
commit 589db44b56
11 changed files with 91 additions and 69 deletions

View file

@ -669,6 +669,11 @@ parse_css_file = {PARSE_CSS_FILE}
{
global $config, $db, $cache, $user, $template, $safe_mode;
if (defined('DISABLE_ACP_EDITOR'))
{
trigger_error($user->lang['EDITOR_DISABLED'] . adm_back_link($this->u_action));
}
$this->page_title = 'EDIT_TEMPLATE';
$filelist = $filelist_cats = array();
@ -3194,6 +3199,7 @@ parse_css_file = {PARSE_CSS_FILE}
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row)
{
// If it exist, we just use the style on installation
@ -3381,7 +3387,6 @@ parse_css_file = {PARSE_CSS_FILE}
// Return store_db in case it had to be altered
return $store_db;
}
}
?>

View file

@ -565,7 +565,7 @@ class phpbb_db_tools
/**
* Private method for performing sql statements (either execute them or return them)
* @private
* @access private
*/
private static function _sql_run_sql($statements)
{
@ -598,7 +598,7 @@ class phpbb_db_tools
/**
* Function to prepare some column information for better usage
* @private
* @access private
*/
private static function sql_prepare_column_data($table_name, $column_name, $column_data)
{

View file

@ -588,7 +588,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ)
case 'owner':
$result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0));
if (!is_null($php) || (!is_readable($filename) && is_writable($filename)))
if (!is_null($php) || (is_readable($filename) && is_writable($filename)))
{
break;
}

View file

@ -1012,7 +1012,6 @@ function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = true)
AND t.topic_time < ' . (time() - $max_age)
. $where;
$db->sql_query($sql);
}
else
{
@ -3015,7 +3014,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)
{

View file

@ -817,11 +817,11 @@ class p_master
{
global $user;
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)
{

View file

@ -263,7 +263,8 @@ class filespec
*
* @param string $destination_path Destination path, for example $config['avatar_path']
* @param bool $overwrite If set to true, an already existing file will be overwritten
* @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode of {@inline phpbb_chmod()}
* @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()}
*
* @access public
*/
function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false)

View file

@ -147,7 +147,7 @@ function user_update_name($old_name, $new_name)
*
* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded.
* @param string $cp_data custom profile fields, see custom_profile::build_insert_sql_array
* @return: the new user's ID.
* @return the new user's ID.
*/
function user_add($user_row, $cp_data = false)
{
@ -3014,7 +3014,7 @@ function group_validate_groupname($group_id, $group_name)
/**
* Set users default group
*
* @private
* @access private
*/
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false)
{

View file

@ -391,7 +391,7 @@ class bbcode_firstpass extends bbcode
/**
* Parse code text from code tag
* @private
* @access private
*/
function bbcode_parse_code($stx, &$code)
{

View file

@ -49,10 +49,10 @@ class search_backend
$words = array();
if (file_exists("{$user->lang_path}/search_ignore_words." . PHP_EXT))
if (file_exists("{$user->lang_path}{$user->lang_name}/search_ignore_words." . PHP_EXT))
{
// include the file containing ignore words
include("{$user->lang_path}/search_ignore_words." . PHP_EXT);
include("{$user->lang_path}{$user->lang_name}/search_ignore_words." . PHP_EXT);
}
$this->ignore_words = $words;
@ -71,10 +71,10 @@ class search_backend
$synonyms = array();
if (file_exists("{$user->lang_path}/search_synonyms." . PHP_EXT))
if (file_exists("{$user->lang_path}{$user->lang_name}/search_synonyms." . PHP_EXT))
{
// include the file containing synonyms
include("{$user->lang_path}/search_synonyms." . PHP_EXT);
include("{$user->lang_path}{$user->lang_name}/search_synonyms." . PHP_EXT);
}
$this->match_synonym = array_keys($synonyms);

View file

@ -1371,7 +1371,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;
@ -1381,6 +1381,30 @@ 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
*/
public function __construct()
{
$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, ...)
*/
@ -1390,9 +1414,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.' . PHP_EXT)) ? $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." . PHP_EXT)) ? $this->data['user_lang'] : basename($config['default_lang']);
$this->date_format = $this->data['user_dateformat'];
$this->timezone = $this->data['user_timezone'] * 3600;
$this->dst = $this->data['user_dst'] * 3600;
@ -1400,7 +1422,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;
@ -1420,10 +1441,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." . PHP_EXT))
if (file_exists($this->lang_path . $accept_lang . "/common." . PHP_EXT))
{
$this->lang_name = $config['default_lang'] = $accept_lang;
$this->lang_path = PHPBB_ROOT_PATH . 'language/' . $accept_lang . '/';
break;
}
else
@ -1432,10 +1452,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." . PHP_EXT))
if (file_exists($this->lang_path . $accept_lang . "/common." . PHP_EXT))
{
$this->lang_name = $config['default_lang'] = $accept_lang;
$this->lang_path = PHPBB_ROOT_PATH . 'language/' . $accept_lang . '/';
break;
}
}
@ -1447,9 +1466,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.' . PHP_EXT) === false)
if ((@include $this->lang_path . $this->lang_name . "/common." . PHP_EXT) === false)
{
die('Language file ' . $this->lang_name . '/common.' . PHP_EXT . " couldn't be opened.");
die('Language file ' . $this->lang_path . $this->lang_name . "/common." . PHP_EXT . " couldn't be opened.");
}
$this->add_lang($lang_set);
@ -1813,12 +1832,11 @@ class user extends session
*/
function set_lang(&$lang, &$help, $lang_file, $use_db = false, $use_help = false)
{
// 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 $config;
$this->lang_path = PHPBB_ROOT_PATH . 'language/' . basename($config['default_lang']) . '/';
$this->lang_name = basename($config['default_lang']);
}
// $lang == $this->lang
@ -1828,11 +1846,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) . '.' . PHP_EXT;
$language_filename = $this->lang_path . $this->lang_name . '/' . substr($lang_file, 0, stripos($lang_file, '/') + 1) . 'help_' . substr($lang_file, stripos($lang_file, '/') + 1) . '.' . PHP_EXT;
}
else
{
$language_filename = $this->lang_path . (($use_help) ? 'help_' : '') . $lang_file . '.' . PHP_EXT;
$language_filename = $this->lang_path . $this->lang_name . '/' . (($use_help) ? 'help_' : '') . $lang_file . '.' . PHP_EXT;
}
if ((@include $language_filename) === false)

View file

@ -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'));
}