diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-12-09 17:01:08 -0600 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-12-09 17:01:08 -0600 |
commit | 6dee2539419ba2c050830b7677294603a63b559a (patch) | |
tree | 4981e8a9d0cd2e4ecaf22f1907242397719d2cd6 /phpBB | |
parent | bd987b6e14ffc134f1c1972e3c0fb3b0a19e09b2 (diff) | |
download | forums-6dee2539419ba2c050830b7677294603a63b559a.tar forums-6dee2539419ba2c050830b7677294603a63b559a.tar.gz forums-6dee2539419ba2c050830b7677294603a63b559a.tar.bz2 forums-6dee2539419ba2c050830b7677294603a63b559a.tar.xz forums-6dee2539419ba2c050830b7677294603a63b559a.zip |
[ticket/11259] Make phpbb_admin_path available everywhere
PHPBB3-11259
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/adm/index.php | 1 | ||||
-rw-r--r-- | phpBB/adm/style/install_header.html | 6 | ||||
-rw-r--r-- | phpBB/adm/style/install_update_diff.html | 2 | ||||
-rw-r--r-- | phpBB/adm/swatch.php | 2 | ||||
-rw-r--r-- | phpBB/common.php | 4 | ||||
-rw-r--r-- | phpBB/includes/db/dbal.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_install.php | 3 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_groups.php | 6 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 8 | ||||
-rw-r--r-- | phpBB/install/index.php | 16 | ||||
-rw-r--r-- | phpBB/install/install_install.php | 4 | ||||
-rw-r--r-- | phpBB/install/install_update.php | 11 | ||||
-rw-r--r-- | phpBB/language/en/install.php | 2 | ||||
-rw-r--r-- | phpBB/memberlist.php | 2 | ||||
-rw-r--r-- | phpBB/viewonline.php | 2 |
16 files changed, 45 insertions, 32 deletions
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index e20bbe4bec..2591fa9d24 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -42,7 +42,6 @@ if (!$auth->acl_get('a_')) // We define the admin variables now, because the user is now able to use the admin related features... define('IN_ADMIN', true); -$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : './'; // Some oft used variables $safe_mode = (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) === 'on') ? true : false; diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html index 6826654ded..5631b83e17 100644 --- a/phpBB/adm/style/install_header.html +++ b/phpBB/adm/style/install_header.html @@ -5,7 +5,7 @@ <!-- IF META -->{META}<!-- ENDIF --> <title>{PAGE_TITLE}</title> -<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> +<link href="{T_TEMPLATE_PATH}/admin.css" rel="stylesheet" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ @@ -49,7 +49,7 @@ function dE(n, s, type) </form> <!-- ENDIF --> </div> - + <div id="page-body"> <div id="tabs"> <ul> @@ -73,5 +73,5 @@ function dE(n, s, type) <!-- END l_block2 --> </ul> </div> - + <div id="main" class="install-body"> diff --git a/phpBB/adm/style/install_update_diff.html b/phpBB/adm/style/install_update_diff.html index ecdc40e157..1f30fe4d13 100644 --- a/phpBB/adm/style/install_update_diff.html +++ b/phpBB/adm/style/install_update_diff.html @@ -5,7 +5,7 @@ <!-- IF META -->{META}<!-- ENDIF --> <title>{PAGE_TITLE}</title> -<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> +<link href="{T_TEMPLATE_PATH}/admin.css" rel="stylesheet" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php index 86498a255f..5e8984db70 100644 --- a/phpBB/adm/swatch.php +++ b/phpBB/adm/swatch.php @@ -21,8 +21,6 @@ $user->session_begin(false); $auth->acl($user->data); $user->setup(); -$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : './'; - // Set custom template for admin area $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', ''); diff --git a/phpBB/common.php b/phpBB/common.php index e99b9edee5..ff128553ab 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -63,6 +63,10 @@ if (!defined('PHPBB_INSTALLED')) exit; } +// In case $adm_relative_path is not set (in case of an update), use the default. +$adm_relative_path = (isset($adm_relative_path)) ? ((substr($adm_relative_path, -1) == '/') ? $adm_relative_path : $adm_relative_path . '/') : 'adm/'; +$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $adm_relative_path; + // Include files require($phpbb_root_path . 'includes/class_loader.' . $phpEx); diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index ef1dd7d14d..c2708b09b2 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -822,7 +822,7 @@ class dbal */ function sql_report($mode, $query = '') { - global $cache, $starttime, $phpbb_root_path, $user; + global $cache, $starttime, $phpbb_root_path, $phpbb_admin_path, $user; global $request; if (is_object($request) && !$request->variable('explain', false)) @@ -852,7 +852,7 @@ class dbal <head> <meta charset="utf-8"> <title>SQL Report</title> - <link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> + <link href="' . $phpbb_admin_path . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body id="errorpage"> <div id="wrap"> diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e492f97022..5fa5c5f505 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5339,7 +5339,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 function page_footer($run_cron = true, $display_template = true, $exit_handler = true) { global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx; - global $request, $phpbb_dispatcher; + global $request, $phpbb_dispatcher, $phpbb_admin_path; // A listener can set this variable to `true` when it overrides this function $page_footer_override = false; @@ -5395,7 +5395,7 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler = 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'), - 'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", false, true, $user->session_id) : '') + 'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id) : '') ); // Call cron-type script diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index ab6b3ea009..1218ac401b 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -515,6 +515,9 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test 'dbuser' => $data['dbuser'], 'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']), 'table_prefix' => $data['table_prefix'], + + 'adm_relative_path' => 'adm/', + 'acm_type' => 'phpbb_cache_driver_file', ); diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 9652986cf2..d92aea91f8 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -25,7 +25,7 @@ class ucp_groups function main($id, $mode) { - global $config, $phpbb_root_path, $phpEx; + global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path; global $db, $user, $auth, $cache, $template; global $request; @@ -438,7 +438,7 @@ class ucp_groups $group_name = $group_row['group_name']; $group_type = $group_row['group_type']; - $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_admin_path . 'images/no_avatar.gif" alt="" />'; $template->assign_vars(array( 'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name, @@ -730,7 +730,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("{$phpbb_admin_path}swatch.$phpEx", 'form=ucp&name=group_colour'), 'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id", 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(), )); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 30592b995d..38bfe978e5 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -73,6 +73,10 @@ if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update."); } +// In case $adm_relative_path is not set (in case of an update), use the default. +$adm_relative_path = (isset($adm_relative_path)) ? ((substr($adm_relative_path, -1) == '/') ? $adm_relative_path : $adm_relative_path . '/') : 'adm/'; +$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $adm_relative_path; + // Include files require($phpbb_root_path . 'includes/class_loader.' . $phpEx); @@ -232,7 +236,7 @@ if ($has_global && !$ga_forum_id) <title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title> - <link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> + <link href="<?php echo $phpbb_admin_path; ?>style/admin.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -282,7 +286,7 @@ header('Content-type: text/html; charset=UTF-8'); <title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title> -<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> +<link href="<?php echo $phpbb_admin_path; ?>style/admin.css" rel="stylesheet" type="text/css" media="screen" /> </head> diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 09560946a6..22dc12fe99 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -73,6 +73,10 @@ else } @ini_set('memory_limit', $mem_limit); +// In case $adm_relative_path is not set (in case of an update), use the default. +$adm_relative_path = (isset($adm_relative_path)) ? ((substr($adm_relative_path, -1) == '/') ? $adm_relative_path : $adm_relative_path . '/') : 'adm/'; +$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $adm_relative_path; + // Include essential scripts require($phpbb_root_path . 'includes/class_loader.' . $phpEx); @@ -215,9 +219,9 @@ $phpbb_style_path_provider = new phpbb_style_path_provider(); $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, new phpbb_template_context()); $phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template); $phpbb_style->set_ext_dir_prefix('adm/'); -$phpbb_style->set_custom_style('admin', '../adm/style', ''); +$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', ''); $template->assign_var('T_ASSETS_PATH', '../assets'); -$template->assign_var('T_TEMPLATE_PATH', '../adm/style'); +$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); $install = new module(); @@ -361,7 +365,7 @@ class module } define('HEADER_INC', true); - global $template, $lang, $stage, $phpbb_root_path; + global $template, $lang, $stage, $phpbb_root_path, $phpbb_admin_path; $template->assign_vars(array( 'L_CHANGE' => $lang['CHANGE'], @@ -370,7 +374,7 @@ class module 'L_SELECT_LANG' => $lang['SELECT_LANG'], 'L_SKIP' => $lang['SKIP'], 'PAGE_TITLE' => $this->get_page_title(), - 'T_IMAGE_PATH' => $phpbb_root_path . 'adm/images/', + 'T_IMAGE_PATH' => $phpbb_admin_path . 'images/', 'S_CONTENT_DIRECTION' => $lang['DIRECTION'], 'S_CONTENT_FLOW_BEGIN' => ($lang['DIRECTION'] == 'ltr') ? 'left' : 'right', @@ -551,7 +555,7 @@ class module */ function error($error, $line, $file, $skip = false) { - global $lang, $db, $template; + global $lang, $db, $template, $phpbb_admin_path; if ($skip) { @@ -573,7 +577,7 @@ class module echo '<head>'; echo '<meta charset="utf-8">'; echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>'; - echo '<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />'; + echo '<link href="' . $phpbb_admin_path . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" />'; echo '</head>'; echo '<body id="errorpage">'; echo '<div id="wrap">'; diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 4b2fa046bc..197554d20f 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1813,7 +1813,7 @@ class install_install extends module */ function email_admin($mode, $sub) { - global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpEx; + global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx; $this->page_title = $lang['STAGE_FINAL']; @@ -1860,7 +1860,7 @@ class install_install extends module 'TITLE' => $lang['INSTALL_CONGRATS'], 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&language=' . $data['language']), '../docs/README.html'), 'L_SUBMIT' => $lang['INSTALL_LOGIN'], - 'U_ACTION' => append_sid($phpbb_root_path . 'adm/index.' . $phpEx, 'i=send_statistics&mode=send_statistics'), + 'U_ACTION' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=send_statistics&mode=send_statistics'), )); } diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 7f40015002..679850db31 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -72,7 +72,7 @@ class install_update extends module function main($mode, $sub) { global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; - global $request; + global $request, $phpbb_admin_path, $adm_relative_path; $this->tpl_name = 'install_update'; $this->page_title = 'UPDATE_INSTALLATION'; @@ -131,7 +131,7 @@ class install_update extends module } // Set custom template again. ;) - $phpbb_style->set_custom_style('admin', '../adm/style', ''); + $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', ''); $template->assign_vars(array( 'S_USER_LANG' => $user->lang['USER_LANG'], @@ -216,7 +216,7 @@ class install_update extends module if ($this->test_update === false) { // Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present - if (in_array('adm/style/install_update.html', $this->update_info['files'])) + if (in_array($adm_relative_path . 'style/install_update.html', $this->update_info['files'])) { $this->tpl_name = '../../install/update/new/adm/style/install_update'; } @@ -493,6 +493,7 @@ class install_update extends module $template->assign_vars(array( 'S_FILE_CHECK' => true, 'S_ALL_UP_TO_DATE' => $all_up_to_date, + 'L_ALL_FILES_UP_TO_DATE' => $user->lang('ALL_FILES_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')), 'S_VERSION_UP_TO_DATE' => $up_to_date, 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), 'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), @@ -1077,12 +1078,12 @@ class install_update extends module */ function show_diff(&$update_list) { - global $phpbb_root_path, $template, $user; + global $phpbb_root_path, $template, $user, $adm_relative_path; $this->tpl_name = 'install_update_diff'; // Got the diff template itself updated? If so, we are able to directly use it - if (in_array('adm/style/install_update_diff.html', $this->update_info['files'])) + if (in_array($adm_relative_path . 'style/install_update_diff.html', $this->update_info['files'])) { $this->tpl_name = '../../install/update/new/adm/style/install_update_diff'; } diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 1c45deae11..f7820714e1 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -374,7 +374,7 @@ $lang = array_merge($lang, array( // Updater $lang = array_merge($lang, array( - 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now <a href="../ucp.php?mode=login">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="../ucp.php?mode=login&redirect=adm/index.php%3Fi=send_statistics%26mode=send_statistics">Send statistics</a> module in your ACP.', + 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="%2$s">Send statistics</a> module in your ACP.', 'ARCHIVE_FILE' => 'Source file within archive', 'BACK' => 'Back', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index d9ba147c70..79be9ca432 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -649,7 +649,7 @@ switch ($mode) 'S_GROUP_OPTIONS' => $group_options, 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false, - 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_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_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '', 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 687fef4c6c..e483915bd5 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -216,7 +216,7 @@ while ($row = $db->sql_fetchrow($result)) $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); break; - case 'adm/index': + case $adm_relative_path . 'index': $location = $user->lang['ACP']; $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); break; |