diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2004-09-01 15:47:46 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2004-09-01 15:47:46 +0000 |
commit | 070cbefa461d53031b6fa8a168c3e9c9db539fb0 (patch) | |
tree | 9fcb30f2d3360c5805935226aad8234ab254beb5 /phpBB/adm/pagestart.php | |
parent | 3c8e36b458742116a41f90421e20251df97c528c (diff) | |
download | forums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.tar forums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.tar.gz forums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.tar.bz2 forums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.tar.xz forums-070cbefa461d53031b6fa8a168c3e9c9db539fb0.zip |
This is a mass commit ... expect trouble! Changes made here are primarily to how login is handled, schema changes necessary!
git-svn-id: file:///svn/phpbb/trunk@4970 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/adm/pagestart.php')
-rw-r--r-- | phpBB/adm/pagestart.php | 87 |
1 files changed, 81 insertions, 6 deletions
diff --git a/phpBB/adm/pagestart.php b/phpBB/adm/pagestart.php index b74a01bbf3..32a72d14e7 100644 --- a/phpBB/adm/pagestart.php +++ b/phpBB/adm/pagestart.php @@ -11,27 +11,40 @@ // // ------------------------------------------------------------- -if (!defined('IN_PHPBB') || !isset($phpbb_root_path)) +if (!defined('IN_PHPBB')) { - die('Hacking attempt'); + exit; } define('NEED_SID', true); +define('IN_ADMIN', true); require($phpbb_root_path . 'common.'.$phpEx); require($phpbb_root_path . 'includes/functions_admin.'.$phpEx); // Start session management $user->start(); +$auth->acl($user->data); +$user->setup('admin'); +// End session management // Did user forget to login? Give 'em a chance to here ... if ($user->data['user_id'] == ANONYMOUS) { - login_box("./adm/index.$phpEx$SID", '', $user->lang['LOGIN_ADMIN']); + login_box('', $user->lang['LOGIN_ADMIN'], $user->lang['LOGIN_ADMIN_SUCCESS'], true); } -$auth->acl($user->data); -$user->setup('admin'); -// End session management +// Have they authenticated (again) as an admin for this session? +if (!$user->data['session_admin']) +{ + login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false); +} + +// Is user any type of admin? No, then stop here, each script needs to +// check specific permissions but this is a catchall +if (!$auth->acl_get('a_')) +{ + trigger_error($user->lang['NO_ADMIN']); +} // Some oft used variables $safe_mode = (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') ? true : false; @@ -257,6 +270,68 @@ function adm_page_confirm($title, $message) } + +function build_cfg_template($tpl_type, $config_key, $options = '') +{ + global $new, $user; + + $tpl = ''; + $name = 'config[' . $config_key . ']'; + + switch ($tpl_type[0]) + { + case 'text': + case 'password': + $size = (int) $tpl_type[1]; + $maxlength = (int) $tpl_type[2]; + + $tpl = '<input class="post" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '" />'; + break; + + case 'dimension': + $size = (int) $tpl_type[1]; + $maxlength = (int) $tpl_type[2]; + + $tpl = '<input class="post" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" /> x <input class="post" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" />'; + break; + + case 'textarea': + $rows = (int) $tpl_type[1]; + $cols = (int) $tpl_type[2]; + + $tpl = '<textarea name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new[$config_key] . '</textarea>'; + break; + + case 'radio': + $key_yes = ($new[$config_key]) ? ' checked="checked"' : ''; + $key_no = (!$new[$config_key]) ? ' checked="checked"' : ''; + + $tpl_type_cond = explode('_', $tpl_type[1]); + $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; + + $tpl_no = '<input type="radio" name="' . $name . '" value="0"' . $key_no . ' />' . (($type_no) ? $user->lang['NO'] : $user->lang['DISABLED']); + $tpl_yes = '<input type="radio" name="' . $name . '" value="1"' . $key_yes . ' />' . (($type_no) ? $user->lang['YES'] : $user->lang['ENABLED']); + + $tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . ' ' . $tpl_no : $tpl_no . ' ' . $tpl_yes; + break; + + case 'select': + eval('$s_options = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';'); + $tpl = '<select name="' . $name . '">' . $s_options . '</select>'; + break; + + case 'custom': + eval('$tpl = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';'); + break; + + default: + break; + } + + return $tpl; +} + + // General ACP module class class module { |