1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-13 20:28:44 +01:00

[ticket/11259] Make phpbb_admin_path available everywhere

PHPBB3-11259
This commit is contained in:
Nathan Guse 2012-12-09 17:01:08 -06:00
parent bd987b6e14
commit 6dee253941
16 changed files with 45 additions and 32 deletions

View File

@ -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;

View File

@ -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">

View File

@ -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[

View File

@ -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', '');

View File

@ -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);

View File

@ -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">

View File

@ -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>&reg; Forum Software &copy; 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

View File

@ -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',
);

View File

@ -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&amp;name=group_colour'),
'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=ucp&amp;name=group_colour'),
'S_UCP_ACTION' => $this->u_action . "&amp;action=$action&amp;g=$group_id",
'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(),
));

View File

@ -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>

View File

@ -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">';

View File

@ -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&amp;language=' . $data['language']), '../docs/README.html'),
'L_SUBMIT' => $lang['INSTALL_LOGIN'],
'U_ACTION' => append_sid($phpbb_root_path . 'adm/index.' . $phpEx, 'i=send_statistics&amp;mode=send_statistics'),
'U_ACTION' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=send_statistics&amp;mode=send_statistics'),
));
}

View File

@ -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&amp;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&amp;mode=$mode&amp;sub=file_check"),
'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;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';
}

View File

@ -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&amp;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',

View File

@ -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&amp;mode=overview&amp;u=' . $user_id, true, $user->session_id) : '',
'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&amp;mode=overview&amp;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&amp;mode=user&amp;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) : '',

View File

@ -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;