aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/acp/acp_styles.php45
-rw-r--r--phpBB/includes/db/db_tools.php4
-rw-r--r--phpBB/includes/functions.php4
-rw-r--r--phpBB/includes/functions_admin.php25
-rw-r--r--phpBB/includes/functions_module.php4
-rw-r--r--phpBB/includes/functions_upload.php3
-rw-r--r--phpBB/includes/functions_user.php6
-rw-r--r--phpBB/includes/message_parser.php2
-rw-r--r--phpBB/includes/search/search.php8
-rw-r--r--phpBB/includes/session.php52
-rw-r--r--phpBB/includes/ucp/ucp_register.php7
11 files changed, 91 insertions, 69 deletions
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 02161f4180..fbd676258e 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -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();
@@ -681,7 +686,7 @@ parse_css_file = {PARSE_CSS_FILE}
// make sure template_file path doesn't go upwards
$template_file = str_replace('..', '.', $template_file);
-
+
// Retrieve some information about the template
$sql = 'SELECT template_storedb, template_path, template_name
FROM ' . STYLES_TEMPLATE_TABLE . "
@@ -694,7 +699,7 @@ parse_css_file = {PARSE_CSS_FILE}
{
trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
-
+
if ($save_changes && !check_form_key('acp_styles'))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
@@ -993,12 +998,12 @@ parse_css_file = {PARSE_CSS_FILE}
foreach ($file_ary as $file)
{
$file = str_replace('/', '.', $file);
-
+
// perform some dirty guessing to get the path right.
// We assume that three dots in a row were '../'
$tpl_file = str_replace('.', '/', $file);
$tpl_file = str_replace('///', '../', $tpl_file);
-
+
$filename = "{$cache_prefix}_$file.html." . PHP_EXT;
if (!file_exists(PHPBB_ROOT_PATH . "cache/$filename"))
@@ -1047,7 +1052,7 @@ parse_css_file = {PARSE_CSS_FILE}
// make sure theme_file path doesn't go upwards
$theme_file = str_replace('..', '.', $theme_file);
-
+
// Retrieve some information about the theme
$sql = 'SELECT theme_storedb, theme_path, theme_name, theme_data
FROM ' . STYLES_THEME_TABLE . "
@@ -1231,7 +1236,7 @@ parse_css_file = {PARSE_CSS_FILE}
$imgsize = request_var('imgsize', false);
$imgwidth = request_var('imgwidth', 0);
$imgheight = request_var('imgheight', 0);
-
+
$imgname = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname);
$imgpath = str_replace('..', '.', $imgpath);
@@ -2096,14 +2101,14 @@ parse_css_file = {PARSE_CSS_FILE}
$style_default = request_var('style_default', 0);
$store_db = request_var('store_db', 0);
- $sql = "SELECT {$mode}_id
+ $sql = "SELECT {$mode}_id
FROM $sql_from
- WHERE {$mode}_id <> $style_id
+ WHERE {$mode}_id <> $style_id
AND {$mode}_name = '" . $db->sql_escape(strtolower($name)) . "'";
$result = $db->sql_query($sql);
$conflict = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
-
+
if ($mode == 'style' && (!$template_id || !$theme_id || !$imageset_id))
{
$error[] = $user->lang['STYLE_ERR_NO_IDS'];
@@ -2141,7 +2146,7 @@ parse_css_file = {PARSE_CSS_FILE}
}
}
}
-
+
if (!sizeof($error))
{
// Check length settings
@@ -2911,7 +2916,7 @@ parse_css_file = {PARSE_CSS_FILE}
$sql = 'SELECT image_name, image_filename, image_lang, image_width, image_height
FROM ' . STYLES_IMAGESET_DATA_TABLE . '
WHERE imageset_id = ' . $theme['imageset_id'] . "
- AND image_filename <> ''
+ AND image_filename <> ''
AND image_lang IN ('" . $db->sql_escape($user_image_lang) . "', '')";
$result2 = $db->sql_query($sql);
@@ -2926,7 +2931,7 @@ parse_css_file = {PARSE_CSS_FILE}
$matches = array();
preg_match_all('#\{IMG_([A-Za-z0-9_]*?)_(WIDTH|HEIGHT|SRC)\}#', $specific_theme_data, $matches);
-
+
$imgs = $find = $replace = array();
if (isset($matches[0]) && sizeof($matches[0]))
{
@@ -2934,13 +2939,13 @@ parse_css_file = {PARSE_CSS_FILE}
{
$img = strtolower($img);
$find[] = $matches[0][$i];
-
+
if (!isset($img_array[$img]))
{
$replace[] = '';
continue;
}
-
+
if (!isset($imgs[$img]))
{
$img_data = &$img_array[$img];
@@ -2951,26 +2956,26 @@ parse_css_file = {PARSE_CSS_FILE}
'height' => $img_data['image_height'],
);
}
-
+
switch ($matches[2][$i])
{
case 'SRC':
$replace[] = $imgs[$img]['src'];
break;
-
+
case 'WIDTH':
$replace[] = $imgs[$img]['width'];
break;
-
+
case 'HEIGHT':
$replace[] = $imgs[$img]['height'];
break;
-
+
default:
continue;
}
}
-
+
if (sizeof($find))
{
$specific_theme_data = str_replace($find, $replace, $specific_theme_data);
@@ -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;
}
-
}
?> \ No newline at end of file
diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php
index d417132c53..bc85d6004b 100644
--- a/phpBB/includes/db/db_tools.php
+++ b/phpBB/includes/db/db_tools.php
@@ -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)
{
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index e17bbfd080..1d711540b0 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -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;
}
@@ -2168,7 +2168,7 @@ function generate_link_hash($link_name)
/**
* checks a link hash - for GET requests
-* @param string $token the submitted token
+* @param string $token the submitted token
* @param string $link_name The name of the link
* @return boolean true if all is fine
*/
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 05312d826f..7096c7099b 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -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);
@@ -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
{
@@ -2357,7 +2356,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 = '';
@@ -2367,7 +2366,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
$log_type = LOG_CRITICAL;
$sql_forum = '';
break;
-
+
default:
return;
}
@@ -2623,7 +2622,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';
@@ -2702,7 +2701,7 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_REMIND'];
break;
}
-
+
$users[] = $row;
}
@@ -2878,7 +2877,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;
@@ -2917,7 +2916,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
return false;
}
}
-
+
return $file_info;
}
@@ -2953,7 +2952,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
@@ -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)
{
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index c1d04cf245..c9d9a9770b 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -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)
{
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 00dc67438b..c79c0808af 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -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)
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 3b376135ad..ee4fa3f805 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -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)
{
@@ -2238,7 +2238,7 @@ function avatar_process_user(&$error, $custom_userdata = false)
}
}
}
-
+
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . (($custom_userdata === false) ? $user->data['user_id'] : $custom_userdata['user_id']);
@@ -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)
{
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index a31e7b094c..d3b0c87c9a 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -391,7 +391,7 @@ class bbcode_firstpass extends bbcode
/**
* Parse code text from code tag
- * @private
+ * @access private
*/
function bbcode_parse_code($stx, &$code)
{
diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/search.php
index ab04463527..a6986dfa2a 100644
--- a/phpBB/includes/search/search.php
+++ b/phpBB/includes/search/search.php
@@ -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);
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 4fac6ddd68..dc3fd7e142 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -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;
@@ -1382,6 +1382,30 @@ class user extends session
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, ...)
*/
function setup($lang_set = false, $style = false)
@@ -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)
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 1b75494e4e..0246e96061 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -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) . "'