diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-10-07 17:40:07 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-10-07 17:40:07 +0000 |
commit | 485935e1f1a3a773260cda0b7ac3f3800dca990e (patch) | |
tree | ef8a8069f948d96bc86787cc30ea8fe1e3239837 /phpBB | |
parent | a7df65168c3380e50fbe84d8f9e74274b1cc74ff (diff) | |
download | forums-485935e1f1a3a773260cda0b7ac3f3800dca990e.tar forums-485935e1f1a3a773260cda0b7ac3f3800dca990e.tar.gz forums-485935e1f1a3a773260cda0b7ac3f3800dca990e.tar.bz2 forums-485935e1f1a3a773260cda0b7ac3f3800dca990e.tar.xz forums-485935e1f1a3a773260cda0b7ac3f3800dca990e.zip |
he braces style is deprecated as of PHP 6
git-svn-id: file:///svn/phpbb/trunk@6459 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/adm/index.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acm/acm_file.php | 8 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_language.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_main.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 4 | ||||
-rw-r--r-- | phpBB/includes/bbcode.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 6 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 8 | ||||
-rw-r--r-- | phpBB/includes/functions_transfer.php | 6 | ||||
-rw-r--r-- | phpBB/includes/functions_upload.php | 15 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 4 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 4 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 2 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 2 | ||||
-rw-r--r-- | phpBB/includes/utf/utf_tools.php | 16 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 4 |
16 files changed, 33 insertions, 56 deletions
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 826df2f04b..7a3997cdd7 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -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 = ''; } diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 0a23036668..b6af055399 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -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"); diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 660f1fd421..896dc75f69 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -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)) { diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 87d8050e2f..d8e8cdf192 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -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); } diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index e1985130aa..50aec6fecb 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -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) diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 7af99e4b57..409aab18e4 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -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); } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4bb99f737d..96c999e3ea 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -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); } diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 2119b86740..5bd6384f34 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -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"; } diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index b147052c9c..00ef78f933 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -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(); diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 6b5d043bae..a7a76cf526 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -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; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 2807df8bd7..9dc6dcc4a7 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -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; diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index d714c9879f..69bebe9e06 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -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 diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 58bfefca0a..2452e19512 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -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 diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index b0d8198936..fc40826a74 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -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; } diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 9cd4026c2c..930595b36f 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -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) { diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 534e72780d..b7a8822515 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -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); |