From d0cd2152ff810e2cf724ea206b9a0934e08795e2 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 2 Jun 2008 17:15:43 +0000 Subject: [PATCH] give the ACP a login screen git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8581 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/index.php | 11 +++++-- phpBB/adm/style/acp_login.html | 46 ++++++++++++++++++++++++++ phpBB/adm/style/overall_header.html | 2 ++ phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 51 ++++++++++++++++++++++++----- 5 files changed, 100 insertions(+), 11 deletions(-) create mode 100755 phpBB/adm/style/acp_login.html diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index c0fa2fdddb..83c4044687 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -28,10 +28,14 @@ $user->setup('acp/common'); // End session management // Have they authenticated (again) as an admin for this session? -if (!isset($user->data['session_admin']) || !$user->data['session_admin']) +if ($user->data['user_id'] != ANONYMOUS && (!isset($user->data['session_admin']) || !$user->data['session_admin'])) { login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false); } +else if ($user->data['user_id'] == ANONYMOUS) +{ + login_box(); +} // Is user any type of admin? No, then stop here, each script needs to // check specific permissions but this is a catchall @@ -108,7 +112,7 @@ function adm_page_header($page_title) $template->assign_vars(array( 'PAGE_TITLE' => $page_title, - 'USERNAME' => $user->data['username'], + 'USERNAME' => ($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '', 'SID' => $SID, '_SID' => $_SID, @@ -120,6 +124,9 @@ function adm_page_header($page_title) 'U_ADM_INDEX' => append_sid("{$phpbb_admin_path}index.$phpEx"), 'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"), + 'S_USER_ADMIN' => $user->data['session_admin'], + 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS && !$user->data['is_bot']), + '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']}/", diff --git a/phpBB/adm/style/acp_login.html b/phpBB/adm/style/acp_login.html new file mode 100755 index 0000000000..015f3ec908 --- /dev/null +++ b/phpBB/adm/style/acp_login.html @@ -0,0 +1,46 @@ + +

{PAGE_TITLE}

+

{LOGIN_EXPLAIN}{L_LOGIN}

+ + +
+

{L_WARNING}

+

{LOGIN_ERROR}

+
+ +
+ +
+
+
+
+
+
+
+
+ +
{L_FORGOT_PASS}
+
{L_RESEND_ACTIVATION}
+ +
+ + +
+

{L_CONFIRM_CODE_EXPLAIN}
+
{CONFIRM_IMAGE}
+
+
+ + +

+ + + + +   + {S_HIDDEN_FIELDS} +

+
+
+ + diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index 5294a101f9..adafc0aa6d 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -186,6 +186,7 @@ function switch_menu()
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e0fb51610b..52e983c1e1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -110,6 +110,7 @@
  • [Change] Show email ban reason on registration. Additionally allow custom errors properly returned if using validate_data(). (Bug #26885)
  • [Feature] Streamlined banning via the MCP by adding a ban link to the user profile. Also pre-fills ban fields as far as possible.
  • [Feature] Added ACP logout to reset an admin session.
  • +
  • [Feature] Handle ACP logins with admin style
  • diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 600506d08f..f45bfa57b3 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2234,7 +2234,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, $phpEx, $phpbb_root_path, $phpbb_admin_path, $config; $err = ''; @@ -2243,6 +2243,16 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa { $user->setup(); } + + if (defined('ADMIN_START')) + { + // Set custom template for admin area + $template->set_custom_template($phpbb_admin_path . 'style', 'admin'); + $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); + + // the acp template is never stored in the database + $user->theme['template_storedb'] = false; + } // Print out error if user tries to authenticate as an administrator without having the privileges... if ($admin && !$auth->acl_get('a_')) @@ -2447,20 +2457,43 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_ADMIN_AUTH' => $admin, + 'S_ACP_LOGIN' => defined('ADMIN_START'), 'USERNAME' => ($admin) ? $user->data['username'] : '', 'USERNAME_CREDENTIAL' => 'username', 'PASSWORD_CREDENTIAL' => ($admin) ? 'password_' . $credential : 'password', )); - - page_header($user->lang['LOGIN'], false); - - $template->set_filenames(array( - 'body' => 'login_body.html') - ); + + if (defined('ADMIN_START')) + { + $template->set_filenames(array( + 'body' => 'acp_login.html') + ); + $template->assign_block_vars('t_block1', array( + 'L_TITLE' => $user->lang['LOGIN'], + 'S_SELECTED' => true, + 'U_TITLE' => '', + )); + adm_page_header($user->lang['LOGIN'], false); + } + else + { + $template->set_filenames(array( + 'body' => 'login_body.html') + ); + page_header($user->lang['LOGIN'], false); + } + make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); - - page_footer(); + if (defined('ADMIN_START') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_footer(); + } + else + { + page_footer(); + } + } /**