diff options
Diffstat (limited to 'phpBB/includes')
103 files changed, 1172 insertions, 1322 deletions
diff --git a/phpBB/includes/acm/acm_apc.php b/phpBB/includes/acm/acm_apc.php index 15f3705d9e..e4c4b79de3 100644 --- a/phpBB/includes/acm/acm_apc.php +++ b/phpBB/includes/acm/acm_apc.php @@ -33,8 +33,7 @@ class acm */ function __construct() { - global $phpbb_root_path; - $this->cache_dir = $phpbb_root_path . 'cache/'; + $this->cache_dir = PHPBB_ROOT_PATH . 'cache/'; } /** @@ -42,8 +41,6 @@ class acm */ private function load() { - global $phpEx; - // grab the global cache if ($this->vars = apc_fetch('global')) { @@ -86,8 +83,6 @@ class acm */ public function tidy() { - global $phpEx; - // cache has auto GC, no need to have any code here :) set_config('cache_last_gc', time(), true); @@ -100,8 +95,6 @@ class acm { if ($var_name[0] === '_') { - global $phpEx; - return apc_fetch($var_name); } else @@ -171,8 +164,6 @@ class acm */ public function destroy($var_name, $table = '') { - global $phpEx; - if ($var_name === 'sql' && !empty($table)) { if (!is_array($table)) @@ -221,8 +212,6 @@ class acm */ public function sql_load($query) { - global $phpEx; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); $query_id = sizeof($this->sql_rowset); @@ -244,7 +233,7 @@ class acm */ public function sql_save($query, &$query_result, $ttl) { - global $db, $phpEx; + global $db; // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); diff --git a/phpBB/includes/acm/acm_eaccelerator.php b/phpBB/includes/acm/acm_eaccelerator.php index 8592658e51..00d08f70d3 100644 --- a/phpBB/includes/acm/acm_eaccelerator.php +++ b/phpBB/includes/acm/acm_eaccelerator.php @@ -33,8 +33,7 @@ class acm */ function __construct() { - global $phpbb_root_path; - $this->cache_dir = $phpbb_root_path . 'cache/'; + $this->cache_dir = PHPBB_ROOT_PATH . 'cache/'; } /** @@ -42,8 +41,6 @@ class acm */ private function load() { - global $phpEx; - // grab the global cache if ($this->vars = eaccelerator_get('global')) { @@ -86,8 +83,6 @@ class acm */ public function tidy() { - global $phpEx; - eaccelerator_gc(); set_config('cache_last_gc', time(), true); @@ -100,8 +95,6 @@ class acm { if ($var_name[0] === '_') { - global $phpEx; - $temp = eaccelerator_get($var_name); if ($temp !== null) @@ -183,8 +176,6 @@ class acm */ public function destroy($var_name, $table = '') { - global $phpEx; - if ($var_name === 'sql' && !empty($table)) { if (!is_array($table)) @@ -237,8 +228,6 @@ class acm */ public function sql_load($query) { - global $phpEx; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); $query_id = sizeof($this->sql_rowset); @@ -260,7 +249,7 @@ class acm */ public function sql_save($query, &$query_result, $ttl) { - global $db, $phpEx; + global $db; // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index f952b372c6..9376549cba 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -34,8 +34,7 @@ class acm */ function __construct() { - global $phpbb_root_path; - $this->cache_dir = $phpbb_root_path . 'cache/'; + $this->cache_dir = PHPBB_ROOT_PATH . 'cache/'; } /** @@ -43,12 +42,10 @@ class acm */ private function load() { - global $phpEx; - // grab the global cache - if (file_exists($this->cache_dir . 'data_global.' . $phpEx)) + if (file_exists($this->cache_dir . 'data_global.' . PHP_EXT)) { - @include($this->cache_dir . 'data_global.' . $phpEx); + @include($this->cache_dir . 'data_global.' . PHP_EXT); return true; } @@ -80,16 +77,14 @@ class acm return; } - global $phpEx; - - if ($fp = @fopen($this->cache_dir . 'data_global.' . $phpEx, 'wb')) + if ($fp = @fopen($this->cache_dir . 'data_global.' . PHP_EXT, 'wb')) { @flock($fp, LOCK_EX); fwrite($fp, "<?php\n\$this->vars = unserialize('" . serialize($this->vars) . "');\n\$this->var_expires = unserialize('" . serialize($this->var_expires) . "');"); @flock($fp, LOCK_UN); fclose($fp); - @chmod($this->cache_dir . 'data_global.' . $phpEx, 0666); + @chmod($this->cache_dir . 'data_global.' . PHP_EXT, 0666); } else { @@ -99,7 +94,7 @@ class acm trigger_error($this->cache_dir . ' is NOT writable.', E_USER_ERROR); } - trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx, E_USER_ERROR); + trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . PHP_EXT, E_USER_ERROR); } $this->is_modified = false; @@ -110,8 +105,6 @@ class acm */ public function tidy() { - global $phpEx; - $dir = @opendir($this->cache_dir); if (!$dir) @@ -135,7 +128,7 @@ class acm } closedir($dir); - if (file_exists($this->cache_dir . 'data_global.' . $phpEx)) + if (file_exists($this->cache_dir . 'data_global.' . PHP_EXT)) { if (!sizeof($this->vars)) { @@ -161,14 +154,12 @@ class acm { if ($var_name[0] === '_') { - global $phpEx; - if (!$this->_exists($var_name)) { return false; } - @include($this->cache_dir . "data{$var_name}.$phpEx"); + @include($this->cache_dir . "data{$var_name}." . PHP_EXT); return (isset($data)) ? $data : false; } else @@ -184,16 +175,14 @@ class acm { if ($var_name[0] === '_') { - global $phpEx; - - if ($fp = @fopen($this->cache_dir . "data{$var_name}.$phpEx", 'wb')) + if ($fp = @fopen($this->cache_dir . "data{$var_name}." . PHP_EXT, 'wb')) { @flock($fp, LOCK_EX); fwrite($fp, "<?php\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\$data = " . (sizeof($var) ? "unserialize('" . serialize($var) . "');" : 'array();')); @flock($fp, LOCK_UN); fclose($fp); - @chmod($this->cache_dir . "data{$var_name}.$phpEx", 0666); + @chmod($this->cache_dir . "data{$var_name}." . PHP_EXT, 0666); } } else @@ -244,8 +233,6 @@ class acm */ public function destroy($var_name, $table = '') { - global $phpEx; - if ($var_name === 'sql' && !empty($table)) { if (!is_array($table)) @@ -306,7 +293,7 @@ class acm if ($var_name[0] === '_') { - $this->remove_file($this->cache_dir . 'data' . $var_name . ".$phpEx", true); + $this->remove_file($this->cache_dir . 'data' . $var_name . '.' . PHP_EXT, true); } else if (isset($this->vars[$var_name])) { @@ -326,8 +313,7 @@ class acm { if ($var_name[0] === '_') { - global $phpEx; - return file_exists($this->cache_dir . 'data' . $var_name . ".$phpEx"); + return file_exists($this->cache_dir . 'data' . $var_name . '.' . PHP_EXT); } else { @@ -350,18 +336,16 @@ class acm */ public function sql_load($query) { - global $phpEx; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); $query_id = sizeof($this->sql_rowset); - if (!file_exists($this->cache_dir . 'sql_' . md5($query) . ".$phpEx")) + if (!file_exists($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT)) { return false; } - @include($this->cache_dir . 'sql_' . md5($query) . ".$phpEx"); + @include($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT); if (!isset($expired)) { @@ -369,7 +353,7 @@ class acm } else if ($expired) { - $this->remove_file($this->cache_dir . 'sql_' . md5($query) . ".$phpEx", true); + $this->remove_file($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT, true); return false; } @@ -382,11 +366,11 @@ class acm */ public function sql_save($query, &$query_result, $ttl) { - global $db, $phpEx; + global $db; // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $filename = $this->cache_dir . 'sql_' . md5($query) . '.' . $phpEx; + $filename = $this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT; if ($fp = @fopen($filename, 'wb')) { diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index fc17b04942..bbb556f173 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -34,7 +34,6 @@ class acm */ function __construct() { - global $phpbb_root_path; $this->memcache = memcache_connect('localhost', 11211); } @@ -43,8 +42,6 @@ class acm */ private function load() { - global $phpEx; - // grab the global cache if ($this->vars = memcache_get($this->memcache, 'global')) { @@ -87,8 +84,6 @@ class acm */ public function tidy() { - global $phpEx; - // cache has auto GC, no need to have any code here :) set_config('cache_last_gc', time(), true); @@ -101,8 +96,6 @@ class acm { if ($var_name[0] === '_') { - global $phpEx; - return memcache_get($this->memcache, $var_name); } else @@ -172,8 +165,6 @@ class acm */ public function destroy($var_name, $table = '') { - global $phpEx; - if ($var_name === 'sql' && !empty($table)) { if (!is_array($table)) @@ -222,8 +213,6 @@ class acm */ public function sql_load($query) { - global $phpEx; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); $query_id = sizeof($this->sql_rowset); @@ -246,7 +235,7 @@ class acm */ public function sql_save($query, &$query_result, $ttl) { - global $db, $phpEx; + global $db; // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); diff --git a/phpBB/includes/acm/acm_xcache.php b/phpBB/includes/acm/acm_xcache.php index 542dc60abb..38db4d27d8 100644 --- a/phpBB/includes/acm/acm_xcache.php +++ b/phpBB/includes/acm/acm_xcache.php @@ -33,8 +33,7 @@ class acm */ function __construct() { - global $phpbb_root_path; - $this->cache_dir = $phpbb_root_path . 'cache/'; + $this->cache_dir = PHPBB_ROOT_PATH . 'cache/'; } /** @@ -42,8 +41,6 @@ class acm */ private function load() { - global $phpEx; - // grab the global cache if (xcache_isset('global')) { @@ -87,8 +84,6 @@ class acm */ public function tidy() { - global $phpEx; - // cache has auto GC, no need to have any code here :) set_config('cache_last_gc', time(), true); @@ -101,8 +96,6 @@ class acm { if ($var_name[0] === '_') { - global $phpEx; - return (xcache_isset($var_name)) ? xcache_get($var_name) : false; } else @@ -176,8 +169,6 @@ class acm */ public function destroy($var_name, $table = '') { - global $phpEx; - if ($var_name === 'sql' && !empty($table)) { if (!is_array($table)) @@ -226,8 +217,6 @@ class acm */ public function sql_load($query) { - global $phpEx; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); $query_id = sizeof($this->sql_rowset); @@ -250,7 +239,7 @@ class acm */ public function sql_save($query, &$query_result, $ttl) { - global $db, $phpEx; + global $db; // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 89769552bd..8d6e91a71c 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -26,8 +26,7 @@ class acp_attachments function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); @@ -79,7 +78,7 @@ class acp_attachments { case 'attach': - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); $sql = 'SELECT group_name, cat_id FROM ' . EXTENSION_GROUPS_TABLE . ' @@ -696,7 +695,7 @@ class acp_attachments $filename_list = ''; $no_image_select = false; - $imglist = filelist($phpbb_root_path . $img_path); + $imglist = filelist(PHPBB_ROOT_PATH . $img_path); if (sizeof($imglist)) { @@ -742,14 +741,14 @@ class acp_attachments } $template->assign_vars(array( - 'PHPBB_ROOT_PATH' => $phpbb_root_path, + 'PHPBB_ROOT_PATH' => PHPBB_ROOT_PATH, 'IMG_PATH' => $img_path, 'ACTION' => $action, 'GROUP_ID' => $group_id, 'GROUP_NAME' => $ext_group_row['group_name'], 'ALLOW_GROUP' => $ext_group_row['allow_group'], 'ALLOW_IN_PM' => $ext_group_row['allow_in_pm'], - 'UPLOAD_ICON_SRC' => $phpbb_root_path . $img_path . '/' . $ext_group_row['upload_icon'], + 'UPLOAD_ICON_SRC' => PHPBB_ROOT_PATH . $img_path . '/' . $ext_group_row['upload_icon'], 'EXTGROUP_FILESIZE' => $ext_group_row['max_filesize'], 'ASSIGNED_EXTENSIONS' => $assigned_extensions, @@ -761,7 +760,7 @@ class acp_attachments 'S_NO_IMAGE' => $no_image_select, 'S_FORUM_IDS' => (sizeof($forum_ids)) ? true : false, - 'U_EXTENSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=extensions"), + 'U_EXTENSIONS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&mode=extensions"), 'U_BACK' => $this->u_action, 'L_LEGEND' => $user->lang[strtoupper($action) . '_EXTENSION_GROUP']) @@ -1032,7 +1031,7 @@ class acp_attachments 'PHYSICAL_FILENAME' => basename($row['physical_filename']), 'ATTACH_ID' => $row['attach_id'], 'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '', - 'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&id=' . $row['attach_id'])) + 'U_FILE' => append_sid('download/file', 'mode=view&id=' . $row['attach_id'])) ); } $db->sql_freeresult($result); @@ -1192,31 +1191,31 @@ class acp_attachments */ function test_upload(&$error, $upload_dir, $create_directory = false) { - global $user, $phpbb_root_path; + global $user; // Does the target directory exist, is it a directory and writable. if ($create_directory) { - if (!file_exists($phpbb_root_path . $upload_dir)) + if (!file_exists(PHPBB_ROOT_PATH . $upload_dir)) { - @mkdir($phpbb_root_path . $upload_dir, 0777); - @chmod($phpbb_root_path . $upload_dir, 0777); + @mkdir(PHPBB_ROOT_PATH . $upload_dir, 0777); + @chmod(PHPBB_ROOT_PATH . $upload_dir, 0777); } } - if (!file_exists($phpbb_root_path . $upload_dir)) + if (!file_exists(PHPBB_ROOT_PATH . $upload_dir)) { $error[] = sprintf($user->lang['NO_UPLOAD_DIR'], $upload_dir); return; } - if (!is_dir($phpbb_root_path . $upload_dir)) + if (!is_dir(PHPBB_ROOT_PATH . $upload_dir)) { $error[] = sprintf($user->lang['UPLOAD_NOT_DIR'], $upload_dir); return; } - if (!is_writable($phpbb_root_path . $upload_dir)) + if (!is_writable(PHPBB_ROOT_PATH . $upload_dir)) { $error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir); return; diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php index 77fb44dda9..3d60ffbe09 100644 --- a/phpBB/includes/acp/acp_ban.php +++ b/phpBB/includes/acp/acp_ban.php @@ -26,9 +26,8 @@ class acp_ban function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $bansubmit = (isset($_POST['bansubmit'])) ? true : false; $unbansubmit = (isset($_POST['unbansubmit'])) ? true : false; @@ -112,7 +111,7 @@ class acp_ban 'S_USERNAME_BAN' => ($mode == 'user') ? true : false, 'U_ACTION' => $this->u_action, - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_ban&field=ban'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=acp_ban&field=ban'), )); } diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 33e8fe7ec1..e0d478689e 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -25,8 +25,7 @@ class acp_bbcodes function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $user->add_lang('acp/posting'); diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 800abd875a..6d3fd34263 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -27,8 +27,7 @@ class acp_board function main($id, $mode) { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $config; $user->add_lang('acp/board'); @@ -418,15 +417,15 @@ class acp_board // Retrieve a list of auth plugins and check their config values $auth_plugins = array(); - $dp = @opendir($phpbb_root_path . 'includes/auth'); + $dp = @opendir(PHPBB_ROOT_PATH . 'includes/auth'); if ($dp) { while (($file = readdir($dp)) !== false) { - if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) + if (preg_match('#^auth_(.*?)\.' . PHP_EXT . '$#', $file)) { - $auth_plugins[] = basename(preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file)); + $auth_plugins[] = basename(preg_replace('#^auth_(.*?)\.' . PHP_EXT . '$#', '\1', $file)); } } closedir($dp); @@ -438,9 +437,9 @@ class acp_board $old_auth_config = array(); foreach ($auth_plugins as $method) { - if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) + if ($method && file_exists(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT)) { - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT); $method = 'acp_' . $method; if (function_exists($method)) @@ -481,7 +480,7 @@ class acp_board $method = basename($cfg_array['auth_method']); if ($method && in_array($method, $auth_plugins)) { - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT); $method = 'init_' . $method; if (function_exists($method)) @@ -579,7 +578,7 @@ class acp_board foreach ($auth_plugins as $method) { - if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) + if ($method && file_exists(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT)) { $method = 'acp_' . $method; if (function_exists($method)) @@ -604,11 +603,9 @@ class acp_board */ function select_auth_method($selected_method, $key = '') { - global $phpbb_root_path, $phpEx; - $auth_plugins = array(); - $dp = @opendir($phpbb_root_path . 'includes/auth'); + $dp = @opendir(PHPBB_ROOT_PATH . 'includes/auth'); if (!$dp) { @@ -617,9 +614,9 @@ class acp_board while (($file = readdir($dp)) !== false) { - if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) + if (preg_match('#^auth_(.*?)\.' . PHP_EXT . '$#', $file)) { - $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); + $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . PHP_EXT . '$#', '\1', $file); } } closedir($dp); diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index 81ac239358..672fb39c1d 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -26,7 +26,6 @@ class acp_bots function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; $action = request_var('action', ''); $submit = (isset($_POST['submit'])) ? true : false; @@ -141,7 +140,7 @@ class acp_bots case 'edit': case 'add': - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $bot_row = array( 'bot_name' => utf8_normalize_nfc(request_var('bot_name', '', true)), diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 5b2b345ef8..8a93f887f1 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -24,8 +24,7 @@ class acp_captcha function main($id, $mode) { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $config; $user->add_lang('acp/board'); @@ -47,11 +46,11 @@ class acp_captcha if ($config['captcha_gd']) { - include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_gd.' . PHP_EXT); } else { - include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_non_gd.' . PHP_EXT); } captcha::execute(gen_rand_string(mt_rand(5, 8)), time()); @@ -92,7 +91,7 @@ class acp_captcha else { - $preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&demo=demo")); + $preview_image_src = append_sid(append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&demo=demo")); if (@extension_loaded('gd')) { $template->assign_var('GD', true); diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 98c2decbf6..561e88bbbf 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -25,8 +25,7 @@ class acp_database function main($id, $mode) { - global $cache, $db, $user, $auth, $template, $table_prefix; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $cache, $db, $user, $auth, $template, $table_prefix, $config; $user->add_lang('acp/database'); @@ -171,7 +170,7 @@ class acp_database break; default: - include($phpbb_root_path . 'includes/functions_install.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT); $tables = get_tables($db); asort($tables); foreach ($tables as $table_name) @@ -225,7 +224,7 @@ class acp_database trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } - $file_name = $phpbb_root_path . 'store/' . $matches[0]; + $file_name = PHPBB_ROOT_PATH . 'store/' . $matches[0]; if (!file_exists($file_name) || !is_readable($file_name)) { @@ -420,7 +419,7 @@ class acp_database $methods[] = $type; } - $dir = $phpbb_root_path . 'store/'; + $dir = PHPBB_ROOT_PATH . 'store/'; $dh = @opendir($dir); if ($dh) @@ -529,8 +528,7 @@ class base_extractor if ($store == true) { - global $phpbb_root_path; - $file = $phpbb_root_path . 'store/' . $filename . $ext; + $file = PHPBB_ROOT_PATH . 'store/' . $filename . $ext; $this->fp = $open($file, 'w'); diff --git a/phpBB/includes/acp/acp_disallow.php b/phpBB/includes/acp/acp_disallow.php index 9549955cc8..abcb964906 100644 --- a/phpBB/includes/acp/acp_disallow.php +++ b/phpBB/includes/acp/acp_disallow.php @@ -25,10 +25,9 @@ class acp_disallow function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $user->add_lang('acp/posting'); diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index c964530c32..b8672a1c03 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -26,7 +26,6 @@ class acp_email function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; $user->add_lang('acp/email'); $this->tpl_name = 'acp_email'; @@ -148,8 +147,8 @@ class acp_email $db->sql_freeresult($result); // Send the messages - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); + include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $messenger = new messenger($use_queue); $errored = false; @@ -218,7 +217,7 @@ class acp_email } else { - $message = sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=critical') . '">', '</a>'); + $message = sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&mode=critical') . '">', '</a>'); trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -250,12 +249,11 @@ class acp_email 'U_ACTION' => $this->u_action, 'S_GROUP_OPTIONS' => $select_list, 'USERNAMES' => $usernames, - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_email&field=usernames'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=acp_email&field=usernames'), 'SUBJECT' => $subject, 'MESSAGE' => $message, - 'S_PRIORITY_OPTIONS' => $s_priority_options) - ); - + 'S_PRIORITY_OPTIONS' => $s_priority_options, + )); } } diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 6f11c88d60..4a5db8f7a0 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -26,8 +26,7 @@ class acp_forums function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $user->add_lang('acp/forums'); $this->tpl_name = 'acp_forums'; @@ -253,13 +252,13 @@ class acp_forums // Redirect to permissions if ($auth->acl_get('a_fauth')) { - $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>'); + $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions' . $acl_url) . '">', '</a>'); } // redirect directly to permission settings screen if authed if ($action == 'add' && !$forum_perm_from && $auth->acl_get('a_fauth')) { - meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); + meta_refresh(4, append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions' . $acl_url)); } trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); @@ -636,7 +635,7 @@ class acp_forums 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DATA_LINK' => $forum_data['forum_link'], 'FORUM_IMAGE' => $forum_data['forum_image'], - 'FORUM_IMAGE_SRC' => ($forum_data['forum_image']) ? $phpbb_root_path . $forum_data['forum_image'] : '', + 'FORUM_IMAGE_SRC' => ($forum_data['forum_image']) ? PHPBB_ROOT_PATH . $forum_data['forum_image'] : '', 'FORUM_POST' => FORUM_POST, 'FORUM_LINK' => FORUM_LINK, 'FORUM_CAT' => FORUM_CAT, @@ -810,8 +809,8 @@ class acp_forums $template->assign_block_vars('forums', array( 'FOLDER_IMAGE' => $folder_image, - 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="" />' : '', - 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . PHPBB_ROOT_PATH . $row['forum_image'] . '" alt="" />' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? PHPBB_ROOT_PATH . $row['forum_image'] : '', 'FORUM_NAME' => $row['forum_name'], 'FORUM_DESCRIPTION' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), 'FORUM_TOPICS' => $row['forum_topics'], @@ -1620,9 +1619,9 @@ class acp_forums */ function delete_forum_content($forum_id) { - global $db, $config, $phpbb_root_path, $phpEx; + global $db, $config; - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); $db->sql_transaction('begin'); diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index eb785ced23..f43c3de484 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -25,8 +25,7 @@ class acp_groups function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; + global $config, $db, $user, $auth, $template, $cache, $file_uploads; $user->add_lang('acp/groups'); $this->tpl_name = 'acp_groups'; @@ -35,7 +34,7 @@ class acp_groups $form_key = 'acp_groups'; add_form_key($form_key); - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); // Check and set some common vars $action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['addusers'])) ? 'addusers' : request_var('action', '')); @@ -49,7 +48,7 @@ class acp_groups // Clear some vars - $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; + $can_upload = (file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $file_uploads) ? true : false; $group_row = array(); // Grab basic data for group, if group_id is set and exists @@ -247,7 +246,7 @@ class acp_groups case 'edit': case 'add': - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); $data = $submit_ary = array(); @@ -330,11 +329,11 @@ class acp_groups else if ($avatar_select && $config['allow_avatar_local']) { // check avatar gallery - if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) + if (is_dir(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category)) { $submit_ary['avatar_type'] = AVATAR_GALLERY; - list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select); + list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select); $submit_ary['avatar'] = $category . '/' . $avatar_select; } } @@ -505,7 +504,7 @@ class acp_groups $type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : ''; $type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : ''; - $avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />'; + $avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . PHPBB_ADMIN_PATH . 'images/no_avatar.gif" alt="" />'; $display_gallery = (isset($_POST['display_gallery'])) ? true : false; @@ -519,7 +518,7 @@ class acp_groups switch ($back_link) { case 'acp_users_groups': - $u_back = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=groups&u=' . request_var('u', 0)); + $u_back = append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=users&mode=groups&u=' . request_var('u', 0)); break; default: @@ -574,7 +573,7 @@ class acp_groups 'GROUP_HIDDEN' => $type_hidden, 'U_BACK' => $u_back, - 'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=settings&name=group_colour'), + 'U_SWATCH' => append_sid(PHPBB_ADMIN_PATH . 'swatch.' . PHP_EXT, 'form=settings&name=group_colour'), 'U_ACTION' => "{$this->u_action}&action=$action&g=$group_id", 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)), ) @@ -604,7 +603,7 @@ class acp_groups while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('leader', array( - 'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"), + 'U_USER_EDIT' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&action=edit&u={$row['user_id']}"), 'USERNAME' => $row['username'], 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, @@ -643,7 +642,7 @@ class acp_groups 'U_ACTION' => $this->u_action . "&g=$group_id", 'U_BACK' => $this->u_action, - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=list&field=usernames'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=list&field=usernames'), 'U_DEFAULT_ALL' => "{$this->u_action}&action=default&g=$group_id", )); @@ -670,7 +669,7 @@ class acp_groups } $template->assign_block_vars('member', array( - 'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"), + 'U_USER_EDIT' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&action=edit&u={$row['user_id']}"), 'USERNAME' => $row['username'], 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 4f16c0c83d..e9b24155c8 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -26,8 +26,7 @@ class acp_icons function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $user->add_lang('acp/posting'); @@ -69,13 +68,13 @@ class acp_icons // Grab file list of paks and images if ($action == 'edit' || $action == 'add' || $action == 'import') { - $imglist = filelist($phpbb_root_path . $img_path, ''); + $imglist = filelist(PHPBB_ROOT_PATH . $img_path, ''); foreach ($imglist as $path => $img_ary) { foreach ($img_ary as $img) { - $img_size = getimagesize($phpbb_root_path . $img_path . '/' . $path . $img); + $img_size = getimagesize(PHPBB_ROOT_PATH . $img_path . '/' . $path . $img); if (!$img_size[0] || !$img_size[1] || strlen($img) > 255) { @@ -89,11 +88,11 @@ class acp_icons } unset($imglist); - if ($dir = @opendir($phpbb_root_path . $img_path)) + if ($dir = @opendir(PHPBB_ROOT_PATH . $img_path)) { while (($file = readdir($dir)) !== false) { - if (is_file($phpbb_root_path . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file)) + if (is_file(PHPBB_ROOT_PATH . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file)) { $_paks[] = $file; } @@ -254,7 +253,7 @@ class acp_icons $template->assign_block_vars('items', array( 'IMG' => $img, 'A_IMG' => addslashes($img), - 'IMG_SRC' => $phpbb_root_path . $img_path . '/' . $img, + 'IMG_SRC' => PHPBB_ROOT_PATH . $img_path . '/' . $img, 'CODE' => ($mode == 'smilies' && isset($img_row['code'])) ? $img_row['code'] : '', 'EMOTION' => ($mode == 'smilies' && isset($img_row['emotion'])) ? $img_row['emotion'] : '', @@ -278,9 +277,9 @@ class acp_icons 'S_ADD_ORDER_LIST_DISPLAY' => $add_order_list . $add_order_lists[1], 'S_ADD_ORDER_LIST_UNDISPLAY' => $add_order_list . $add_order_lists[0], - 'IMG_SRC' => $phpbb_root_path . $img_path . '/' . $default_row['smiley_url'], + 'IMG_SRC' => PHPBB_ROOT_PATH . $img_path . '/' . $default_row['smiley_url'], 'IMG_PATH' => $img_path, - 'PHPBB_ROOT_PATH' => $phpbb_root_path, + 'PHPBB_ROOT_PATH' => PHPBB_ROOT_PATH, 'CODE' => $default_row['code'], 'EMOTION' => $default_row['emotion'], @@ -352,7 +351,7 @@ class acp_icons { if ($image_width[$image] == 0 || $image_height[$image] == 0) { - $img_size = getimagesize($phpbb_root_path . $img_path . '/' . $image); + $img_size = getimagesize(PHPBB_ROOT_PATH . $img_path . '/' . $image); $image_width[$image] = $img_size[0]; $image_height[$image] = $img_size[1]; } @@ -461,7 +460,7 @@ class acp_icons { $order = 0; - if (!($pak_ary = @file($phpbb_root_path . $img_path . '/' . $pak))) + if (!($pak_ary = @file(PHPBB_ROOT_PATH . $img_path . '/' . $pak))) { trigger_error($user->lang['PAK_FILE_NOT_READABLE'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -833,7 +832,7 @@ class acp_icons $template->assign_block_vars('items', array( 'S_SPACER' => (!$spacer && !$row['display_on_posting']) ? true : false, 'ALT_TEXT' => $alt_text, - 'IMG_SRC' => $phpbb_root_path . $img_path . '/' . $row[$fields . '_url'], + 'IMG_SRC' => PHPBB_ROOT_PATH . $img_path . '/' . $row[$fields . '_url'], 'WIDTH' => $row[$fields . '_width'], 'HEIGHT' => $row[$fields . '_height'], 'CODE' => (isset($row['code'])) ? $row['code'] : '', diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index 90f326b099..1a1ff3ecf7 100755 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -32,9 +32,8 @@ class acp_inactive function main($id, $mode) { global $config, $db, $user, $auth, $template; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $user->add_lang('memberlist'); @@ -98,7 +97,7 @@ class acp_inactive if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users)) { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(); @@ -167,7 +166,7 @@ class acp_inactive if ($row = $db->sql_fetchrow($result)) { // Send the messages - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(); $usernames = array(); @@ -182,7 +181,7 @@ class acp_inactive $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username']), 'REGISTER_DATE' => $user->format_date($row['user_regdate']), - 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey']) + 'U_ACTIVATE' => generate_board_url() . '/ucp.' . PHP_EXT . '?mode=activate&u=' . $row['user_id'] . '&k=' . $row['user_actkey']) ); $messenger->send($row['user_notify_type']); @@ -228,7 +227,7 @@ class acp_inactive 'REASON' => $row['inactive_reason'], 'USER_ID' => $row['user_id'], 'USERNAME' => $row['username'], - 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}")) + 'U_USER_ADMIN' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&mode=overview&u={$row['user_id']}")) ); } diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php index 3862ee1ee8..a8b55ab397 100644 --- a/phpBB/includes/acp/acp_jabber.php +++ b/phpBB/includes/acp/acp_jabber.php @@ -26,12 +26,11 @@ class acp_jabber function main($id, $mode) { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $config; $user->add_lang('acp/board'); - include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_jabber.' . PHP_EXT); $action = request_var('action', ''); $submit = (isset($_POST['submit'])) ? true : false; diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index fc2ae11b1e..66f201dbed 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -32,10 +32,9 @@ class acp_language function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; global $safe_mode, $file_uploads; - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $this->default_variables(); @@ -61,7 +60,7 @@ class acp_language list($_REQUEST['language_file'], ) = array_keys($missing_file); } - $selected_lang_file = request_var('language_file', '|common.' . $phpEx); + $selected_lang_file = request_var('language_file', '|common.' . PHP_EXT); list($this->language_directory, $this->language_file) = explode('|', $selected_lang_file); @@ -78,7 +77,7 @@ class acp_language $action = 'upload_file'; $method = request_var('method', ''); - include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_transfer.' . PHP_EXT); switch ($method) { @@ -103,7 +102,7 @@ class acp_language { case 'upload_file': - include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_transfer.' . PHP_EXT); $method = request_var('method', ''); @@ -219,7 +218,7 @@ class acp_language { case 'email': // Get email templates - $email_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'email', 'txt'); + $email_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'email', 'txt'); $email_files = $email_files['email/']; if (!in_array($this->language_file, $email_files)) @@ -230,7 +229,7 @@ class acp_language case 'acp': // Get acp files - $acp_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'acp', $phpEx); + $acp_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'acp', PHP_EXT); $acp_files = $acp_files['acp/']; if (!in_array($this->language_file, $acp_files)) @@ -241,7 +240,7 @@ class acp_language case 'mods': // Get mod files - $mods_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'mods', $phpEx); + $mods_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'mods', PHP_EXT); $mods_files = (isset($mods_files['mods/'])) ? $mods_files['mods/'] : array(); if (!in_array($this->language_file, $mods_files)) @@ -269,7 +268,7 @@ class acp_language foreach ($mkdir_ary as $dir) { - $dir = $phpbb_root_path . 'store/' . $dir; + $dir = PHPBB_ROOT_PATH . 'store/' . $dir; if (!is_dir($dir)) { @@ -284,7 +283,7 @@ class acp_language // Get target filename for storage folder $filename = $this->get_filename($row['lang_iso'], $this->language_directory, $this->language_file, true, true); - $fp = @fopen($phpbb_root_path . $filename, 'wb'); + $fp = @fopen(PHPBB_ROOT_PATH . $filename, 'wb'); if (!$fp) { @@ -354,7 +353,7 @@ class acp_language header('Content-Type: application/octetstream; name="' . $this->language_file . '"'); header('Content-disposition: attachment; filename=' . $this->language_file); - $fp = @fopen($phpbb_root_path . $filename, 'rb'); + $fp = @fopen(PHPBB_ROOT_PATH . $filename, 'rb'); while ($buffer = fread($fp, 1024)) { echo $buffer; @@ -382,7 +381,7 @@ class acp_language $old_file = '/' . $this->get_filename($row['lang_iso'], $dir, $file, false, true); $lang_path = 'language/' . $row['lang_iso'] . '/' . (($dir) ? $dir . '/' : ''); - include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_transfer.' . PHP_EXT); $method = request_var('method', ''); if ($method != 'ftp' && $method != 'ftp_fsock') @@ -412,9 +411,9 @@ class acp_language $transfer->close_session(); // Remove from storage folder - if (file_exists($phpbb_root_path . 'store/' . $lang_path . $file)) + if (file_exists(PHPBB_ROOT_PATH . 'store/' . $lang_path . $file)) { - @unlink($phpbb_root_path . 'store/' . $lang_path . $file); + @unlink(PHPBB_ROOT_PATH . 'store/' . $lang_path . $file); } add_log('admin', 'LOG_LANGUAGE_FILE_REPLACED', $file); @@ -447,15 +446,15 @@ class acp_language $missing_vars = $missing_files = array(); // Get email templates - $email_files = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'email', 'txt'); + $email_files = filelist(PHPBB_ROOT_PATH . 'language/' . $config['default_lang'], 'email', 'txt'); $email_files = $email_files['email/']; // Get acp files - $acp_files = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'acp', $phpEx); + $acp_files = filelist(PHPBB_ROOT_PATH . 'language/' . $config['default_lang'], 'acp', PHP_EXT); $acp_files = $acp_files['acp/']; // Get mod files - $mods_files = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'mods', $phpEx); + $mods_files = filelist(PHPBB_ROOT_PATH . 'language/' . $config['default_lang'], 'mods', PHP_EXT); $mods_files = (isset($mods_files['mods/'])) ? $mods_files['mods/'] : array(); // Check if our current filename matches the files @@ -493,13 +492,13 @@ class acp_language { $store_filename = $this->get_filename($lang_iso, $this->language_directory, $this->language_file, true, true); - if (file_exists($phpbb_root_path . $store_filename)) + if (file_exists(PHPBB_ROOT_PATH . $store_filename)) { - @unlink($phpbb_root_path . $store_filename); + @unlink(PHPBB_ROOT_PATH . $store_filename); } } - include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_transfer.' . PHP_EXT); $methods = transfer::methods(); @@ -529,7 +528,7 @@ class acp_language foreach ($this->main_files as $file) { - if (file_exists($phpbb_root_path . $this->get_filename($lang_iso, '', $file))) + if (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, '', $file))) { $missing_vars[$file] = $this->compare_language_files($config['default_lang'], $lang_iso, '', $file); @@ -547,7 +546,7 @@ class acp_language // Now go through acp/mods directories foreach ($acp_files as $file) { - if (file_exists($phpbb_root_path . $this->get_filename($lang_iso, 'acp', $file))) + if (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, 'acp', $file))) { $missing_vars['acp/' . $file] = $this->compare_language_files($config['default_lang'], $lang_iso, 'acp', $file); @@ -566,7 +565,7 @@ class acp_language { foreach ($mods_files as $file) { - if (file_exists($phpbb_root_path . $this->get_filename($lang_iso, 'mods', $file))) + if (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, 'mods', $file))) { $missing_vars['mods/' . $file] = $this->compare_language_files($config['default_lang'], $lang_iso, 'mods', $file); @@ -585,7 +584,7 @@ class acp_language // More missing files... for example email templates? foreach ($email_files as $file) { - if (!file_exists($phpbb_root_path . $this->get_filename($lang_iso, 'email', $file))) + if (!file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, 'email', $file))) { $missing_files[] = $this->get_filename($lang_iso, 'email', $file); } @@ -625,7 +624,7 @@ class acp_language } // Main language files - $s_lang_options = '<option value="|common.' . $phpEx . '" class="sep">' . $user->lang['LANGUAGE_FILES'] . '</option>'; + $s_lang_options = '<option value="|common.' . PHP_EXT . '" class="sep">' . $user->lang['LANGUAGE_FILES'] . '</option>'; foreach ($this->main_files as $file) { if (strpos($file, 'help_') === 0) @@ -633,14 +632,14 @@ class acp_language continue; } - $prefix = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : ''; + $prefix = (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : ''; $selected = (!$this->language_directory && $this->language_file == $file) ? ' selected="selected"' : ''; $s_lang_options .= '<option value="|' . $file . '"' . $selected . '>' . $prefix . $file . '</option>'; } // Help Files - $s_lang_options .= '<option value="|common.' . $phpEx . '" class="sep">' . $user->lang['HELP_FILES'] . '</option>'; + $s_lang_options .= '<option value="|common.' . PHP_EXT . '" class="sep">' . $user->lang['HELP_FILES'] . '</option>'; foreach ($this->main_files as $file) { if (strpos($file, 'help_') !== 0) @@ -648,7 +647,7 @@ class acp_language continue; } - $prefix = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : ''; + $prefix = (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : ''; $selected = (!$this->language_directory && $this->language_file == $file) ? ' selected="selected"' : ''; $s_lang_options .= '<option value="|' . $file . '"' . $selected . '>' . $prefix . $file . '</option>'; @@ -664,11 +663,11 @@ class acp_language continue; } - $s_lang_options .= '<option value="|common.' . $phpEx . '" class="sep">' . $user->lang[strtoupper($check) . '_FILES'] . '</option>'; + $s_lang_options .= '<option value="|common.' . PHP_EXT . '" class="sep">' . $user->lang[strtoupper($check) . '_FILES'] . '</option>'; foreach (${$check . '_files'} as $file) { - $prefix = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, $check, $file, true, true))) ? '* ' : ''; + $prefix = (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, $check, $file, true, true))) ? '* ' : ''; $selected = ($this->language_directory == $check && $this->language_file == $file) ? ' selected="selected"' : ''; $s_lang_options .= '<option value="' . $check . '|' . $file . '"' . $selected . '>' . $prefix . $file . '</option>'; @@ -681,10 +680,10 @@ class acp_language $is_email_file = ($this->language_directory == 'email') ? true : false; $is_help_file = (strpos($this->language_file, 'help_') === 0) ? true : false; - $file_from_store = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, true, true))) ? true : false; + $file_from_store = (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, true, true))) ? true : false; $no_store_filename = $this->get_filename($lang_iso, $this->language_directory, $this->language_file); - if (!$file_from_store && !file_exists($phpbb_root_path . $no_store_filename)) + if (!$file_from_store && !file_exists(PHPBB_ROOT_PATH . $no_store_filename)) { $print_message = sprintf($user->lang['MISSING_LANGUAGE_FILE'], $no_store_filename); } @@ -692,12 +691,12 @@ class acp_language { if ($is_email_file) { - $lang = file_get_contents($phpbb_root_path . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store)); + $lang = file_get_contents(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store)); } else { $help = array(); - include($phpbb_root_path . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store)); + include(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store)); if ($is_help_file) { @@ -794,12 +793,12 @@ class acp_language $lang_iso = request_var('iso', ''); $lang_iso = basename($lang_iso); - if (!$lang_iso || !file_exists("{$phpbb_root_path}language/$lang_iso/iso.txt")) + if (!$lang_iso || !file_exists(PHPBB_ROOT_PATH . "language/$lang_iso/iso.txt")) { trigger_error($user->lang['LANGUAGE_PACK_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } - $file = file("{$phpbb_root_path}language/$lang_iso/iso.txt"); + $file = file(PHPBB_ROOT_PATH . "language/$lang_iso/iso.txt"); $lang_pack = array( 'iso' => $lang_iso, @@ -849,9 +848,9 @@ class acp_language $result = $db->sql_query($sql); while ($imageset_row = $db->sql_fetchrow($result)) { - if (@file_exists("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg")) + if (@file_exists(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg")) { - $cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg"); + $cfg_data_imageset_data = parse_cfg_file(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg"); foreach ($cfg_data_imageset_data as $image_name => $value) { if (strpos($value, '*') !== false) @@ -994,41 +993,41 @@ class acp_language $use_method = '.tar'; } - include_once($phpbb_root_path . 'includes/functions_compress.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_compress.' . PHP_EXT); if ($use_method == '.zip') { - $compress = new compress_zip('w', $phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method); + $compress = new compress_zip('w', PHPBB_ROOT_PATH . 'store/lang_' . $row['lang_iso'] . $use_method); } else { - $compress = new compress_tar('w', $phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method, $use_method); + $compress = new compress_tar('w', PHPBB_ROOT_PATH . 'store/lang_' . $row['lang_iso'] . $use_method, $use_method); } // Get email templates - $email_templates = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'email', 'txt'); + $email_templates = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'email', 'txt'); $email_templates = $email_templates['email/']; // Get acp files - $acp_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'acp', $phpEx); + $acp_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'acp', PHP_EXT); $acp_files = $acp_files['acp/']; // Get mod files - $mod_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'mods', $phpEx); + $mod_files = filelist(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'], 'mods', PHP_EXT); $mod_files = (isset($mod_files['mods/'])) ? $mod_files['mods/'] : array(); // Add main files $this->add_to_archive($compress, $this->main_files, $row['lang_iso']); // Add search files if they exist... - if (file_exists($phpbb_root_path . 'language/' . $row['lang_iso'] . '/search_ignore_words.' . $phpEx)) + if (file_exists(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'] . '/search_ignore_words.' . PHP_EXT)) { - $this->add_to_archive($compress, array("search_ignore_words.$phpEx"), $row['lang_iso']); + $this->add_to_archive($compress, array('search_ignore_words.' . PHP_EXT), $row['lang_iso']); } - if (file_exists($phpbb_root_path . 'language/' . $row['lang_iso'] . '/search_synonyms.' . $phpEx)) + if (file_exists(PHPBB_ROOT_PATH . 'language/' . $row['lang_iso'] . '/search_synonyms.' . PHP_EXT)) { - $this->add_to_archive($compress, array("search_synonyms.$phpEx"), $row['lang_iso']); + $this->add_to_archive($compress, array('search_synonyms.' . PHP_EXT), $row['lang_iso']); } // Write files in folders @@ -1055,7 +1054,7 @@ class acp_language $compress->close(); $compress->download('lang_' . $row['lang_iso']); - @unlink($phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method); + @unlink(PHPBB_ROOT_PATH . 'store/lang_' . $row['lang_iso'] . $use_method); exit; @@ -1101,17 +1100,17 @@ class acp_language $db->sql_freeresult($result); $new_ary = $iso = array(); - $dp = @opendir("{$phpbb_root_path}language"); + $dp = @opendir(PHPBB_ROOT_PATH . 'language'); if ($dp) { 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)) { - if ($iso = file("{$phpbb_root_path}language/$file/iso.txt")) + if ($iso = file(PHPBB_ROOT_PATH . "language/$file/iso.txt")) { if (sizeof($iso) == 3) { @@ -1153,8 +1152,6 @@ class acp_language */ function default_variables() { - global $phpEx; - $this->language_file_header = '<?php /** * @@ -1199,7 +1196,7 @@ $lang = array_merge($lang, array( '; // Language files in language root directory - $this->main_files = array("common.$phpEx", "groups.$phpEx", "install.$phpEx", "mcp.$phpEx", "memberlist.$phpEx", "posting.$phpEx", "search.$phpEx", "ucp.$phpEx", "viewforum.$phpEx", "viewtopic.$phpEx", "help_bbcode.$phpEx", "help_faq.$phpEx"); + $this->main_files = array('common.' . PHP_EXT, 'groups.' . PHP_EXT, 'install.' . PHP_EXT, 'mcp.' . PHP_EXT, 'memberlist.' . PHP_EXT, 'posting.' . PHP_EXT, 'search.' . PHP_EXT, 'ucp.' . PHP_EXT, 'viewforum.' . PHP_EXT, 'viewtopic.' . PHP_EXT, 'help_bbcode.' . PHP_EXT, 'help_faq.' . PHP_EXT); } /** @@ -1207,7 +1204,7 @@ $lang = array_merge($lang, array( */ function get_filename($lang_iso, $directory, $filename, $check_store = false, $only_return_filename = false) { - global $phpbb_root_path, $safe_mode; + global $safe_mode; $check_filename = "language/$lang_iso/" . (($directory) ? $directory . '/' : '') . $filename; @@ -1215,7 +1212,7 @@ $lang = array_merge($lang, array( { $check_store_filename = ($safe_mode) ? "store/langfile_{$lang_iso}" . (($directory) ? '_' . $directory : '') . "_{$filename}" : "store/language/$lang_iso/" . (($directory) ? $directory . '/' : '') . $filename; - if (!$only_return_filename && file_exists($phpbb_root_path . $check_store_filename)) + if (!$only_return_filename && file_exists(PHPBB_ROOT_PATH . $check_store_filename)) { return $check_store_filename; } @@ -1233,8 +1230,6 @@ $lang = array_merge($lang, array( */ function add_to_archive(&$compress, $filelist, $lang_iso, $directory = '') { - global $phpbb_root_path; - foreach ($filelist as $file) { // Get source filename @@ -1242,7 +1237,7 @@ $lang = array_merge($lang, array( $destination = 'language/' . $lang_iso . '/' . (($directory) ? $directory . '/' : '') . $file; // Add file to archive - $compress->add_custom_file($phpbb_root_path . $source, $destination); + $compress->add_custom_file(PHPBB_ROOT_PATH . $source, $destination); } } @@ -1359,22 +1354,20 @@ $lang = array_merge($lang, array( */ function compare_language_files($source_lang, $dest_lang, $directory, $file) { - global $phpbb_root_path, $phpEx; - $return_ary = array(); $lang = array(); - include("{$phpbb_root_path}language/{$source_lang}/" . (($directory) ? $directory . '/' : '') . $file); + include(PHPBB_ROOT_PATH . "language/{$source_lang}/" . (($directory) ? $directory . '/' : '') . $file); $lang_entry_src = $lang; $lang = array(); - if (!file_exists($phpbb_root_path . $this->get_filename($dest_lang, $directory, $file, true))) + if (!file_exists(PHPBB_ROOT_PATH . $this->get_filename($dest_lang, $directory, $file, true))) { return array(); } - include($phpbb_root_path . $this->get_filename($dest_lang, $directory, $file, true)); + include(PHPBB_ROOT_PATH . $this->get_filename($dest_lang, $directory, $file, true)); $lang_entry_dst = $lang; diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 12953173f1..7ad0734151 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -25,8 +25,7 @@ class acp_logs function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $user->add_lang('mcp'); diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index bf6e8a39b5..3e24898908 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -26,7 +26,6 @@ class acp_main function main($id, $mode) { global $config, $db, $user, $auth, $template; - global $phpbb_root_path, $phpbb_admin_path, $phpEx; // Show restore permissions notice if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) @@ -42,16 +41,16 @@ class acp_main $db->sql_freeresult($result); $perm_from = '<strong' . (($user_row['user_colour']) ? ' style="color: #' . $user_row['user_colour'] . '">' : '>'); - $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_row['user_id']) . '">' : ''; + $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . append_sid('memberlist', 'mode=viewprofile&u=' . $user_row['user_id']) . '">' : ''; $perm_from .= $user_row['username']; $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '</a>' : ''; $perm_from .= '</strong>'; $template->assign_vars(array( 'S_RESTORE_PERMISSIONS' => true, - 'U_RESTORE_PERMISSIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm'), + 'U_RESTORE_PERMISSIONS' => append_sid('ucp', 'mode=restore_perm'), 'PERM_FROM' => $perm_from, - 'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm')), + 'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid('ucp', 'mode=restore_perm')), )); return; @@ -162,7 +161,7 @@ class acp_main if (!function_exists('update_last_username')) { - include($phpbb_root_path . "includes/functions_user.$phpEx"); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); } update_last_username(); @@ -311,13 +310,13 @@ class acp_main $avatar_dir_size = 0; - if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path'])) + if ($avatar_dir = @opendir(PHPBB_ROOT_PATH . $config['avatar_path'])) { while (($file = readdir($avatar_dir)) !== false) { if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false) { - $avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file); + $avatar_dir_size += filesize(PHPBB_ROOT_PATH . $config['avatar_path'] . '/' . $file); } } closedir($avatar_dir); @@ -387,8 +386,8 @@ class acp_main 'BOARD_VERSION' => $config['version'], 'U_ACTION' => $this->u_action, - 'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'), - 'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'), + 'U_ADMIN_LOG' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&mode=admin'), + 'U_INACTIVE_USERS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=inactive&mode=list'), 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, @@ -429,7 +428,7 @@ class acp_main 'REASON' => $row['inactive_reason'], 'USER_ID' => $row['user_id'], 'USERNAME' => $row['username'], - 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}")) + 'U_USER_ADMIN' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&mode=overview&u={$row['user_id']}")) ); } @@ -446,7 +445,7 @@ class acp_main } // Warn if install is still present - if (file_exists($phpbb_root_path . 'install')) + if (file_exists(PHPBB_ROOT_PATH . 'install')) { $template->assign_var('S_REMOVE_INSTALL', true); } diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index f3540941df..0ab8ac6f6b 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -37,8 +37,7 @@ class acp_modules function main($id, $mode) { - global $db, $user, $auth, $template, $module; - global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; + global $db, $user, $auth, $template, $module, $config; // Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant) define('MODULE_INCLUDE', true); @@ -530,11 +529,9 @@ class acp_modules */ function get_module_infos($module = '', $module_class = false) { - global $phpbb_root_path, $phpEx; - $module_class = ($module_class === false) ? $this->module_class : $module_class; - $directory = $phpbb_root_path . 'includes/' . $module_class . '/info/'; + $directory = PHPBB_ROOT_PATH . 'includes/' . $module_class . '/info/'; $fileinfo = array(); if (!$module) @@ -549,9 +546,9 @@ class acp_modules while (($file = readdir($dh)) !== false) { // Is module? - if (preg_match('/^' . $module_class . '_.+\.' . $phpEx . '$/', $file)) + if (preg_match('/^' . $module_class . '_.+\.' . PHP_EXT . '$/', $file)) { - $class = str_replace(".$phpEx", '', $file) . '_info'; + $class = str_replace('.' . PHP_EXT, '', $file) . '_info'; if (!class_exists($class)) { @@ -578,7 +575,7 @@ class acp_modules if (!class_exists($class)) { - include($directory . $filename . '.' . $phpEx); + include($directory . $filename . '.' . PHP_EXT); } // Get module title tag diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 03ea5a39dd..cdc276ad01 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -25,11 +25,10 @@ class acp_permission_roles function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); - include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); + include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT); $auth_admin = new auth_admin(); diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 9240db271c..ed7ca5e942 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -26,11 +26,10 @@ class acp_permissions function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); - include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); + include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT); $auth_admin = new auth_admin(); @@ -354,7 +353,7 @@ class acp_permissions $template->assign_vars(array( 'S_SELECT_USER' => true, - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_victim&field=username&select_single=true'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=select_victim&field=username&select_single=true'), )); break; @@ -416,7 +415,7 @@ class acp_permissions 'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'], 'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'], 'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], (($user->data['user_type'] == USER_FOUNDER) ? false : 0)), - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=add_user&field=username&select_single=true'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=add_user&field=username&select_single=true'), )); break; diff --git a/phpBB/includes/acp/acp_php_info.php b/phpBB/includes/acp/acp_php_info.php index 9935c0466e..3df63edc17 100644 --- a/phpBB/includes/acp/acp_php_info.php +++ b/phpBB/includes/acp/acp_php_info.php @@ -25,8 +25,7 @@ class acp_php_info function main($id, $mode) { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $config; if ($mode != 'info') { diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 253308d153..a05766f4a6 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -29,11 +29,10 @@ class acp_profile function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; - include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); + include(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); $user->add_lang(array('ucp', 'acp/profile')); $this->tpl_name = 'acp_profile'; diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index a82a438db7..a1e4620377 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -25,10 +25,10 @@ class acp_prune function main($id, $mode) { - global $user, $phpEx, $phpbb_admin_path, $phpbb_root_path; + global $user; $user->add_lang('acp/prune'); - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); switch ($mode) { @@ -51,8 +51,7 @@ class acp_prune */ function prune_forums($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $all_forums = request_var('all_forums', 0); $forum_id = request_var('f', array(0)); @@ -228,8 +227,7 @@ class acp_prune */ function prune_users($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $user->add_lang('memberlist'); @@ -300,8 +298,8 @@ class acp_prune { $template->assign_block_vars('users', array( 'USERNAME' => $usernames[$user_id], - 'U_PROFILE' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx, 'mode=viewprofile&u=' . $user_id), - 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', + 'U_PROFILE' => append_sid('memberlist', 'mode=viewprofile&u=' . $user_id), + 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', )); } @@ -358,7 +356,7 @@ class acp_prune 'S_JOINED_OPTIONS' => $s_find_join_time, 'S_ACTIVE_OPTIONS' => $s_find_active_time, 'S_COUNT_OPTIONS' => $s_find_count, - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_prune&field=users'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=acp_prune&field=users'), )); } diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index 41ed5b0fba..aa827d646c 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -25,8 +25,7 @@ class acp_ranks function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $user->add_lang('acp/posting'); @@ -157,7 +156,7 @@ class acp_ranks } $db->sql_freeresult($result); - $imglist = filelist($phpbb_root_path . $config['ranks_path'], ''); + $imglist = filelist(PHPBB_ROOT_PATH . $config['ranks_path'], ''); $edit_img = $filename_list = ''; foreach ($imglist as $path => $img_ary) @@ -196,12 +195,12 @@ class acp_ranks $template->assign_vars(array( 'S_EDIT' => true, 'U_BACK' => $this->u_action, - 'RANKS_PATH' => $phpbb_root_path . $config['ranks_path'], + 'RANKS_PATH' => PHPBB_ROOT_PATH . $config['ranks_path'], 'U_ACTION' => $this->u_action . '&id=' . $rank_id, 'RANK_TITLE' => (isset($ranks['rank_title'])) ? $ranks['rank_title'] : '', 'S_FILENAME_LIST' => $filename_list, - 'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : $phpbb_admin_path . 'images/spacer.gif', + 'RANK_IMAGE' => ($edit_img) ? PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $edit_img : PHPBB_ADMIN_PATH . 'images/spacer.gif', 'S_SPECIAL_RANK' => (!isset($ranks['rank_special']) || $ranks['rank_special']) ? true : false, 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0) ); @@ -227,7 +226,7 @@ class acp_ranks 'S_RANK_IMAGE' => ($row['rank_image']) ? true : false, 'S_SPECIAL_RANK' => ($row['rank_special']) ? true : false, - 'RANK_IMAGE' => $phpbb_root_path . $config['ranks_path'] . '/' . $row['rank_image'], + 'RANK_IMAGE' => PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $row['rank_image'], 'RANK_TITLE' => $row['rank_title'], 'MIN_POSTS' => $row['rank_min'], diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index 7a74c29631..c7706402be 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -25,8 +25,7 @@ class acp_reasons function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $user->add_lang(array('mcp', 'acp/posting')); diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index dc6f3d1c44..a593afc648 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -50,8 +50,7 @@ class acp_search function settings($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $submit = (isset($_POST['submit'])) ? true : false; @@ -159,7 +158,7 @@ class acp_search { add_log('admin', 'LOG_CONFIG_SEARCH'); } - $extra_message = '<br />' . $user->lang['SWITCHED_SEARCH_BACKEND'] . '<br /><a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=search&mode=index') . '">» ' . $user->lang['GO_TO_SEARCH_INDEX'] . '</a>'; + $extra_message = '<br />' . $user->lang['SWITCHED_SEARCH_BACKEND'] . '<br /><a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=search&mode=index') . '">» ' . $user->lang['GO_TO_SEARCH_INDEX'] . '</a>'; } else { @@ -227,8 +226,7 @@ class acp_search function index($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; if (isset($_REQUEST['action']) && is_array($_REQUEST['action'])) { @@ -297,7 +295,7 @@ class acp_search if (method_exists($this->search, 'delete_index')) { // pass a reference to myself so the $search object can make use of save_state() and attributes - if ($error = $this->search->delete_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=delete", false))) + if ($error = $this->search->delete_index($this, append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&mode=$mode&action=delete", false))) { $this->state = array(''); $this->save_state(); @@ -360,7 +358,7 @@ class acp_search if (method_exists($this->search, 'create_index')) { // pass a reference to acp_search so the $search object can make use of save_state() and attributes - if ($error = $this->search->create_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=create", false))) + if ($error = $this->search->create_index($this, append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&mode=$mode&action=create", false))) { $this->state = array(''); $this->save_state(); @@ -500,8 +498,8 @@ class acp_search $template->assign_vars(array( 'S_INDEX' => true, 'U_ACTION' => $this->u_action, - 'U_PROGRESS_BAR' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=progress_bar"), - 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=progress_bar")), + 'U_PROGRESS_BAR' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&mode=$mode&action=progress_bar"), + 'UA_PROGRESS_BAR' => addslashes(append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&mode=$mode&action=progress_bar")), )); if (isset($this->state[1])) @@ -546,19 +544,17 @@ class acp_search function get_search_types() { - global $phpbb_root_path, $phpEx; - $search_types = array(); - $dp = @opendir($phpbb_root_path . 'includes/search'); + $dp = @opendir(PHPBB_ROOT_PATH . 'includes/search'); if ($dp) { while (($file = readdir($dp)) !== false) { - if ((preg_match('#\.' . $phpEx . '$#', $file)) && ($file != "search.$phpEx")) + if ((preg_match('#\.' . PHP_EXT . '$#', $file)) && ($file != 'search.' . PHP_EXT)) { - $search_types[] = preg_replace('#^(.*?)\.' . $phpEx . '$#', '\1', $file); + $search_types[] = preg_replace('#^(.*?)\.' . PHP_EXT . '$#', '\1', $file); } } closedir($dp); @@ -601,15 +597,15 @@ class acp_search */ function init_search($type, &$search, &$error) { - global $phpbb_root_path, $phpEx, $user; + global $user; - if (!preg_match('#^\w+$#', $type) || !file_exists("{$phpbb_root_path}includes/search/$type.$phpEx")) + if (!preg_match('#^\w+$#', $type) || !file_exists(PHPBB_ROOT_PATH . "includes/search/$type." . PHP_EXT)) { $error = $user->lang['NO_SUCH_SEARCH_MODULE']; return $error; } - include_once("{$phpbb_root_path}includes/search/$type.$phpEx"); + include_once(PHPBB_ROOT_PATH . "includes/search/$type." . PHP_EXT); if (!class_exists($type)) { diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 538114de6a..e5002a3de6 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -31,8 +31,7 @@ class acp_styles function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; // Hardcoded template bitfield to add for new templates $bitfield = new bitfield(); @@ -246,7 +245,7 @@ parse_css_file = {PARSE_CSS_FILE} $template_refreshed = ''; // Only refresh database if the template is stored in the database - if ($template_row['template_storedb'] && file_exists("{$phpbb_root_path}styles/{$template_row['template_path']}/template/")) + if ($template_row['template_storedb'] && file_exists(PHPBB_ROOT_PATH . "styles/{$template_row['template_path']}/template/")) { $filelist = array('' => array()); @@ -257,7 +256,7 @@ parse_css_file = {PARSE_CSS_FILE} while ($row = $db->sql_fetchrow($result)) { -// if (@filemtime("{$phpbb_root_path}styles/{$template_row['template_path']}/template/" . $row['template_filename']) > $row['template_mtime']) +// if (@filemtime(PHPBB_ROOT_PATH . "styles/{$template_row['template_path']}/template/" . $row['template_filename']) > $row['template_mtime']) // { // get folder info from the filename if (($slash_pos = strrpos($row['template_filename'], '/')) === false) @@ -325,11 +324,11 @@ parse_css_file = {PARSE_CSS_FILE} if (confirm_box(true)) { - if ($theme_row['theme_storedb'] && file_exists("{$phpbb_root_path}styles/{$theme_row['theme_path']}/theme/stylesheet.css")) + if ($theme_row['theme_storedb'] && file_exists(PHPBB_ROOT_PATH . "styles/{$theme_row['theme_path']}/theme/stylesheet.css")) { // Save CSS contents $sql_ary = array( - 'theme_mtime' => (int) filemtime("{$phpbb_root_path}styles/{$theme_row['theme_path']}/theme/stylesheet.css"), + 'theme_mtime' => (int) filemtime(PHPBB_ROOT_PATH . "styles/{$theme_row['theme_path']}/theme/stylesheet.css"), 'theme_data' => $this->db_theme_data($theme_row) ); @@ -386,7 +385,7 @@ parse_css_file = {PARSE_CSS_FILE} $imageset_definitions = array_merge($imageset_definitions, $key_array); } - $cfg_data_imageset = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/imageset.cfg"); + $cfg_data_imageset = parse_cfg_file(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/imageset.cfg"); $db->sql_transaction('begin'); @@ -437,9 +436,9 @@ parse_css_file = {PARSE_CSS_FILE} while ($row = $db->sql_fetchrow($result)) { - if (@file_exists("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$row['lang_dir']}/imageset.cfg")) + if (@file_exists(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$row['lang_dir']}/imageset.cfg")) { - $cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$row['lang_dir']}/imageset.cfg"); + $cfg_data_imageset_data = parse_cfg_file(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$row['lang_dir']}/imageset.cfg"); foreach ($cfg_data_imageset_data as $image_name => $value) { if (strpos($value, '*') !== false) @@ -511,7 +510,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function frontend($mode, $options, $actions) { - global $user, $template, $db, $config, $phpbb_root_path, $phpEx; + global $user, $template, $db, $config; $sql_from = ''; $style_count = array(); @@ -600,7 +599,7 @@ parse_css_file = {PARSE_CSS_FILE} 'L_STYLE_ACT_DEACT' => $user->lang['STYLE_' . strtoupper($stylevis)], 'S_OPTIONS' => implode(' | ', $s_options), 'S_ACTIONS' => implode(' | ', $s_actions), - 'U_PREVIEW' => ($mode == 'style') ? append_sid("{$phpbb_root_path}index.$phpEx", "$mode=" . $row[$mode . '_id']) : '', + 'U_PREVIEW' => ($mode == 'style') ? append_sid('index', "style=" . $row[$mode . '_id']) : '', 'NAME' => $row[$mode . '_name'], 'STYLE_COUNT' => ($mode == 'style' && isset($style_count[$row['style_id']])) ? $style_count[$row['style_id']] : 0, @@ -612,16 +611,16 @@ parse_css_file = {PARSE_CSS_FILE} // Grab uninstalled items $new_ary = $cfg = array(); - $dp = @opendir("{$phpbb_root_path}styles"); + $dp = @opendir(PHPBB_ROOT_PATH . 'styles'); if ($dp) { 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")) + if ($cfg = file(PHPBB_ROOT_PATH . "styles/$file/$subpath$mode.cfg")) { $items = parse_cfg_file('', $cfg); $name = (isset($items['name'])) ? trim($items['name']) : false; @@ -668,7 +667,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function edit_template($template_id) { - global $phpbb_root_path, $phpEx, $config, $db, $cache, $user, $template, $safe_mode; + global $config, $db, $cache, $user, $template, $safe_mode; $this->page_title = 'EDIT_TEMPLATE'; @@ -709,7 +708,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($save_changes && $template_file) { // Get the filesystem location of the current file - $file = "{$phpbb_root_path}styles/{$template_info['template_path']}/template/$template_file"; + $file = PHPBB_ROOT_PATH . "styles/{$template_info['template_path']}/template/$template_file"; $additional = ''; // If the template is stored on the filesystem try to write the file else store it in the database @@ -734,7 +733,7 @@ parse_css_file = {PARSE_CSS_FILE} WHERE template_id = ' . $template_id; $db->sql_query($sql); - $filelist = filelist("{$phpbb_root_path}styles/{$template_info['template_path']}/template", '', 'html'); + $filelist = filelist(PHPBB_ROOT_PATH . "styles/{$template_info['template_path']}/template", '', 'html'); $this->store_templates('insert', $template_id, $template_info['template_path'], $filelist); add_log('admin', 'LOG_TEMPLATE_EDIT_DETAILS', $template_info['template_name']); @@ -763,7 +762,7 @@ parse_css_file = {PARSE_CSS_FILE} // Generate a category array containing template filenames if (!$template_info['template_storedb']) { - $template_path = "{$phpbb_root_path}styles/{$template_info['template_path']}/template"; + $template_path = PHPBB_ROOT_PATH . "styles/{$template_info['template_path']}/template"; $filelist = filelist($template_path, '', 'html'); $filelist[''] = array_diff($filelist[''], array('bbcode.html')); @@ -898,7 +897,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function template_cache($template_id) { - global $phpbb_root_path, $phpEx, $config, $db, $cache, $user, $template; + global $config, $db, $cache, $user, $template; $source = str_replace('/', '.', request_var('source', '')); $file_ary = array_diff(request_var('delete', array('')), array('')); @@ -928,7 +927,7 @@ parse_css_file = {PARSE_CSS_FILE} // Someone wants to see the cached source ... so we'll highlight it, // add line numbers and indent it appropriately. This could be nasty // on larger source files ... - if ($source && file_exists("{$phpbb_root_path}cache/{$cache_prefix}_$source.html.$phpEx")) + if ($source && file_exists(PHPBB_ROOT_PATH . "cache/{$cache_prefix}_$source.html." . PHP_EXT)) { adm_page_header($user->lang['TEMPLATE_CACHE']); @@ -940,7 +939,7 @@ parse_css_file = {PARSE_CSS_FILE} 'FILENAME' => str_replace('.', '/', $source) . '.html') ); - $code = str_replace(array("\r\n", "\r"), array("\n", "\n"), file_get_contents("{$phpbb_root_path}cache/{$cache_prefix}_$source.html.$phpEx")); + $code = str_replace(array("\r\n", "\r"), array("\n", "\n"), file_get_contents(PHPBB_ROOT_PATH . "cache/{$cache_prefix}_$source.html." . PHP_EXT)); $conf = array('highlight.bg', 'highlight.comment', 'highlight.default', 'highlight.html', 'highlight.keyword', 'highlight.string'); foreach ($conf as $ini_var) @@ -1000,9 +999,9 @@ parse_css_file = {PARSE_CSS_FILE} $tpl_file = str_replace('.', '/', $file); $tpl_file = str_replace('///', '../', $tpl_file); - $filename = "{$cache_prefix}_$file.html.$phpEx"; + $filename = "{$cache_prefix}_$file.html." . PHP_EXT; - if (!file_exists("{$phpbb_root_path}cache/$filename")) + if (!file_exists(PHPBB_ROOT_PATH . "cache/$filename")) { continue; } @@ -1010,10 +1009,10 @@ parse_css_file = {PARSE_CSS_FILE} $template->assign_block_vars('file', array( 'U_VIEWSOURCE' => $this->u_action . "&action=cache&id=$template_id&source=$file", - 'CACHED' => $user->format_date(filemtime("{$phpbb_root_path}cache/$filename")), + 'CACHED' => $user->format_date(filemtime(PHPBB_ROOT_PATH . "cache/$filename")), 'FILENAME' => $file, - 'FILESIZE' => sprintf('%.1f ' . $user->lang['KIB'], filesize("{$phpbb_root_path}cache/$filename") / 1024), - 'MODIFIED' => $user->format_date((!$template_row['template_storedb']) ? filemtime("{$phpbb_root_path}styles/{$template_row['template_path']}/template/$tpl_file.html") : $filemtime[$file . '.html'])) + 'FILESIZE' => sprintf('%.1f ' . $user->lang['KIB'], filesize(PHPBB_ROOT_PATH . "cache/$filename") / 1024), + 'MODIFIED' => $user->format_date((!$template_row['template_storedb']) ? filemtime(PHPBB_ROOT_PATH . "styles/{$template_row['template_path']}/template/$tpl_file.html") : $filemtime[$file . '.html'])) ); } unset($filemtime); @@ -1034,7 +1033,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function edit_theme($theme_id) { - global $phpbb_root_path, $phpEx, $config, $db, $cache, $user, $template, $safe_mode; + global $config, $db, $cache, $user, $template, $safe_mode; $this->page_title = 'EDIT_THEME'; @@ -1065,7 +1064,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($save_changes) { // Get the filesystem location of the current file - $file = "{$phpbb_root_path}styles/{$theme_info['theme_path']}/theme/$theme_file"; + $file = PHPBB_ROOT_PATH . "styles/{$theme_info['theme_path']}/theme/$theme_file"; $additional = ''; $message = $user->lang['THEME_UPDATED']; @@ -1110,7 +1109,7 @@ parse_css_file = {PARSE_CSS_FILE} // Generate a category array containing theme filenames if (!$theme_info['theme_storedb']) { - $theme_path = "{$phpbb_root_path}styles/{$theme_info['theme_path']}/theme"; + $theme_path = PHPBB_ROOT_PATH ."styles/{$theme_info['theme_path']}/theme"; $filelist = filelist($theme_path, '', 'css'); @@ -1218,7 +1217,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function edit_imageset($imageset_id) { - global $db, $user, $phpbb_root_path, $cache, $template; + global $db, $user, $cache, $template; $this->page_title = 'EDIT_IMAGESET'; @@ -1293,7 +1292,7 @@ parse_css_file = {PARSE_CSS_FILE} $imgheight = request_var('imgheight', 0); $imglang = ''; - if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath")) + if ($imgpath && !file_exists(PHPBB_ROOT_PATH . "styles/$imageset_path/imageset/$imgpath")) { trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -1302,7 +1301,7 @@ parse_css_file = {PARSE_CSS_FILE} { if (!$imgwidth || !$imgheight) { - list($imgwidth_file, $imgheight_file) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"); + list($imgwidth_file, $imgheight_file) = getimagesize(PHPBB_ROOT_PATH . "styles/$imageset_path/imageset/$imgpath"); $imgwidth = ($imgwidth) ? $imgwidth : $imgwidth_file; $imgheight = ($imgheight) ? $imgheight : $imgheight_file; } @@ -1361,7 +1360,7 @@ parse_css_file = {PARSE_CSS_FILE} $imagesetlist = array('nolang' => array(), 'lang' => array()); $langs = array(); - $dir = "{$phpbb_root_path}styles/$imageset_path/imageset"; + $dir = PHPBB_ROOT_PATH . "styles/$imageset_path/imageset"; $dp = @opendir($dir); if ($dp) @@ -1487,7 +1486,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function remove($mode, $style_id) { - global $db, $template, $user, $phpbb_root_path, $cache, $config; + global $db, $template, $user, $cache, $config; $new_id = request_var('new_id', 0); $update = (isset($_POST['update'])) ? true : false; @@ -1623,7 +1622,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function export($mode, $style_id) { - global $db, $template, $user, $phpbb_root_path, $cache, $phpEx, $config; + global $db, $template, $user, $cache, $config; $update = (isset($_POST['update'])) ? true : false; @@ -1866,7 +1865,7 @@ parse_css_file = {PARSE_CSS_FILE} end($data); - $imageset_root = "{$phpbb_root_path}styles/{$style_row['imageset_path']}/imageset/"; + $imageset_root = PHPBB_ROOT_PATH . "styles/{$style_row['imageset_path']}/imageset/"; if ($dh = @opendir($imageset_root)) { @@ -1946,7 +1945,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!sizeof($error)) { - include($phpbb_root_path . 'includes/functions_compress.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_compress.' . PHP_EXT); if ($mode == 'style') { @@ -1959,11 +1958,11 @@ parse_css_file = {PARSE_CSS_FILE} if ($format == 'zip') { - $compress = new compress_zip('w', $phpbb_root_path . "store/$path$ext"); + $compress = new compress_zip('w', PHPBB_ROOT_PATH . "store/$path$ext"); } else { - $compress = new compress_tar('w', $phpbb_root_path . "store/$path$ext", $ext); + $compress = new compress_tar('w', PHPBB_ROOT_PATH . "store/$path$ext", $ext); } if (sizeof($files)) @@ -1989,7 +1988,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$store) { $compress->download($path); - @unlink("{$phpbb_root_path}store/$path$ext"); + @unlink(PHPBB_ROOT_PATH . "store/$path$ext"); exit; } @@ -2040,7 +2039,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function details($mode, $style_id) { - global $template, $db, $config, $user, $safe_mode, $cache, $phpbb_root_path; + global $template, $db, $config, $user, $safe_mode, $cache; $update = (isset($_POST['update'])) ? true : false; $l_type = strtoupper($mode); @@ -2112,7 +2111,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($mode === 'theme' || $mode === 'template') { // a rather elaborate check we have to do here once to avoid trouble later - $check = "{$phpbb_root_path}styles/" . $style_row["{$mode}_path"] . (($mode === 'theme') ? '/theme/stylesheet.css' : '/template'); + $check = PHPBB_ROOT_PATH . "styles/" . $style_row["{$mode}_path"] . (($mode === 'theme') ? '/theme/stylesheet.css' : '/template'); if (($style_row["{$mode}_storedb"] != $store_db) && !$store_db && ($safe_mode || !@is_writable($check))) { $error[] = $user->lang['EDIT_' . strtoupper($mode) . '_STORED_DB']; @@ -2122,7 +2121,7 @@ parse_css_file = {PARSE_CSS_FILE} // themes which have to be parsed have to go into db if ($mode == 'theme') { - $cfg = parse_cfg_file("{$phpbb_root_path}styles/" . $style_row["{$mode}_path"] . "/theme/theme.cfg"); + $cfg = parse_cfg_file(PHPBB_ROOT_PATH . "styles/" . $style_row["{$mode}_path"] . "/theme/theme.cfg"); if (isset($cfg['parse_css_file']) && $cfg['parse_css_file'] && !$store_db) { @@ -2193,12 +2192,12 @@ parse_css_file = {PARSE_CSS_FILE} { $theme_data = $this->db_theme_data($style_row); } - else if (!$store_db && !$safe_mode && @is_writable("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css")) + else if (!$store_db && !$safe_mode && @is_writable(PHPBB_ROOT_PATH . "styles/{$style_row['theme_path']}/theme/stylesheet.css")) { $store_db = 1; $theme_data = $style_row['theme_data']; - if ($fp = @fopen("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css", 'wb')) + if ($fp = @fopen(PHPBB_ROOT_PATH . "styles/{$style_row['theme_path']}/theme/stylesheet.css", 'wb')) { $store_db = (@fwrite($fp, str_replace("styles/{$style_row['theme_path']}/theme/", './', $theme_data))) ? 0 : 1; } @@ -2206,7 +2205,7 @@ parse_css_file = {PARSE_CSS_FILE} } $sql_ary += array( - 'theme_mtime' => ($store_db) ? filemtime("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css") : 0, + 'theme_mtime' => ($store_db) ? filemtime(PHPBB_ROOT_PATH . "styles/{$style_row['theme_path']}/theme/stylesheet.css") : 0, 'theme_storedb' => $store_db, 'theme_data' => ($store_db) ? $theme_data : '', ); @@ -2217,7 +2216,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($style_row['template_storedb'] != $store_db) { - if (!$store_db && !$safe_mode && @is_writable("{$phpbb_root_path}styles/{$style_row['template_path']}/template")) + if (!$store_db && !$safe_mode && @is_writable(PHPBB_ROOT_PATH . "styles/{$style_row['template_path']}/template")) { $sql = 'SELECT * FROM ' . STYLES_TEMPLATE_DATA_TABLE . " @@ -2226,7 +2225,7 @@ parse_css_file = {PARSE_CSS_FILE} while ($row = $db->sql_fetchrow($result)) { - if (!($fp = @fopen("{$phpbb_root_path}styles/{$style_row['template_path']}/template/" . $row['template_filename'], 'wb'))) + if (!($fp = @fopen(PHPBB_ROOT_PATH . "styles/{$style_row['template_path']}/template/" . $row['template_filename'], 'wb'))) { $store_db = 1; $error[] = $user->lang['EDIT_TEMPLATE_STORED_DB']; @@ -2247,7 +2246,7 @@ parse_css_file = {PARSE_CSS_FILE} } else if ($store_db) { - $filelist = filelist("{$phpbb_root_path}styles/{$style_row['template_path']}/template", '', 'html'); + $filelist = filelist(PHPBB_ROOT_PATH . "styles/{$style_row['template_path']}/template", '', 'html'); $this->store_templates('insert', $style_id, $style_row['template_path'], $filelist); } else @@ -2350,9 +2349,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function load_css_file($path, $filename) { - global $phpbb_root_path; - - $file = "{$phpbb_root_path}styles/$path/theme/$filename"; + $file = PHPBB_ROOT_PATH . "styles/$path/theme/$filename"; if (file_exists($file) && ($content = file_get_contents($file))) { @@ -2372,17 +2369,15 @@ parse_css_file = {PARSE_CSS_FILE} * * @param array $theme_row is an associative array containing the theme's current database entry * @param mixed $stylesheet can either be the new content for the stylesheet or false to load from the standard file - * @param string $root_path should only be used in case you want to use a different root path than "{$phpbb_root_path}styles/{$theme_row['theme_path']}" + * @param string $root_path should only be used in case you want to use a different root path than PHPBB_ROOT_PATH . "styles/{$theme_row['theme_path']}" * * @return string Stylesheet data for theme_data column in the theme table */ function db_theme_data($theme_row, $stylesheet = false, $root_path = '') { - global $phpbb_root_path; - if (!$root_path) { - $root_path = $phpbb_root_path . 'styles/' . $theme_row['theme_path']; + $root_path = PHPBB_ROOT_PATH . 'styles/' . $theme_row['theme_path']; } if (!$stylesheet) @@ -2415,7 +2410,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function store_templates($mode, $style_id, $template_path, $filelist) { - global $phpbb_root_path, $phpEx, $db; + global $db; $template_path = $template_path . '/template/'; $includes = array(); @@ -2423,11 +2418,11 @@ parse_css_file = {PARSE_CSS_FILE} { foreach ($file_ary as $file) { - if (!($fp = @fopen("{$phpbb_root_path}styles/$template_path$pathfile$file", 'r'))) + if (!($fp = @fopen(PHPBB_ROOT_PATH . "styles/$template_path$pathfile$file", 'r'))) { - trigger_error("Could not open {$phpbb_root_path}styles/$template_path$pathfile$file", E_USER_ERROR); + trigger_error('Could not open ' . PHPBB_ROOT_PATH . "styles/$template_path$pathfile$file", E_USER_ERROR); } - $template_data = fread($fp, filesize("{$phpbb_root_path}styles/$template_path$pathfile$file")); + $template_data = fread($fp, filesize(PHPBB_ROOT_PATH . "styles/$template_path$pathfile$file")); fclose($fp); if (preg_match_all('#<!-- INCLUDE (.*?\.html) -->#is', $template_data, $matches)) @@ -2456,8 +2451,8 @@ parse_css_file = {PARSE_CSS_FILE} 'template_id' => (int) $style_id, 'template_filename' => "$pathfile$file", 'template_included' => (isset($includes[$file])) ? implode(':', $includes[$file]) . ':' : '', - 'template_mtime' => (int) filemtime("{$phpbb_root_path}styles/$template_path$pathfile$file"), - 'template_data' => (string) file_get_contents("{$phpbb_root_path}styles/$template_path$pathfile$file"), + 'template_mtime' => (int) filemtime(PHPBB_ROOT_PATH . "styles/$template_path$pathfile$file"), + 'template_data' => (string) file_get_contents(PHPBB_ROOT_PATH . "styles/$template_path$pathfile$file"), ); if ($mode == 'insert') @@ -2484,11 +2479,11 @@ parse_css_file = {PARSE_CSS_FILE} */ function template_cache_filelist($template_path) { - global $phpbb_root_path, $phpEx, $user; + global $user; $cache_prefix = 'tpl_' . $template_path; - if (!($dp = @opendir("{$phpbb_root_path}cache"))) + if (!($dp = @opendir(PHPBB_ROOT_PATH . 'cache'))) { trigger_error($user->lang['TEMPLATE_ERR_CACHE_READ'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -2501,9 +2496,9 @@ parse_css_file = {PARSE_CSS_FILE} continue; } - if (is_file($phpbb_root_path . 'cache/' . $file) && (strpos($file, $cache_prefix) === 0)) + if (is_file(PHPBB_ROOT_PATH . 'cache/' . $file) && (strpos($file, $cache_prefix) === 0)) { - $file_ary[] = str_replace('.', '/', preg_replace('#^' . preg_quote($cache_prefix, '#') . '_(.*?)\.html\.' . $phpEx . '$#i', '\1', $file)); + $file_ary[] = str_replace('.', '/', preg_replace('#^' . preg_quote($cache_prefix, '#') . '_(.*?)\.html\.' . PHP_EXT . '$#i', '\1', $file)); } } closedir($dp); @@ -2520,7 +2515,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function clear_template_cache($template_row, $file_ary = false) { - global $phpbb_root_path, $phpEx, $user; + global $user; $cache_prefix = 'tpl_' . $template_row['template_path']; @@ -2538,7 +2533,7 @@ parse_css_file = {PARSE_CSS_FILE} { $file = str_replace('/', '.', $file); - $file = "{$phpbb_root_path}cache/{$cache_prefix}_$file.html.$phpEx"; + $file = PHPBB_ROOT_PATH . "cache/{$cache_prefix}_$file.html." . PHP_EXT; if (file_exists($file) && is_file($file)) { @unlink($file); @@ -2554,7 +2549,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function install($mode) { - global $phpbb_root_path, $phpEx, $config, $db, $cache, $user, $template; + global $config, $db, $cache, $user, $template; $l_type = strtoupper($mode); @@ -2568,7 +2563,7 @@ parse_css_file = {PARSE_CSS_FILE} // Installing, obtain cfg file contents if ($install_path) { - $root_path = $phpbb_root_path . 'styles/' . $install_path . '/'; + $root_path = PHPBB_ROOT_PATH . 'styles/' . $install_path . '/'; $cfg_file = ($mode == 'style') ? "$root_path$mode.cfg" : "$root_path$mode/$mode.cfg"; if (!file_exists($cfg_file)) @@ -2617,7 +2612,7 @@ parse_css_file = {PARSE_CSS_FILE} $element . '_copyright' => '') ); - $this->test_installed($element, $error, (${'reqd_' . $element}) ? $phpbb_root_path . 'styles/' . $reqd_template . '/' : $root_path, ${'reqd_' . $element}, $style_row[$element . '_id'], $style_row[$element . '_name'], $style_row[$element . '_copyright']); + $this->test_installed($element, $error, (${'reqd_' . $element}) ? PHPBB_ROOT_PATH . 'styles/' . $reqd_template . '/' : $root_path, ${'reqd_' . $element}, $style_row[$element . '_id'], $style_row[$element . '_name'], $style_row[$element . '_copyright']); if (!$style_row[$element . '_name']) { @@ -2656,7 +2651,7 @@ parse_css_file = {PARSE_CSS_FILE} { foreach ($element_ary as $element => $table) { - ${$element . '_root_path'} = (${'reqd_' . $element}) ? $phpbb_root_path . 'styles/' . ${'reqd_' . $element} . '/' : false; + ${$element . '_root_path'} = (${'reqd_' . $element}) ? PHPBB_ROOT_PATH . 'styles/' . ${'reqd_' . $element} . '/' : false; ${$element . '_path'} = (${'reqd_' . $element}) ? ${'reqd_' . $element} : false; } $this->install_style($error, 'install', $root_path, $style_row['style_id'], $style_row['style_name'], $install_path, $style_row['style_copyright'], $style_row['style_active'], $style_row['style_default'], $style_row, $template_root_path, $template_path, $theme_root_path, $theme_path, $imageset_root_path, $imageset_path); @@ -2712,7 +2707,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function add($mode) { - global $phpbb_root_path, $phpEx, $config, $db, $cache, $user, $template; + global $config, $db, $cache, $user, $template; $l_type = strtoupper($mode); $element_ary = array('template' => STYLES_TEMPLATE_TABLE, 'theme' => STYLES_THEME_TABLE, 'imageset' => STYLES_IMAGESET_TABLE); @@ -3031,7 +3026,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function install_element($mode, &$error, $action, $root_path, &$id, $name, $path, $copyright, $store_db = 0) { - global $phpbb_root_path, $db, $user; + global $db, $user; switch ($mode) { @@ -3120,7 +3115,7 @@ parse_css_file = {PARSE_CSS_FILE} case 'theme': // We are only interested in the theme configuration for now - $theme_cfg = parse_cfg_file("{$phpbb_root_path}styles/$path/theme/theme.cfg"); + $theme_cfg = parse_cfg_file(PHPBB_ROOT_PATH . "styles/$path/theme/theme.cfg"); if (isset($theme_cfg['parse_css_file']) && $theme_cfg['parse_css_file']) { @@ -3130,7 +3125,7 @@ parse_css_file = {PARSE_CSS_FILE} $sql_ary += array( 'theme_storedb' => $store_db, 'theme_data' => ($store_db) ? $this->db_theme_data($sql_ary, false, $root_path) : '', - 'theme_mtime' => (int) filemtime("{$phpbb_root_path}styles/$path/theme/stylesheet.css") + 'theme_mtime' => (int) filemtime(PHPBB_ROOT_PATH . "styles/$path/theme/stylesheet.css") ); break; diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index dbb25bdbbd..a6440c8364 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -26,7 +26,6 @@ class acp_update function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang('install'); @@ -48,7 +47,7 @@ class acp_update $latest_version = trim($info[0]); $announcement_url = trim($info[1]); - $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update'); + $update_link = append_sid('install/index', 'mode=update'); // Determine automatic update... $sql = 'SELECT config_value diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 3ad8c88fb9..667cd6a64b 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -31,8 +31,7 @@ class acp_users function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; + global $config, $db, $user, $auth, $template, $cache, $file_uploads; $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; @@ -51,7 +50,7 @@ class acp_users // Whois (special case) if ($action == 'whois') { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $this->page_title = 'WHOIS'; $this->tpl_name = 'simple_body'; @@ -78,7 +77,7 @@ class acp_users 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_USER' => true, - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_user&field=username&select_single=true'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=select_user&field=username&select_single=true'), )); return; @@ -146,7 +145,7 @@ class acp_users $template->assign_vars(array( 'U_BACK' => $this->u_action, - 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"), + 'U_MODE_SELECT' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&u=$user_id"), 'U_ACTION' => $this->u_action . '&u=' . $user_id, 'S_FORM_OPTIONS' => $s_form_options, 'MANAGED_USERNAME' => $user_row['username']) @@ -162,7 +161,7 @@ class acp_users { case 'overview': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $user->add_lang('acp/ban'); @@ -303,7 +302,7 @@ class acp_users if ($config['email_enable']) { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $server_url = generate_board_url(); @@ -347,7 +346,7 @@ class acp_users $messenger->assign_vars(array( 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), 'USERNAME' => htmlspecialchars_decode($user_row['username']), - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey") + 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u={$user_row['user_id']}&k=$user_actkey") ); $messenger->send(NOTIFY_EMAIL); @@ -906,7 +905,7 @@ class acp_users 'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'), 'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}", - 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_row['user_id']}") : '', + 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid('ucp', "mode=switch_perm&u={$user_row['user_id']}") : '', 'USER' => $user_row['username'], 'USER_REGISTERED' => $user->format_date($user_row['user_regdate']), @@ -1024,8 +1023,8 @@ class acp_users case 'profile': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); + include(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); $cp = new custom_profile(); @@ -1227,7 +1226,7 @@ class acp_users case 'prefs': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $data = array( 'dateformat' => utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)), @@ -1438,10 +1437,10 @@ class acp_users case 'avatar': - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); - $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; + $can_upload = (file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $file_uploads) ? true : false; if ($submit) { @@ -1461,7 +1460,7 @@ class acp_users } // Generate users avatar - $avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />'; + $avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '<img src="' . PHPBB_ADMIN_PATH . 'images/no_avatar.gif" alt="" />'; $display_gallery = (isset($_POST['display_gallery'])) ? true : false; $avatar_select = basename(request_var('avatar_select', '')); @@ -1532,8 +1531,8 @@ class acp_users case 'sig': - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); + include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false; $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false; @@ -1544,7 +1543,7 @@ class acp_users if ($submit || $preview) { - include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT); $message_parser = new parse_message($signature); @@ -1602,7 +1601,7 @@ class acp_users 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', - 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), + 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], @@ -1734,11 +1733,11 @@ class acp_users { if ($row['in_message']) { - $view_topic = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&p={$row['post_msg_id']}"); + $view_topic = append_sid('ucp', "i=pm&p={$row['post_msg_id']}"); } else { - $view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . '#p' . $row['post_msg_id']; + $view_topic = append_sid('viewtopic', "t={$row['topic_id']}&p={$row['post_msg_id']}") . '#p' . $row['post_msg_id']; } $template->assign_block_vars('attach', array( @@ -1756,7 +1755,7 @@ class acp_users 'S_IN_MESSAGE' => $row['in_message'], - 'U_DOWNLOAD' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . $row['attach_id']), + 'U_DOWNLOAD' => append_sid('download/file', 'mode=view&id=' . $row['attach_id']), 'U_VIEW_TOPIC' => $view_topic) ); } @@ -1775,7 +1774,7 @@ class acp_users case 'groups': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $user->add_lang(array('groups', 'acp/groups')); $group_id = request_var('g', 0); @@ -1933,7 +1932,7 @@ class acp_users foreach ($data_ary as $data) { $template->assign_block_vars('group', array( - 'U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"), + 'U_EDIT_GROUP' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"), 'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'], 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'], 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], @@ -1957,7 +1956,7 @@ class acp_users case 'perm': - include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT); $auth_admin = new auth_admin(); @@ -2015,8 +2014,8 @@ class acp_users 'S_FORUM_OPTIONS' => $s_forum_options, 'U_ACTION' => $this->u_action . '&u=' . $user_id, - 'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx" ,'i=permissions&mode=setting_user_global&user_id[]=' . $user_id), - 'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id)) + 'U_USER_PERMISSIONS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions&mode=setting_user_global&user_id[]=' . $user_id), + 'U_USER_FORUM_PERMISSIONS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id)) ); break; diff --git a/phpBB/includes/acp/acp_words.php b/phpBB/includes/acp/acp_words.php index 596c2fc743..5db6bef3e5 100644 --- a/phpBB/includes/acp/acp_words.php +++ b/phpBB/includes/acp/acp_words.php @@ -26,8 +26,7 @@ class acp_words function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $cache, $config; $user->add_lang('acp/posting'); diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 5c81092a65..0fd78981a9 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -262,7 +262,7 @@ class auth_admin extends auth */ public function display_mask($mode, $permission_type, array $hold_ary, $user_mode = 'user', $local = false, $group_display = true) { - global $template, $user, $db, $phpbb_root_path, $phpEx; + global $template, $user, $db; // Define names for template loops, might be able to be set $tpl_pmask = 'p_mask'; @@ -606,7 +606,7 @@ class auth_admin extends auth */ public function display_role_mask(array $hold_ary) { - global $db, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $template, $user; if (!sizeof($hold_ary)) { @@ -650,7 +650,7 @@ class auth_admin extends auth $template->assign_block_vars('role_mask.users', array( 'USER_ID' => $row['user_id'], 'USERNAME' => $row['username'], - 'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u={$row['user_id']}")) + 'U_PROFILE' => append_sid('memberlist', "mode=viewprofile&u={$row['user_id']}")) ); } $db->sql_freeresult($result); @@ -669,7 +669,7 @@ class auth_admin extends auth $template->assign_block_vars('role_mask.groups', array( 'GROUP_ID' => $row['group_id'], 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], - 'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=group&g={$row['group_id']}")) + 'U_PROFILE' => append_sid('memberlist', "mode=group&g={$row['group_id']}")) ); } $db->sql_freeresult($result); @@ -1076,7 +1076,7 @@ class auth_admin extends auth */ private static function assign_cat_array(array $category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view) { - global $template, $user, $phpbb_admin_path, $phpEx; + global $template, $user; @reset($category_array); while (list($cat, $cat_array) = each($category_array)) @@ -1118,8 +1118,8 @@ class auth_admin extends auth 'FIELD_NAME' => $permission, 'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']', - 'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', - 'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', + 'U_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', + 'UA_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) ); @@ -1136,8 +1136,8 @@ class auth_admin extends auth 'FIELD_NAME' => $permission, 'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']', - 'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', - 'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', + 'U_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', + 'UA_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) ); diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php index 3512d14d56..6f6a7f3ba9 100644 --- a/phpBB/includes/auth.php +++ b/phpBB/includes/auth.php @@ -848,10 +848,10 @@ class auth */ public function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0) { - global $config, $db, $user, $phpbb_root_path, $phpEx; + global $config, $db, $user; $method = trim(basename($config['auth_method'])); - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT); $method = 'login_' . $method; if (function_exists($method)) @@ -864,7 +864,7 @@ class auth // we are going to use the user_add function so include functions_user.php if it wasn't defined yet if (!function_exists('user_add')) { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); } user_add($login['user_row'], (isset($login['cp_data'])) ? $login['cp_data'] : false); diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php index acdd4e3386..c57a06a46d 100644 --- a/phpBB/includes/auth/auth_apache.php +++ b/phpBB/includes/auth/auth_apache.php @@ -165,9 +165,7 @@ function autologin_apache() if (!function_exists('user_add')) { - global $phpbb_root_path, $phpEx; - - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); } // create the user if he does not exist yet diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index 00dd438210..fa99a2fe4c 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -137,8 +137,7 @@ function login_db(&$username, &$password) { if (!function_exists('utf8_to_cp1252')) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/recode_basic.' . PHP_EXT); } // cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 354885143c..d688f660f2 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -128,12 +128,12 @@ class bbcode */ function bbcode_cache_init() { - global $user, $phpbb_root_path; + global $user; if (empty($this->template_filename)) { $this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']); - $this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html'; + $this->template_filename = PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html'; if (!@file_exists($this->template_filename)) { diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index af2c0ab9fa..879fbb6a80 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -324,7 +324,7 @@ class cache */ public static function obtain_cfg_item($theme, $item = 'theme') { - global $config, $phpbb_root_path, $cache; + global $config, $cache; $parsed_array = $cache->get('_cfg_' . $item . '_' . $theme[$item . '_path']); @@ -334,7 +334,7 @@ class cache } $reparse = false; - $filename = $phpbb_root_path . 'styles/' . $theme[$item . '_path'] . '/' . $item . '/' . $item . '.cfg'; + $filename = PHPBB_ROOT_PATH . 'styles/' . $theme[$item . '_path'] . '/' . $item . '/' . $item . '.cfg'; if (!file_exists($filename)) { @@ -395,22 +395,18 @@ class cache if (($hook_files = $cache->get('_hooks')) === false) { - global $phpbb_root_path; - $hook_files = array(); // Now search for hooks... - $dh = @opendir($phpbb_root_path . 'includes/hooks/'); + $dh = @opendir(PHPBB_ROOT_PATH . 'includes/hooks/'); if ($dh) { - global $phpEx; - while (($file = readdir($dh)) !== false) { - if (strpos($file, 'hook_') === 0 && substr($file, -(strlen($phpEx) + 1)) === '.' . $phpEx) + if (strpos($file, 'hook_') === 0 && substr($file, -(strlen(PHP_EXT) + 1)) === '.' . PHP_EXT) { - $hook_files[] = substr($file, 0, -(strlen($phpEx) + 1)); + $hook_files[] = substr($file, 0, -(strlen(PHP_EXT) + 1)); } } closedir($dh); diff --git a/phpBB/includes/db/db2.php b/phpBB/includes/db/db2.php index ecabc1c2e1..8a5ce0103d 100644 --- a/phpBB/includes/db/db2.php +++ b/phpBB/includes/db/db2.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * MSSQL Database Abstraction Layer diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index d385b98f55..4082edf24a 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -618,7 +618,7 @@ class dbal */ function sql_report($mode, $query = '') { - global $cache, $starttime, $phpbb_root_path, $user; + global $cache, $starttime, $user; if (empty($_REQUEST['explain'])) { @@ -649,7 +649,7 @@ class dbal <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>SQL Report</title> - <link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> + <link href="' . PHPBB_ROOT_PATH . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body id="errorpage"> <div id="wrap"> diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index 48eb22046e..7760666ea1 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * Firebird/Interbase Database Abstraction Layer diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index a6c8d26a4d..f842cb06d6 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * MSSQL Database Abstraction Layer diff --git a/phpBB/includes/db/mssql_2005.php b/phpBB/includes/db/mssql_2005.php index 9fc2e7027f..730013c6f5 100644 --- a/phpBB/includes/db/mssql_2005.php +++ b/phpBB/includes/db/mssql_2005.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * MSSQL Database Abstraction Layer diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php index f79cd55af4..86faf82036 100644 --- a/phpBB/includes/db/mssql_odbc.php +++ b/phpBB/includes/db/mssql_odbc.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * Unified ODBC functions diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 1e32b8178a..fd4dc74674 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * MySQL Database Abstraction Layer diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index 48ea8d3c53..a7ba07b8a5 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * MySQLi Database Abstraction Layer diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index 09648d9841..a66dfcce8b 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * Oracle Database Abstraction Layer diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index f4237999ff..4c3e4729fa 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * PostgreSQL Database Abstraction Layer diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index 64621496c4..f887e4e3b1 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/db/dbal.' . PHP_EXT); /** * Sqlite Database Abstraction Layer diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a42d773286..a61c1ed1a3 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1581,16 +1581,37 @@ function on_page($num_items, $per_page, $start) * * Examples: * <code> -* append_sid("{$phpbb_root_path}viewtopic.$phpEx?t=1&f=2"); -* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2'); -* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2', false); -* append_sid("{$phpbb_root_path}viewtopic.$phpEx", array('t' => 1, 'f' => 2)); +* append_sid(PHPBB_ROOT_PATH . 'viewtopic.' . PHP_EXT . '?t=1&f=2'); +* append_sid(PHPBB_ROOT_PATH . 'viewtopic.' . PHP_EXT, 't=1&f=2'); +* append_sid('viewtopic', 't=1&f=2'); // short notation of the above example +* append_sid('viewtopic', 't=1&f=2', false); +* append_sid('viewtopic', array('t' => 1, 'f' => 2)); * </code> * */ function append_sid($url, $params = false, $is_amp = true, $session_id = false) { global $_SID, $_EXTRA_URL, $phpbb_hook; + static $parsed_urls = array(); + + // Adjust internal url before calling the hook - we are able to just leave out any path and extension. + // In this case the root path and extension are added before going through this function. + if (isset($parsed_urls[$url])) + { + $url = $parsed_urls[$url]; + } + else + { + if (strpos($url, '.' . PHP_EXT) === false && $url[0] != '.' && $url[0] != '/') + { + $parsed_urls[$url] = $url = PHPBB_ROOT_PATH . $url . '.' . PHP_EXT; + } + } + + if (empty($params)) + { + $params = false; + } // Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropiatly. // They could mimick most of what is within this function @@ -1727,7 +1748,7 @@ function generate_board_url($without_script_path = false) */ function redirect($url, $return = false) { - global $db, $cache, $config, $user, $phpbb_root_path; + global $db, $cache, $config, $user; if (empty($user->lang)) { @@ -1786,8 +1807,8 @@ function redirect($url, $return = false) } else { - // Used ./ before, but $phpbb_root_path is working better with urls within another root path - $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($phpbb_root_path))); + // Used ./ before, but PHPBB_ROOT_PATH is working better with urls within another root path + $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath(PHPBB_ROOT_PATH))); $page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($pathinfo['dirname']))); $intersection = array_intersect_assoc($root_dirs, $page_dirs); @@ -1871,15 +1892,13 @@ function redirect($url, $return = false) */ function reapply_sid($url) { - global $phpEx, $phpbb_root_path; - - if ($url === "index.$phpEx") + if ($url === 'index.' . PHP_EXT) { - return append_sid("index.$phpEx"); + return append_sid('index.' . PHP_EXT); } - else if ($url === "{$phpbb_root_path}index.$phpEx") + else if ($url === PHPBB_ROOT_PATH . 'index.' . PHP_EXT) { - return append_sid("{$phpbb_root_path}index.$phpEx"); + return append_sid('index'); } // Remove previously added sid @@ -1904,7 +1923,7 @@ function reapply_sid($url) */ function build_url($strip_vars = false) { - global $user, $phpbb_root_path; + global $user; // Append SID $redirect = append_sid($user->page['page'], false, false); @@ -1957,7 +1976,7 @@ function build_url($strip_vars = false) $redirect .= ($query) ? '?' . $query : ''; } - return $phpbb_root_path . str_replace('&', '&', $redirect); + return PHPBB_ROOT_PATH . str_replace('&', '&', $redirect); } /** @@ -2055,7 +2074,6 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '') { global $user, $template, $db; - global $phpEx, $phpbb_root_path; if (isset($_POST['cancel'])) { @@ -2125,7 +2143,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo } // re-add sid / transform & to & for user->page (user->page is always using &) - $use_page = ($u_action) ? $phpbb_root_path . $u_action : $phpbb_root_path . str_replace('&', '&', $user->page['page']); + $use_page = ($u_action) ? PHPBB_ROOT_PATH . $u_action : PHPBB_ROOT_PATH . str_replace('&', '&', $user->page['page']); $u_action = reapply_sid($use_page); $u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key; @@ -2157,7 +2175,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo */ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true) { - global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config; + global $db, $user, $template, $auth, $config; $err = ''; @@ -2241,9 +2259,9 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa // The result parameter is always an array, holding the relevant information... if ($result['status'] == LOGIN_SUCCESS) { - $redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx"); + $redirect = request_var('redirect', PHPBB_ROOT_PATH . 'index.' . PHP_EXT); $message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT']; - $l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "{$phpbb_root_path}index.$phpEx" || $redirect === "index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']); + $l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === PHPBB_ROOT_PATH . 'index.' . PHP_EXT || $redirect === "index." . PHP_EXT) ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']); // append/replace SID (may change during the session for AOL users) $redirect = reapply_sid($redirect); @@ -2295,7 +2313,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $template->assign_vars(array( 'S_CONFIRM_CODE' => true, 'CONFIRM_ID' => $confirm_id, - 'CONFIRM_IMAGE' => '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_LOGIN) . '" alt="" title="" />', + 'CONFIRM_IMAGE' => '<img src="' . append_sid('ucp', 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_LOGIN) . '" alt="" title="" />', 'L_LOGIN_CONFIRM_EXPLAIN' => sprintf($user->lang['LOGIN_CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'), )); @@ -2306,7 +2324,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa case LOGIN_ERROR_PASSWORD_CONVERT: $err = sprintf( $user->lang[$result['error_msg']], - ($config['email_enable']) ? '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') . '">' : '', + ($config['email_enable']) ? '<a href="' . append_sid('ucp', 'mode=sendpassword') . '">' : '', ($config['email_enable']) ? '</a>' : '', ($config['board_contact']) ? '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">' : '', ($config['board_contact']) ? '</a>' : '' @@ -2360,13 +2378,13 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa 'LOGIN_ERROR' => $err, 'LOGIN_EXPLAIN' => $l_explain, - 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', - 'U_RESEND_ACTIVATION' => ($config['require_activation'] != USER_ACTIVATION_NONE && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '', - 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), - 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), + 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid('ucp', 'mode=sendpassword') : '', + 'U_RESEND_ACTIVATION' => ($config['require_activation'] != USER_ACTIVATION_NONE && $config['email_enable']) ? append_sid('ucp', 'mode=resend_act') : '', + 'U_TERMS_USE' => append_sid('ucp', 'mode=terms'), + 'U_PRIVACY' => append_sid('ucp', 'mode=privacy'), 'S_DISPLAY_FULL_LOGIN' => ($s_display) ? true : false, - 'S_LOGIN_ACTION' => (!$admin) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("index.$phpEx", false, true, $user->session_id), // Needs to stay index.$phpEx because we are within the admin directory + 'S_LOGIN_ACTION' => (!$admin) ? append_sid('ucp', 'mode=login') : append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, false, true, $user->session_id), 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_ADMIN_AUTH' => $admin, @@ -2381,7 +2399,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $template->set_filenames(array( 'body' => 'login_body.html') ); - make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + make_jumpbox(append_sid('viewforum')); page_footer(); } @@ -2391,7 +2409,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa */ function login_forum_box($forum_data) { - global $db, $config, $user, $template, $phpEx; + global $db, $config, $user, $template; $password = request_var('password', '', true); @@ -2628,11 +2646,9 @@ function add_log() */ function get_backtrace() { - global $phpbb_root_path; - $output = '<div style="font-family: monospace;">'; $backtrace = debug_backtrace(); - $path = phpbb_realpath($phpbb_root_path); + $path = phpbb_realpath(PHPBB_ROOT_PATH); foreach ($backtrace as $number => $trace) { @@ -2835,7 +2851,7 @@ function phpbb_checkdnsrr($host, $type = '') function msg_handler($errno, $msg_text, $errfile, $errline) { global $cache, $db, $auth, $template, $config, $user; - global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text; + global $msg_title, $msg_long_text; // Do not display notices if we suppress them via @ if (error_reporting() == 0) @@ -2880,8 +2896,8 @@ function msg_handler($errno, $msg_text, $errfile, $errline) } // remove complete path to installation, with the risk of changing backslashes meant to be there - $errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile); - $msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text); + $errfile = str_replace(array(phpbb_realpath(PHPBB_ROOT_PATH), '\\'), array('', '/'), $errfile); + $msg_text = str_replace(array(phpbb_realpath(PHPBB_ROOT_PATH), '\\'), array('', '/'), $msg_text); echo '<b>[phpBB Debug] PHP Notice</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n"; } @@ -2898,7 +2914,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; $msg_title = (!isset($msg_title)) ? $user->lang['GENERAL_ERROR'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title); - $l_return_index = sprintf($user->lang['RETURN_INDEX'], '<a href="' . $phpbb_root_path . '">', '</a>'); + $l_return_index = sprintf($user->lang['RETURN_INDEX'], '<a href="' . PHPBB_ROOT_PATH . '">', '</a>'); $l_notify = ''; if (!empty($config['board_contact'])) @@ -2909,7 +2925,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) else { $msg_title = 'General Error'; - $l_return_index = '<a href="' . $phpbb_root_path . '">Return to index page</a>'; + $l_return_index = '<a href="' . PHPBB_ROOT_PATH . '">Return to index page</a>'; $l_notify = ''; if (!empty($config['board_contact'])) @@ -3034,7 +3050,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) */ function page_header($page_title = '', $display_online_list = true) { - global $db, $config, $template, $SID, $_SID, $user, $auth, $phpEx, $phpbb_root_path; + global $db, $config, $template, $SID, $_SID, $user, $auth; if (defined('HEADER_INC')) { @@ -3055,12 +3071,12 @@ function page_header($page_title = '', $display_online_list = true) // Generate logged in/logged out status if ($user->data['user_id'] != ANONYMOUS) { - $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id); + $u_login_logout = append_sid('ucp', 'mode=logout', true, $user->session_id); $l_login_logout = sprintf($user->lang['LOGOUT_USER'], $user->data['username']); } else { - $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'); + $u_login_logout = append_sid('ucp', 'mode=login'); $l_login_logout = $user->lang['LOGIN']; } @@ -3272,7 +3288,7 @@ function page_header($page_title = '', $display_online_list = true) $user_lang = $user->lang['USER_LANG']; if (strpos($user_lang, '-x-') !== false) { - $user_lang = substr($user_lang, 0, strpos($user_lang, '-x-')); + $user_lang = substr($user_lang, 0, strpos($user_lang, '-x-')); } // The following assigns all _common_ variables that may be used at any point in a template. @@ -3280,7 +3296,7 @@ function page_header($page_title = '', $display_online_list = true) 'SITENAME' => $config['sitename'], 'SITE_DESCRIPTION' => $config['site_desc'], 'PAGE_TITLE' => $page_title, - 'SCRIPT_NAME' => str_replace('.' . $phpEx, '', $user->page['page_name']), + 'SCRIPT_NAME' => str_replace('.' . PHP_EXT, '', $user->page['page_name']), 'LAST_VISIT_DATE' => sprintf($user->lang['YOU_LAST_VISIT'], $s_last_visit), 'LAST_VISIT_YOU' => $s_last_visit, 'CURRENT_TIME' => sprintf($user->lang['CURRENT_TIME'], $user->format_date(time(), false, true)), @@ -3296,32 +3312,32 @@ function page_header($page_title = '', $display_online_list = true) 'SID' => $SID, '_SID' => $_SID, 'SESSION_ID' => $user->session_id, - 'ROOT_PATH' => $phpbb_root_path, + 'ROOT_PATH' => PHPBB_ROOT_PATH, 'L_LOGIN_LOGOUT' => $l_login_logout, 'L_INDEX' => $user->lang['FORUM_INDEX'], 'L_ONLINE_EXPLAIN' => $l_online_time, - 'U_PRIVATEMSGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'), - 'U_RETURN_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'), - 'U_POPUP_PM' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=popup'), - 'UA_POPUP_PM' => addslashes(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=popup')), - 'U_MEMBERLIST' => append_sid("{$phpbb_root_path}memberlist.$phpEx"), - 'U_VIEWONLINE' => ($auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) ? append_sid("{$phpbb_root_path}viewonline.$phpEx") : '', + 'U_PRIVATEMSGS' => append_sid('ucp', 'i=pm&folder=inbox'), + 'U_RETURN_INBOX' => append_sid('ucp', 'i=pm&folder=inbox'), + 'U_POPUP_PM' => append_sid('ucp', 'i=pm&mode=popup'), + 'UA_POPUP_PM' => addslashes(append_sid('ucp', 'i=pm&mode=popup')), + 'U_MEMBERLIST' => append_sid('memberlist'), + 'U_VIEWONLINE' => ($auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) ? append_sid('viewonline') : '', 'U_LOGIN_LOGOUT' => $u_login_logout, - 'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"), - 'U_SEARCH' => append_sid("{$phpbb_root_path}search.$phpEx"), - 'U_REGISTER' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), - 'U_PROFILE' => append_sid("{$phpbb_root_path}ucp.$phpEx"), - 'U_MODCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id), - 'U_FAQ' => append_sid("{$phpbb_root_path}faq.$phpEx"), - 'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'), - 'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'), - 'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'), - 'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'), - 'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'), - 'U_TEAM' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=leaders'), - 'U_RESTORE_PERMISSIONS' => ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm') : '', + 'U_INDEX' => append_sid('index'), + 'U_SEARCH' => append_sid('search'), + 'U_REGISTER' => append_sid('ucp', 'mode=register'), + 'U_PROFILE' => append_sid('ucp'), + 'U_MODCP' => append_sid('mcp', false, true, $user->session_id), + 'U_FAQ' => append_sid('faq'), + 'U_SEARCH_SELF' => append_sid('search', 'search_id=egosearch'), + 'U_SEARCH_NEW' => append_sid('search', 'search_id=newposts'), + 'U_SEARCH_UNANSWERED' => append_sid('search', 'search_id=unanswered'), + 'U_SEARCH_ACTIVE_TOPICS'=> append_sid('search', 'search_id=active_topics'), + 'U_DELETE_COOKIES' => append_sid('ucp', 'mode=delete_cookies'), + 'U_TEAM' => append_sid('memberlist', 'mode=leaders'), + 'U_RESTORE_PERMISSIONS' => ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) ? append_sid('ucp', 'mode=restore_perm') : '', 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false, 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false, @@ -3347,18 +3363,18 @@ function page_header($page_title = '', $display_online_list = true) 'S_NEW_PM' => ($s_privmsg_new) ? 1 : 0, 'S_REGISTER_ENABLED' => ($config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false, - 'T_THEME_PATH' => "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme', - 'T_TEMPLATE_PATH' => "{$phpbb_root_path}styles/" . $user->theme['template_path'] . '/template', - 'T_IMAGESET_PATH' => "{$phpbb_root_path}styles/" . $user->theme['imageset_path'] . '/imageset', - 'T_IMAGESET_LANG_PATH' => "{$phpbb_root_path}styles/" . $user->theme['imageset_path'] . '/imageset/' . $user->data['user_lang'], - 'T_IMAGES_PATH' => "{$phpbb_root_path}images/", - 'T_SMILIES_PATH' => "{$phpbb_root_path}{$config['smilies_path']}/", - 'T_AVATAR_PATH' => "{$phpbb_root_path}{$config['avatar_path']}/", - 'T_AVATAR_GALLERY_PATH' => "{$phpbb_root_path}{$config['avatar_gallery_path']}/", - 'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/", - 'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/", - 'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", - 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : "{$phpbb_root_path}style.$phpEx?sid=$user->session_id&id=" . $user->theme['style_id'] . '&lang=' . $user->data['user_lang'], + 'T_THEME_PATH' => PHPBB_ROOT_PATH . 'styles/' . $user->theme['theme_path'] . '/theme', + 'T_TEMPLATE_PATH' => PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template', + 'T_IMAGESET_PATH' => PHPBB_ROOT_PATH . 'styles/' . $user->theme['imageset_path'] . '/imageset', + 'T_IMAGESET_LANG_PATH' => PHPBB_ROOT_PATH . 'styles/' . $user->theme['imageset_path'] . '/imageset/' . $user->data['user_lang'], + 'T_IMAGES_PATH' => PHPBB_ROOT_PATH . 'images/', + 'T_SMILIES_PATH' => PHPBB_ROOT_PATH . $config['smilies_path'] . '/', + 'T_AVATAR_PATH' => PHPBB_ROOT_PATH . $config['avatar_path'] . '/', + 'T_AVATAR_GALLERY_PATH' => PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/', + 'T_ICONS_PATH' => PHPBB_ROOT_PATH . $config['icons_path'] . '/', + 'T_RANKS_PATH' => PHPBB_ROOT_PATH . $config['ranks_path'] . '/', + 'T_UPLOAD_PATH' => PHPBB_ROOT_PATH . $config['upload_path'] . '/', + 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? PHPBB_ROOT_PATH . 'styles/' . $user->theme['theme_path'] . '/theme/stylesheet.css' : PHPBB_ROOT_PATH . 'style.' . PHP_EXT . "?sid=$user->session_id&id=" . $user->theme['style_id'] . '&lang=' . $user->data['user_lang'], 'T_STYLESHEET_NAME' => $user->theme['theme_name'], 'SITE_LOGO_IMG' => $user->img('site_logo')) @@ -3379,7 +3395,7 @@ function page_header($page_title = '', $display_online_list = true) */ function page_footer($run_cron = true) { - global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx; + global $db, $config, $template, $user, $auth, $cache, $starttime; // Output page creation time if (defined('DEBUG')) @@ -3416,7 +3432,7 @@ function page_footer($run_cron = true) 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', - 'U_ACP' => ($auth->acl_get('a_') && $user->data['is_registered']) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", false, true, $user->session_id) : '') + 'U_ACP' => ($auth->acl_get('a_') && $user->data['is_registered']) ? append_sid(CONFIG_ADM_FOLDER . 'index', false, true, $user->session_id) : '') ); // Call cron-type script @@ -3424,7 +3440,7 @@ function page_footer($run_cron = true) { $cron_type = ''; - if (time() - $config['queue_interval'] > $config['last_queue_run'] && !defined('IN_ADMIN') && file_exists($phpbb_root_path . 'cache/queue.' . $phpEx)) + if (time() - $config['queue_interval'] > $config['last_queue_run'] && !defined('IN_ADMIN') && file_exists(PHPBB_ROOT_PATH . 'cache/queue.' . PHP_EXT)) { // Process email queue $cron_type = 'queue'; @@ -3455,7 +3471,7 @@ function page_footer($run_cron = true) if ($cron_type) { - $template->assign_var('RUN_CRON_TASK', '<img src="' . append_sid($phpbb_root_path . 'cron.' . $phpEx, 'cron_type=' . $cron_type) . '" width="1" height="1" alt="cron" />'); + $template->assign_var('RUN_CRON_TASK', '<img src="' . append_sid('cron', 'cron_type=' . $cron_type) . '" width="1" height="1" alt="cron" />'); } } diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 52e266befb..05312d826f 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -630,7 +630,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s */ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true) { - global $db, $config, $phpbb_root_path, $phpEx; + global $db, $config; if ($where_type === 'range') { @@ -739,12 +739,12 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = // Remove the message from the search index $search_type = basename($config['search_type']); - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } - include_once("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + include_once(PHPBB_ROOT_PATH . "includes/search/$search_type." . PHP_EXT); $error = false; $search = new $search_type($error); @@ -1101,7 +1101,7 @@ function update_posted_info(&$topic_ids) */ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) { - global $db, $phpbb_root_path, $config; + global $db, $config; // Because of copying topics or modifications a physical filename could be assigned more than once. If so, do not remove the file itself. $sql = 'SELECT COUNT(attach_id) AS num_entries @@ -1118,7 +1118,7 @@ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) } $filename = ($mode == 'thumbnail') ? 'thumb_' . basename($filename) : basename($filename); - return @unlink($phpbb_root_path . $config['upload_path'] . '/' . $filename); + return @unlink(PHPBB_ROOT_PATH . $config['upload_path'] . '/' . $filename); } /** @@ -2154,7 +2154,7 @@ function remove_comments(&$output) */ function cache_moderators() { - global $db, $cache, $auth, $phpbb_root_path, $phpEx; + global $db, $cache, $auth; // Remove cached sql results $cache->destroy('sql', MODERATOR_CACHE_TABLE); @@ -2323,11 +2323,11 @@ function cache_moderators() */ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC') { - global $db, $user, $auth, $phpEx, $phpbb_root_path, $phpbb_admin_path; + global $db, $user, $auth; $topic_id_list = $reportee_id_list = $is_auth = $is_mod = array(); - $profile_url = (defined('IN_ADMIN')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview') : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile'); + $profile_url = (defined('IN_ADMIN')) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=users&mode=overview') : append_sid('memberlist', 'mode=viewprofile'); switch ($mode) { @@ -2411,7 +2411,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id 'forum_id' => $row['forum_id'], 'topic_id' => $row['topic_id'], - 'viewforum' => ($row['forum_id'] && $auth->acl_get('f_read', $row['forum_id'])) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : false, + 'viewforum' => ($row['forum_id'] && $auth->acl_get('f_read', $row['forum_id'])) ? append_sid('viewforum', 'f=' . $row['forum_id']) : false, 'action' => (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}', ); @@ -2498,8 +2498,8 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id foreach ($log as $key => $row) { - $log[$key]['viewtopic'] = (isset($is_auth[$row['topic_id']])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $is_auth[$row['topic_id']] . '&t=' . $row['topic_id']) : false; - $log[$key]['viewlogs'] = (isset($is_mod[$row['topic_id']])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&mode=topic_logs&t=' . $row['topic_id'], true, $user->session_id) : false; + $log[$key]['viewtopic'] = (isset($is_auth[$row['topic_id']])) ? append_sid('viewtopic', 'f=' . $is_auth[$row['topic_id']] . '&t=' . $row['topic_id']) : false; + $log[$key]['viewlogs'] = (isset($is_mod[$row['topic_id']])) ? append_sid('mcp', 'i=logs&mode=topic_logs&t=' . $row['topic_id'], true, $user->session_id) : false; } } @@ -3005,7 +3005,7 @@ function tidy_database() */ function add_permission_language() { - global $user, $phpEx; + global $user; // First of all, our own file. We need to include it as the first file because it presets all relevant variables. $user->add_lang('acp/permissions_phpbb'); @@ -3021,9 +3021,9 @@ function add_permission_language() { while (($file = readdir($dh)) !== false) { - if ($file !== 'permissions_phpbb.' . $phpEx && strpos($file, 'permissions_') === 0 && substr($file, -(strlen($phpEx) + 1)) === '.' . $phpEx) + if ($file !== 'permissions_phpbb.' . PHP_EXT && strpos($file, 'permissions_') === 0 && substr($file, -(strlen(PHP_EXT) + 1)) === '.' . PHP_EXT) { - $files_to_add[] = $path . substr($file, 0, -(strlen($phpEx) + 1)); + $files_to_add[] = $path . substr($file, 0, -(strlen(PHP_EXT) + 1)); } } closedir($dh); diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index c439ed8390..f4efc6b5c9 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -29,8 +29,6 @@ class compress */ public function add_file($src, $src_rm_prefix = '', $src_add_prefix = '', $skip_files = '') { - global $phpbb_root_path; - $skip_files = explode(',', $skip_files); // Remove rm prefix from src path @@ -40,22 +38,22 @@ class compress // Remove initial "/" if present $src_path = (substr($src_path, 0, 1) == '/') ? substr($src_path, 1) : $src_path; - if (is_file($phpbb_root_path . $src)) + if (is_file(PHPBB_ROOT_PATH . $src)) { - $this->data($src_path, file_get_contents("$phpbb_root_path$src"), false, stat("$phpbb_root_path$src")); + $this->data($src_path, file_get_contents(PHPBB_ROOT_PATH . $src), false, stat(PHPBB_ROOT_PATH . $src)); } - else if (is_dir($phpbb_root_path . $src)) + else if (is_dir(PHPBB_ROOT_PATH . $src)) { // Clean up path, add closing / if not present $src_path = ($src_path && substr($src_path, -1) != '/') ? $src_path . '/' : $src_path; $filelist = array(); - $filelist = filelist("$phpbb_root_path$src", '', '*'); + $filelist = filelist(PHPBB_ROOT_PATH . $src, '', '*'); krsort($filelist); if ($src_path) { - $this->data($src_path, '', true, stat("$phpbb_root_path$src")); + $this->data($src_path, '', true, stat(PHPBB_ROOT_PATH . $src)); } foreach ($filelist as $path => $file_ary) @@ -66,7 +64,7 @@ class compress $path = (substr($path, 0, 1) == '/') ? substr($path, 1) : $path; $path = ($path && substr($path, -1) != '/') ? $path . '/' : $path; - $this->data("$src_path$path", '', true, stat("$phpbb_root_path$src$path")); + $this->data("$src_path$path", '', true, stat(PHPBB_ROOT_PATH . $src . $path)); } foreach ($file_ary as $file) @@ -76,7 +74,7 @@ class compress continue; } - $this->data("$src_path$path$file", file_get_contents("$phpbb_root_path$src$path$file"), false, stat("$phpbb_root_path$src$path$file")); + $this->data("$src_path$path$file", file_get_contents(PHPBB_ROOT_PATH . $src . $path . $file), false, stat(PHPBB_ROOT_PATH . $src . $path . $file)); } } } @@ -429,8 +427,6 @@ class compress_zip extends compress */ public function download($filename, $download_name = false) { - global $phpbb_root_path; - if ($download_name === false) { $download_name = $filename; @@ -442,7 +438,7 @@ class compress_zip extends compress header("Content-Type: $mimetype; name=\"$download_name.zip\""); header("Content-disposition: attachment; filename=$download_name.zip"); - $fp = @fopen("{$phpbb_root_path}store/$filename.zip", 'rb'); + $fp = @fopen(PHPBB_ROOT_PATH . "store/$filename.zip", 'rb'); if ($fp) { while ($buffer = fread($fp, 1024)) @@ -649,8 +645,6 @@ class compress_tar extends compress */ public function download($filename, $download_name = false) { - global $phpbb_root_path; - if ($download_name === false) { $download_name = $filename; @@ -679,7 +673,7 @@ class compress_tar extends compress header("Content-Type: $mimetype; name=\"$download_name$this->type\""); header("Content-disposition: attachment; filename=$download_name$this->type"); - $fp = @fopen("{$phpbb_root_path}store/$filename$this->type", 'rb'); + $fp = @fopen(PHPBB_ROOT_PATH . "store/$filename$this->type", 'rb'); if ($fp) { while ($buffer = fread($fp, 1024)) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index ee6c8ea4b1..73ab553cf0 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -406,8 +406,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags) { if (!class_exists('bbcode')) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); } if (empty($bbcode)) @@ -435,8 +434,6 @@ function generate_text_for_display($text, $uid, $bitfield, $flags) */ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false) { - global $phpbb_root_path, $phpEx; - $uid = $bitfield = ''; if (!$text) @@ -446,7 +443,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb if (!class_exists('parse_message')) { - include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT); } $message_parser = new parse_message($text); @@ -473,8 +470,6 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb */ function generate_text_for_edit($text, $uid, $flags) { - global $phpbb_root_path, $phpEx; - decode_message($text, $uid); return array( @@ -699,7 +694,7 @@ function bbcode_nl2br($text) */ function smiley_text($text, $force_option = false) { - global $config, $user, $phpbb_root_path; + global $config, $user; if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) { @@ -707,7 +702,7 @@ function smiley_text($text, $force_option = false) } else { - return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . $phpbb_root_path . $config['smilies_path'] . '/\2 />', $text); + return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . PHPBB_ROOT_PATH . $config['smilies_path'] . '/\2 />', $text); } } @@ -728,7 +723,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, } global $template, $cache, $user; - global $extensions, $config, $phpbb_root_path, $phpEx; + global $extensions, $config; // $compiled_attachments = array(); @@ -816,8 +811,8 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, // Some basics... $attachment['extension'] = strtolower(trim($attachment['extension'])); - $filename = $phpbb_root_path . $config['upload_path'] . '/' . basename($attachment['physical_filename']); - $thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . basename($attachment['physical_filename']); + $filename = PHPBB_ROOT_PATH . $config['upload_path'] . '/' . basename($attachment['physical_filename']); + $thumbnail_filename = PHPBB_ROOT_PATH . $config['upload_path'] . '/thumb_' . basename($attachment['physical_filename']); $upload_icon = ''; @@ -829,7 +824,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, } else if ($extensions[$attachment['extension']]['upload_icon']) { - $upload_icon = '<img src="' . $phpbb_root_path . $config['upload_icons_path'] . '/' . trim($extensions[$attachment['extension']]['upload_icon']) . '" alt="" />'; + $upload_icon = '<img src="' . PHPBB_ROOT_PATH . $config['upload_icons_path'] . '/' . trim($extensions[$attachment['extension']]['upload_icon']) . '" alt="" />'; } } @@ -907,14 +902,14 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, $display_cat = ATTACHMENT_CATEGORY_NONE; } - $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']); + $download_link = append_sid('download/file', 'id=' . $attachment['attach_id']); switch ($display_cat) { // Images case ATTACHMENT_CATEGORY_IMAGE: $l_downloaded_viewed = 'VIEWED_COUNT'; - $inline_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']); + $inline_link = append_sid('download/file', 'id=' . $attachment['attach_id']); $download_link .= '&mode=view'; $block_array += array( @@ -928,7 +923,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, // Images, but display Thumbnail case ATTACHMENT_CATEGORY_THUMB: $l_downloaded_viewed = 'VIEWED_COUNT'; - $thumbnail_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id'] . '&t=1'); + $thumbnail_link = append_sid('download/file', 'id=' . $attachment['attach_id'] . '&t=1'); $download_link .= '&mode=view'; $block_array += array( @@ -1118,7 +1113,7 @@ function truncate_string($string, $max_length = 60, $allow_reply = true, $append */ function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false) { - global $phpbb_root_path, $phpEx, $user, $auth; + global $user, $auth; $profile_url = ''; $username_colour = ($username_colour) ? '#' . $username_colour : ''; @@ -1143,7 +1138,7 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', } else { - $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&u=' . (int) $user_id : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . (int) $user_id); + $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&u=' . (int) $user_id : append_sid('memberlist', 'mode=viewprofile&u=' . (int) $user_id); } } else diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 6fd7e5b221..592fcf13f3 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -418,7 +418,7 @@ function remote_avatar_dims() function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false) { - global $config, $convert, $phpbb_root_path, $user; + global $config, $convert, $user; $relative_path = empty($convert->convertor['source_path_absolute']); @@ -486,7 +486,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false function import_attachment_files($category_name = '') { - global $config, $convert, $phpbb_root_path, $db, $user; + global $config, $convert, $db, $user; $sql = 'SELECT config_value AS upload_path FROM ' . CONFIG_TABLE . " @@ -550,7 +550,7 @@ function _import_check($config_var, $source, $use_target) 'relative_path' => (empty($convert->convertor['source_path_absolute'])) ? true : false, ); - // copy file will prepend $phpBB_root_path + // copy file will prepend PHPBB_ROOT_PATH $target = $config[$config_var] . '/' . basename(($use_target === false) ? $source : $use_target); if (!empty($convert->convertor[$config_var]) && strpos($source, $convert->convertor[$config_var]) !== 0) @@ -584,7 +584,7 @@ function import_attachment($source, $use_target = false) return ''; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $config, $user; if (empty($convert->convertor['upload_path'])) { @@ -625,7 +625,7 @@ function import_rank($source, $use_target = false) return ''; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $config, $user; if (!isset($convert->convertor['ranks_path'])) { @@ -643,7 +643,7 @@ function import_smiley($source, $use_target = false) return ''; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $config, $user; if (!isset($convert->convertor['smilies_path'])) { @@ -663,7 +663,7 @@ function import_avatar($source, $use_target = false, $user_id = false) return; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $config, $user; if (!isset($convert->convertor['avatar_path'])) { @@ -741,7 +741,7 @@ function get_smiley_dim($source, $axis) return $smiley_cache[$source][$axis]; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $config, $user; $orig_source = $source; @@ -856,7 +856,7 @@ function get_upload_avatar_dim($source, $axis) $source = substr($source, 7); } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $config, $user; if (!isset($convert->convertor['avatar_path'])) { @@ -898,7 +898,7 @@ function get_gallery_avatar_dim($source, $axis) return $avatar_cache[$source][$axis]; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $config, $user; $orig_source = $source; @@ -1111,7 +1111,7 @@ function words_unique(&$words) */ function add_user_group($group_id, $user_id, $group_leader=false) { - global $convert, $phpbb_root_path, $config, $user, $db; + global $convert, $config, $user, $db; $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'group_id' => $group_id, @@ -1131,7 +1131,7 @@ function add_user_group($group_id, $user_id, $group_leader=false) */ function user_group_auth($group, $select_query, $use_src_db) { - global $convert, $phpbb_root_path, $config, $user, $db, $src_db, $same_db; + global $convert, $config, $user, $db, $src_db, $same_db; if (!in_array($group, array('guests', 'registered', 'registered_coppa', 'global_moderators', 'administrators', 'bots'))) { @@ -1187,7 +1187,7 @@ function get_config() return $convert_config; } - global $src_db, $same_db, $phpbb_root_path, $config; + global $src_db, $same_db, $config; global $convert; if ($convert->config_schema['table_format'] != 'file') @@ -1354,14 +1354,14 @@ function extract_variables_from_file($_filename) function get_path($src_path, $src_url, $test_file) { - global $config, $phpbb_root_path, $phpEx; + global $config; $board_config = get_config(); - $test_file = preg_replace('/\.php$/i', ".$phpEx", $test_file); + $test_file = preg_replace('/\.php$/i', '.' . PHP_EXT, $test_file); $src_path = path($src_path); - if (@file_exists($phpbb_root_path . $src_path . $test_file)) + if (@file_exists(PHPBB_ROOT_PATH . $src_path . $test_file)) { return $src_path; } @@ -1421,7 +1421,7 @@ function get_path($src_path, $src_url, $test_file) if (!empty($path)) { - if (@file_exists($phpbb_root_path . $path . $test_file)) + if (@file_exists(PHPBB_ROOT_PATH . $path . $test_file)) { return $path; } @@ -1763,7 +1763,7 @@ function sync_post_count($offset, $limit) */ function add_bots() { - global $db, $convert, $user, $config, $phpbb_root_path, $phpEx; + global $db, $convert, $user, $config; $db->sql_query($convert->truncate_statement . BOTS_TABLE); @@ -1843,7 +1843,7 @@ function add_bots() if (!function_exists('user_add')) { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); } foreach ($bots as $bot_name => $bot_ary) @@ -2112,7 +2112,7 @@ function fix_empty_primary_groups() */ function remove_invalid_users() { - global $convert, $db, $phpEx, $phpbb_root_path; + global $convert, $db; // username_clean is UNIQUE $sql = 'SELECT user_id @@ -2126,7 +2126,7 @@ function remove_invalid_users() { if (!function_exists('user_delete')) { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); } user_delete('remove', $row['user_id']); @@ -2248,7 +2248,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $source_relative_path = true) { - global $convert, $phpbb_root_path, $config, $user, $db; + global $convert, $config, $user, $db; if (substr($trg, -1) == '/') { @@ -2267,7 +2267,7 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour return; } - $path = $phpbb_root_path; + $path = PHPBB_ROOT_PATH; $parts = explode('/', $trg); unset($parts[sizeof($parts) - 1]); @@ -2286,15 +2286,15 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour @chmod($path, 0777); } - if (!@copy($src_path, $phpbb_root_path . $trg_path)) + if (!@copy($src_path, PHPBB_ROOT_PATH . $trg_path)) { - $convert->p_master->error(sprintf($user->lang['COULD_NOT_COPY'], $src_path, $phpbb_root_path . $trg_path), __LINE__, __FILE__, !$die_on_failure); + $convert->p_master->error(sprintf($user->lang['COULD_NOT_COPY'], $src_path, PHPBB_ROOT_PATH . $trg_path), __LINE__, __FILE__, !$die_on_failure); return; } if ($perm = @fileperms($src_path)) { - @chmod($phpbb_root_path . $trg_path, $perm); + @chmod(PHPBB_ROOT_PATH . $trg_path, $perm); } return true; @@ -2302,13 +2302,13 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_failure = true, $source_relative_path = true) { - global $convert, $phpbb_root_path, $config, $user, $db; + global $convert, $config, $user, $db; $dirlist = $filelist = $bad_dirs = array(); $src = path($src, $source_relative_path); $trg = path($trg); $src_path = relative_base($src, $source_relative_path, __LINE__, __FILE__); - $trg_path = $phpbb_root_path . $trg; + $trg_path = PHPBB_ROOT_PATH . $trg; if (!is_dir($trg_path)) { @@ -2411,7 +2411,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ function relative_base($path, $is_relative = true, $line = false, $file = false) { - global $convert, $phpbb_root_path, $config, $user, $db; + global $convert, $config, $user, $db; if (!$is_relative) { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index e7971b3398..162b935f28 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -21,8 +21,7 @@ if (!defined('IN_PHPBB')) */ function display_forums($root_data = '', $display_moderators = true, $return_moderators = false) { - global $db, $auth, $user, $template; - global $phpbb_root_path, $phpEx, $config; + global $db, $auth, $user, $template, $config; $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array(); $parent_id = $visible_forums = 0; @@ -274,9 +273,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), 'FORUM_FOLDER_IMG' => '', 'FORUM_FOLDER_IMG_SRC' => '', - 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang['FORUM_CAT'] . '" />' : '', - 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', - 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id'])) + 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . PHPBB_ROOT_PATH . $row['forum_image'] . '" alt="' . $user->lang['FORUM_CAT'] . '" />' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? PHPBB_ROOT_PATH . $row['forum_image'] : '', + 'U_VIEWFORUM' => append_sid('viewforum', 'f=' . $row['forum_id'])) ); continue; @@ -300,7 +299,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($subforum_row['display'] && $subforum_row['name']) { $subforums_list[] = array( - 'link' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $subforum_id), + 'link' => append_sid('viewforum', 'f=' . $subforum_id), 'name' => $subforum_row['name'], 'unread' => $subforum_unread, ); @@ -350,7 +349,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod { $last_post_subject = $row['forum_last_post_subject']; $last_post_time = $user->format_date($row['forum_last_post_time']); - $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; + $last_post_url = append_sid('viewtopic', 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } else { @@ -378,7 +377,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_type'] != FORUM_LINK) { - $u_viewforum = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']); + $u_viewforum = append_sid('viewforum', 'f=' . $row['forum_id']); } else { @@ -386,7 +385,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod // If the forum is having a password or no read access we do not expose the link, but instead handle it in viewforum if (($row['forum_flags'] & FORUM_FLAG_LINK_TRACK) || $row['forum_password'] || !$auth->acl_get('f_read', $forum_id)) { - $u_viewforum = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']); + $u_viewforum = append_sid('viewforum', 'f=' . $row['forum_id']); } else { @@ -411,8 +410,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), 'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'), 'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '', - 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '', - 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . PHPBB_ROOT_PATH . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? PHPBB_ROOT_PATH . $row['forum_image'] : '', 'LAST_POST_SUBJECT' => censor_text($last_post_subject), 'LAST_POST_TIME' => $last_post_time, 'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), @@ -444,7 +443,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } $template->assign_vars(array( - 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $root_data['forum_id'] . '&mark=forums') : '', + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid('viewforum', 'f=' . $root_data['forum_id'] . '&mark=forums') : '', 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false, 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'], 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST')) @@ -468,7 +467,7 @@ function generate_forum_rules(&$forum_data) return; } - global $template, $phpbb_root_path, $phpEx; + global $template; if ($forum_data['forum_rules']) { @@ -489,7 +488,6 @@ function generate_forum_rules(&$forum_data) function generate_forum_nav(&$forum_data) { global $db, $user, $template, $auth; - global $phpEx, $phpbb_root_path; if (!$auth->acl_get('f_list', $forum_data['forum_id'])) { @@ -518,7 +516,7 @@ function generate_forum_nav(&$forum_data) 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false, 'FORUM_NAME' => $parent_name, 'FORUM_ID' => $parent_forum_id, - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id)) + 'U_VIEW_FORUM' => append_sid('viewforum', 'f=' . $parent_forum_id)) ); } } @@ -529,7 +527,7 @@ function generate_forum_nav(&$forum_data) 'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_ID' => $forum_data['forum_id'], - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id'])) + 'U_VIEW_FORUM' => append_sid('viewforum', 'f=' . $forum_data['forum_id'])) ); $template->assign_vars(array( @@ -630,7 +628,7 @@ function topic_generate_pagination($replies, $url) */ function get_moderators(&$forum_moderators, $forum_id = false) { - global $config, $template, $db, $phpbb_root_path, $phpEx; + global $config, $template, $db; // Have we disabled the display of moderators? If so, then return // from whence we came ... @@ -689,7 +687,7 @@ function get_moderators(&$forum_moderators, $forum_id = false) } else { - $forum_moderators[$row['forum_id']][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>'; + $forum_moderators[$row['forum_id']][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . append_sid('memberlist', 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>'; } } $db->sql_freeresult($result); @@ -874,7 +872,6 @@ function display_reasons($reason_id = 0) function display_user_activity(&$userdata) { global $auth, $template, $db, $user; - global $phpbb_root_path, $phpEx; // Do not display user activity for users having more than 5000 posts... if ($userdata['user_posts'] > 5000) @@ -972,10 +969,10 @@ function display_user_activity(&$userdata) 'ACTIVE_TOPIC' => censor_text($active_t_name), 'ACTIVE_TOPIC_POSTS' => ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), 'ACTIVE_TOPIC_PCT' => sprintf($l_active_pct, $active_t_pct), - 'U_ACTIVE_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $active_f_id), - 'U_ACTIVE_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $active_t_id), - 'S_SHOW_ACTIVITY' => true) - ); + 'U_ACTIVE_FORUM' => append_sid('viewforum', 'f=' . $active_f_id), + 'U_ACTIVE_TOPIC' => append_sid('viewtopic', 't=' . $active_t_id), + 'S_SHOW_ACTIVITY' => true, + )); } /** @@ -983,7 +980,7 @@ function display_user_activity(&$userdata) */ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0) { - global $template, $db, $user, $phpEx, $start, $phpbb_root_path; + global $template, $db, $user, $start; $table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE; $where_sql = ($mode == 'forum') ? 'forum_id' : 'topic_id'; @@ -1022,7 +1019,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $db->sql_query($sql); } - $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $redirect_url = append_sid("view$mode", "$u_url=$match_id&start=$start"); meta_refresh(3, $redirect_url); @@ -1056,7 +1053,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $db->sql_query($sql); } - $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $redirect_url = append_sid("view$mode", "$u_url=$match_id&start=$start"); meta_refresh(3, $redirect_url); $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); @@ -1083,7 +1080,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($can_watch) { - $s_watching['link'] = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&" . (($is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start"); + $s_watching['link'] = append_sid("view$mode", "$u_url=$match_id&" . (($is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start"); $s_watching['title'] = $user->lang[(($is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; $s_watching['is_watching'] = $is_watching; } @@ -1103,7 +1100,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, */ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) { - global $ranks, $config, $phpbb_root_path; + global $ranks, $config; if (empty($ranks)) { @@ -1114,8 +1111,8 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank if (!empty($user_rank)) { $rank_title = (isset($ranks['special'][$user_rank]['rank_title'])) ? $ranks['special'][$user_rank]['rank_title'] : ''; - $rank_img = (!empty($ranks['special'][$user_rank]['rank_image'])) ? '<img src="' . $phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] . '" alt="' . $ranks['special'][$user_rank]['rank_title'] . '" title="' . $ranks['special'][$user_rank]['rank_title'] . '" />' : ''; - $rank_img_src = (!empty($ranks['special'][$user_rank]['rank_image'])) ? $phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] : ''; + $rank_img = (!empty($ranks['special'][$user_rank]['rank_image'])) ? '<img src="' . PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] . '" alt="' . $ranks['special'][$user_rank]['rank_title'] . '" title="' . $ranks['special'][$user_rank]['rank_title'] . '" />' : ''; + $rank_img_src = (!empty($ranks['special'][$user_rank]['rank_image'])) ? PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] : ''; } else { @@ -1126,8 +1123,8 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank if ($user_posts >= $rank['rank_min']) { $rank_title = $rank['rank_title']; - $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . $phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; - $rank_img_src = (!empty($rank['rank_image'])) ? $phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image'] : ''; + $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $rank['rank_image'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; + $rank_img_src = (!empty($rank['rank_image'])) ? PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $rank['rank_image'] : ''; break; } } @@ -1148,7 +1145,7 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank */ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR') { - global $user, $config, $phpbb_root_path, $phpEx; + global $user, $config; if (empty($avatar) || !$avatar_type) { @@ -1160,11 +1157,11 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ switch ($avatar_type) { case AVATAR_UPLOAD: - $avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar="; + $avatar_img = PHPBB_ROOT_PATH . 'download/file.' . PHP_EXT . '?avatar='; break; case AVATAR_GALLERY: - $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/'; + $avatar_img = PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/'; break; } diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 84b1fb66c2..2c81b73e7f 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -277,14 +277,14 @@ function get_tables($db) */ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true) { - global $phpbb_root_path, $phpEx, $config, $lang; + global $config, $lang; $dbms = $dbms_details['DRIVER']; if ($load_dbal) { // Include the DB layer - include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); } // Instantiate it and set return on error true diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index ef896f2c89..e571df74d1 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -6,6 +6,7 @@ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * +* @todo handling email and jabber queue through the database, not relying on a single file/file transactions */ /** @@ -17,10 +18,16 @@ if (!defined('IN_PHPBB')) } /** +* phpbb_messenger +* phpbb_queue +* phpbb_smtp_mailer +*/ + +/** * Messenger * @package phpBB3 */ -class messenger +class phpbb_messenger { private $vars, $msg, $extra_headers, $replyto, $from, $subject; private $addresses = array(); @@ -53,7 +60,7 @@ class messenger /** * Sets an email address to send to */ - function to($address, $realname = '') + public function to($address, $realname = '') { global $config; @@ -75,7 +82,7 @@ class messenger /** * Sets an cc address to send to */ - function cc($address, $realname = '') + public function cc($address, $realname = '') { $pos = isset($this->addresses['cc']) ? sizeof($this->addresses['cc']) : 0; $this->addresses['cc'][$pos]['email'] = trim($address); @@ -85,7 +92,7 @@ class messenger /** * Sets an bcc address to send to */ - function bcc($address, $realname = '') + public function bcc($address, $realname = '') { $pos = isset($this->addresses['bcc']) ? sizeof($this->addresses['bcc']) : 0; $this->addresses['bcc'][$pos]['email'] = trim($address); @@ -95,7 +102,7 @@ class messenger /** * Sets a im contact to send to */ - function im($address, $realname = '') + public function im($address, $realname = '') { $pos = isset($this->addresses['im']) ? sizeof($this->addresses['im']) : 0; $this->addresses['im'][$pos]['uid'] = trim($address); @@ -105,7 +112,7 @@ class messenger /** * Set the reply to address */ - function replyto($address) + public function replyto($address) { $this->replyto = trim($address); } @@ -113,7 +120,7 @@ class messenger /** * Set the from address */ - function from($address) + public function from($address) { $this->from = trim($address); } @@ -121,7 +128,7 @@ class messenger /** * set up subject for mail */ - function subject($subject = '') + public function subject($subject = '') { $this->subject = trim($subject); } @@ -129,7 +136,7 @@ class messenger /** * set up extra mail headers */ - function headers($headers) + public function headers($headers) { $this->extra_headers[] = trim($headers); } @@ -137,7 +144,7 @@ class messenger /** * Set the email priority */ - function set_mail_priority($priority = MAIL_NORMAL_PRIORITY) + public function set_mail_priority($priority = MAIL_NORMAL_PRIORITY) { $this->mail_priority = $priority; } @@ -145,9 +152,9 @@ class messenger /** * Set email template to use */ - function template($template_file, $template_lang = '') + public function template($template_file, $template_lang = '') { - global $config, $phpbb_root_path; + global $config; if (!trim($template_file)) { @@ -161,7 +168,7 @@ class messenger if (empty($this->tpl_msg[$template_lang . $template_file])) { - $tpl_file = "{$phpbb_root_path}language/$template_lang/email/$template_file.txt"; + $tpl_file = PHPBB_ROOT_PATH . "language/$template_lang/email/$template_file.txt"; if (!file_exists($tpl_file)) { @@ -184,7 +191,7 @@ class messenger /** * assign variables to email template */ - function assign_vars($vars) + public function assign_vars($vars) { $this->vars = (empty($this->vars)) ? $vars : $this->vars + $vars; } @@ -192,7 +199,7 @@ class messenger /** * Send the mail out to the recipients set previously in var $this->addresses */ - function send($method = NOTIFY_EMAIL, $break = false) + public function send($method = NOTIFY_EMAIL, $break = false) { global $config, $user; @@ -256,7 +263,7 @@ class messenger */ public static function error($type, $msg) { - global $user, $phpEx, $phpbb_root_path, $config; + global $user, $config; // Session doesn't exist, create it if (!isset($user->session_id) || $user->session_id === '') @@ -285,7 +292,7 @@ class messenger /** * Save to queue */ - function save_queue() + public function save_queue() { global $config; @@ -436,7 +443,7 @@ class messenger */ private function msg_jabber() { - global $config, $db, $user, $phpbb_root_path, $phpEx; + global $config, $db, $user; if (empty($config['jab_enable']) || empty($config['jab_host']) || empty($config['jab_username']) || empty($config['jab_password'])) { @@ -463,7 +470,7 @@ class messenger if (!$use_queue) { - include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_jabber.' . PHP_EXT); $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_use_ssl']); if (!$this->jabber->connect()) @@ -499,10 +506,67 @@ class messenger } /** +* Classes for handling queue objects - singletons +*/ +class phpbb_queue_jabber +{ + static $queue; + + public function __construct(phpbb_queue &$queue) + { + self::queue = $queue; + } + + // singleton + public static function &get_instance(phpbb_queue &$queue) + { + static $self; + + if (is_object($self) === true) + { + return $self; + } + + $self = new phpbb_queue_jabber($queue); + return $self; + } + + public function start() + { + echo "START"; + print_r($queue); + exit; +/* if (!$config['jab_enable']) + { + unset($this->queue_data['jabber']); + continue 2; + } + + include_once(PHPBB_ROOT_PATH . 'includes/functions_jabber.' . PHP_EXT); + $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_use_ssl']); + + if (!$this->jabber->connect()) + { + messenger::error('JABBER', $user->lang['ERR_JAB_CONNECT']); + continue 2; + } + + if (!$this->jabber->login()) + { + messenger::error('JABBER', $user->lang['ERR_JAB_AUTH']); + continue 2; + } +*/ + } +} + +class phpbb_queue_test( + +/** * handling email and jabber queue * @package phpBB3 */ -class queue +class phpbb_queue { private $data = array(); private $queue_data = array(); @@ -514,10 +578,8 @@ class queue */ function __construct() { - global $phpEx, $phpbb_root_path; - $this->data = array(); - $this->cache_file = "{$phpbb_root_path}cache/queue.$phpEx"; + $this->cache_file = PHPBB_ROOT_PATH . 'cache/queue.' . PHP_EXT; } /** @@ -544,7 +606,7 @@ class queue */ public function process() { - global $db, $config, $phpEx, $phpbb_root_path, $user; + global $db, $config, $user; set_config('last_queue_run', time(), true); @@ -584,6 +646,13 @@ class queue $num_items = sizeof($data_ary['data']); } + $class = 'phpbb_queue_' . $object; + $queue_object &= $class->get_instance($this); + + $queue_object->start(); + + +/* switch ($object) { case 'email': @@ -596,27 +665,7 @@ class queue break; case 'jabber': - if (!$config['jab_enable']) - { - unset($this->queue_data['jabber']); - continue 2; - } - - include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); - $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_use_ssl']); - - if (!$this->jabber->connect()) - { - messenger::error('JABBER', $user->lang['ERR_JAB_CONNECT']); - continue 2; - } - - if (!$this->jabber->login()) - { - messenger::error('JABBER', $user->lang['ERR_JAB_AUTH']); - continue 2; - } - + break; default: @@ -682,6 +731,7 @@ class queue $this->jabber->disconnect(); break; } + */ } if (!sizeof($this->queue_data)) diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index f4ee454033..c1d04cf245 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -44,8 +44,7 @@ class p_master */ function list_modules($p_class) { - global $auth, $db, $user, $cache; - global $config, $phpbb_root_path, $phpEx; + global $auth, $db, $user, $cache, $config; // Sanitise for future path use, it's escaped as appropriate for queries $this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class)); @@ -393,9 +392,9 @@ class p_master */ function load_active($mode = false, $module_url = false, $execute_module = true) { - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user; + global $user; - $module_path = $phpbb_root_path . 'includes/' . $this->p_class; + $module_path = PHPBB_ROOT_PATH . 'includes/' . $this->p_class; $icat = request_var('icat', ''); if ($this->active_module === false) @@ -405,16 +404,16 @@ class p_master if (!class_exists("{$this->p_class}_$this->p_name")) { - if (!file_exists("$module_path/{$this->p_class}_$this->p_name.$phpEx")) + if (!file_exists("$module_path/{$this->p_class}_$this->p_name." . PHP_EXT)) { - trigger_error("Cannot find module $module_path/{$this->p_class}_$this->p_name.$phpEx", E_USER_ERROR); + trigger_error("Cannot find module $module_path/{$this->p_class}_$this->p_name." . PHP_EXT, E_USER_ERROR); } - include("$module_path/{$this->p_class}_$this->p_name.$phpEx"); + include("$module_path/{$this->p_class}_$this->p_name." . PHP_EXT); if (!class_exists("{$this->p_class}_$this->p_name")) { - trigger_error("Module file $module_path/{$this->p_class}_$this->p_name.$phpEx does not contain correct class [{$this->p_class}_$this->p_name]", E_USER_ERROR); + trigger_error("Module file $module_path/{$this->p_class}_$this->p_name." . PHP_EXT . " does not contain correct class [{$this->p_class}_$this->p_name]", E_USER_ERROR); } if (!empty($mode)) @@ -438,7 +437,7 @@ class p_master } // Not being able to overwrite ;) - $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; } else { @@ -449,7 +448,7 @@ class p_master } else { - $this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; + $this->module->u_action = PHPBB_ROOT_PATH . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; } $this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; @@ -816,7 +815,7 @@ class p_master */ function add_mod_info($module_class) { - global $user, $phpEx; + global $user; if (file_exists($user->lang_path . 'mods')) { @@ -828,9 +827,9 @@ class p_master { while (($entry = readdir($dir)) !== false) { - if (strpos($entry, 'info_' . strtolower($module_class) . '_') === 0 && substr(strrchr($entry, '.'), 1) == $phpEx) + if (strpos($entry, 'info_' . strtolower($module_class) . '_') === 0 && substr(strrchr($entry, '.'), 1) == PHP_EXT) { - $add_files[] = 'mods/' . substr(basename($entry), 0, -(strlen($phpEx) + 1)); + $add_files[] = 'mods/' . substr(basename($entry), 0, -(strlen(PHP_EXT) + 1)); } } closedir($dir); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 877ba8c912..df5609edf1 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -22,7 +22,6 @@ if (!defined('IN_PHPBB')) function generate_smilies($mode, $forum_id) { global $auth, $db, $user, $config, $template; - global $phpEx, $phpbb_root_path; if ($mode == 'window') { @@ -89,7 +88,7 @@ function generate_smilies($mode, $forum_id) $template->assign_block_vars('smiley', array( 'SMILEY_CODE' => $row['code'], 'A_SMILEY_CODE' => addslashes($row['code']), - 'SMILEY_IMG' => $phpbb_root_path . $config['smilies_path'] . '/' . $row['smiley_url'], + 'SMILEY_IMG' => PHPBB_ROOT_PATH . $config['smilies_path'] . '/' . $row['smiley_url'], 'SMILEY_WIDTH' => $row['smiley_width'], 'SMILEY_HEIGHT' => $row['smiley_height'], 'SMILEY_DESC' => $row['emotion']) @@ -101,7 +100,7 @@ function generate_smilies($mode, $forum_id) { $template->assign_vars(array( 'S_SHOW_SMILEY_LINK' => true, - 'U_MORE_SMILIES' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&f=' . $forum_id)) + 'U_MORE_SMILIES' => append_sid('posting', 'mode=smilies&f=' . $forum_id)) ); } @@ -246,7 +245,7 @@ function update_post_information($type, $ids, $return_update_sql = false) */ function posting_gen_topic_icons($mode, $icon_id) { - global $phpbb_root_path, $config, $template, $cache; + global $config, $template, $cache; // Grab icons $icons = cache::obtain_icons(); @@ -264,7 +263,7 @@ function posting_gen_topic_icons($mode, $icon_id) { $template->assign_block_vars('topic_icon', array( 'ICON_ID' => $id, - 'ICON_IMG' => $phpbb_root_path . $config['icons_path'] . '/' . $data['img'], + 'ICON_IMG' => PHPBB_ROOT_PATH . $config['icons_path'] . '/' . $data['img'], 'ICON_WIDTH' => $data['width'], 'ICON_HEIGHT' => $data['height'], @@ -349,13 +348,12 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false) { global $auth, $user, $config, $db, $cache; - global $phpbb_root_path, $phpEx; $filedata = array( 'error' => array() ); - include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_upload.' . PHP_EXT); $upload = new fileupload(); if ($config['check_attachment_content']) @@ -463,7 +461,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage } // Check free disk space - if ($free_space = @disk_free_space($phpbb_root_path . $config['upload_path'])) + if ($free_space = @disk_free_space(PHPBB_ROOT_PATH . $config['upload_path'])) { if ($free_space <= $file->get('filesize')) { @@ -763,7 +761,7 @@ function posting_gen_inline_attachments(&$attachment_data) */ function posting_gen_attachment_entry($attachment_data, &$filename_data) { - global $template, $config, $phpbb_root_path, $phpEx, $user; + global $template, $config, $user; $template->assign_vars(array( 'S_SHOW_ATTACH_BOX' => true) @@ -788,7 +786,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data) $hidden .= '<input type="hidden" name="attachment_data[' . $count . '][' . $key . ']" value="' . $value . '" />'; } - $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false); + $download_link = append_sid('download/file', 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false); $template->assign_block_vars('attach_row', array( 'FILENAME' => basename($attach_row['real_filename']), @@ -822,7 +820,6 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data) function load_drafts($topic_id = 0, $forum_id = 0, $id = 0) { global $user, $db, $template, $auth; - global $phpbb_root_path, $phpEx; $topic_ids = $forum_ids = $draft_rows = array(); @@ -895,24 +892,24 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0) $topic_forum_id = ($topic_rows[$draft['topic_id']]['forum_id']) ? $topic_rows[$draft['topic_id']]['forum_id'] : $forum_id; $link_topic = true; - $view_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_forum_id . '&t=' . $draft['topic_id']); + $view_url = append_sid('viewtopic', 'f=' . $topic_forum_id . '&t=' . $draft['topic_id']); $title = $topic_rows[$draft['topic_id']]['topic_title']; - $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $topic_forum_id . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id']); + $insert_url = append_sid('posting', 'f=' . $topic_forum_id . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id']); } else if ($draft['forum_id'] && $auth->acl_get('f_read', $draft['forum_id'])) { $link_forum = true; - $view_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $draft['forum_id']); + $view_url = append_sid('viewforum', 'f=' . $draft['forum_id']); $title = $draft['forum_name']; - $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id']); + $insert_url = append_sid('posting', 'f=' . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id']); } else { // Either display as PM draft if forum_id and topic_id are empty or if access to the forums has been denied afterwards... $link_pm = true; - $insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&d={$draft['draft_id']}"); + $insert_url = append_sid('ucp', "i=$id&mode=compose&d={$draft['draft_id']}"); } $template->assign_block_vars('draftrow', array( @@ -936,8 +933,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0) */ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true) { - global $user, $auth, $db, $template, $bbcode, $cache; - global $config, $phpbb_root_path, $phpEx; + global $user, $auth, $db, $template, $bbcode, $cache, $config; // Go ahead and pull all data for this topic $sql = 'SELECT p.post_id @@ -995,7 +991,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id // Instantiate BBCode class if (!isset($bbcode) && $bbcode_bitfield !== '') { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); $bbcode = new bbcode(base64_encode($bbcode_bitfield)); } @@ -1075,8 +1071,8 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id 'MESSAGE' => $message, 'DECODED_MESSAGE' => $decoded_message, 'POST_ID' => $row['post_id'], - 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'], - 'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=post_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_MINI_POST' => append_sid('viewtopic', 'p=' . $row['post_id']) . '#p' . $row['post_id'], + 'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? append_sid('mcp', 'i=main&mode=post_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'POSTER_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '') ); @@ -1107,7 +1103,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id */ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id, $topic_id, $post_id) { - global $db, $user, $config, $phpbb_root_path, $phpEx, $auth; + global $db, $user, $config, $auth; $topic_notification = ($mode == 'reply' || $mode == 'quote') ? true : false; $forum_notification = ($mode == 'post') ? true : false; @@ -1238,7 +1234,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id // Now, we are able to really send out notifications if (sizeof($msg_users)) { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(); $msg_list_ary = array(); @@ -1268,11 +1264,11 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id 'TOPIC_TITLE' => htmlspecialchars_decode($topic_title), 'FORUM_NAME' => htmlspecialchars_decode($forum_name), - 'U_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id", - 'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id", - 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&p=$post_id&e=$post_id", - 'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&unwatch=topic", - 'U_STOP_WATCHING_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id&unwatch=forum", + 'U_FORUM' => generate_board_url() . '/viewforum.' . PHP_EXT . "?f=$forum_id", + 'U_TOPIC' => generate_board_url() . '/viewtopic.' . PHP_EXT . "?f=$forum_id&t=$topic_id", + 'U_NEWEST_POST' => generate_board_url() . '/viewtopic.' . PHP_EXT . "?f=$forum_id&t=$topic_id&p=$post_id&e=$post_id", + 'U_STOP_WATCHING_TOPIC' => generate_board_url() . '/viewtopic.' . PHP_EXT . "?f=$forum_id&t=$topic_id&unwatch=topic", + 'U_STOP_WATCHING_FORUM' => generate_board_url() . '/viewforum.' . PHP_EXT . "?f=$forum_id&unwatch=forum", )); $messenger->send($addr['method']); @@ -1333,8 +1329,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id */ function delete_post($forum_id, $topic_id, $post_id, &$data) { - global $db, $user, $auth; - global $config, $phpEx, $phpbb_root_path; + global $db, $user, $auth, $config; // Specify our post mode $post_mode = 'delete'; @@ -1353,7 +1348,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) $sql_data = array(); $next_post_id = false; - include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); $db->sql_transaction('begin'); @@ -1555,7 +1550,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) */ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true) { - global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path; + global $db, $auth, $user, $config, $template; // We do not handle erasing posts here if ($mode == 'delete') @@ -2053,7 +2048,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u else { // insert attachment into db - if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + if (!@file_exists(PHPBB_ROOT_PATH . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) { continue; } @@ -2346,14 +2341,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Select the search method and do some additional checks to ensure it can actually be utilised $search_type = basename($config['search_type']); - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } if (!class_exists($search_type)) { - include("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + include(PHPBB_ROOT_PATH . "includes/search/$search_type." . PHP_EXT); } $error = false; @@ -2447,7 +2442,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $params .= '&t=' . $data['topic_id']; } - $url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx"; + $url = (!$params) ? 'viewforum' : 'viewtopic'; $url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor; return $url; diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index d01d89a7e3..b80f55420b 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -116,7 +116,6 @@ $global_rule_conditions = array( function get_folder($user_id, $folder_id = false) { global $db, $user, $template; - global $phpbb_root_path, $phpEx; $folder = array(); @@ -200,7 +199,7 @@ function get_folder($user_id, $folder_id = false) 'NUM_MESSAGES' => $folder_ary['num_messages'], 'UNREAD_MESSAGES' => $folder_ary['unread_messages'], - 'U_FOLDER' => ($f_id > 0) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $f_id) : append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $folder_id_name), + 'U_FOLDER' => ($f_id > 0) ? append_sid('ucp', 'i=pm&folder=' . $f_id) : append_sid('ucp', 'i=pm&folder=' . $folder_id_name), 'S_CUR_FOLDER' => ($f_id === $folder_id) ? true : false, 'S_UNREAD_MESSAGES' => ($folder_ary['unread_messages']) ? true : false, @@ -731,7 +730,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_folder_id) { global $db, $user; - global $phpbb_root_path, $phpEx; $num_moved = 0; @@ -762,7 +760,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol if ($message_limit && $row['pm_count'] + sizeof($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $row['folder_name']) . '<br /><br />'; - $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $row['folder_id']) . '">', '</a>', $row['folder_name']); + $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid('ucp', 'i=pm&folder=' . $row['folder_id']) . '">', '</a>', $row['folder_name']); trigger_error($message); } } @@ -779,7 +777,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol if ($message_limit && $num_messages + sizeof($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $user->lang['PM_INBOX']) . '<br /><br />'; - $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox') . '">', '</a>', $user->lang['PM_INBOX']); + $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid('ucp', 'i=pm&folder=inbox') . '">', '</a>', $user->lang['PM_INBOX']); trigger_error($message); } } @@ -868,7 +866,7 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) */ function handle_mark_actions($user_id, $mark_action) { - global $db, $user, $phpbb_root_path, $phpEx; + global $db, $user; $msg_ids = request_var('marked_msg_id', array(0)); $cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX); @@ -899,7 +897,7 @@ function handle_mark_actions($user_id, $mark_action) delete_pm($user_id, $msg_ids, $cur_folder_id); $success_msg = (sizeof($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; - $redirect = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $cur_folder_id); + $redirect = append_sid('ucp', 'i=pm&folder=' . $cur_folder_id); meta_refresh(3, $redirect); trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $redirect . '">', '</a>')); @@ -1105,7 +1103,7 @@ function rebuild_header($check_ary) */ function write_pm_addresses($check_ary, $author_id, $plaintext = false) { - global $db, $user, $template, $phpbb_root_path, $phpEx; + global $db, $user, $template; $addresses = array(); @@ -1228,7 +1226,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) else { $tpl_ary = array_merge($tpl_ary, array( - 'U_VIEW' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $id), + 'U_VIEW' => append_sid('memberlist', 'mode=group&g=' . $id), )); } @@ -1281,7 +1279,7 @@ function get_folder_status($folder_id, $folder) */ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) { - global $db, $auth, $config, $phpEx, $template, $user, $phpbb_root_path; + global $db, $auth, $config, $template, $user; // We do not handle erasing pms here if ($mode == 'delete') @@ -1528,7 +1526,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) else { // insert attachment into db - if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + if (!@file_exists(PHPBB_ROOT_PATH . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) { continue; } @@ -1585,7 +1583,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) */ function pm_notification($mode, $author, $recipients, $subject, $message) { - global $db, $user, $config, $phpbb_root_path, $phpEx, $auth; + global $db, $user, $config, $auth; $subject = censor_text($subject); @@ -1640,7 +1638,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message) return; } - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(); foreach ($msg_list_ary as $pos => $addr) @@ -1655,7 +1653,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message) 'AUTHOR_NAME' => htmlspecialchars_decode($author), 'USERNAME' => htmlspecialchars_decode($addr['name']), - 'U_INBOX' => generate_board_url() . "/ucp.$phpEx?i=pm&folder=inbox") + 'U_INBOX' => generate_board_url() . '/ucp.' . PHP_EXT . '?i=pm&folder=inbox') ); $messenger->send($addr['method']); @@ -1672,7 +1670,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message) */ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false) { - global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode; + global $db, $user, $config, $template, $auth, $bbcode; // Get History Messages (could be newer) $sql = 'SELECT t.*, p.*, u.* @@ -1703,7 +1701,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $rowset = array(); $bbcode_bitfield = ''; - $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&folder='; + $folder_url = append_sid('ucp', 'i=pm') . '&folder='; do { @@ -1736,14 +1734,14 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode { if (!class_exists('bbcode')) { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); } $bbcode = new bbcode(base64_encode($bbcode_bitfield)); } $title = censor_text($title); - $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); + $url = append_sid('ucp', 'i=pm'); $next_history_pm = $previous_history_pm = $prev_id = 0; foreach ($rowset as $id => $row) diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index cccd0b758f..cb53d62282 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -728,8 +728,7 @@ class custom_profile */ private function generate_text($profile_row, $preview = false) { - global $template; - global $user, $phpEx, $phpbb_root_path; + global $template, $user; $field_length = explode('|', $profile_row['field_length']); $profile_row['field_rows'] = $field_length[0]; @@ -838,7 +837,6 @@ class custom_profile */ private function get_profile_field($profile_row) { - global $phpbb_root_path, $phpEx; global $config; $var_name = 'pf_' . $profile_row['field_ident']; diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 5ff04b9826..1eea6c1b85 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -735,9 +735,7 @@ class template_compile */ public function compile_write($handle, $data) { - global $phpEx; - - $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . '.' . $phpEx; + $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . '.' . PHP_EXT; if ($fp = @fopen($filename, 'wb')) { diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index 9eb32a7b45..63f8d72e9f 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -38,13 +38,11 @@ class transfer */ function __construct() { - global $phpbb_root_path; - $this->file_perms = 0644; $this->dir_perms = 0777; // We use the store directory as temporary path to circumvent open basedir restrictions - $this->tmp_path = $phpbb_root_path . 'store/'; + $this->tmp_path = PHPBB_ROOT_PATH . 'store/'; } /** @@ -52,9 +50,7 @@ class transfer */ public function write_file($destination_file = '', $contents = '') { - global $phpbb_root_path; - - $destination_file = $this->root_path . str_replace($phpbb_root_path, '', $destination_file); + $destination_file = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $destination_file); // need to create a temp file and then move that temp file. // ftp functions can only move files around and can't create. @@ -104,9 +100,7 @@ class transfer */ public function make_dir($dir) { - global $phpbb_root_path; - - $dir = str_replace($phpbb_root_path, '', $dir); + $dir = str_replace(PHPBB_ROOT_PATH, '', $dir); $dir = explode('/', $dir); $dirs = ''; @@ -120,7 +114,7 @@ class transfer } $cur_dir = $dir[$i] . '/'; - if (!file_exists($phpbb_root_path . $dirs . $cur_dir)) + if (!file_exists(PHPBB_ROOT_PATH . $dirs . $cur_dir)) { // create the directory $result = $this->_mkdir($dir[$i]); @@ -144,10 +138,8 @@ class transfer */ public function copy_file($from_loc, $to_loc) { - global $phpbb_root_path; - - $from_loc = ((strpos($from_loc, $phpbb_root_path) !== 0) ? $phpbb_root_path : '') . $from_loc; - $to_loc = $this->root_path . str_replace($phpbb_root_path, '', $to_loc); + $from_loc = ((strpos($from_loc, PHPBB_ROOT_PATH) !== 0) ? PHPBB_ROOT_PATH : '') . $from_loc; + $to_loc = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $to_loc); if (!file_exists($from_loc)) { @@ -164,9 +156,7 @@ class transfer */ public function delete_file($file) { - global $phpbb_root_path; - - $file = $this->root_path . str_replace($phpbb_root_path, '', $file); + $file = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $file); return $this->_delete($file); } @@ -177,9 +167,7 @@ class transfer */ public function remove_dir($dir) { - global $phpbb_root_path; - - $dir = $this->root_path . str_replace($phpbb_root_path, '', $dir); + $dir = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $dir); return $this->_rmdir($dir); } @@ -189,9 +177,7 @@ class transfer */ public function rename($old_handle, $new_handle) { - global $phpbb_root_path; - - $old_handle = $this->root_path . str_replace($phpbb_root_path, '', $old_handle); + $old_handle = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $old_handle); return $this->_rename($old_handle, $new_handle); } @@ -201,9 +187,7 @@ class transfer */ public function file_exists($directory, $filename) { - global $phpbb_root_path; - - $directory = $this->root_path . str_replace($phpbb_root_path, '', $directory); + $directory = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $directory); $this->_chdir($directory); $result = $this->_ls(''); diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 96c5562adf..4411f28e5a 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -268,7 +268,7 @@ class filespec */ function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = 0666) { - global $user, $phpbb_root_path; + global $user; if (sizeof($this->error)) { @@ -276,7 +276,7 @@ class filespec } // 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; + $this->destination_path = PHPBB_ROOT_PATH . $destination; // Check if the destination path exist... if (!file_exists($this->destination_path)) @@ -693,7 +693,7 @@ class fileupload */ function remote_upload($upload_url) { - global $user, $phpbb_root_path; + global $user; $upload_ary = array(); $upload_ary['local_mode'] = true; @@ -783,7 +783,7 @@ class fileupload return $file; } - $tmp_path = (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') ? false : $phpbb_root_path . 'cache'; + $tmp_path = (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') ? false : PHPBB_ROOT_PATH . 'cache'; $filename = tempnam($tmp_path, unique_id() . '-'); if (!($fp = @fopen($filename, 'wb'))) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 8519cd4fa6..e32a88f1dc 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -151,7 +151,7 @@ function user_update_name($old_name, $new_name) */ function user_add($user_row, $cp_data = false) { - global $db, $user, $auth, $config, $phpbb_root_path, $phpEx; + global $db, $user, $auth, $config; if (empty($user_row['username']) || !isset($user_row['group_id']) || !isset($user_row['user_email']) || !isset($user_row['user_type'])) { @@ -256,7 +256,7 @@ function user_add($user_row, $cp_data = false) if (!class_exists('custom_profile')) { - include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); } $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . @@ -301,7 +301,6 @@ function user_add($user_row, $cp_data = false) function user_delete($mode, $user_id, $post_username = false) { global $cache, $config, $db, $user, $auth; - global $phpbb_root_path, $phpEx; $sql = 'SELECT * FROM ' . USERS_TABLE . ' @@ -438,7 +437,7 @@ function user_delete($mode, $user_id, $post_username = false) if (!function_exists('delete_posts')) { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); } $sql = 'SELECT topic_id, COUNT(post_id) AS total_posts @@ -1769,7 +1768,7 @@ function validate_jabber($jid) */ function avatar_delete($mode, $row, $clean_db = false) { - global $phpbb_root_path, $config, $db, $user; + global $config, $db, $user; // Check if the users avatar is actually *not* a group avatar if ($mode == 'user') @@ -1785,9 +1784,9 @@ function avatar_delete($mode, $row, $clean_db = false) avatar_remove_db($row[$mode . '_avatar']); } $filename = get_avatar_filename($row[$mode . '_avatar']); - if (file_exists($phpbb_root_path . $config['avatar_path'] . '/' . $filename)) + if (file_exists(PHPBB_ROOT_PATH . $config['avatar_path'] . '/' . $filename)) { - @unlink($phpbb_root_path . $config['avatar_path'] . '/' . $filename); + @unlink(PHPBB_ROOT_PATH . $config['avatar_path'] . '/' . $filename); return true; } @@ -1799,7 +1798,7 @@ function avatar_delete($mode, $row, $clean_db = false) */ function avatar_remote($data, &$error) { - global $config, $db, $user, $phpbb_root_path, $phpEx; + global $config, $db, $user; if (!preg_match('#^(http|https|ftp)://#i', $data['remotelink'])) { @@ -1834,7 +1833,7 @@ function avatar_remote($data, &$error) } // Check image type - include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_upload.' . PHP_EXT); $types = fileupload::image_types(); $extension = strtolower(filespec::get_extension($data['remotelink'])); @@ -1877,10 +1876,10 @@ function avatar_remote($data, &$error) */ function avatar_upload($data, &$error) { - global $phpbb_root_path, $config, $db, $user, $phpEx; + global $config, $db, $user; // Init upload class - include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_upload.' . PHP_EXT); $upload = new fileupload('AVATAR_', array('jpg', 'jpeg', 'gif', 'png'), $config['avatar_filesize'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], explode('|', $config['mime_triggers'])); if (!empty($_FILES['uploadfile']['name'])) @@ -1948,12 +1947,11 @@ function get_avatar_filename($avatar_entry) */ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var = 'avatar_row') { - global $user, $cache, $template; - global $config, $phpbb_root_path; + global $user, $cache, $template, $config; $avatar_list = array(); - $path = $phpbb_root_path . $config['avatar_gallery_path']; + $path = PHPBB_ROOT_PATH . $config['avatar_gallery_path']; if (!file_exists($path) || !is_dir($path)) { @@ -2032,13 +2030,13 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var foreach ($avatar_row_ary as $avatar_col_ary) { $template->assign_block_vars($block_var . '.avatar_column', array( - 'AVATAR_IMAGE' => $phpbb_root_path . $config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'], + 'AVATAR_IMAGE' => PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'], 'AVATAR_NAME' => $avatar_col_ary['name'], 'AVATAR_FILE' => $avatar_col_ary['filename']) ); $template->assign_block_vars($block_var . '.avatar_option_column', array( - 'AVATAR_IMAGE' => $phpbb_root_path . $config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'], + 'AVATAR_IMAGE' => PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'], 'S_OPTIONS_AVATAR' => $avatar_col_ary['filename']) ); } @@ -2053,7 +2051,7 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var */ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $current_y = 0) { - global $config, $phpbb_root_path, $user; + global $config, $user; switch ($avatar_type) { @@ -2061,11 +2059,11 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $ break; case AVATAR_UPLOAD : - $avatar = $phpbb_root_path . $config['avatar_path'] . '/' . get_avatar_filename($avatar); + $avatar = PHPBB_ROOT_PATH . $config['avatar_path'] . '/' . get_avatar_filename($avatar); break; case AVATAR_GALLERY : - $avatar = $phpbb_root_path . $config['avatar_gallery_path'] . '/' . $avatar ; + $avatar = PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $avatar ; break; } @@ -2106,7 +2104,7 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $ */ function avatar_process_user(&$error, $custom_userdata = false) { - global $config, $phpbb_root_path, $auth, $user, $db; + global $config, $auth, $user, $db; $data = array( 'uploadurl' => request_var('uploadurl', ''), @@ -2143,7 +2141,7 @@ function avatar_process_user(&$error, $custom_userdata = false) $avatar_select = basename(request_var('avatar_select', '')); // Can we upload? - $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + $can_upload = ($config['allow_avatar_upload'] && file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) { @@ -2161,14 +2159,14 @@ function avatar_process_user(&$error, $custom_userdata = false) $sql_ary['user_avatar'] = $avatar_select; // check avatar gallery - if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) + if (!is_dir(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category)) { $sql_ary['user_avatar'] = ''; $sql_ary['user_avatar_type'] = $sql_ary['user_avatar_width'] = $sql_ary['user_avatar_height'] = 0; } else { - list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $sql_ary['user_avatar']); + list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category . '/' . $sql_ary['user_avatar']); $sql_ary['user_avatar'] = $category . '/' . $sql_ary['user_avatar']; } } @@ -2260,7 +2258,7 @@ function avatar_process_user(&$error, $custom_userdata = false) */ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow_desc_bbcode = false, $allow_desc_urls = false, $allow_desc_smilies = false) { - global $phpbb_root_path, $config, $db, $user, $file_upload; + global $config, $db, $user, $file_upload; $error = array(); $attribute_ary = array( @@ -2420,7 +2418,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow */ function group_correct_avatar($group_id, $old_entry) { - global $config, $db, $phpbb_root_path; + global $config, $db; $group_id = (int)$group_id; $ext = substr(strrchr($old_entry, '.'), 1); @@ -2428,7 +2426,7 @@ function group_correct_avatar($group_id, $old_entry) $new_filename = $config['avatar_salt'] . "_g$group_id.$ext"; $new_entry = 'g' . $group_id . '_' . substr(time(), -5) . ".$ext"; - $avatar_path = $phpbb_root_path . $config['avatar_path']; + $avatar_path = PHPBB_ROOT_PATH . $config['avatar_path']; if (@rename($avatar_path . '/'. $old_filename, $avatar_path . '/' . $new_filename)) { $sql = 'UPDATE ' . GROUPS_TABLE . ' @@ -2459,7 +2457,7 @@ function avatar_remove_db($avatar_name) */ function group_delete($group_id, $group_name = false) { - global $db, $phpbb_root_path, $phpEx; + global $db; if (!$group_name) { @@ -2513,7 +2511,7 @@ function group_delete($group_id, $group_name = false) // Re-cache moderators if (!function_exists('cache_moderators')) { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); } cache_moderators(); @@ -2833,7 +2831,7 @@ function remove_default_rank($group_id, $user_ids) */ function group_user_attributes($action, $group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $group_attributes = false) { - global $db, $auth, $phpbb_root_path, $phpEx, $config; + global $db, $auth, $config; // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); @@ -2891,7 +2889,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna $db->sql_query($sql); // Send approved email to users... - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(); foreach ($email_users as $row) @@ -2904,8 +2902,8 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username']), 'GROUP_NAME' => htmlspecialchars_decode($group_name), - 'U_GROUP' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=membership") - ); + 'U_GROUP' => generate_board_url() . '/ucp.' . PHP_EXT . '?i=groups&mode=membership', + )); $messenger->send($row['user_notify_type']); } @@ -3246,8 +3244,7 @@ function group_update_listings($group_id) { if (!function_exists('cache_moderators')) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); } cache_moderators(); } @@ -3256,8 +3253,7 @@ function group_update_listings($group_id) { if (!function_exists('update_foes')) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); } update_foes(array($group_id)); } diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index cb6211abda..7289644d39 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -26,12 +26,11 @@ class mcp_ban function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); // Include the admin banning interface... - include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/acp/acp_ban.' . PHP_EXT); $bansubmit = (isset($_POST['bansubmit'])) ? true : false; $unbansubmit = (isset($_POST['unbansubmit'])) ? true : false; @@ -148,7 +147,7 @@ class mcp_ban 'S_USERNAME_BAN' => ($mode == 'user') ? true : false, 'U_ACTION' => $this->u_action, - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp_ban&field=ban'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=mcp_ban&field=ban'), )); if ($mode != 'user') diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index eec428a70b..b0a1de8efa 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -21,12 +21,11 @@ if (!defined('IN_PHPBB')) */ function mcp_forum_view($id, $mode, $action, $forum_info) { - global $template, $db, $user, $auth, $cache, $module; - global $phpEx, $phpbb_root_path, $config; + global $template, $db, $user, $auth, $cache, $module, $config; $user->add_lang(array('viewtopic', 'viewforum')); - include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); // merge_topic is the quickmod action, merge_topics is the mcp_forum action, and merge_select is the mcp_topic action $merge_select = ($action == 'merge_select' || $action == 'merge_topic' || $action == 'merge_topics') ? true : false; @@ -50,7 +49,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $url_extra .= ($GLOBALS['post_id']) ? '&p=' . $GLOBALS['post_id'] : ''; $url_extra .= ($GLOBALS['user_id']) ? '&u=' . $GLOBALS['user_id'] : ''; - $url = append_sid("{$phpbb_root_path}mcp.$phpEx?$url_extra"); + $url = ($url_extra) ? append_sid('mcp', $url_extra) : append_sid('mcp'); // Resync Topics switch ($action) @@ -121,8 +120,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'S_CAN_MAKE_STICKY' => $auth->acl_get('f_sticky', $forum_id), 'S_CAN_MAKE_ANNOUNCE' => $auth->acl_get('f_announce', $forum_id), - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), - 'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id) && $module->loaded('logs')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&mode=forum_logs&f=' . $forum_id) : '', + 'U_VIEW_FORUM' => append_sid('viewforum', 'f=' . $forum_id), + 'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id) && $module->loaded('logs')) ? append_sid('mcp', 'i=logs&mode=forum_logs&f=' . $forum_id) : '', 'S_MCP_ACTION' => $url . "&i=$id&forum_action=$action&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''), @@ -255,8 +254,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info) if ($row['topic_status'] == ITEM_MOVED) { $topic_row = array_merge($topic_row, array( - 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_moved_id']}"), - 'U_DELETE_TOPIC' => ($auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&topic_id_list[]={$row['topic_id']}&mode=forum_view&action=delete_topic") : '', + 'U_VIEW_TOPIC' => append_sid('viewtopic', "t={$row['topic_moved_id']}"), + 'U_DELETE_TOPIC' => ($auth->acl_get('m_delete', $forum_id)) ? append_sid('mcp', "i=$id&f=$forum_id&topic_id_list[]={$row['topic_id']}&mode=forum_view&action=delete_topic") : '', 'S_MOVED_TOPIC' => true, 'TOPIC_ID' => $row['topic_moved_id'], )); @@ -272,12 +271,12 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $u_select_topic = $url . "&i=$id&mode=topic_view&action=merge&to_topic_id=" . $row['topic_id'] . $selected_ids; } $topic_row = array_merge($topic_row, array( - 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&t={$row['topic_id']}&mode=topic_view"), + 'U_VIEW_TOPIC' => append_sid('mcp', "i=$id&f=$forum_id&t={$row['topic_id']}&mode=topic_view"), 'S_SELECT_TOPIC' => ($merge_select && !in_array($row['topic_id'], $source_topic_ids)) ? true : false, 'U_SELECT_TOPIC' => $u_select_topic, 'U_MCP_QUEUE' => $u_mcp_queue, - 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&t=' . $row['topic_id'] . '&action=reports') : '', + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid('mcp', 'i=main&mode=topic_view&t=' . $row['topic_id'] . '&action=reports') : '', 'TOPIC_ID' => $row['topic_id'], 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? true : false, )); @@ -293,7 +292,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) */ function mcp_resync_topics($topic_ids) { - global $auth, $db, $template, $phpEx, $user, $phpbb_root_path; + global $auth, $db, $template, $user; if (!sizeof($topic_ids)) { @@ -337,7 +336,7 @@ function mcp_resync_topics($topic_ids) */ function merge_topics($forum_id, $topic_ids, $to_topic_id) { - global $db, $template, $user, $phpEx, $phpbb_root_path, $auth; + global $db, $template, $user, $auth; if (!sizeof($topic_ids)) { @@ -423,14 +422,14 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); // Link to the new topic - $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); + $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); } else { confirm_box(false, 'MERGE_TOPICS', $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -439,7 +438,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) } else { - meta_refresh(3, append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$to_forum_id&t=$to_topic_id")); + meta_refresh(3, append_sid('viewtopic', "f=$to_forum_id&t=$to_topic_id")); trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); } } diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 707fe22685..4905640754 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -21,8 +21,7 @@ if (!defined('IN_PHPBB')) */ function mcp_front_view($id, $mode, $action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth, $module; + global $template, $db, $user, $auth, $module, $config; // Latest 5 unapproved if ($module->loaded('queue')) @@ -98,12 +97,12 @@ function mcp_front_view($id, $mode, $action) } $template->assign_block_vars('unapproved', array( - 'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $row['forum_id'] . '&p=' . $row['post_id']), - 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=forum_view&f=' . $row['forum_id']) : '', - 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&f=' . $row['forum_id'] . '&t=' . $row['topic_id']), - 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', - 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), - 'U_AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']), + 'U_POST_DETAILS' => append_sid('mcp', 'i=queue&mode=approve_details&f=' . $row['forum_id'] . '&p=' . $row['post_id']), + 'U_MCP_FORUM' => (!$global_topic) ? append_sid('mcp', 'i=main&mode=forum_view&f=' . $row['forum_id']) : '', + 'U_MCP_TOPIC' => append_sid('mcp', 'i=main&mode=topic_view&f=' . $row['forum_id'] . '&t=' . $row['topic_id']), + 'U_FORUM' => (!$global_topic) ? append_sid('viewforum', 'f=' . $row['forum_id']) : '', + 'U_TOPIC' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), + 'U_AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? '' : append_sid('memberlist', 'mode=viewprofile&u=' . $row['poster_id']), 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'POST_ID' => $row['post_id'], @@ -117,7 +116,7 @@ function mcp_front_view($id, $mode, $action) } $template->assign_vars(array( - 'S_MCP_QUEUE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue"), + 'S_MCP_QUEUE_ACTION' => append_sid('mcp', 'i=queue'), )); if ($total == 0) @@ -198,11 +197,11 @@ function mcp_front_view($id, $mode, $action) } $template->assign_block_vars('report', array( - 'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id'] . "&i=reports&mode=report_details"), - 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&i=$id&mode=forum_view") : '', - 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'] . "&i=$id&mode=topic_view"), - 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', - 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), + 'U_POST_DETAILS' => append_sid('mcp', 'f=' . $row['forum_id'] . '&p=' . $row['post_id'] . "&i=reports&mode=report_details"), + 'U_MCP_FORUM' => (!$global_topic) ? append_sid('mcp', 'f=' . $row['forum_id'] . "&i=$id&mode=forum_view") : '', + 'U_MCP_TOPIC' => append_sid('mcp', 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'] . "&i=$id&mode=topic_view"), + 'U_FORUM' => (!$global_topic) ? append_sid('viewforum', 'f=' . $row['forum_id']) : '', + 'U_TOPIC' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), 'REPORTER_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'REPORTER' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), @@ -273,8 +272,8 @@ function mcp_front_view($id, $mode, $action) ); } - $template->assign_var('S_MCP_ACTION', append_sid("{$phpbb_root_path}mcp.$phpEx")); - make_jumpbox(append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=forum_view'), 0, false, 'm_', true); + $template->assign_var('S_MCP_ACTION', append_sid('mcp')); + make_jumpbox(append_sid('mcp', 'i=main&mode=forum_view'), 0, false, 'm_', true); } ?>
\ No newline at end of file diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index 6c74e65f5b..3816d2eb17 100755 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -33,8 +33,7 @@ class mcp_logs function main($id, $mode) { - global $auth, $db, $user, $template; - global $config, $phpbb_root_path, $phpEx; + global $auth, $db, $user, $template, $config; $user->add_lang('acp/common'); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index f000bcc881..470a7f1a62 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -33,8 +33,7 @@ class mcp_main function main($id, $mode) { - global $auth, $db, $user, $template, $action; - global $config, $phpbb_root_path, $phpEx; + global $auth, $db, $user, $template, $action, $config; $quickmod = ($mode == 'quickmod') ? true : false; @@ -136,7 +135,7 @@ class mcp_main switch ($mode) { case 'front': - include($phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_front.' . PHP_EXT); $user->add_lang('acp/common'); @@ -147,7 +146,7 @@ class mcp_main break; case 'forum_view': - include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_forum.' . PHP_EXT); $user->add_lang('viewforum'); @@ -170,7 +169,7 @@ class mcp_main break; case 'topic_view': - include($phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_topic.' . PHP_EXT); mcp_topic_view($id, $mode, $action); @@ -179,7 +178,7 @@ class mcp_main break; case 'post_details': - include($phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_post.' . PHP_EXT); mcp_post_details($id, $mode, $action); @@ -199,7 +198,7 @@ class mcp_main */ function lock_unlock($action, $ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path; + global $auth, $user, $db; if ($action == 'lock' || $action == 'unlock') { @@ -265,7 +264,7 @@ function lock_unlock($action, $ids) confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -284,7 +283,7 @@ function lock_unlock($action, $ids) */ function change_topic_type($action, $topic_ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path; + global $auth, $user, $db; // For changing topic types, we only allow operations in one forum. $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('f_announce', 'f_sticky', 'm_'), true); @@ -511,7 +510,7 @@ function change_topic_type($action, $topic_ids) } } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -531,7 +530,6 @@ function change_topic_type($action, $topic_ids) function mcp_move_topic($topic_ids) { global $auth, $user, $db, $template; - global $phpEx, $phpbb_root_path; // Here we limit the operation to one forum only $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_move'), true); @@ -730,7 +728,7 @@ function mcp_move_topic($topic_ids) confirm_box(false, 'MOVE_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -743,8 +741,8 @@ function mcp_move_topic($topic_ids) $message = $user->lang[$success_msg]; $message .= '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id") . '">', '</a>'); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$to_forum_id") . '">', '</a>'); + $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f=$forum_id") . '">', '</a>'); + $message .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid('viewforum', "f=$to_forum_id") . '">', '</a>'); trigger_error($message); } @@ -755,7 +753,7 @@ function mcp_move_topic($topic_ids) */ function mcp_delete_topic($topic_ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path; + global $auth, $user, $db; if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete'))) { @@ -791,7 +789,7 @@ function mcp_delete_topic($topic_ids) confirm_box(false, (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS', $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -800,7 +798,7 @@ function mcp_delete_topic($topic_ids) } else { - $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + $redirect_url = append_sid('viewforum', 'f=' . $forum_id); meta_refresh(3, $redirect_url); trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>')); } @@ -811,7 +809,7 @@ function mcp_delete_topic($topic_ids) */ function mcp_delete_post($post_ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path; + global $auth, $user, $db; if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_delete'))) { @@ -833,7 +831,7 @@ function mcp_delete_post($post_ids) { if (!function_exists('delete_posts')) { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); } // Count the number of topics that are affected @@ -877,9 +875,9 @@ function mcp_delete_post($post_ids) $return_link = array(); if ($affected_topics == 1 && !$deleted_topics && $topic_id) { - $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") . '">', '</a>'); + $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f=$forum_id&t=$topic_id") . '">', '</a>'); } - $return_link[] = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>'); + $return_link[] = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>'); if (sizeof($post_ids) == 1) { @@ -912,7 +910,7 @@ function mcp_delete_post($post_ids) confirm_box(false, (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS', $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -932,7 +930,6 @@ function mcp_delete_post($post_ids) function mcp_fork_topic($topic_ids) { global $auth, $user, $db, $template, $config; - global $phpEx, $phpbb_root_path; if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) { @@ -1202,7 +1199,7 @@ function mcp_fork_topic($topic_ids) confirm_box(false, 'FORK_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -1211,13 +1208,13 @@ function mcp_fork_topic($topic_ids) } else { - $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + $redirect_url = append_sid('viewforum', 'f=' . $forum_id); meta_refresh(3, $redirect_url); $return_link = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'); if ($forum_id != $to_forum_id) { - $return_link .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $to_forum_id) . '">', '</a>'); + $return_link .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $to_forum_id) . '">', '</a>'); } trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index b4804d56ea..5ca3d8f606 100755 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -33,8 +33,7 @@ class mcp_notes function main($id, $mode) { - global $auth, $db, $user, $template; - global $config, $phpbb_root_path, $phpEx; + global $auth, $db, $user, $template, $config; $action = request_var('action', array('' => '')); @@ -49,8 +48,8 @@ class mcp_notes { case 'front': $template->assign_vars(array( - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'), - 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=mcp&field=username&select_single=true'), + 'U_POST_ACTION' => append_sid('mcp', 'i=notes&mode=user_notes'), 'L_TITLE' => $user->lang['MCP_NOTES'], )); @@ -72,8 +71,7 @@ class mcp_notes */ function mcp_notes_user_view($action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + global $template, $db, $user, $auth, $config; $user_id = request_var('u', 0); $username = request_var('username', '', true); @@ -176,7 +174,7 @@ class mcp_notes // Generate the appropriate user information for the user we are looking at if (!function_exists('get_user_avatar')) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); } $rank_title = $rank_img = ''; diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 8d4ea46e31..e73c2d30ec 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -21,8 +21,7 @@ if (!defined('IN_PHPBB')) */ function mcp_post_details($id, $mode, $action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth, $cache; + global $template, $db, $user, $auth, $cache, $config; $user->add_lang('posting'); @@ -40,7 +39,8 @@ function mcp_post_details($id, $mode, $action) } $post_info = $post_info[$post_id]; - $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url()); + $extra_url = extra_url(); + $url = ($extra_url) ? append_sid('mcp', extra_url()) : append_sid('mcp') . '?'; switch ($action) { @@ -49,11 +49,11 @@ function mcp_post_details($id, $mode, $action) if ($auth->acl_get('m_info', $post_info['forum_id'])) { $ip = request_var('ip', ''); - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $template->assign_vars(array( - 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&p=$post_id") . '">', '</a>'), - 'U_RETURN_POST' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&p=$post_id"), + 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid('mcp', "i=$id&mode=$mode&p=$post_id") . '">', '</a>'), + 'U_RETURN_POST' => append_sid('mcp', "i=$id&mode=$mode&p=$post_id"), 'L_RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), 'WHOIS' => user_ipwhois($ip), )); @@ -130,7 +130,7 @@ function mcp_post_details($id, $mode, $action) if ($post_info['bbcode_bitfield']) { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); $bbcode = new bbcode($post_info['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); } @@ -178,7 +178,7 @@ function mcp_post_details($id, $mode, $action) $template->assign_vars(array( 'U_MCP_ACTION' => "$url&i=main&quickmod=1", // Use this for mode paramaters 'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters - 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"), + 'U_APPROVE_ACTION' => append_sid('mcp', "i=queue&p=$post_id&f={$post_info['forum_id']}"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_CAN_CHGPOSTER' => $auth->acl_get('m_chgposter', $post_info['forum_id']), @@ -191,19 +191,19 @@ function mcp_post_details($id, $mode, $action) 'S_USER_NOTES' => true, 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, - 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp_chgposter&field=username&select_single=true'), - 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), - 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), - 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), - 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', - 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), - 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), + 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid('posting', "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=mcp_chgposter&field=username&select_single=true'), + 'U_MCP_APPROVE' => append_sid('mcp', 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), + 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), + 'U_MCP_USER_NOTES' => append_sid('mcp', 'i=notes&mode=user_notes&u=' . $post_info['user_id']), + 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid('mcp', 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', + 'U_VIEW_POST' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), + 'U_VIEW_TOPIC' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), - 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_info['forum_id']}&p=$post_id") . "#p$post_id\">", '</a>'), - 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$post_info['forum_id']}&start={$start}") . '">', '</a>'), + 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$post_info['forum_id']}&p=$post_id") . "#p$post_id\">", '</a>'), + 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f={$post_info['forum_id']}&start={$start}") . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), @@ -222,7 +222,7 @@ function mcp_post_details($id, $mode, $action) 'POST_ID' => $post_info['post_id'], 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&i=$id&mode=$mode&lookup={$post_info['poster_ip']}#ip" : '', - 'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '', + 'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid('mcp', "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '', )); // Get User Notes @@ -274,7 +274,7 @@ function mcp_post_details($id, $mode, $action) 'REASON_TITLE' => $row['reason_title'], 'REASON_DESC' => $row['reason_description'], 'REPORTER' => ($row['user_id'] != ANONYMOUS) ? $row['username'] : $user->lang['GUEST'], - 'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) : '', + 'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? append_sid('memberlist', 'mode=viewprofile&u=' . $row['user_id']) : '', 'USER_NOTIFY' => ($row['user_notify']) ? true : false, 'REPORT_TIME' => $user->format_date($row['report_time']), 'REPORT_TEXT' => bbcode_nl2br(trim($row['report_text'])), @@ -337,8 +337,8 @@ function mcp_post_details($id, $mode, $action) 'NUM_POSTS' => $user_row['postings'], 'L_POST_S' => ($user_row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], - 'U_PROFILE' => ($user_id == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id), - 'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user_id . '&sr=topics')) + 'U_PROFILE' => ($user_id == ANONYMOUS) ? '' : append_sid('memberlist', 'mode=viewprofile&u=' . $user_id), + 'U_SEARCHPOSTS' => append_sid('search', 'author_id=' . $user_id . '&sr=topics')) ); } } @@ -367,7 +367,7 @@ function mcp_post_details($id, $mode, $action) 'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], 'U_LOOKUP_IP' => ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? '' : "$url&i=$id&mode=post_details&rdns={$row['poster_ip']}#ip", - 'U_WHOIS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$row['poster_ip']}")) + 'U_WHOIS' => append_sid('mcp', "i=$id&mode=$mode&action=whois&p=$post_id&ip={$row['poster_ip']}")) ); } $db->sql_freeresult($result); @@ -394,7 +394,7 @@ function mcp_post_details($id, $mode, $action) */ function change_poster(&$post_info, $userdata) { - global $auth, $db, $config, $phpbb_root_path, $phpEx; + global $auth, $db, $config; if (empty($userdata) || $userdata['user_id'] == $post_info['user_id']) { @@ -467,9 +467,9 @@ function change_poster(&$post_info, $userdata) // refresh search cache of this post $search_type = basename($config['search_type']); - if (file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) { - require("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + require(PHPBB_ROOT_PATH . "includes/search/$search_type." . PHP_EXT); // We do some additional checks in the module to ensure it can actually be utilised $error = false; diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 36e937897e..eea00e5660 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -34,9 +34,9 @@ class mcp_queue function main($id, $mode) { global $auth, $db, $user, $template, $cache; - global $config, $phpbb_root_path, $phpEx, $action; + global $config, $action; - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); $forum_id = request_var('f', 0); $start = request_var('start', 0); @@ -47,7 +47,7 @@ class mcp_queue { case 'approve': case 'disapprove': - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $post_id_list = request_var('post_id_list', array(0)); @@ -130,7 +130,7 @@ class mcp_queue if ($post_info['bbcode_bitfield']) { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); $bbcode = new bbcode($post_info['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); } @@ -175,29 +175,29 @@ class mcp_queue } } - $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']); - $topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']); + $post_url = append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']); + $topic_url = append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']); $template->assign_vars(array( 'S_MCP_QUEUE' => true, - 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"), + 'U_APPROVE_ACTION' => append_sid('mcp', "i=queue&p=$post_id&f=$forum_id"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, - 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', - 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), - 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), - 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), - 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', + 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid('posting', "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', + 'U_MCP_APPROVE' => append_sid('mcp', 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), + 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), + 'U_MCP_USER_NOTES' => append_sid('mcp', 'i=notes&mode=user_notes&u=' . $post_info['user_id']), + 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid('mcp', 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), - 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue' . (($topic_id) ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . "&start=$start\">", '</a>'), + 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid('mcp', 'i=queue' . (($topic_id) ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . "&start=$start\">", '</a>'), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'), 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), @@ -216,7 +216,7 @@ class mcp_queue 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], - 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id . '&lookup=' . $post_info['poster_ip']) . '#ip' : '', + 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid('mcp', 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id . '&lookup=' . $post_info['poster_ip']) . '#ip' : '', )); break; @@ -404,10 +404,10 @@ class mcp_queue } $template->assign_block_vars('postrow', array( - 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), - 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', - 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''), - 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&start=$start&mode=approve_details&f={$row['forum_id']}&p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&t={$row['topic_id']}" : '')), + 'U_TOPIC' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), + 'U_VIEWFORUM' => (!$global_topic) ? append_sid('viewforum', 'f=' . $row['forum_id']) : '', + 'U_VIEWPOST' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''), + 'U_VIEW_DETAILS' => append_sid('mcp', "i=queue&start=$start&mode=approve_details&f={$row['forum_id']}&p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&t={$row['topic_id']}" : '')), 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), @@ -452,7 +452,6 @@ class mcp_queue function approve_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; - global $phpEx, $phpbb_root_path; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -655,8 +654,8 @@ function approve_post($post_id_list, $id, $mode) 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])), 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title'])), - 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&e=0", - 'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&p=$post_id&e=$post_id") + 'U_VIEW_TOPIC' => generate_board_url() . '/viewtopic.' . PHP_EXT . "?f={$post_data['forum_id']}&t={$post_data['topic_id']}&e=0", + 'U_VIEW_POST' => generate_board_url() . '/viewtopic.' . PHP_EXT . "?f={$post_data['forum_id']}&t={$post_data['topic_id']}&p=$post_id&e=$post_id") ); $messenger->send($post_data['user_notify_type']); @@ -685,7 +684,7 @@ function approve_post($post_id_list, $id, $mode) if (sizeof($post_id_list) == 1) { $post_data = $post_info[$post_id_list[0]]; - $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_data['forum_id']}&t={$post_data['topic_id']}&p={$post_data['post_id']}") . '#p' . $post_data['post_id']; + $post_url = append_sid('viewtopic', "f={$post_data['forum_id']}&t={$post_data['topic_id']}&p={$post_data['post_id']}") . '#p' . $post_data['post_id']; } unset($post_info); @@ -723,7 +722,7 @@ function approve_post($post_id_list, $id, $mode) confirm_box(false, 'APPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -751,7 +750,6 @@ function approve_post($post_id_list, $id, $mode) function disapprove_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; - global $phpEx, $phpbb_root_path; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -886,7 +884,7 @@ function disapprove_post($post_id_list, $id, $mode) { if (!function_exists('delete_posts')) { - include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); } // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts @@ -951,7 +949,7 @@ function disapprove_post($post_id_list, $id, $mode) } else { - include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); display_reasons($reason_id); @@ -980,7 +978,7 @@ function disapprove_post($post_id_list, $id, $mode) confirm_box(false, 'DISAPPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index c837ff0e67..98d66aedff 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -34,9 +34,9 @@ class mcp_reports function main($id, $mode) { global $auth, $db, $user, $template, $cache; - global $config, $phpbb_root_path, $phpEx, $action; + global $config, $action; - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); $forum_id = request_var('f', 0); $start = request_var('start', 0); @@ -47,7 +47,7 @@ class mcp_reports { case 'close': case 'delete': - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $report_id_list = request_var('report_id_list', array(0)); @@ -139,7 +139,7 @@ class mcp_reports if ($post_info['bbcode_bitfield']) { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); $bbcode = new bbcode($post_info['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); } @@ -186,28 +186,28 @@ class mcp_reports $template->assign_vars(array( 'S_MCP_REPORT' => true, - 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), + 'S_CLOSE_ACTION' => append_sid('mcp', 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, - 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', - 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), - 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), - 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $report['user_id']), - 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), - 'U_MCP_WARN_REPORTER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', - 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', - 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), - 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), + 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid('posting', "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', + 'U_MCP_APPROVE' => append_sid('mcp', 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), + 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), + 'U_MCP_REPORTER_NOTES' => append_sid('mcp', 'i=notes&mode=user_notes&u=' . $report['user_id']), + 'U_MCP_USER_NOTES' => append_sid('mcp', 'i=notes&mode=user_notes&u=' . $post_info['user_id']), + 'U_MCP_WARN_REPORTER' => ($auth->acl_get('m_warn')) ? append_sid('mcp', 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', + 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid('mcp', 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', + 'U_VIEW_POST' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), + 'U_VIEW_TOPIC' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), - 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports' . (($post_info['post_reported']) ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start . '&f=' . $post_info['forum_id']) . '">', '</a>'), + 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid('mcp', 'i=reports' . (($post_info['post_reported']) ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start . '&f=' . $post_info['forum_id']) . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'REPORT_DATE' => $user->format_date($report['report_time']), 'REPORT_ID' => $report_id, @@ -372,9 +372,9 @@ class mcp_reports } $template->assign_block_vars('postrow', array( - 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', - 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'], - 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&start=$start&mode=report_details&f={$row['forum_id']}&r={$row['report_id']}"), + 'U_VIEWFORUM' => (!$global_topic) ? append_sid('viewforum', 'f=' . $row['forum_id']) : '', + 'U_VIEWPOST' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'], + 'U_VIEW_DETAILS' => append_sid('mcp', "i=reports&start=$start&mode=report_details&f={$row['forum_id']}&r={$row['report_id']}"), 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), @@ -429,7 +429,6 @@ class mcp_reports function close_report($report_id_list, $mode, $action) { global $db, $template, $user, $config; - global $phpEx, $phpbb_root_path; $sql = 'SELECT r.post_id FROM ' . REPORTS_TABLE . ' r @@ -616,7 +615,7 @@ function close_report($report_id_list, $mode, $action) confirm_box(false, $user->lang[strtoupper($action) . '_REPORT' . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -629,12 +628,12 @@ function close_report($report_id_list, $mode, $action) $return_forum = ''; if (sizeof($forum_ids == 1)) { - $return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />'; + $return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />'; } $return_topic = ''; if (sizeof($topic_ids == 1)) { - $return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . current($topic_ids) . 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />'; + $return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . current($topic_ids) . 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />'; } trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>')); diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 2e7f60825d..5c4c1feaad 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -21,10 +21,9 @@ if (!defined('IN_PHPBB')) */ function mcp_topic_view($id, $mode, $action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth, $cache; + global $template, $db, $user, $auth, $cache, $config; - $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url()); + $url = append_sid(PHPBB_ROOT_PATH. 'mcp.' . PHP_EXT . '?' . extra_url()); $user->add_lang('viewtopic'); @@ -77,9 +76,9 @@ function mcp_topic_view($id, $mode, $action) // Approve posts? if ($action == 'approve' && $auth->acl_get('m_approve', $topic_info['forum_id'])) { - include($phpbb_root_path . 'includes/mcp/mcp_queue.' . $phpEx); - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_queue.' . PHP_EXT); + include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); if (!sizeof($post_id_list)) { @@ -140,7 +139,7 @@ function mcp_topic_view($id, $mode, $action) if ($bbcode_bitfield !== '') { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); $bbcode = new bbcode(base64_encode($bbcode_bitfield)); } @@ -220,7 +219,7 @@ function mcp_topic_view($id, $mode, $action) 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, 'POST_ID' => $row['post_id'], - 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id) . '">', '</a>'), + 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . $topic_id) . '">', '</a>'), 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), @@ -230,8 +229,8 @@ function mcp_topic_view($id, $mode, $action) 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, 'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''), - 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '', - 'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '') + 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid('mcp', 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '', + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid('mcp', 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '') ); // Display not already displayed Attachments for this post, we already parsed them. ;) @@ -253,7 +252,7 @@ function mcp_topic_view($id, $mode, $action) if ($auth->acl_get('m_split', $topic_info['forum_id'])) { - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); $s_topic_icons = posting_gen_topic_icons('', $icon_id); // Has the user selected a topic for merge? @@ -283,10 +282,10 @@ function mcp_topic_view($id, $mode, $action) $template->assign_vars(array( 'TOPIC_TITLE' => $topic_info['topic_title'], - 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']), + 'U_VIEW_TOPIC' => append_sid('viewtopic', 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']), 'TO_TOPIC_ID' => $to_topic_id, - 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_topic_info['forum_id'] . '&t=' . $to_topic_id) . '">' . $to_topic_info['topic_title'] . '</a>') : '', + 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . append_sid('viewtopic', 'f=' . $to_topic_info['forum_id'] . '&t=' . $to_topic_id) . '">' . $to_topic_info['topic_title'] . '</a>') : '', 'SPLIT_SUBJECT' => $subject, 'POSTS_PER_PAGE' => $posts_per_page, @@ -314,11 +313,11 @@ function mcp_topic_view($id, $mode, $action) 'U_SELECT_TOPIC' => "$url&i=$id&mode=forum_view&action=merge_select" . (($forum_id) ? "&f=$forum_id" : ''), - 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start") . '">', '</a>'), - 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&start=$start") . '">', '</a>'), + 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start") . '">', '</a>'), + 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f={$topic_info['forum_id']}&start=$start") . '">', '</a>'), 'PAGE_NUMBER' => on_page($total, $posts_per_page, $start), - 'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir"), $total, $posts_per_page, $start), + 'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination(append_sid('mcp', "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir"), $total, $posts_per_page, $start), 'TOTAL_POSTS' => ($total == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total), )); } @@ -328,7 +327,7 @@ function mcp_topic_view($id, $mode, $action) */ function split_topic($action, $topic_id, $to_forum_id, $subject) { - global $db, $template, $user, $phpEx, $phpbb_root_path, $auth; + global $db, $template, $user, $auth; $post_id_list = request_var('post_id_list', array(0)); $forum_id = request_var('forum_id', 0); @@ -492,14 +491,14 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $success_msg = 'TOPIC_SPLIT_SUCCESS'; // Link back to both topics - $return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); + $return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); } else { confirm_box(false, ($action == 'split_all') ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND', $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -508,7 +507,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) } else { - meta_refresh(3, append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$to_forum_id&t=$to_topic_id")); + meta_refresh(3, append_sid('viewtopic', "f=$to_forum_id&t=$to_topic_id")); trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); } } @@ -518,7 +517,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) */ function merge_posts($topic_id, $to_topic_id) { - global $db, $template, $user, $phpEx, $phpbb_root_path, $auth; + global $db, $template, $user, $auth; if (!$to_topic_id) { @@ -584,7 +583,7 @@ function merge_posts($topic_id, $to_topic_id) if ($row) { - $return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $topic_id) . '">', '</a>'); + $return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $row['forum_id'] . '&t=' . $topic_id) . '">', '</a>'); } else { @@ -598,14 +597,14 @@ function merge_posts($topic_id, $to_topic_id) } // Link to the new topic - $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); + $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); } else { confirm_box(false, 'MERGE_POSTS', $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = request_var('redirect', 'index.' . PHP_EXT); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -614,7 +613,7 @@ function merge_posts($topic_id, $to_topic_id) } else { - meta_refresh(3, append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$to_forum_id&t=$to_topic_id")); + meta_refresh(3, append_sid('viewtopic', "f=$to_forum_id&t=$to_topic_id")); trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); } } diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 6751ef41bf..1ca40cb841 100755 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -33,8 +33,7 @@ class mcp_warn function main($id, $mode) { - global $auth, $db, $user, $template; - global $config, $phpbb_root_path, $phpEx; + global $auth, $db, $user, $template, $config; $action = request_var('action', array('' => '')); @@ -76,12 +75,11 @@ class mcp_warn */ function mcp_warn_front_view() { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + global $template, $db, $user, $auth, $config; $template->assign_vars(array( - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'), - 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=mcp&field=username&select_single=true'), + 'U_POST_ACTION' => append_sid('mcp', 'i=warn&mode=warn_user'), )); // Obtain a list of the 5 naughtiest users.... @@ -94,12 +92,12 @@ class mcp_warn foreach ($highest as $row) { $template->assign_block_vars('highest', array( - 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + 'U_NOTES' => append_sid('mcp', 'i=notes&mode=user_notes&u=' . $row['user_id']), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USERNAME' => $row['username'], 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), + 'U_USER' => append_sid('memberlist', 'mode=viewprofile&u=' . $row['user_id']), 'WARNING_TIME' => $user->format_date($row['user_last_warning']), 'WARNINGS' => $row['user_warnings'], @@ -116,12 +114,12 @@ class mcp_warn while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('latest', array( - 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + 'U_NOTES' => append_sid('mcp', 'i=notes&mode=user_notes&u=' . $row['user_id']), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USERNAME' => $row['username'], 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), + 'U_USER' => append_sid('memberlist', 'mode=viewprofile&u=' . $row['user_id']), 'WARNING_TIME' => $user->format_date($row['warning_time']), 'WARNINGS' => $row['user_warnings'], @@ -135,8 +133,7 @@ class mcp_warn */ function mcp_warn_list_view($action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + global $template, $db, $user, $auth, $config; $user->add_lang('memberlist'); @@ -164,12 +161,12 @@ class mcp_warn foreach ($users as $row) { $template->assign_block_vars('user', array( - 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + 'U_NOTES' => append_sid('mcp', 'i=notes&mode=user_notes&u=' . $row['user_id']), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USERNAME' => $row['username'], 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), + 'U_USER' => append_sid('memberlist', 'mode=viewprofile&u=' . $row['user_id']), 'WARNING_TIME' => $user->format_date($row['user_last_warning']), 'WARNINGS' => $row['user_warnings'], @@ -184,7 +181,7 @@ class mcp_warn 'S_SELECT_SORT_DAYS' => $s_limit_days, 'PAGE_NUMBER' => on_page($user_count, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"), $user_count, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination(append_sid('mcp', "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"), $user_count, $config['topics_per_page'], $start), 'TOTAL_USERS' => ($user_count == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $user_count), )); } @@ -194,8 +191,7 @@ class mcp_warn */ function mcp_warn_post_view($action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + global $template, $db, $user, $auth, $config; $post_id = request_var('p', 0); $forum_id = request_var('f', 0); @@ -260,7 +256,7 @@ class mcp_warn { $msg = $user->lang['FORM_INVALID']; } - $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + $redirect = append_sid('mcp', "i=notes&mode=user_notes&u=$user_id"); meta_refresh(2, $redirect); trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } @@ -274,7 +270,7 @@ class mcp_warn // Second parse bbcode here if ($user_row['bbcode_bitfield']) { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); $bbcode = new bbcode($user_row['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']); @@ -286,7 +282,7 @@ class mcp_warn // Generate the appropriate user information for the user we are looking at if (!function_exists('get_user_avatar')) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); } $rank_title = $rank_img = ''; @@ -306,7 +302,7 @@ class mcp_warn 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $rank_img, - 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&p=$post_id#p$post_id"), + 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . '/viewtopic.' . PHP_EXT . "?f=$forum_id&p=$post_id#p$post_id"), )); } @@ -315,7 +311,7 @@ class mcp_warn */ function mcp_warn_user_view($action) { - global $phpEx, $phpbb_root_path, $config, $module; + global $config, $module; global $template, $db, $user, $auth; $user_id = request_var('u', 0); @@ -362,7 +358,7 @@ class mcp_warn { $msg = $user->lang['FORM_INVALID']; } - $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + $redirect = append_sid('mcp', "i=notes&mode=user_notes&u=$user_id"); meta_refresh(2, $redirect); trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } @@ -370,7 +366,7 @@ class mcp_warn // Generate the appropriate user information for the user we are looking at if (!function_exists('get_user_avatar')) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); } $rank_title = $rank_img = ''; @@ -400,16 +396,15 @@ class mcp_warn */ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + global $template, $db, $user, $auth, $config; if ($send_pm) { - include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); - include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_privmsgs.' . PHP_EXT); + include_once(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT); - $user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . $user_row['user_lang'] . "/mcp.$phpEx")) ? $user_row['user_lang'] : $config['default_lang']; - include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp.$phpEx"); + $user_row['user_lang'] = (file_exists(PHPBB_ROOT_PATH . 'language/' . $user_row['user_lang'] . '/mcp.' . PHP_EXT)) ? $user_row['user_lang'] : $config['default_lang']; + include(PHPBB_ROOT_PATH . 'language/' . basename($user_row['user_lang']) . '/mcp.' . PHP_EXT); $message_parser = new parse_message(); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 7d3977c507..286ccd8152 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -18,7 +18,7 @@ if (!defined('IN_PHPBB')) if (!class_exists('bbcode')) { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); } /** @@ -970,7 +970,7 @@ class bbcode_firstpass extends bbcode */ function path_in_domain($url) { - global $config, $phpEx, $user; + global $config, $user; if ($config['force_server_vars']) { @@ -982,7 +982,7 @@ class bbcode_firstpass extends bbcode } // Is the user trying to link to a php file in this domain and script path? - if (strpos($url, ".{$phpEx}") !== false && strpos($url, $check_path) !== false) + if (strpos($url, '.' . PHP_EXT) !== false && strpos($url, $check_path) !== false) { $server_name = $user->host; @@ -993,14 +993,14 @@ class bbcode_firstpass extends bbcode } // Check again in correct order... - $pos_ext = strpos($url, ".{$phpEx}"); + $pos_ext = strpos($url, '.' . PHP_EXT); $pos_path = strpos($url, $check_path); $pos_domain = strpos($url, $server_name); if ($pos_domain !== false && $pos_path >= $pos_domain && $pos_ext >= $pos_path) { // Ok, actually we allow linking to some files (this may be able to be extended in some way later...) - if (strpos($url, '/' . $check_path . '/download/file.' . $phpEx) !== 0) + if (strpos($url, '/' . $check_path . '/download/file.' . PHP_EXT) !== 0) { return false; } @@ -1300,7 +1300,7 @@ class parse_message extends bbcode_firstpass */ function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) { - global $config, $auth, $user, $phpbb_root_path, $phpEx, $db; + global $config, $auth, $user, $db; $error = array(); @@ -1390,7 +1390,7 @@ class parse_message extends bbcode_firstpass // Perform actions on temporary attachments if ($delete_file) { - include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); $index = array_keys(request_var('delete_file', array(0 => 0))); $index = (!empty($index)) ? $index[0] : false; @@ -1488,7 +1488,7 @@ class parse_message extends bbcode_firstpass */ function get_submitted_attachment_data($check_user_id = false) { - global $user, $db, $phpbb_root_path, $phpEx, $config; + global $user, $db, $config; $this->filename_data['filecomment'] = utf8_normalize_nfc(request_var('filecomment', '', true)); $attachment_data = (isset($_POST['attachment_data'])) ? $_POST['attachment_data'] : array(); diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index a119f866c4..17cc6782c5 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) /** * @ignore */ -include_once($phpbb_root_path . 'includes/search/search.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/search/search.' . PHP_EXT); /** * fulltext_mysql diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index e38f095f6d..48a29e4f31 100755 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) /** * @ignore */ -include_once($phpbb_root_path . 'includes/search/search.' . $phpEx); +include_once(PHPBB_ROOT_PATH . 'includes/search/search.' . PHP_EXT); /** * fulltext_native @@ -46,7 +46,7 @@ class fulltext_native extends search_backend */ function __construct(&$error) { - global $phpbb_root_path, $phpEx, $config; + global $config; $this->word_length = array('min' => $config['fulltext_native_min_chars'], 'max' => $config['fulltext_native_max_chars']); @@ -55,7 +55,7 @@ class fulltext_native extends search_backend */ if (!class_exists('utf_normalizer')) { - include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/utf_normalizer.' . PHP_EXT); } @@ -966,7 +966,7 @@ class fulltext_native extends search_backend */ private function split_message($text) { - global $phpbb_root_path, $phpEx, $user; + global $user; $match = $words = array(); @@ -1408,7 +1408,6 @@ class fulltext_native extends search_backend */ private function cleanup($text, $allowed_chars = null) { - global $phpbb_root_path, $phpEx; static $conv = array(), $conv_loaded = array(); $words = $allow = array(); @@ -1598,7 +1597,7 @@ class fulltext_native extends search_backend if (!isset($conv_loaded[$idx])) { $conv_loaded[$idx] = 1; - $file = $phpbb_root_path . 'includes/utf/data/search_indexer_' . $idx . '.' . $phpEx; + $file = PHPBB_ROOT_PATH . 'includes/utf/data/search_indexer_' . $idx . '.' . PHP_EXT; if (file_exists($file)) { diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/search.php index e13a59caed..ab04463527 100755 --- a/phpBB/includes/search/search.php +++ b/phpBB/includes/search/search.php @@ -45,14 +45,14 @@ class search_backend { if (!sizeof($this->ignore_words)) { - global $user, $phpEx; + global $user; $words = array(); - if (file_exists("{$user->lang_path}/search_ignore_words.$phpEx")) + if (file_exists("{$user->lang_path}/search_ignore_words." . PHP_EXT)) { // include the file containing ignore words - include("{$user->lang_path}/search_ignore_words.$phpEx"); + include("{$user->lang_path}/search_ignore_words." . PHP_EXT); } $this->ignore_words = $words; @@ -67,14 +67,14 @@ class search_backend { if (!sizeof($this->match_synonym)) { - global $user, $phpEx; + global $user; $synonyms = array(); - if (file_exists("{$user->lang_path}/search_synonyms.$phpEx")) + if (file_exists("{$user->lang_path}/search_synonyms." . PHP_EXT)) { // include the file containing synonyms - include("{$user->lang_path}/search_synonyms.$phpEx"); + include("{$user->lang_path}/search_synonyms." . PHP_EXT); } $this->match_synonym = array_keys($synonyms); diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 6db65509ec..29d3ba584e 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -150,7 +150,7 @@ class session */ function session_begin($update_session_page = true) { - global $phpEx, $SID, $_SID, $_EXTRA_URL, $db, $config, $phpbb_root_path; + global $SID, $_SID, $_EXTRA_URL, $db, $config; // Give us some basic information $this->time_now = time(); @@ -160,7 +160,7 @@ class session $this->referer = (!empty($_SERVER['HTTP_REFERER'])) ? htmlspecialchars((string) $_SERVER['HTTP_REFERER']) : ''; $this->forwarded_for = (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? (string) $_SERVER['HTTP_X_FORWARDED_FOR'] : ''; $this->host = (!empty($_SERVER['HTTP_HOST'])) ? (string) strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); - $this->page = $this->extract_current_page($phpbb_root_path); + $this->page = $this->extract_current_page(PHPBB_ROOT_PATH); // if the forwarded for header shall be checked we have to validate its contents if ($config['forwarded_for_check']) @@ -283,7 +283,7 @@ class session // Check whether the session is still valid if we have one $method = basename(trim($config['auth_method'])); - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT); $method = 'validate_session_' . $method; if (function_exists($method)) @@ -383,7 +383,7 @@ class session */ function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) { - global $SID, $_SID, $db, $config, $cache, $phpbb_root_path, $phpEx; + global $SID, $_SID, $db, $config, $cache; $this->data = array(); @@ -440,7 +440,7 @@ class session } $method = basename(trim($config['auth_method'])); - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT); $method = 'autologin_' . $method; if (function_exists($method)) @@ -732,7 +732,7 @@ class session */ function session_kill($new_session = true) { - global $SID, $_SID, $db, $config, $phpbb_root_path, $phpEx; + global $SID, $_SID, $db, $config; $sql = 'DELETE FROM ' . SESSIONS_TABLE . " WHERE session_id = '" . $db->sql_escape($this->session_id) . "' @@ -741,7 +741,7 @@ class session // Allow connecting logout with external auth method logout $method = basename(trim($config['auth_method'])); - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT); $method = 'logout_' . $method; if (function_exists($method)) @@ -1075,15 +1075,13 @@ class session // We show a login box here to allow founders accessing the board if banned by IP if (defined('IN_LOGIN') && $this->data['user_id'] == ANONYMOUS) { - global $phpEx; - $this->setup('ucp'); $this->data['is_registered'] = $this->data['is_bot'] = false; // Set as a precaution to allow login_box() handling this case correctly as well as this function not being executed again. define('IN_CHECK_BAN', 1); - login_box("index.$phpEx"); + login_box('index.' . PHP_EXT); // The false here is needed, else the user is able to circumvent the ban. $this->session_kill(false); @@ -1358,12 +1356,12 @@ class user extends session */ function setup($lang_set = false, $style = false) { - global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; + global $db, $template, $config, $auth, $cache; 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(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->date_format = $this->data['user_dateformat']; $this->timezone = $this->data['user_timezone'] * 3600; @@ -1372,7 +1370,7 @@ class user extends session else { $this->lang_name = basename($config['default_lang']); - $this->lang_path = $phpbb_root_path . 'language/' . $this->lang_name . '/'; + $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; @@ -1392,10 +1390,10 @@ 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(PHPBB_ROOT_PATH . 'language/' . $accept_lang . "/common." . PHP_EXT)) { $this->lang_name = $config['default_lang'] = $accept_lang; - $this->lang_path = $phpbb_root_path . 'language/' . $accept_lang . '/'; + $this->lang_path = PHPBB_ROOT_PATH . 'language/' . $accept_lang . '/'; break; } else @@ -1404,10 +1402,10 @@ 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(PHPBB_ROOT_PATH . 'language/' . $accept_lang . "/common." . PHP_EXT)) { $this->lang_name = $config['default_lang'] = $accept_lang; - $this->lang_path = $phpbb_root_path . 'language/' . $accept_lang . '/'; + $this->lang_path = PHPBB_ROOT_PATH . 'language/' . $accept_lang . '/'; break; } } @@ -1419,9 +1417,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 . 'common.' . PHP_EXT) === false) { - die('Language file ' . $this->lang_name . "/common.$phpEx" . " couldn't be opened."); + die('Language file ' . $this->lang_name . '/common.' . PHP_EXT . " couldn't be opened."); } $this->add_lang($lang_set); @@ -1504,7 +1502,7 @@ class user extends session { $this->theme['theme_storedb'] = 1; - $stylesheet = file_get_contents("{$phpbb_root_path}styles/{$this->theme['theme_path']}/theme/stylesheet.css"); + $stylesheet = file_get_contents(PHPBB_ROOT_PATH . "styles/{$this->theme['theme_path']}/theme/stylesheet.css"); // Match CSS imports $matches = array(); preg_match_all('/@import url\(["\'](.*)["\']\);/i', $stylesheet, $matches); @@ -1514,7 +1512,7 @@ class user extends session $content = ''; foreach ($matches[0] as $idx => $match) { - if ($content = @file_get_contents("{$phpbb_root_path}styles/{$this->theme['theme_path']}/theme/" . $matches[1][$idx])) + if ($content = @file_get_contents(PHPBB_ROOT_PATH . "styles/{$this->theme['theme_path']}/theme/" . $matches[1][$idx])) { $content = trim($content); } @@ -1545,7 +1543,7 @@ class user extends session $template->set_template(); - $this->img_lang = (file_exists($phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . $this->lang_name)) ? $this->lang_name : $config['default_lang']; + $this->img_lang = (file_exists(PHPBB_ROOT_PATH . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . $this->lang_name)) ? $this->lang_name : $config['default_lang']; $sql = 'SELECT image_name, image_filename, image_lang, image_height, image_width FROM ' . STYLES_IMAGESET_DATA_TABLE . ' @@ -1580,9 +1578,9 @@ class user extends session AND image_lang = \'' . $db->sql_escape($this->img_lang) . '\''; $result = $db->sql_query($sql); - if (@file_exists("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg")) + if (@file_exists(PHPBB_ROOT_PATH . "styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg")) { - $cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg"); + $cfg_data_imageset_data = parse_cfg_file(PHPBB_ROOT_PATH . "styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg"); foreach ($cfg_data_imageset_data as $image_name => $value) { if (strpos($value, '*') !== false) @@ -1645,7 +1643,7 @@ class user extends session // Disable board if the install/ directory is still present // For the brave development army we do not care about this, else we need to comment out this everytime we develop locally - if (!defined('DEBUG_EXTRA') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install')) + if (!defined('DEBUG_EXTRA') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists(PHPBB_ROOT_PATH . 'install')) { // Adjust the message slightly according to the permissions if ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) @@ -1718,9 +1716,9 @@ class user extends session // ucp profile reg_details page ... of course do not redirect if we're already in the ucp if (!defined('IN_ADMIN') && !defined('ADMIN_START') && $config['chg_passforce'] && $this->data['is_registered'] && $auth->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) { - if (strpos($this->page['query_string'], 'mode=reg_details') === false && $this->page['page_name'] != "ucp.$phpEx") + if (strpos($this->page['query_string'], 'mode=reg_details') === false && $this->page['page_name'] != 'ucp.' . PHP_EXT) { - redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=reg_details')); + redirect(append_sid('ucp', 'i=profile&mode=reg_details')); } } @@ -1745,8 +1743,6 @@ class user extends session */ function add_lang($lang_set, $use_db = false, $use_help = false) { - global $phpEx; - if (is_array($lang_set)) { foreach ($lang_set as $key => $lang_file) @@ -1786,14 +1782,12 @@ class user extends session */ function set_lang(&$lang, &$help, $lang_file, $use_db = false, $use_help = false) { - global $phpEx; - // Make sure the language path is set (if the user setup did not happen it is not set) if (!$this->lang_path) { - global $phpbb_root_path, $config; + global $config; - $this->lang_path = $phpbb_root_path . 'language/' . basename($config['default_lang']) . '/'; + $this->lang_path = PHPBB_ROOT_PATH . 'language/' . basename($config['default_lang']) . '/'; } // $lang == $this->lang @@ -1803,11 +1797,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 . 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 . '.' . $phpEx; + $language_filename = $this->lang_path . (($use_help) ? 'help_' : '') . $lang_file . '.' . PHP_EXT; } if ((@include $language_filename) === false) @@ -1924,7 +1918,6 @@ class user extends session function img($img, $alt = '', $width = false, $suffix = '', $type = 'full_tag') { static $imgs; - global $phpbb_root_path; $img_data = &$imgs[$img]; @@ -1937,7 +1930,7 @@ class user extends session return $img_data; } - $img_data['src'] = $phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename']; + $img_data['src'] = PHPBB_ROOT_PATH . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename']; $img_data['width'] = $this->img_array[$img]['image_width']; $img_data['height'] = $this->img_array[$img]['image_height']; } diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index e5f57cfdc2..bcaa0eb5f4 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -46,12 +46,12 @@ class template */ public function set_template() { - global $phpbb_root_path, $user; + global $user; - if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template')) + if (file_exists(PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template')) { - $this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'; - $this->cachepath = $phpbb_root_path . 'cache/tpl_' . $user->theme['template_path'] . '_'; + $this->root = PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template'; + $this->cachepath = PHPBB_ROOT_PATH . 'cache/tpl_' . $user->theme['template_path'] . '_'; } else { @@ -69,10 +69,8 @@ class template */ public function set_custom_template($template_path, $template_name) { - global $phpbb_root_path; - $this->root = $template_path; - $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . $template_name . '_'; + $this->cachepath = PHPBB_ROOT_PATH . 'cache/ctpl_' . $template_name . '_'; return true; } @@ -199,9 +197,9 @@ class template */ private function _tpl_load(&$handle) { - global $user, $phpEx, $config; + global $user, $config; - $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . $phpEx; + $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . PHP_EXT; $recompile = (($config['load_tplcompile'] && @filemtime($filename) < filemtime($this->files[$handle])) || !file_exists($filename) || @filesize($filename) === 0) ? true : false; @@ -211,11 +209,11 @@ class template return $filename; } - global $db, $phpbb_root_path; + global $db; if (!class_exists('template_compile')) { - include($phpbb_root_path . 'includes/functions_template.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_template.' . PHP_EXT); } $compile = new template_compile($this); @@ -247,7 +245,7 @@ class template { do { - if ($row['template_mtime'] < filemtime($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/' . $row['template_filename'])) + if ($row['template_mtime'] < filemtime(PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template/' . $row['template_filename'])) { if ($row['template_filename'] == $this->filename[$handle]) { @@ -271,7 +269,7 @@ class template else { // Only bother compiling if it doesn't already exist - if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . '.' . $phpEx)) + if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . '.' . PHP_EXT)) { $this->filename[$row['template_filename']] = $row['template_filename']; $compile->compile_write($row['template_filename'], $compile->compile(trim($row['template_data']))); diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index 355c9898c2..9589b6928b 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -27,8 +27,7 @@ class ucp_activate function main($id, $mode) { - global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $template; + global $db, $user, $auth, $template, $config; $user_id = request_var('u', 0); $key = request_var('k', ''); @@ -47,7 +46,7 @@ class ucp_activate if ($user_row['user_type'] <> USER_INACTIVE && !$user_row['user_newpasswd']) { - meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + meta_refresh(3, append_sid('index')); trigger_error('ALREADY_ACTIVATED'); } @@ -75,7 +74,7 @@ class ucp_activate if (!$update_password) { - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); user_active_flip('activate', $user_row['user_id']); @@ -87,7 +86,7 @@ class ucp_activate if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(false); @@ -120,7 +119,7 @@ class ucp_activate } } - meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + meta_refresh(3, append_sid('index')); trigger_error($user->lang[$message]); } } diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index 5685702de2..f70c772d9b 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -27,7 +27,7 @@ class ucp_attachments function main($id, $mode) { - global $template, $user, $db, $config, $phpEx, $phpbb_root_path; + global $template, $user, $db, $config; $start = request_var('start', 0); $sort_key = request_var('sk', 'a'); @@ -70,7 +70,7 @@ class ucp_attachments { if (!function_exists('delete_attachments')) { - include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); } delete_attachments('attach', $delete_ids); @@ -138,11 +138,11 @@ class ucp_attachments { if ($row['in_message']) { - $view_topic = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&p={$row['post_msg_id']}"); + $view_topic = append_sid('ucp', "i=pm&p={$row['post_msg_id']}"); } else { - $view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . "#p{$row['post_msg_id']}"; + $view_topic = append_sid('viewtopic', "t={$row['topic_id']}&p={$row['post_msg_id']}") . "#p{$row['post_msg_id']}"; } $template->assign_block_vars('attachrow', array( @@ -161,7 +161,7 @@ class ucp_attachments 'S_IN_MESSAGE' => $row['in_message'], - 'U_VIEW_ATTACHMENT' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $row['attach_id']), + 'U_VIEW_ATTACHMENT' => append_sid('download/file', 'id=' . $row['attach_id']), 'U_VIEW_TOPIC' => $view_topic) ); diff --git a/phpBB/includes/ucp/ucp_confirm.php b/phpBB/includes/ucp/ucp_confirm.php index e416ff4b88..55d27e3c2e 100644 --- a/phpBB/includes/ucp/ucp_confirm.php +++ b/phpBB/includes/ucp/ucp_confirm.php @@ -35,7 +35,7 @@ class ucp_confirm function main($id, $mode) { - global $db, $user, $phpbb_root_path, $config, $phpEx; + global $db, $user, $config; // Do we have an id? No, then just exit $confirm_id = request_var('id', ''); @@ -64,11 +64,11 @@ class ucp_confirm if ($config['captcha_gd']) { - include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_gd.' . PHP_EXT); } else { - include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_non_gd.' . PHP_EXT); } captcha::execute($row['code'], $row['seed']); diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index d884e0d571..d7cbd29dbe 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -26,8 +26,7 @@ class ucp_groups function main($id, $mode) { - global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $cache, $template; + global $db, $user, $auth, $cache, $template, $config; $user->add_lang('groups'); @@ -203,7 +202,7 @@ class ucp_groups $email_template = 'group_request'; } - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(); $sql = 'SELECT u.username, u.username_clean, u.user_email, u.user_notify_type, u.user_jabber, u.user_lang @@ -224,8 +223,8 @@ class ucp_groups 'USERNAME' => htmlspecialchars_decode($row['username']), 'GROUP_NAME' => htmlspecialchars_decode($group_row[$group_id]['group_name']), - 'U_PENDING' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=manage&action=list&g=$group_id", - 'U_GROUP' => generate_board_url() . "/memberlist.$phpEx?mode=group&g=$group_id") + 'U_PENDING' => generate_board_url() . '/ucp.' . PHP_EXT . "?i=groups&mode=manage&action=list&g=$group_id", + 'U_GROUP' => generate_board_url() . '/memberlist.' . PHP_EXT . "?mode=group&g=$group_id") ); $messenger->send($row['user_notify_type']); @@ -333,7 +332,7 @@ class ucp_groups 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], 'GROUP_COLOUR' => $row['group_colour'], - 'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']), + 'U_VIEW_GROUP' => append_sid('memberlist', 'mode=group&g=' . $row['group_id']), 'S_GROUP_DEFAULT' => ($row['group_id'] == $user->data['group_id']) ? true : false, 'S_ROW_COUNT' => ${$block . '_count'}++) @@ -389,7 +388,7 @@ class ucp_groups 'S_CAN_JOIN' => ($row['group_type'] == GROUP_OPEN || $row['group_type'] == GROUP_FREE) ? true : false, 'GROUP_COLOUR' => $row['group_colour'], - 'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']), + 'U_VIEW_GROUP' => append_sid('memberlist', 'mode=group&g=' . $row['group_id']), 'S_ROW_COUNT' => $nonmember_count++) ); @@ -440,7 +439,7 @@ class ucp_groups { case 'edit': - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); if (!$group_id) { @@ -470,7 +469,7 @@ class ucp_groups $avatar_select = basename(request_var('avatar_select', '')); $category = basename(request_var('category', '')); - $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; + $can_upload = (file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $file_uploads) ? true : false; // Did we submit? if ($update) @@ -523,11 +522,11 @@ class ucp_groups else if ($avatar_select && $config['allow_avatar_local']) { // check avatar gallery - if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) + if (is_dir(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category)) { $submit_ary['avatar_type'] = AVATAR_GALLERY; - list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select); + list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select); $submit_ary['avatar'] = $category . '/' . $avatar_select; } } @@ -654,7 +653,7 @@ class ucp_groups $type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : ''; $type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : ''; - $avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_root_path . 'adm/images/no_avatar.gif" alt="" />'; + $avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . PHPBB_ROOT_PATH . 'adm/images/no_avatar.gif" alt="" />'; $display_gallery = (isset($_POST['display_gallery'])) ? true : false; @@ -707,7 +706,7 @@ class ucp_groups 'GROUP_CLOSED' => $type_closed, 'GROUP_HIDDEN' => $type_hidden, - 'U_SWATCH' => append_sid("{$phpbb_root_path}adm/swatch.$phpEx", 'form=ucp&name=group_colour'), + 'U_SWATCH' => append_sid(CONFIG_ADM_FOLDER . '/swatch', 'form=ucp&name=group_colour'), 'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id", 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), )); @@ -818,7 +817,7 @@ class ucp_groups 'PAGINATION' => generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start), 'U_ACTION' => $this->u_action . "&g=$group_id", - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=usernames'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=ucp&field=usernames'), )); break; diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 59d7431113..2549e07024 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -33,7 +33,7 @@ class ucp_main function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $template; switch ($mode) { @@ -156,10 +156,10 @@ class ucp_main 'S_UNREAD' => $unread_topic, 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), - 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], + 'U_LAST_POST' => append_sid('viewtopic', "f=$g_forum_id&t=$topic_id&p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), - 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&view=unread") . '#unread', - 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id")) + 'U_NEWEST_POST' => append_sid('viewtopic', "f=$g_forum_id&t=$topic_id&view=unread") . '#unread', + 'U_VIEW_TOPIC' => append_sid('viewtopic', "f=$g_forum_id&t=$topic_id")) ); } @@ -167,7 +167,7 @@ class ucp_main { if (!function_exists('display_user_activity')) { - include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); } display_user_activity($user->data); } @@ -191,14 +191,14 @@ class ucp_main // 'S_GROUP_OPTIONS' => $group_options, - 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user->data['user_id'] . '&sr=posts') : '', + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid('search', 'author_id=' . $user->data['user_id'] . '&sr=posts') : '', )); break; case 'subscribed': - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); $user->add_lang('viewforum'); @@ -244,8 +244,8 @@ class ucp_main { $msg = $user->lang['FORM_INVALID']; } - $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=subscribed") . '">', '</a>'); - meta_refresh(3, append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=subscribed")); + $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . append_sid('ucp', "i=$id&mode=subscribed") . '">', '</a>'); + meta_refresh(3, append_sid('ucp', "i=$id&mode=subscribed")); trigger_error($message); } @@ -322,7 +322,7 @@ class ucp_main if ($row['forum_last_post_id']) { $last_post_time = $user->format_date($row['forum_last_post_time']); - $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=" . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; + $last_post_url = append_sid('viewtopic', "f=$forum_id&p=" . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } else { @@ -333,8 +333,8 @@ class ucp_main 'FORUM_ID' => $forum_id, 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), 'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'), - 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '', - 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . PHPBB_ROOT_PATH . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? PHPBB_ROOT_PATH . $row['forum_image'] : '', 'FORUM_NAME' => $row['forum_name'], 'LAST_POST_SUBJECT' => $row['forum_last_post_subject'], 'LAST_POST_TIME' => $last_post_time, @@ -345,7 +345,7 @@ class ucp_main 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'U_LAST_POST' => $last_post_url, - 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id'])) + 'U_VIEWFORUM' => append_sid('viewforum', 'f=' . $row['forum_id'])) ); } $db->sql_freeresult($result); @@ -379,7 +379,7 @@ class ucp_main break; } - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); $user->add_lang('viewforum'); @@ -556,23 +556,23 @@ class ucp_main if (isset($topic_rows[$draft['topic_id']]) && $auth->acl_get('f_read', $topic_rows[$draft['topic_id']]['forum_id'])) { $link_topic = true; - $view_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_rows[$draft['topic_id']]['forum_id'] . '&t=' . $draft['topic_id']); + $view_url = append_sid('viewtopic', 'f=' . $topic_rows[$draft['topic_id']]['forum_id'] . '&t=' . $draft['topic_id']); $title = $topic_rows[$draft['topic_id']]['topic_title']; - $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $topic_rows[$draft['topic_id']]['forum_id'] . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id']); + $insert_url = append_sid('posting', 'f=' . $topic_rows[$draft['topic_id']]['forum_id'] . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id']); } else if ($auth->acl_get('f_read', $draft['forum_id'])) { $link_forum = true; - $view_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $draft['forum_id']); + $view_url = append_sid('viewforum', 'f=' . $draft['forum_id']); $title = $draft['forum_name']; - $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id']); + $insert_url = append_sid('posting', 'f=' . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id']); } else if ($pm_drafts) { $link_pm = true; - $insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&d=" . $draft['draft_id']); + $insert_url = append_sid('ucp', "i=$id&mode=compose&d=" . $draft['draft_id']); } $template_row = array( @@ -629,7 +629,7 @@ class ucp_main */ function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array()) { - global $user, $db, $template, $config, $auth, $phpbb_root_path, $phpEx; + global $user, $db, $template, $config, $auth; $table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE; $start = request_var('start', 0); @@ -772,7 +772,7 @@ class ucp_main $folder_img = $folder_alt = $topic_type = ''; topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type); - $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); + $view_topic_url = append_sid('viewtopic', "f=$forum_id&t=$topic_id"); // Send vars to template $template->assign_block_vars('topicrow', array( @@ -796,7 +796,7 @@ class ucp_main 'S_DELETED_TOPIC' => (!$row['topic_id']) ? true : false, 'S_GLOBAL_TOPIC' => (!$forum_id) ? true : false, - 'PAGINATION' => topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id")), + 'PAGINATION' => topic_generate_pagination($replies, append_sid('viewtopic', 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id")), 'REPLIES' => $replies, 'VIEWS' => $row['topic_views'], 'TOPIC_TITLE' => censor_text($row['topic_title']), @@ -814,10 +814,10 @@ class ucp_main 'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, - 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', + 'U_NEWEST_POST' => append_sid('viewtopic', "f=$forum_id&t=$topic_id&view=unread") . '#unread', 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], 'U_VIEW_TOPIC' => $view_topic_url, - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), + 'U_VIEW_FORUM' => append_sid('viewforum', 'f=' . $forum_id), )); } } diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index b4ac0c11da..e4371602cb 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -43,7 +43,7 @@ class ucp_pm function main($id, $mode) { - global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config; + global $user, $template, $auth, $db, $config; if (!$user->data['is_registered']) { @@ -80,7 +80,7 @@ class ucp_pm $mode = 'view'; } - include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_privmsgs.' . PHP_EXT); switch ($mode) { @@ -103,9 +103,9 @@ class ucp_pm $template->assign_vars(array( 'MESSAGE' => $l_new_message, 'S_NOT_LOGGED_IN' => ($user->data['user_id'] == ANONYMOUS) ? true : false, - 'CLICK_TO_VIEW' => sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox') . '" onclick="jump_to_inbox(this.href); return false;">', '</a>'), - 'U_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'), - 'UA_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox', false)) + 'CLICK_TO_VIEW' => sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . append_sid('ucp', 'i=pm&folder=inbox') . '" onclick="jump_to_inbox(this.href); return false;">', '</a>'), + 'U_INBOX' => append_sid('ucp', 'i=pm&folder=inbox'), + 'UA_INBOX' => append_sid('ucp', 'i=pm&folder=inbox', false)) ); $tpl_file = 'ucp_pm_popup'; @@ -122,7 +122,7 @@ class ucp_pm trigger_error('NO_AUTH_SEND_MESSAGE'); } - include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/ucp/ucp_pm_compose.' . PHP_EXT); compose_pm($id, $mode, $action); $tpl_file = 'posting_body'; @@ -132,7 +132,7 @@ class ucp_pm set_user_message_limit(); get_folder($user->data['user_id']); - include($phpbb_root_path . 'includes/ucp/ucp_pm_options.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/ucp/ucp_pm_options.' . PHP_EXT); message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions); $tpl_file = 'ucp_pm_options'; @@ -144,7 +144,7 @@ class ucp_pm $this->p_name = 'pm'; // Call another module... please do not try this at home... Hoochie Coochie Man - include($phpbb_root_path . 'includes/ucp/ucp_main.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/ucp/ucp_main.' . PHP_EXT); $module = new ucp_main($this); $module->u_action = $this->u_action; @@ -365,7 +365,7 @@ class ucp_pm if ($action == 'view_folder') { - include($phpbb_root_path . 'includes/ucp/ucp_pm_viewfolder.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/ucp/ucp_pm_viewfolder.' . PHP_EXT); view_folder($id, $mode, $folder_id, $folder); $tpl_file = 'ucp_pm_viewfolder'; @@ -382,7 +382,7 @@ class ucp_pm trigger_error('NO_MESSAGE'); } - include($phpbb_root_path . 'includes/ucp/ucp_pm_viewmessage.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/ucp/ucp_pm_viewmessage.' . PHP_EXT); view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row); $tpl_file = ($view == 'print') ? 'ucp_pm_viewmessage_print' : 'ucp_pm_viewmessage'; diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index af592e3612..298fd6ef18 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -22,12 +22,11 @@ if (!defined('IN_PHPBB')) */ function compose_pm($id, $mode, $action) { - global $template, $db, $auth, $user; - global $phpbb_root_path, $phpEx, $config; + global $template, $db, $auth, $user, $config; - include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); + include(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT); if (!$action) { @@ -71,9 +70,9 @@ function compose_pm($id, $mode, $action) { if ($msg_id) { - redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id)); + redirect(append_sid('ucp', 'i=pm&mode=view&action=view_message&p=' . $msg_id)); } - redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm')); + redirect(append_sid('ucp', 'i=pm')); } // Output PM_TO box if message composing @@ -113,7 +112,7 @@ function compose_pm($id, $mode, $action) 'S_SHOW_PM_BOX' => true, 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false, 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? $group_options : '', - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=$select_single"), + 'U_FIND_USERNAME' => append_sid('memberlist', "mode=searchuser&form=postform&field=username_list&select_single=$select_single"), )); } @@ -343,7 +342,7 @@ function compose_pm($id, $mode, $action) $message_parser->message = ($action == 'reply') ? '' : $message_text; unset($message_text); - $s_action = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=$mode&action=$action", true, $user->session_id); + $s_action = append_sid('ucp', "i=$id&mode=$mode&action=$action", true, $user->session_id); $s_action .= ($msg_id) ? "&p=$msg_id" : ''; // Delete triggered ? @@ -358,7 +357,7 @@ function compose_pm($id, $mode, $action) delete_pm($user->data['user_id'], $msg_id, $folder_id); // jump to next message in "history"? nope, not for the moment. But able to be included later. - $meta_info = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&folder=$folder_id"); + $meta_info = append_sid('ucp', "i=pm&folder=$folder_id"); $message = $user->lang['MESSAGE_DELETED']; meta_refresh(3, $meta_info); @@ -373,11 +372,11 @@ function compose_pm($id, $mode, $action) 'action' => 'delete' ); - // "{$phpbb_root_path}ucp.$phpEx?i=pm&mode=compose" + // "ucp.php?i=pm&mode=compose" confirm_box(false, 'DELETE_MESSAGE', build_hidden_fields($s_hidden_fields)); } - redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id)); + redirect(append_sid('ucp', 'i=pm&mode=view&action=view_message&p=' . $msg_id)); } // Handle User/Group adding/removing @@ -470,7 +469,7 @@ function compose_pm($id, $mode, $action) ); $db->sql_query($sql); - $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=$mode"); + $redirect_url = append_sid('ucp', "i=pm&mode=$mode"); meta_refresh(3, $redirect_url); $message = $user->lang['DRAFT_SAVED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); @@ -641,8 +640,8 @@ function compose_pm($id, $mode, $action) // ((!$message_subject) ? $subject : $message_subject) $msg_id = submit_pm($action, $subject, $pm_data); - $return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&p=' . $msg_id); - $return_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=outbox'); + $return_message_url = append_sid('ucp', 'i=pm&mode=view&p=' . $msg_id); + $return_folder_url = append_sid('ucp', 'i=pm&folder=outbox'); meta_refresh(3, $return_message_url); $message = $user->lang['MESSAGE_STORED'] . '<br /><br />' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '<a href="' . $return_message_url . '">', '</a>') . '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $return_folder_url . '">', '</a>', $user->lang['PM_OUTBOX']); @@ -724,11 +723,11 @@ function compose_pm($id, $mode, $action) $post_id = request_var('p', 0); if ($config['allow_post_links']) { - $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}: {$message_subject}[/url]\n\n"; + $message_link = "[url=" . generate_board_url() . '/viewtopic.' . PHP_EXT . "?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}: {$message_subject}[/url]\n\n"; } else { - $message_link = $user->lang['SUBJECT'] . ': ' . $message_subject . " (" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id})\n\n"; + $message_link = $user->lang['SUBJECT'] . ': ' . $message_subject . " (" . generate_board_url() . '/viewtopic.' . PHP_EXT . "?p={$post_id}#p{$post_id})\n\n"; } } else @@ -749,11 +748,11 @@ function compose_pm($id, $mode, $action) if ($config['allow_post_links']) { - $quote_username_text = '[url=' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]"; + $quote_username_text = '[url=' . generate_board_url() . '/memberlist.' . PHP_EXT . "?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]"; } else { - $quote_username_text = $quote_username . ' (' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']})"; + $quote_username_text = $quote_username . ' (' . generate_board_url() . '/memberlist.' . PHP_EXT . "?mode=viewprofile&u={$post['author_id']})"; } $forward_text = array(); @@ -881,7 +880,7 @@ function compose_pm($id, $mode, $action) else { $tpl_ary = array_merge($tpl_ary, array( - 'U_VIEW' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $id), + 'U_VIEW' => append_sid('memberlist', 'mode=group&g=' . $id), )); } @@ -944,7 +943,7 @@ function compose_pm($id, $mode, $action) 'SUBJECT' => (isset($message_subject)) ? $message_subject : '', 'MESSAGE' => $message_text, - 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), + 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], @@ -977,8 +976,8 @@ function compose_pm($id, $mode, $action) 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']), - 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup'), - 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup')), + 'U_PROGRESS_BAR' => append_sid('posting', 'f=0&mode=popup'), + 'UA_PROGRESS_BAR' => addslashes(append_sid('posting', 'f=0&mode=popup')), )); // Build custom bbcodes array diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index 2d2ff23cab..46f5740c46 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -21,9 +21,9 @@ if (!defined('IN_PHPBB')) */ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions) { - global $phpbb_root_path, $phpEx, $user, $template, $auth, $config, $db; + global $user, $template, $auth, $config, $db; - $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=options"); + $redirect_url = append_sid('ucp', "i=pm&mode=options"); add_form_key('ucp_pm_options'); // Change "full folder" setting - what to do if folder is full @@ -262,7 +262,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $db->sql_query($sql); - $meta_info = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=$mode"); + $meta_info = append_sid('ucp', "i=pm&mode=$mode"); $message = $user->lang['FOLDER_REMOVED']; meta_refresh(3, $meta_info); @@ -352,7 +352,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit if (!$delete_id) { - redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=' . $mode)); + redirect(append_sid('ucp', 'i=pm&mode=' . $mode)); } // Do we need to confirm? @@ -363,7 +363,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit AND rule_id = $delete_id"; $db->sql_query($sql); - $meta_info = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=' . $mode); + $meta_info = append_sid('ucp', 'i=pm&mode=' . $mode); $message = $user->lang['RULE_DELETED']; // Reset user_message_rules if no more assigned @@ -477,7 +477,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit 'DEFAULT_ACTION' => ($config['full_folder_action'] == 1) ? $user->lang['DELETE_OLDEST_MESSAGES'] : $user->lang['HOLD_NEW_MESSAGES'], - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=rule_string&select_single=true'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=ucp&field=rule_string&select_single=true'), )); $rule_lang = $action_lang = $check_lang = array(); diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 0137531154..25e1497ca6 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -22,8 +22,7 @@ if (!defined('IN_PHPBB')) */ function view_folder($id, $mode, $folder_id, $folder) { - global $user, $template, $auth, $db, $cache; - global $phpbb_root_path, $config, $phpEx; + global $user, $template, $auth, $db, $cache, $config; $submit_export = (isset($_POST['submit_export'])) ? true : false; @@ -180,7 +179,7 @@ function view_folder($id, $mode, $folder_id, $folder) else { $user_colour = ($recipient_list[$type][$ug_id]['colour']) ? ' style="font-weight: bold; color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : ''; - $link = '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $ug_id) . '"' . $user_colour . '>'; + $link = '<a href="' . append_sid('memberlist', 'mode=group&g=' . $ug_id) . '"' . $user_colour . '>'; $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . (($link) ? '</a>' : ''); } } @@ -199,8 +198,8 @@ function view_folder($id, $mode, $folder_id, $folder) $folder_alt = ($row['pm_unread']) ? 'NEW_MESSAGES' : 'NO_NEW_MESSAGES'; // Generate all URIs ... - $view_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=view&f=$folder_id&p=$message_id"); - $remove_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&action=delete&p=$message_id"); + $view_message_url = append_sid('ucp', "i=$id&mode=view&f=$folder_id&p=$message_id"); + $remove_message_url = append_sid('ucp', "i=$id&mode=compose&action=delete&p=$message_id"); $row_indicator = ''; foreach ($color_rows as $var) @@ -228,7 +227,7 @@ function view_folder($id, $mode, $folder_id, $folder) 'SENT_TIME' => $user->format_date($row['message_time']), 'SUBJECT' => censor_text($row['message_subject']), 'FOLDER' => (isset($folder[$row['folder_id']])) ? $folder[$row['folder_id']]['folder_name'] : '', - 'U_FOLDER' => (isset($folder[$row['folder_id']])) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'folder=' . $row['folder_id']) : '', + 'U_FOLDER' => (isset($folder[$row['folder_id']])) ? append_sid('ucp', 'folder=' . $row['folder_id']) : '', 'PM_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '', 'PM_ICON_URL' => (!empty($icons[$row['icon_id']])) ? $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] : '', 'FOLDER_IMG' => $user->img($folder_img, $folder_alt), @@ -280,7 +279,7 @@ function view_folder($id, $mode, $folder_id, $folder) { $row = &$folder_info['rowset'][$message_id]; - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); $sql = 'SELECT p.message_text, p.bbcode_uid FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -439,7 +438,7 @@ function view_folder($id, $mode, $folder_id, $folder) */ function get_pm_from($folder_id, $folder, $user_id) { - global $user, $db, $template, $config, $auth, $phpbb_root_path, $phpEx; + global $user, $db, $template, $config, $auth; $start = request_var('start', 0); @@ -498,7 +497,7 @@ function get_pm_from($folder_id, $folder, $user_id) } $template->assign_vars(array( - 'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"), $pm_count, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination(append_sid('ucp', "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"), $pm_count, $config['topics_per_page'], $start), 'PAGE_NUMBER' => on_page($pm_count, $config['topics_per_page'], $start), 'TOTAL_MESSAGES' => (($pm_count == 1) ? $user->lang['VIEW_PM_MESSAGE'] : sprintf($user->lang['VIEW_PM_MESSAGES'], $pm_count)), @@ -511,8 +510,8 @@ function get_pm_from($folder_id, $folder, $user_id) 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_TOPIC_ICONS' => ($config['enable_pm_icons']) ? true : false, - 'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose') : '', - 'S_PM_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id")) + 'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid('ucp', 'i=pm&mode=compose') : '', + 'S_PM_ACTION' => append_sid('ucp', "i=pm&mode=view&action=view_folder&f=$folder_id")) ); // Grab all pm data diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 31208d9b01..62932d013a 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -21,8 +21,7 @@ if (!defined('IN_PHPBB')) */ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) { - global $user, $template, $auth, $db, $cache; - global $phpbb_root_path, $phpEx, $config; + global $user, $template, $auth, $db, $cache, $config; $user->add_lang(array('viewtopic', 'memberlist')); @@ -33,7 +32,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // Not able to view message, it was deleted by the sender if ($message_row['pm_deleted']) { - $meta_info = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&folder=$folder_id"); + $meta_info = append_sid('ucp', "i=pm&folder=$folder_id"); $message = $user->lang['NO_AUTH_READ_REMOVED_MESSAGE']; $message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>'); @@ -54,7 +53,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // Instantiate BBCode if need be if ($message_row['bbcode_bitfield']) { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); $bbcode = new bbcode($message_row['bbcode_bitfield']); } @@ -155,7 +154,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) { if ($bbcode === false) { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); $bbcode = new bbcode($user_info['user_sig_bbcode_bitfield']); } @@ -166,7 +165,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $signature = smiley_text($signature); } - $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); + $url = append_sid('ucp', 'i=pm'); $template->assign_vars(array( 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), @@ -199,13 +198,13 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'EDITED_MESSAGE' => $l_edited_by, 'MESSAGE_ID' => $message_row['msg_id'], - 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $author_id) : '', + 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid('ucp', 'i=pm&mode=compose&u=' . $author_id) : '', 'U_WWW' => (!empty($user_info['user_website'])) ? $user_info['user_website'] : '', 'U_ICQ' => ($user_info['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($user_info['user_icq']) : '', - 'U_AIM' => ($user_info['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=aim&u=' . $author_id) : '', + 'U_AIM' => ($user_info['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid('memberlist', 'mode=contact&action=aim&u=' . $author_id) : '', 'U_YIM' => ($user_info['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($user_info['user_yim']) . '&.src=pg' : '', - 'U_MSN' => ($user_info['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=msnm&u=' . $author_id) : '', - 'U_JABBER' => ($user_info['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $author_id) : '', + 'U_MSN' => ($user_info['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid('memberlist', 'mode=contact&action=msnm&u=' . $author_id) : '', + 'U_JABBER' => ($user_info['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid('memberlist', 'mode=contact&action=jabber&u=' . $author_id) : '', 'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_EMAIL' => $user_info['email'], @@ -250,8 +249,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) */ function get_user_information($user_id, $user_row) { - global $db, $auth, $user, $cache; - global $phpbb_root_path, $phpEx, $config; + global $db, $auth, $user, $cache, $config; if (!$user_id) { @@ -292,7 +290,7 @@ function get_user_information($user_id, $user_row) if (!function_exists('get_user_avatar')) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); } $user_row['avatar'] = ($user->optionget('viewavatars')) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : ''; @@ -301,7 +299,7 @@ function get_user_information($user_id, $user_row) if (!empty($user_row['user_allow_viewemail']) || $auth->acl_get('a_email')) { - $user_row['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$user_id") : ((($config['board_hide_emails'] && !$auth->acl_get('a_email')) || empty($user_row['user_email'])) ? '' : 'mailto:' . $user_row['user_email']); + $user_row['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid('memberlist', "mode=email&u=$user_id") : ((($config['board_hide_emails'] && !$auth->acl_get('a_email')) || empty($user_row['user_email'])) ? '' : 'mailto:' . $user_row['user_email']); } return $user_row; diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 3762cf25f6..6648661560 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -27,7 +27,7 @@ class ucp_prefs function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $template; $submit = (isset($_POST['submit'])) ? true : false; $error = $data = array(); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 65fef2d267..fae48b84fa 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -29,7 +29,7 @@ class ucp_profile function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $template; $user->add_lang('posting'); @@ -137,7 +137,7 @@ class ucp_profile { $message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN'; - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $server_url = generate_board_url(); @@ -160,7 +160,7 @@ class ucp_profile $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($data['username']), - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey") + 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u={$user->data['user_id']}&k=$user_actkey") ); $messenger->send(NOTIFY_EMAIL); @@ -192,8 +192,8 @@ class ucp_profile $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($data['username']), - 'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u={$user->data['user_id']}", - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey") + 'U_USER_DETAILS' => "$server_url/memberlist." . PHP_EXT . "?mode=viewprofile&u={$user->data['user_id']}", + 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u={$user->data['user_id']}&k=$user_actkey") ); $messenger->send($row['user_notify_type']); @@ -225,8 +225,8 @@ class ucp_profile // Now, we can remove the user completely (kill the session) - NOT BEFORE!!! if (!empty($sql_ary['user_actkey'])) { - meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx)); - $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid($phpbb_root_path . 'index.' . $phpEx) . '">', '</a>'); + meta_refresh(5, append_sid('index')); + $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); // Because the user gets deactivated we log him out too, killing his session $user->session_kill(); @@ -265,7 +265,7 @@ class ucp_profile case 'profile_info': - include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); $cp = new custom_profile(); @@ -461,8 +461,8 @@ class ucp_profile trigger_error('NO_AUTH_SIGNATURE'); } - include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false; $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false; @@ -474,7 +474,7 @@ class ucp_profile if ($submit || $preview) { - include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT); if (!sizeof($error)) { @@ -534,7 +534,7 @@ class ucp_profile 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', - 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), + 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], @@ -556,13 +556,13 @@ class ucp_profile case 'avatar': - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); $display_gallery = request_var('display_gallery', '0'); $avatar_select = basename(request_var('avatar_select', '')); $category = basename(request_var('category', '')); - $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + $can_upload = ($config['allow_avatar_upload'] && file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; add_form_key('ucp_avatar'); @@ -590,7 +590,7 @@ class ucp_profile 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']), 'AVATAR_SIZE' => $config['avatar_filesize'], - 'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=avatar&display_gallery=1'), + 'U_GALLERY' => append_sid('ucp', 'i=profile&mode=avatar&display_gallery=1'), 'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '', diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 4e94501d39..1b75494e4e 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -27,7 +27,7 @@ class ucp_register function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $template; // if ($config['require_activation'] == USER_ACTIVATION_DISABLE) @@ -35,7 +35,7 @@ class ucp_register trigger_error('UCP_REGISTER_DISABLE'); } - include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); $confirm_id = request_var('confirm_id', ''); $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; @@ -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(PHPBB_ROOT_PATH . 'language/' . $use_lang . '/')) { if ($change_lang) { @@ -69,7 +69,7 @@ class ucp_register } $user->lang_name = $lang = $use_lang; - $user->lang_path = $phpbb_root_path . 'language/' . $lang . '/'; + $user->lang_path = PHPBB_ROOT_PATH . 'language/' . $lang . '/'; $user->lang = array(); $user->add_lang(array('common', 'ucp')); } @@ -117,12 +117,12 @@ class ucp_register 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), - 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0' . $add_lang), - 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1' . $add_lang), + 'U_COPPA_NO' => append_sid('ucp', 'mode=register&coppa=0' . $add_lang), + 'U_COPPA_YES' => append_sid('ucp', 'mode=register&coppa=1' . $add_lang), 'S_SHOW_COPPA' => true, 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), - 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang), + 'S_UCP_ACTION' => append_sid('ucp', 'mode=register' . $add_lang), )); } else @@ -133,7 +133,7 @@ class ucp_register 'S_SHOW_COPPA' => false, 'S_REGISTRATION' => true, 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), - 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang . $add_coppa), + 'S_UCP_ACTION' => append_sid('ucp', 'mode=register' . $add_lang . $add_coppa), ) ); } @@ -359,7 +359,7 @@ class ucp_register if ($config['email_enable']) { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(false); @@ -376,7 +376,7 @@ class ucp_register 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), 'USERNAME' => htmlspecialchars_decode($data['username']), 'PASSWORD' => htmlspecialchars_decode($data['new_password']), - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") + 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u=$user_id&k=$user_actkey") ); if ($coppa) @@ -417,8 +417,8 @@ class ucp_register $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($data['username']), - 'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id", - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") + 'U_USER_DETAILS' => "$server_url/memberlist." . PHP_EXT . "?mode=viewprofile&u=$user_id", + 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u=$user_id&k=$user_actkey") ); $messenger->send($row['user_notify_type']); @@ -427,7 +427,7 @@ class ucp_register } } - $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); + $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); trigger_error($message); } } @@ -501,7 +501,7 @@ class ucp_register ); $db->sql_query($sql); } - $confirm_image = '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_REG . $str) . '" alt="" title="" />'; + $confirm_image = '<img src="' . append_sid('ucp', 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_REG . $str) . '" alt="" title="" />'; $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />'; } @@ -537,7 +537,7 @@ class ucp_register 'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false, 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, - 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), + 'S_UCP_ACTION' => append_sid('ucp', 'mode=register'), ) ); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 12de817099..05dfe5d74d 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -27,8 +27,7 @@ class ucp_remind function main($id, $mode) { - global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $template; + global $db, $user, $auth, $template, $config; $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); @@ -79,7 +78,7 @@ class ucp_remind WHERE user_id = " . $user_row['user_id']; $db->sql_query($sql); - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(false); @@ -91,22 +90,22 @@ class ucp_remind $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey") + 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u={$user_row['user_id']}&k=$user_actkey") ); $messenger->send($user_row['user_notify_type']); - meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + meta_refresh(3, append_sid('index')); - $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); + $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); trigger_error($message); } $template->assign_vars(array( 'USERNAME' => $username, 'EMAIL' => $email, - 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')) - ); + 'S_PROFILE_ACTION' => append_sid('ucp', 'mode=sendpassword'), + )); $this->tpl_name = 'ucp_remind'; $this->page_title = 'UCP_REMIND'; diff --git a/phpBB/includes/ucp/ucp_resend.php b/phpBB/includes/ucp/ucp_resend.php index 48176a3989..92445868e4 100644 --- a/phpBB/includes/ucp/ucp_resend.php +++ b/phpBB/includes/ucp/ucp_resend.php @@ -27,8 +27,7 @@ class ucp_resend function main($id, $mode) { - global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $template; + global $db, $user, $auth, $template, $config; $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); @@ -86,7 +85,7 @@ class ucp_resend $coppa = ($row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL) ? true : false; - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(false); if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa) @@ -102,7 +101,7 @@ class ucp_resend $messenger->assign_vars(array( 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), 'USERNAME' => htmlspecialchars_decode($user_row['username']), - 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") + 'U_ACTIVATE' => generate_board_url() . '/ucp.' . PHP_EXT . "?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") ); if ($coppa) @@ -135,27 +134,27 @@ class ucp_resend $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username']), - 'U_USER_DETAILS' => generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$user_row['user_id']}", - 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") - ); + 'U_USER_DETAILS' => generate_board_url() . '/memberlist.' . PHP_EXT . "?mode=viewprofile&u={$user_row['user_id']}", + 'U_ACTIVATE' => generate_board_url() . '/ucp.' . PHP_EXT . "?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}", + )); $messenger->send($row['user_notify_type']); } $db->sql_freeresult($result); } - meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + meta_refresh(3, append_sid('index')); $message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT']; - $message .= '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); + $message .= '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); trigger_error($message); } $template->assign_vars(array( 'USERNAME' => $username, 'EMAIL' => $email, - 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=resend_act')) - ); + 'S_PROFILE_ACTION' => append_sid('ucp', 'mode=resend_act'), + )); $this->tpl_name = 'ucp_resend'; $this->page_title = 'UCP_RESEND'; diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index fb5df9394b..f0a0b1b63d 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -26,7 +26,7 @@ class ucp_zebra function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $template; $submit = (isset($_POST['submit']) || isset($_GET['add']) || isset($_GET['remove'])) ? true : false; $s_hidden_fields = ''; @@ -238,12 +238,12 @@ class ucp_zebra $template->assign_vars(array( 'L_TITLE' => $user->lang['UCP_ZEBRA_' . $l_mode], - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=add'), + 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=ucp&field=add'), 'S_USERNAME_OPTIONS' => $s_username_options, 'S_HIDDEN_FIELDS' => $s_hidden_fields, - 'S_UCP_ACTION' => $this->u_action) - ); + 'S_UCP_ACTION' => $this->u_action, + )); $this->tpl_name = 'ucp_zebra_' . $mode; $this->page_title = 'UCP_ZEBRA_' . $l_mode; diff --git a/phpBB/includes/utf/utf_normalizer.php b/phpBB/includes/utf/utf_normalizer.php index 9048a71e51..5f88adaa4c 100644 --- a/phpBB/includes/utf/utf_normalizer.php +++ b/phpBB/includes/utf/utf_normalizer.php @@ -93,14 +93,12 @@ class utf_normalizer // Note: we do not check for $GLOBALS['utf_canonical_decomp']. It is assumed they are always loaded together if (!isset($GLOBALS['utf_nfc_qc'])) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_nfc_qc.' . PHP_EXT); } if (!isset($GLOBALS['utf_canonical_decomp'])) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_canonical_decomp.' . PHP_EXT); } // Replace any byte in the range 0x00..0x1F, except for \r, \n and \t @@ -133,14 +131,12 @@ class utf_normalizer if (!isset($GLOBALS['utf_nfc_qc'])) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_nfc_qc.' . PHP_EXT); } if (!isset($GLOBALS['utf_canonical_decomp'])) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_canonical_decomp.' . PHP_EXT); } $str = self::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); @@ -165,14 +161,12 @@ class utf_normalizer if (!isset($GLOBALS['utf_nfkc_qc'])) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfkc_qc.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_nfkc_qc.' . PHP_EXT); } if (!isset($GLOBALS['utf_compatibility_decomp'])) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_compatibility_decomp.' . PHP_EXT); } $str = self::recompose($str, $pos, $len, $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); @@ -197,8 +191,7 @@ class utf_normalizer if (!isset($GLOBALS['utf_canonical_decomp'])) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_canonical_decomp.' . PHP_EXT); } $str = self::decompose($str, $pos, $len, $GLOBALS['utf_canonical_decomp']); @@ -223,8 +216,7 @@ class utf_normalizer if (!isset($GLOBALS['utf_compatibility_decomp'])) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_compatibility_decomp.' . PHP_EXT); } $str = self::decompose($str, $pos, $len, $GLOBALS['utf_compatibility_decomp']); @@ -250,15 +242,13 @@ class utf_normalizer // Load some commonly-used tables if (!isset($utf_jamo_index, $utf_jamo_type, $utf_combining_class)) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_normalizer_common.' . PHP_EXT); } // Load the canonical composition table if (!isset($utf_canonical_comp)) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_comp.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_canonical_comp.' . PHP_EXT); } // Buffer the last ASCII char before the UTF-8 stuff if applicable @@ -951,8 +941,7 @@ class utf_normalizer // Load some commonly-used tables if (!isset($utf_combining_class)) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/data/utf_normalizer_common.' . PHP_EXT); } // UTF char length array diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 5345cc746d..8dbb236a1c 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -634,24 +634,23 @@ function utf8_decode_ncr_callback($m) function utf8_case_fold($text, $option = 'full') { static $uniarray = array(); - global $phpbb_root_path, $phpEx; // common is always set if (!isset($uniarray['c'])) { - $uniarray['c'] = include($phpbb_root_path . 'includes/utf/data/case_fold_c.' . $phpEx); + $uniarray['c'] = include(PHPBB_ROOT_PATH . 'includes/utf/data/case_fold_c.' . PHP_EXT); } // only set full if we need to if ($option === 'full' && !isset($uniarray['f'])) { - $uniarray['f'] = include($phpbb_root_path . 'includes/utf/data/case_fold_f.' . $phpEx); + $uniarray['f'] = include(PHPBB_ROOT_PATH . 'includes/utf/data/case_fold_f.' . PHP_EXT); } // only set simple if we need to if ($option !== 'full' && !isset($uniarray['s'])) { - $uniarray['s'] = include($phpbb_root_path . 'includes/utf/data/case_fold_s.' . $phpEx); + $uniarray['s'] = include(PHPBB_ROOT_PATH . 'includes/utf/data/case_fold_s.' . PHP_EXT); } // common is always replaced @@ -1248,15 +1247,13 @@ function utf8_case_fold_nfkc($text, $option = 'full') "\xF0\x9D\x9E\xBB" => "\xCF\x83", "\xF0\x9D\x9F\x8A" => "\xCF\x9D", ); - global $phpbb_root_path, $phpEx; // do the case fold $text = utf8_case_fold($text, $option); if (!class_exists('utf_normalizer')) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/utf_normalizer.' . PHP_EXT); } // convert to NFKC @@ -1345,7 +1342,6 @@ function utf8_case_fold_nfc($text, $option = 'full') "\xE1\xBF\xB7" => "\xE1\xBF\xB6\xCD\x85", "\xE1\xBF\xBC" => "\xCE\xA9\xCD\x85", ); - global $phpbb_root_path, $phpEx; // perform a small trick, avoid further normalization on composed points that contain U+0345 in their decomposition $text = strtr($text, $ypogegrammeni); @@ -1372,8 +1368,7 @@ function utf8_normalize_nfc($strings) if (!class_exists('utf_normalizer')) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/utf/utf_normalizer.' . PHP_EXT); } if (!is_array($strings)) @@ -1416,12 +1411,11 @@ function utf8_normalize_nfc($strings) */ function utf8_clean_string($text) { - global $phpbb_root_path, $phpEx; - static $homographs = array(); + if (empty($homographs)) { - $homographs = include($phpbb_root_path . 'includes/utf/data/confusables.' . $phpEx); + $homographs = include(PHPBB_ROOT_PATH . 'includes/utf/data/confusables.' . PHP_EXT); } $text = utf8_case_fold_nfkc($text); |