diff options
| author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-05-09 14:11:55 +0000 |
|---|---|---|
| committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-05-09 14:11:55 +0000 |
| commit | 2fc8842b0f834bcc86eece396ba3850674dd72c2 (patch) | |
| tree | e8e81c45d3f535dca12150d8e1581700a0873a60 /phpBB/ucp | |
| parent | 21ce5c483169c0959b49c6c90cfb596d9e93112e (diff) | |
| download | forums-2fc8842b0f834bcc86eece396ba3850674dd72c2.tar forums-2fc8842b0f834bcc86eece396ba3850674dd72c2.tar.gz forums-2fc8842b0f834bcc86eece396ba3850674dd72c2.tar.bz2 forums-2fc8842b0f834bcc86eece396ba3850674dd72c2.tar.xz forums-2fc8842b0f834bcc86eece396ba3850674dd72c2.zip | |
Had to make a start on the UCP proper ... note that things may and in places are quite broken
git-svn-id: file:///svn/phpbb/trunk@3996 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/ucp')
| -rw-r--r-- | phpBB/ucp/ucp_prefs.php | 70 | ||||
| -rw-r--r-- | phpBB/ucp/ucp_profile.php | 86 | ||||
| -rw-r--r-- | phpBB/ucp/ucp_register.php | 316 | ||||
| -rw-r--r-- | phpBB/ucp/ucp_zebra.php | 33 |
4 files changed, 312 insertions, 193 deletions
diff --git a/phpBB/ucp/ucp_prefs.php b/phpBB/ucp/ucp_prefs.php new file mode 100644 index 0000000000..97d38dede8 --- /dev/null +++ b/phpBB/ucp/ucp_prefs.php @@ -0,0 +1,70 @@ +<?php +/*************************************************************************** + * usercp_profile.php + * ------------------- + * begin : Saturday, Feb 21, 2003 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * + ***************************************************************************/ + +class ucp_prefs extends ucp +{ + function main($module_id) + { + global $config, $db, $user, $SID, $template, $phpEx; + + $submode = ($_REQUEST['mode']) ? htmlspecialchars($_REQUEST['mode']) : 'personal'; + + // Setup internal subsection display + $submodules['PERSONAL'] = "module_id=$module_id&mode=personal"; + $submodules['VIEW'] = "module_id=$module_id&mode=view"; + $submodules['POST'] = "module_id=$module_id&mode=post"; + + $user->lang = array_merge($user->lang, array( + 'UCP_PERSONAL' => 'Personal Settings', + 'UCP_VIEW' => 'Viewing Posts', + 'UCP_POST' => 'Posting Messages') + ); + + ucp::subsection($submodules, $submode); + unset($submodules); + + switch($submode) + { + case 'view': + break; + + case 'post': + break; + + default: + break; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang['UCP_' . strtoupper($submode)], + + 'S_DISPLAY_' . strtoupper($submode) => true, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_UCP_ACTION' => "ucp.$phpEx$SID&module_id=$module_id&mode=$submode") + ); + + ucp::output($user->lang['UCP_PROFILE'], 'ucp_prefs.html'); + } +} + +?>
\ No newline at end of file diff --git a/phpBB/ucp/ucp_profile.php b/phpBB/ucp/ucp_profile.php new file mode 100644 index 0000000000..600ea6727e --- /dev/null +++ b/phpBB/ucp/ucp_profile.php @@ -0,0 +1,86 @@ +<?php +/*************************************************************************** + * usercp_profile.php + * ------------------- + * begin : Saturday, Feb 21, 2003 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * + ***************************************************************************/ + + +class ucp_profile extends ucp +{ + function main($module_id) + { + global $config, $db, $user, $auth, $SID, $template, $phpEx; + + $submode = ($_REQUEST['mode']) ? htmlspecialchars($_REQUEST['mode']) : 'reg_details'; + + $submodules['REG_DETAILS'] = "module_id=$module_id&mode=reg_details"; + $submodules['PROFILE'] = "module_id=$module_id&mode=profile"; + $submodules['SIGNATURE'] = "module_id=$module_id&mode=signature"; + $submodules['AVATAR'] = "module_id=$module_id&mode=avatar"; + + $user->lang = array_merge($user->lang, array( + 'UCP_REG_DETAILS' => 'Registration details', + 'UCP_PROFILE' => 'Your Profile', + 'UCP_SIGNATURE' => 'Your signature', + 'UCP_AVATAR' => 'Your avatar') + ); + + ucp::subsection($submodules, $submode); + unset($submodules); + + switch ($submode) + { + case 'reg_details': + $template->assign_vars(array( + 'USERNAME' => $user->data['username'], + + 'S_CHANGE_USERNAME' => $auth->acl_get('u_chgname'), ) + ); + break; + + case 'profile': + break; + + case 'signature': + $template->assign_vars(array( + 'SIGNATURE' => $user->data['signature']) + ); + break; + + case 'avatar': + break; + + default: + break; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang['UCP_' . strtoupper($submode)], + + 'S_DISPLAY_' . strtoupper($submode) => true, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_UCP_ACTION' => "ucp.$phpEx$SID&module_id=$module_id&mode=$submode") + ); + + ucp::output($user->lang['UCP_PROFILE'], 'ucp_profile.html'); + } +} + +?>
\ No newline at end of file diff --git a/phpBB/ucp/ucp_register.php b/phpBB/ucp/ucp_register.php index 5d523c9561..ad7295492a 100644 --- a/phpBB/ucp/ucp_register.php +++ b/phpBB/ucp/ucp_register.php @@ -19,59 +19,129 @@ * ***************************************************************************/ -if (!defined('IN_PHPBB')) +class ucp_register extends ucp { - die('Hacking attempt'); - exit; -} - + function main() + { + global $config, $db, $user, $SID, $template, $phpEx; + // + if ($config['require_activation'] == USER_ACTIVATION_DISABLE) + { + trigger_error($user->lang['UCP_REGISTER_DISABLE']); + } + $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; + $agreed = (!empty($_POST['agreed'])) ? 1 : 0; + // + if (!$agreed) + { + if ($coppa === false && $config['coppa_enable']) + { + $now = getdate(); + $coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']); + unset($now); -// -if ($mode == 'register' && $config['require_activation'] == USER_ACTIVATION_DISABLE) -{ - trigger_error($user->lang['UCP_REGISTER_DISABLE']); -} + $template->assign_vars(array( + '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' => "ucp.$phpEx$SID&mode=register&coppa=0", + 'U_COPPA_YES' => "ucp.$phpEx$SID&mode=register&coppa=1", + 'S_SHOW_COPPA' => true, + 'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register") + ); + } + else + { + $template->assign_vars(array( + 'L_AGREEMENT' => $user->lang['UCP_AGREEMENT'], + 'S_SHOW_COPPA' => false, + 'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register") + ); + } + ucp::output($user->lang['REGISTER'], 'ucp_agreement.html'); + } + // Check and initialize some variables if needed + $error = array(); + if (isset($_POST['submit'])) + { + // Load the userdata manipulation methods + ucp::load('includes/functions_user'); + $userdata = new userdata(); + if ($message = $userdata->add_user($coppa)) + { + $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], "<a href=\"index.$phpEx$SID\">", '</a>'); + trigger_error($message); + } + } -$coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; -$agreed = (!empty($_POST['agreed'])) ? 1 : 0; -$lang = (isset($_POST['lang'])) ? htmlspecialchars($_POST['lang']) : ''; -$tz = (isset($_POST['tz'])) ? intval($_POST['tz']) : $config['board_timezone']; + // If an error occured we need to stripslashes on returned data + $username = (isset($_POST['username'])) ? stripslashes(htmlspecialchars($_POST['username'])) : ''; + $password = (isset($_POST['new_password'])) ? stripslashes(htmlspecialchars($_POST['new_password'])) : ''; + $password_confirm = (isset($_POST['password_confirm'])) ? stripslashes(htmlspecialchars($_POST['password_confirm'])) : ''; + $email = (isset($_POST['email'])) ? stripslashes(htmlspecialchars($_POST['email'])) : ''; + $email_confirm = (isset($_POST['email_confirm'])) ? stripslashes(htmlspecialchars($_POST['email_confirm'])) : ''; + $lang = (isset($_POST['lang'])) ? htmlspecialchars($_POST['lang']) : ''; + $tz = (isset($_POST['tz'])) ? intval($_POST['tz']) : $config['board_timezone']; -$error = array(); + $s_hidden_fields = '<input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />'; + // Visual Confirmation - Show images + $confirm_image = ''; + if (!empty($config['enable_confirm'])) + { + $sql = "SELECT session_id + FROM " . SESSIONS_TABLE; + $result = $db->sql_query($sql); + if ($row = $db->sql_fetchrow($result)) + { + $confirm_sql = ''; + do + { + $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'"; + } + while ($row = $db->sql_fetchrow($result)); + + $sql = "DELETE FROM " . CONFIRM_TABLE . " + WHERE session_id NOT IN ($confirm_sql)"; + $db->sql_query($sql); + } + $db->sql_freeresult($result); + $sql = "SELECT COUNT(session_id) AS attempts + FROM " . CONFIRM_TABLE . " + WHERE session_id = '" . $userdata['session_id'] . "'"; + $result = $db->sql_query($sql); -if (!$agreed) -{ - if ($coppa === false && $config['coppa_enable']) - { - $now = getdate(); - $coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']); - unset($now); + if ($row = $db->sql_fetchrow($result)) + { + if ($row['attempts'] > 5) + { + trigger_error($user->lang['Too_many_registers']); + } + } + $db->sql_freeresult($result); - $template->assign_vars(array( - 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), - 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), + $code = ucp::gen_rand_string(6); + $confirm_id = md5(uniqid($user_ip)); - 'U_COPPA_NO' => "ucp.$phpEx$SID&mode=register&coppa=0", - 'U_COPPA_YES' => "ucp.$phpEx$SID&mode=register&coppa=1", + $sql = "INSERT INTO " . CONFIRM_TABLE . " (confirm_id, session_id, code) + VALUES ('$confirm_id', '" . $user->data['session_id'] . "', '$code')"; + $db->sql_query($sql); + + $confirm_image = (@extension_loaded('zlib')) ? "<img src=\"ucp/usercp_confirm.$phpEx$SID&id=$confirm_id\" alt=\"\" title=\"\" />" : '<img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=1" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=2" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=3" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=4" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=5" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=6" alt="" title="" />'; + $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />'; + } - 'S_SHOW_COPPA' => true, - 'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register") - ); - } - else - { + // $l_reg_cond = ''; switch ($config['require_activation']) { @@ -84,170 +154,30 @@ if (!$agreed) break; } + // $template->assign_vars(array( - 'L_AGREEMENT' => $user->lang['UCP_AGREEMENT'], - 'L_REG_CONDITIONS' => $l_reg_cond, - - 'S_SHOW_COPPA' => false, - 'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register") + 'USERNAME' => $username, + 'PASSWORD' => $password, + 'PASSWORD_CONFIRM' => $password_confirm, + 'EMAIL' => $email, + 'EMAIL_CONFIRM' => $email, + 'CONFIRM_IMG' => $confirm_image, + 'ERROR' => (sizeof($userdata->error)) ? implode('<br />', $userdata->error) : '', + + 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlentities($config['board_contact']) . '">', '</a>'), + 'L_ITEMS_REQUIRED' => $l_reg_cond, + + 'S_LANG_OPTIONS' => language_select($lang), + 'S_TZ_OPTIONS' => tz_select($tz), + 'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false, + 'S_COPPA' => $coppa, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_UCP_ACTION' => "ucp.$phpEx$SID&mode=register") ); - } - - page_header($user->lang['REGISTER']); - - $template->set_filenames(array( - 'body' => 'ucp_agreement.html') - ); - make_jumpbox('viewforum.'.$phpEx); - - page_footer(); - -} -else -{ - $agreed = TRUE; -} - - - - - - -// Check and initialize some variables if needed -if (isset($_POST['submit'])) -{ - // Load the userdata manipulation methods - require($phpbb_root_path . 'includes/functions_user.'.$phpEx); - $userdata = new userdata(); - - if($message = $userdata->add_new_user($coppa)) - { - $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], "<a href=\"index.$phpEx$SID\">", '</a>'); - trigger_error($message); - } -} -// End of submit - - - - - - -if (sizeof($userdata->error)) -{ - // If an error occured we need to stripslashes on returned data - $username = stripslashes($username); - $password = stripslashes($password); - $password_confirm = stripslashes($password_confirm); - $email = stripslashes($email); - $email_confirm = stripslashes($email_confirm); -} - - - - - - // Visual Confirmation - Show images - $confirm_image = ''; - if (!empty($config['enable_confirm'])) - { - $sql = "SELECT session_id - FROM " . SESSIONS_TABLE; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $confirm_sql = ''; - do - { - $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'"; - } - while ($row = $db->sql_fetchrow($result)); - - $sql = "DELETE FROM " . CONFIRM_TABLE . " - WHERE session_id NOT IN ($confirm_sql)"; - $db->sql_query($sql); - } - $db->sql_freeresult($result); - - $sql = "SELECT COUNT(session_id) AS attempts - FROM " . CONFIRM_TABLE . " - WHERE session_id = '" . $userdata['session_id'] . "'"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - if ($row['attempts'] > 5) - { - trigger_error($user->lang['Too_many_registers']); - } - } - $db->sql_freeresult($result); - - $code = gen_png_string(6); - $confirm_id = md5(uniqid($user_ip)); - - $sql = "INSERT INTO " . CONFIRM_TABLE . " (confirm_id, session_id, code) - VALUES ('$confirm_id', '" . $user->data['session_id'] . "', '$code')"; - $db->sql_query($sql); - - $confirm_image = (@extension_loaded('zlib')) ? '<img src="' . "ucp/usercp_confirm.$phpEx$SID&id=$confirm_id" . '" alt="" title="" />' : '<img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=1" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=2" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=3" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=4" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=5" alt="" title="" /><img src="ucp/usercp_confirm.$phpEx?$SID&id=$confirm_id&c=6" alt="" title="" />'; - $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />'; - } - // End visual confirmation - - - $template->assign_vars(array( - 'USERNAME' => $username, - 'PASSWORD' => $password, - 'PASSWORD_CONFIRM' => $password_confirm, - 'EMAIL' => $email, - 'EMAIL_CONFIRM' => $email, - 'CONFIRM_IMG' => $confirm_image, - 'ERROR' => (sizeof($userdata->error)) ? implode('<br />', $userdata->error) : '', - - 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlentities($config['board_contact']) . '">', '</a>'), - - 'S_LANG_OPTIONS' => language_select($lang), - 'S_TZ_OPTIONS' => tz_select($tz), - 'S_CONFIRM_CODE' => ($config['enable_confirm']) ? 1 : 0, - 'S_COPPA' => $coppa, - 'S_HIDDEN_FIELDS' => '<input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />', - 'S_FORM_ENCTYPE' => $form_enctype, - 'S_PROFILE_ACTION' => "ucp.$phpEx$SID&mode=register") - ); - - -// -page_header($user->lang['REGISTER']); - -$template->set_filenames(array( - 'body' => 'ucp_register.html') -); -make_jumpbox('viewforum.'.$phpEx); - -page_footer(); - - - - -function gen_png_string($num_chars) -{ - $chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'); - - list($usec, $sec) = explode(' ', microtime()); - mt_srand($sec * $usec); - - $max_chars = count($chars) - 1; - $rand_str = ''; - for ($i = 0; $i < $num_chars; $i++) - { - $rand_str .= $chars[mt_rand(0, $max_chars)]; + // + ucp::output($user->lang['REGISTER'], 'ucp_register.html'); } - - return $rand_str; } - ?>
\ No newline at end of file diff --git a/phpBB/ucp/ucp_zebra.php b/phpBB/ucp/ucp_zebra.php new file mode 100644 index 0000000000..b5a4051390 --- /dev/null +++ b/phpBB/ucp/ucp_zebra.php @@ -0,0 +1,33 @@ +<?php +/*************************************************************************** + * usercp_profile.php + * ------------------- + * begin : Saturday, Feb 21, 2003 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * + ***************************************************************************/ + + +class ucp_zebra extends ucp +{ + function main($module_id) + { + return; + } +} + +?>
\ No newline at end of file |
