mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
he braces style is deprecated as of PHP 6
git-svn-id: file:///svn/phpbb/trunk@6459 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
a7df65168c
commit
485935e1f1
16 changed files with 33 additions and 56 deletions
|
@ -424,7 +424,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
|
|||
}
|
||||
|
||||
$destination = str_replace(array('../', '..\\', './', '.\\'), '', $destination);
|
||||
if ($destination && ($destination{0} == '/' || $destination{0} == "\\"))
|
||||
if ($destination && ($destination[0] == '/' || $destination[0] == "\\"))
|
||||
{
|
||||
$destination = '';
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ class acm
|
|||
*/
|
||||
function get($var_name)
|
||||
{
|
||||
if ($var_name{0} == '_')
|
||||
if ($var_name[0] == '_')
|
||||
{
|
||||
global $phpEx;
|
||||
|
||||
|
@ -165,7 +165,7 @@ class acm
|
|||
*/
|
||||
function put($var_name, $var, $ttl = 31536000)
|
||||
{
|
||||
if ($var_name{0} == '_')
|
||||
if ($var_name[0] == '_')
|
||||
{
|
||||
global $phpEx;
|
||||
|
||||
|
@ -249,7 +249,7 @@ class acm
|
|||
return;
|
||||
}
|
||||
|
||||
if ($var_name{0} == '_')
|
||||
if ($var_name[0] == '_')
|
||||
{
|
||||
@unlink($this->cache_dir . 'data' . $var_name . ".$phpEx");
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ class acm
|
|||
*/
|
||||
function _exists($var_name)
|
||||
{
|
||||
if ($var_name{0} == '_')
|
||||
if ($var_name[0] == '_')
|
||||
{
|
||||
global $phpEx;
|
||||
return file_exists($this->cache_dir . 'data' . $var_name . ".$phpEx");
|
||||
|
|
|
@ -892,7 +892,7 @@ class acp_language
|
|||
|
||||
while (($file = readdir($dp)) !== false)
|
||||
{
|
||||
if ($file{0} != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt"))
|
||||
if ($file[0] != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt"))
|
||||
{
|
||||
if (!in_array($file, $installed))
|
||||
{
|
||||
|
|
|
@ -251,7 +251,7 @@ class acp_main
|
|||
{
|
||||
while (($file = readdir($avatar_dir)) !== false)
|
||||
{
|
||||
if ($file{0} != '.' && $file != 'CVS' && strpos($file, 'index.') === false)
|
||||
if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false)
|
||||
{
|
||||
$avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file);
|
||||
}
|
||||
|
|
|
@ -533,7 +533,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
|
|||
while (($file = readdir($dp)) !== false)
|
||||
{
|
||||
$subpath = ($mode != 'style') ? "$mode/" : '';
|
||||
if ($file{0} != '.' && file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
|
||||
if ($file[0] != '.' && file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
|
||||
{
|
||||
if ($cfg = file("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
|
||||
{
|
||||
|
@ -1433,7 +1433,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
|
|||
$dp = opendir($dir);
|
||||
while (($file = readdir($dp)) !== false)
|
||||
{
|
||||
if (!is_file($dir . '/' . $file) && !is_link($dir . '/' . $file) && $file{0} != '.' && strtoupper($file) != 'CVS' && !sizeof($imagesetlist['lang']))
|
||||
if (!is_file($dir . '/' . $file) && !is_link($dir . '/' . $file) && $file[0] != '.' && strtoupper($file) != 'CVS' && !sizeof($imagesetlist['lang']))
|
||||
{
|
||||
$dp2 = opendir("$dir/$file");
|
||||
while (($file2 = readdir($dp2)) !== false)
|
||||
|
|
|
@ -536,7 +536,7 @@ class bbcode
|
|||
$username = str_replace('\"', '"', $username);
|
||||
|
||||
// remove newline at the beginning
|
||||
if ($quote{0} == "\n")
|
||||
if ($quote[0] == "\n")
|
||||
{
|
||||
$quote = substr($quote, 1);
|
||||
}
|
||||
|
@ -572,7 +572,7 @@ class bbcode
|
|||
$code = str_replace(' ', ' ', $code);
|
||||
|
||||
// remove newline at the beginning
|
||||
if (!empty($code) && $code{0} == "\n")
|
||||
if (!empty($code) && $code[0] == "\n")
|
||||
{
|
||||
$code = substr($code, 1);
|
||||
}
|
||||
|
|
|
@ -1490,7 +1490,7 @@ function redirect($url)
|
|||
{
|
||||
// Full URL
|
||||
}
|
||||
else if ($url{0} == '/')
|
||||
else if ($url[0] == '/')
|
||||
{
|
||||
// Absolute uri, prepend direct url...
|
||||
$url = generate_board_url(true) . $url;
|
||||
|
@ -2510,7 +2510,7 @@ function parse_cfg_file($filename, $lines = false)
|
|||
{
|
||||
$line = trim($line);
|
||||
|
||||
if (!$line || $line{0} == '#' || ($delim_pos = strpos($line, '=')) === false)
|
||||
if (!$line || $line[0] == '#' || ($delim_pos = strpos($line, '=')) === false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -2531,7 +2531,7 @@ function parse_cfg_file($filename, $lines = false)
|
|||
{
|
||||
$value = '';
|
||||
}
|
||||
else if (($value{0} == "'" && $value{sizeof($value)-1} == "'") || ($value{0} == '"' && $value{sizeof($value)-1} == '"'))
|
||||
else if (($value[0] == "'" && $value[sizeof($value) - 1] == "'") || ($value[0] == '"' && $value[sizeof($value) - 1] == '"'))
|
||||
{
|
||||
$value = substr($value, 1, sizeof($value)-2);
|
||||
}
|
||||
|
|
|
@ -347,7 +347,7 @@ function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png')
|
|||
$matches[$dir][] = $fname;
|
||||
}
|
||||
}
|
||||
else if ($fname{0} != '.' && is_dir("$rootdir$dir$fname"))
|
||||
else if ($fname[0] != '.' && is_dir("$rootdir$dir$fname"))
|
||||
{
|
||||
$matches += filelist($rootdir, "$dir$fname", $type);
|
||||
}
|
||||
|
@ -1047,7 +1047,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
|
|||
else if ($where_type == 'range')
|
||||
{
|
||||
// Only check a range of topics/forums. For instance: 'topic_id BETWEEN 1 AND 60'
|
||||
$where_sql = 'WHERE (' . $mode{0} . ".$where_ids)";
|
||||
$where_sql = 'WHERE (' . $mode[0] . ".$where_ids)";
|
||||
$where_sql_and = $where_sql . "\n\tAND";
|
||||
}
|
||||
else
|
||||
|
@ -1063,7 +1063,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
|
|||
|
||||
// Limit the topics/forums we are syncing, use specific topic/forum IDs.
|
||||
// $where_type contains the field for the where clause (forum_id, topic_id)
|
||||
$where_sql = 'WHERE ' . $db->sql_in_set($mode{0} . '.' . $where_type, $where_ids);
|
||||
$where_sql = 'WHERE ' . $db->sql_in_set($mode[0] . '.' . $where_type, $where_ids);
|
||||
$where_sql_and = $where_sql . "\n\tAND";
|
||||
}
|
||||
}
|
||||
|
@ -1075,7 +1075,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
|
|||
}
|
||||
|
||||
// $where_type contains the field for the where clause (forum_id, topic_id)
|
||||
$where_sql = 'WHERE ' . $db->sql_in_set($mode{0} . '.' . $where_type, $where_ids);
|
||||
$where_sql = 'WHERE ' . $db->sql_in_set($mode[0] . '.' . $where_type, $where_ids);
|
||||
$where_sql_and = $where_sql . "\n\tAND";
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ class ftp extends transfer
|
|||
|
||||
// Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (/ at the end)
|
||||
$this->root_path = str_replace('\\', '/', $this->root_path);
|
||||
$this->root_path = (($root_path{0} != '/' ) ? '/' : '') . $root_path . ((substr($root_path, -1, 1) == '/') ? '' : '/');
|
||||
$this->root_path = (($root_path[0] != '/' ) ? '/' : '') . $root_path . ((substr($root_path, -1, 1) == '/') ? '' : '/');
|
||||
|
||||
// Init some needed values
|
||||
transfer::transfer();
|
||||
|
@ -475,9 +475,9 @@ class ftp_fsock extends transfer
|
|||
$this->password = $password;
|
||||
$this->timeout = $timeout;
|
||||
|
||||
// Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (prefixed with / and no / at the end)
|
||||
// Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (/ at the end)
|
||||
$this->root_path = str_replace('\\', '/', $this->root_path);
|
||||
$this->root_path = (($root_path{0} != '/' ) ? '/' : '') . $root_path . ((substr($root_path, -1, 1) == '/') ? '' : '/');
|
||||
$this->root_path = (($root_path[0] != '/' ) ? '/' : '') . $root_path . ((substr($root_path, -1, 1) == '/') ? '' : '/');
|
||||
|
||||
// Init some needed values
|
||||
transfer::transfer();
|
||||
|
|
|
@ -226,21 +226,6 @@ class filespec
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// Adjust destination path (no trailing slash)
|
||||
if ($destination{(sizeof($destination)-1)} == '/' || $destination{(sizeof($destination)-1)} == '\\')
|
||||
{
|
||||
$destination = substr($destination, 0, sizeof($destination)-2);
|
||||
}
|
||||
|
||||
$destination = str_replace(array('../', '..\\', './', '.\\'), '', $destination);
|
||||
if ($destination && ($destination{0} == '/' || $destination{0} == "\\"))
|
||||
{
|
||||
$destination = '';
|
||||
}
|
||||
*/
|
||||
|
||||
// We need to trust the admin in specifying valid upload directories and an attacker not being able to overwrite it...
|
||||
$this->destination_path = $phpbb_root_path . $destination;
|
||||
|
||||
|
|
|
@ -1372,7 +1372,7 @@ function avatar_upload($data, &$error)
|
|||
}
|
||||
|
||||
$destination = str_replace(array('../', '..\\', './', '.\\'), '', $destination);
|
||||
if ($destination && ($destination{0} == '/' || $destination{0} == "\\"))
|
||||
if ($destination && ($destination[0] == '/' || $destination[0] == "\\"))
|
||||
{
|
||||
$destination = '';
|
||||
}
|
||||
|
@ -1411,7 +1411,7 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var
|
|||
|
||||
while (($file = readdir($dp)) !== false)
|
||||
{
|
||||
if ($file{0} != '.' && is_dir("$path/$file"))
|
||||
if ($file[0] != '.' && is_dir("$path/$file"))
|
||||
{
|
||||
$avatar_row_count = $avatar_col_count = 0;
|
||||
|
||||
|
|
|
@ -231,10 +231,10 @@ class mcp_queue
|
|||
if ($mode == 'unapproved_posts')
|
||||
{
|
||||
$sql = 'SELECT p.post_id
|
||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql{0} == 'u') ? ', ' . USERS_TABLE . ' u' : '') . "
|
||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . "
|
||||
WHERE p.forum_id IN (0, $forum_list)
|
||||
AND p.post_approved = 0
|
||||
" . (($sort_order_sql{0} == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
|
||||
" . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
|
||||
' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
|
||||
AND t.topic_id = p.topic_id
|
||||
AND t.topic_first_post_id <> p.post_id
|
||||
|
|
|
@ -303,7 +303,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
|
|||
|
||||
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
|
||||
if ($sort_order_sql{0} == 'u')
|
||||
if ($sort_order_sql[0] == 'u')
|
||||
{
|
||||
$sql = 'SELECT p.post_id, p.forum_id, p.post_approved
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
|
||||
|
|
|
@ -649,7 +649,7 @@ class bbcode_firstpass extends bbcode
|
|||
preg_match_all('#\[((?:/)?(?:[a-z]+))#i', $username, $tags);
|
||||
foreach ($tags[1] as $tag)
|
||||
{
|
||||
if ($tag{0} != '/')
|
||||
if ($tag[0] != '/')
|
||||
{
|
||||
$end_tags[] = '/' . $tag;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
* @todo make sure the replacements are called correctly
|
||||
* already done: strtolower, strtoupper, ucfirst, str_split, strrpos, strlen (hopefully!), strpos
|
||||
* already done: strtolower, strtoupper, ucfirst, str_split, strrpos, strlen (hopefully!), strpos, substr
|
||||
* remaining: clean_username, htmlentities (no longer needed for internal data?), htmlspecialchars (using charset), html_entity_decode (own function to reverse htmlspecialchars and not htmlentities)
|
||||
* substr, strspn, chr, ord
|
||||
* strspn, chr, ord
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -226,13 +226,7 @@ if (extension_loaded('mbstring'))
|
|||
|
||||
/**
|
||||
* UTF-8 aware alternative to substr
|
||||
* Return part of a string given character offset (and optionally length)
|
||||
*
|
||||
* @author Harry Fuecks
|
||||
* @param string
|
||||
* @param integer number of UTF-8 characters offset (from left)
|
||||
* @param integer (optional) length in UTF-8 characters from offset
|
||||
* @return mixed string or FALSE if failure
|
||||
* @ignore
|
||||
*/
|
||||
function utf8_substr($str, $offset, $length = null)
|
||||
{
|
||||
|
@ -248,9 +242,7 @@ if (extension_loaded('mbstring'))
|
|||
|
||||
/**
|
||||
* Return the length (in characters) of a UTF-8 string
|
||||
*
|
||||
* @param string $text UTF-8 string
|
||||
* @return integer Length (in chars) of given string
|
||||
* @ignore
|
||||
*/
|
||||
function utf8_strlen($text)
|
||||
{
|
||||
|
|
|
@ -824,10 +824,10 @@ $i = $i_total = 0;
|
|||
|
||||
// Go ahead and pull all data for this topic
|
||||
$sql = 'SELECT p.post_id
|
||||
FROM ' . POSTS_TABLE . ' p' . (($sort_by_sql[$sort_key]{0} == 'u') ? ', ' . USERS_TABLE . ' u': '') . "
|
||||
FROM ' . POSTS_TABLE . ' p' . (($sort_by_sql[$sort_key][0] == 'u') ? ', ' . USERS_TABLE . ' u': '') . "
|
||||
WHERE p.topic_id = $topic_id
|
||||
" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . "
|
||||
" . (($sort_by_sql[$sort_key]{0} == 'u') ? 'AND u.user_id = p.poster_id': '') . "
|
||||
" . (($sort_by_sql[$sort_key][0] == 'u') ? 'AND u.user_id = p.poster_id': '') . "
|
||||
$limit_posts_time
|
||||
ORDER BY $sql_sort_order";
|
||||
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||
|
|
Loading…
Add table
Reference in a new issue