aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/ucp
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/ucp')
-rw-r--r--phpBB/ucp/ucp_activate.php95
-rw-r--r--phpBB/ucp/ucp_main.php198
-rw-r--r--phpBB/ucp/ucp_pm.php33
-rw-r--r--phpBB/ucp/ucp_prefs.php30
-rw-r--r--phpBB/ucp/ucp_profile.php53
-rw-r--r--phpBB/ucp/ucp_register.php10
6 files changed, 381 insertions, 38 deletions
diff --git a/phpBB/ucp/ucp_activate.php b/phpBB/ucp/ucp_activate.php
new file mode 100644
index 0000000000..303a0e225c
--- /dev/null
+++ b/phpBB/ucp/ucp_activate.php
@@ -0,0 +1,95 @@
+<?php
+/***************************************************************************
+ * usercp_activate.php
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * 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_activate extends ucp
+{
+ function main($module_id)
+ {
+ global $config, $db, $user, $auth, $SID, $template, $phpEx;
+
+ $sql = "SELECT user_active, user_id, user_email, user_newpasswd, user_lang, user_actkey, username
+ FROM " . USERS_TABLE . "
+ WHERE user_id = " . intval($_GET['u']);
+ $result = $db->sql_query($sql);
+
+ if ($row = $db->sql_fetchrow($result))
+ {
+ if ($row['user_active'] && $row['user_actkey'] == '')
+ {
+ meta_refresh(3, "index.$phpEx$SID");
+ trigger_error($user->lang['Already_activated']);
+ }
+ else if ($row['user_actkey'] == $_GET['key'])
+ {
+ $sql_update_pass = ($row['user_newpasswd'] != '') ? ", user_password = '" . $db->sql_escape($row['user_newpasswd']) . "', user_newpasswd = ''" : '';
+
+ $sql = "UPDATE " . USERS_TABLE . "
+ SET user_active = 1, user_actkey = ''" . $sql_update_pass . "
+ WHERE user_id = " . $row['user_id'];
+ $result = $db->sql_query($sql);
+
+ if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass == '')
+ {
+ ucp::load('includes/emailer');
+ $emailer = new emailer($config['smtp_delivery']);
+
+ $emailer->use_template('admin_welcome_activated', $row['user_lang']);
+ $emailer->to($row['user_email']);
+
+ $emailer->assign_vars(array(
+ 'SITENAME' => $config['sitename'],
+ 'USERNAME' => $row['username'],
+ 'PASSWORD' => $password_confirm,
+ 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']))
+ );
+ $emailer->send();
+ $emailer->reset();
+
+ meta_refresh(3, "index.$phpEx$SID");
+ trigger_error($user->lang['Account_active_admin']);
+ }
+ else
+ {
+ meta_refresh(3, "index.$phpEx$SID");
+ $message = ($sql_update_pass == '') ? $user->lang['Account_active'] : $user->lang['Password_activated'];
+ trigger_error($message);
+ }
+
+ set_config('newest_user_id', $row['user_id']);
+ set_config('newest_username', $row['username']);
+ set_config('num_users', $config['num_users'] + 1, TRUE);
+ }
+ else
+ {
+ trigger_error($user->lang['Wrong_activation']);
+ }
+ }
+ else
+ {
+ trigger_error($user->lang['No_such_user']);
+ }
+ $db->sql_freeresult($result);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/phpBB/ucp/ucp_main.php b/phpBB/ucp/ucp_main.php
new file mode 100644
index 0000000000..1dd4b2795a
--- /dev/null
+++ b/phpBB/ucp/ucp_main.php
@@ -0,0 +1,198 @@
+<?php
+/***************************************************************************
+ * ucp_main.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_main extends ucp
+{
+ function main($id)
+ {
+ global $config, $db, $user, $SID, $template, $phpEx;
+
+ $submode = ($_REQUEST['mode']) ? htmlspecialchars($_REQUEST['mode']) : 'personal';
+
+ // Setup internal subsection display
+ $submodules['PERSONAL'] = "i=$id&amp;mode=personal";
+ $submodules['VIEW'] = "i=$id&amp;mode=view";
+ $submodules['POST'] = "i=$id&amp;mode=post";
+
+
+ $this->subsection($submodules, $submode);
+ unset($submodules);
+
+ switch($submode)
+ {
+ case 'view':
+ break;
+
+ case 'post':
+ break;
+
+ default:
+ break;
+ }
+
+
+ // Subscribed Topics
+ $sql = "SELECT tw.topic_id, t.topic_title, t.topic_last_post_time, t.poll_start, t.topic_replies, t.topic_type, t.forum_id
+ FROM " . TOPICS_TABLE . " t, " . TOPICS_WATCH_TABLE . " tw
+ WHERE t.topic_id = tw.topic_id
+ AND tw.user_id = " . $user->data['user_id'] . "
+ ORDER BY t.topic_last_post_time DESC";
+ $result = $db->sql_query($sql);
+
+ $topic_count = 0;
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $replies = $row['topic_replies'];
+ $topic_id = $row['topic_id'];
+ $forum_id = $row['forum_id'];
+
+ switch ($row['topic_type'])
+ {
+ case POST_ANNOUNCE:
+ $topic_type = $user->lang['Topic_Announcement'] . ' ';
+ $folder = 'folder_announce';
+ $folder_new = 'folder_announce_new';
+ break;
+
+ case POST_STICKY:
+ $topic_type = $user->lang['Topic_Sticky'] . ' ';
+ $folder = 'folder_sticky';
+ $folder_new = 'folder_sticky_new';
+ break;
+
+ case ITEM_LOCKED:
+ $folder = 'folder_locked';
+ $folder_new = 'folder_locked_new';
+ break;
+
+ default:
+ if ($replies >= intval($config['hot_threshold']))
+ {
+ $folder = 'folder_hot';
+ $folder_new = 'folder_hot_new';
+ }
+ else
+ {
+ $folder = 'folder';
+ $folder_new = 'folder_new';
+ }
+ break;
+ }
+
+ $unread_topic = false;
+ if ($user->data['user_id'] && $row['topic_last_post_time'] > $user->data['session_last_visit'])
+ {
+ $unread_topic = true;
+ }
+
+ $newest_post_img = ($unread_topic) ? '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $topic_id . '&amp;view=newest#newest">' . $user->img('goto_post_newest', 'View_newest_post') . '</a> ' : '';
+ $folder_img = ($unread_topic) ? $folder_new : $folder;
+ $folder_alt = ($unread_topic) ? 'New_posts' : (($row['topic_status'] == ITEM_LOCKED) ? 'Topic_locked' : 'No_new_posts');
+
+ $view_topic_url = 'viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id;
+
+ $template->assign_block_vars('subscribed_topics', array(
+ 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
+ 'NEWEST_POST_IMG' => $newest_post_img,
+
+ 'TOPIC_TITLE' => (!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $row['topic_title']) : $row['topic_title'],
+
+ 'U_TOPIC' => $view_topic_url)
+ );
+ }
+ $db->sql_freeresult($result);
+ // End Subscribed Topics
+
+
+ // Subscribed Forums
+ $sql = "SELECT f.forum_id, f.forum_last_post_time, f.forum_last_post_id, f.left_id, f.right_id, f.forum_status, f.forum_name, f.forum_desc
+ FROM " . FORUMS_TABLE . " f, " . FORUMS_WATCH_TABLE . " fw
+ WHERE f.forum_id = fw.forum_id
+ AND fw.user_id = " . $user->data['user_id'] . "
+ ORDER BY f.forum_last_post_time DESC";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $forum_id = $row['forum_id'];
+
+ $unread_topics = ($user->data['user_id'] && $row['forum_last_post_time'] > $user->data['user_lastvisit']) ? TRUE : FALSE;
+
+ $folder_image = ($unread_topics) ? 'forum_new' : 'forum';
+ $folder_alt = ($unread_topics) ? 'New_posts' : 'No_new_posts';
+
+ if ($row['left_id'] + 1 < $row['right_id'])
+ {
+ $folder_image = ($unread_topics) ? 'sub_forum_new' : 'sub_forum';
+ $folder_alt = ($unread_topics) ? 'New_posts' : 'No_new_posts';
+ }
+ elseif ($row['forum_status'] == ITEM_LOCKED)
+ {
+ $folder_image = 'forum_locked';
+ $folder_alt = 'Forum_locked';
+ }
+ else
+ {
+ $folder_image = ($unread_topics) ? 'forum_new' : 'forum';
+ $folder_alt = ($unread_topics) ? 'New_posts' : 'No_new_posts';
+ }
+
+ $last_post = '<a href="viewtopic.' . $phpEx . $SID . '&amp;f=' . $row['forum_id'] . '&amp;p=' . $row['forum_last_post_id'] . '#' . $row['forum_last_post_id'] . '">' . $user->img('goto_post_latest', 'View_latest_post') . '</a>';
+
+
+ $template->assign_block_vars('subscribed_forums', array(
+ 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt),
+ 'NEWEST_FORUM_POST_IMG' => $last_post,
+
+ 'FORUM_NAME' => $row['forum_name'],
+
+ 'U_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $row['forum_id'])
+ );
+ }
+ $db->sql_freeresult($result);
+ // End Subscribed forums
+
+
+ // Buddy List
+
+ // End Buddy List
+
+
+ // Private Messages
+
+ // End Private Messages
+
+
+
+
+ $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&amp;i=$id&amp;mode=$submode")
+ );
+
+ $this->output($user->lang['UCP_MAIN'], 'ucp_main.html');
+ }
+}
+
+?> \ No newline at end of file
diff --git a/phpBB/ucp/ucp_pm.php b/phpBB/ucp/ucp_pm.php
new file mode 100644
index 0000000000..142cff9f58
--- /dev/null
+++ b/phpBB/ucp/ucp_pm.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_pm extends ucp
+{
+ function main($module_id)
+ {
+ return;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/phpBB/ucp/ucp_prefs.php b/phpBB/ucp/ucp_prefs.php
index d390a92f7c..7ad954e6d6 100644
--- a/phpBB/ucp/ucp_prefs.php
+++ b/phpBB/ucp/ucp_prefs.php
@@ -1,6 +1,6 @@
<?php
/***************************************************************************
- * usercp_profile.php
+ * ucp_prefs.php
* -------------------
* begin : Saturday, Feb 21, 2003
* copyright : (C) 2001 The phpBB Group
@@ -8,7 +8,6 @@
*
* $Id$
*
- *
***************************************************************************/
/***************************************************************************
@@ -18,27 +17,38 @@
* 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)
+ function main($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&amp;mode=personal";
- $submodules['VIEW'] = "module_id=$module_id&amp;mode=view";
- $submodules['POST'] = "module_id=$module_id&amp;mode=post";
+ $submodules['PERSONAL'] = "i=$id&amp;mode=personal";
+ $submodules['VIEW'] = "i=$id&amp;mode=view";
+ $submodules['POST'] = "i=$id&amp;mode=post";
- ucp::subsection($submodules, $submode);
+ $this->subsection($submodules, $submode);
unset($submodules);
switch($submode)
{
+ case 'personal':
+ $template->assign_vars(array(
+ 'VIEW_EMAIL_YES' => ($user->data['user_viewemail ']) ? ' checked="checked"' : '',
+ 'VIEW_EMAIL_NO' => (!$user->data['user_viewemail ']) ? ' checked="checked"' : '',
+ 'DATE_FORMAT' => $user->data['user_dateformat'],
+
+ 'S_LANG_OPTIONS' => language_select($user->data['user_lang']),
+ 'S_STYLE_OPTIONS' => style_select($user->data['user_style']),
+ 'S_TZ_OPTIONS' => tz_select($user->data['user_timezone']),)
+ );
+ break;
+
case 'view':
break;
@@ -54,10 +64,10 @@ class ucp_prefs extends ucp
'S_DISPLAY_' . strtoupper($submode) => true,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
- 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;module_id=$module_id&amp;mode=$submode")
+ 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode")
);
- ucp::output($user->lang['UCP_PROFILE'], 'ucp_prefs.html');
+ $this->output($user->lang['UCP_PROFILE'], 'ucp_prefs.html');
}
}
diff --git a/phpBB/ucp/ucp_profile.php b/phpBB/ucp/ucp_profile.php
index 48b6a63d92..a37fc6a8a3 100644
--- a/phpBB/ucp/ucp_profile.php
+++ b/phpBB/ucp/ucp_profile.php
@@ -1,6 +1,6 @@
<?php
/***************************************************************************
- * usercp_profile.php
+ * ucp_profile.php
* -------------------
* begin : Saturday, Feb 21, 2003
* copyright : (C) 2001 The phpBB Group
@@ -8,7 +8,6 @@
*
* $Id$
*
- *
***************************************************************************/
/***************************************************************************
@@ -18,29 +17,29 @@
* 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)
+ function main($id)
{
global $config, $db, $user, $auth, $SID, $template, $phpEx;
$submode = ($_REQUEST['mode']) ? htmlspecialchars($_REQUEST['mode']) : 'reg_details';
- $submodules['REG_DETAILS'] = "module_id=$module_id&amp;mode=reg_details";
- $submodules['PROFILE'] = "module_id=$module_id&amp;mode=profile";
- $submodules['SIGNATURE'] = "module_id=$module_id&amp;mode=signature";
- $submodules['AVATAR'] = "module_id=$module_id&amp;mode=avatar";
+ $submodules['REG_DETAILS'] = "i=$id&amp;mode=reg_details";
+ $submodules['PROFILE'] = "i=$id&amp;mode=profile";
+ $submodules['SIGNATURE'] = "i=$id&amp;mode=signature";
+ $submodules['AVATAR'] = "i=$id&amp;mode=avatar";
- ucp::subsection($submodules, $submode);
+ $this->subsection($submodules, $submode);
unset($submodules);
switch ($submode)
{
case 'reg_details':
+
$template->assign_vars(array(
'USERNAME' => $user->data['username'],
'EMAIL' => $user->data['user_email'],
@@ -53,24 +52,30 @@ class ucp_profile extends ucp
case 'profile':
+ list($day, $month, $year) = explode('-', $user->data['user_birthday']);
+
$s_birthday_day_options = '';
for ($i = 1; $i < 32; $i++)
{
- $selected = '';
- $s_birthday_day_options .= "<option value=\"$i\">$i</option>";
+ $selected = ($i == $day) ? ' selected="selected"' : '';
+ $s_birthday_day_options .= "<option value=\"$i\"$selected>$i</option>";
}
+
$s_birthday_month_options = '';
for ($i = 1; $i < 13; $i++)
{
- $selected = '';
- $s_birthday_month_options .= "<option value=\"$i\">$i</option>";
+ $selected = ($i == $month) ? ' selected="selected"' : '';
+ $s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>";
}
$s_birthday_year_options = '';
- for ($i = 1900; $i < 2004; $i++)
+
+ $now = getdate();
+ for ($i = $now['year'] - 100; $i < $now['year']; $i++)
{
- $selected = '';
- $s_birthday_year_options .= "<option value=\"$i\">$i</option>";
+ $selected = ($i == $year) ? ' selected="selected"' : '';
+ $s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";
}
+ unset($now);
$template->assign_vars(array(
'ICQ' => $user->data['user_icq'],
@@ -90,7 +95,8 @@ class ucp_profile extends ucp
break;
case 'signature':
- ucp::load('includes/functions_posting');
+
+ $this->loadfile('includes/functions_posting');
$html_status = ($config['allow_html']) ? true : false;
$bbcode_status = ($config['allow_bbcode']) ? true : false;
@@ -116,7 +122,7 @@ class ucp_profile extends ucp
if (!sizeof($error))
{
- ucp::load('includes/message_parser');
+ $this->loadfile('includes/message_parser');
$message_parser = new parse_message();
$message_parser->message = trim(stripslashes($signature));
@@ -134,7 +140,7 @@ class ucp_profile extends ucp
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
- meta_refresh(3, "ucp.$phpEx$SID&amp;module_id=$module_id&amp;mode=$submode");
+ meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode");
trigger_error('');
}
}
@@ -146,7 +152,7 @@ class ucp_profile extends ucp
global $phpbb_root_path;
- ucp::load('includes/message_parser');
+ $this->loadfile('includes/message_parser');
$signature_preview = $signature;
@@ -157,7 +163,7 @@ class ucp_profile extends ucp
if ($enable_bbcode)
{
- ucp::load('includes/bbcode');
+ $this->loadfile('includes/bbcode');
$bbcode = new bbcode($message_parser->bbcode_bitfield);
// Second parse bbcode here
@@ -207,6 +213,7 @@ class ucp_profile extends ucp
$template->assign_vars(array(
'AVATAR' => '<img src="images/avatars/upload/' . $user->data['user_avatar'] . '" />',
+
'S_UPLOAD_AVATAR_FILE' => true,
'S_UPLOAD_AVATAR_URL' => true,
'S_LINK_AVATAR' => true,
@@ -224,10 +231,10 @@ class ucp_profile extends ucp
'S_DISPLAY_' . strtoupper($submode) => true,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
- 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;module_id=$module_id&amp;mode=$submode")
+ 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode")
);
- ucp::output($user->lang['UCP_PROFILE'], 'ucp_profile.html');
+ $this->output($user->lang['UCP_PROFILE'], 'ucp_profile.html');
}
}
diff --git a/phpBB/ucp/ucp_register.php b/phpBB/ucp/ucp_register.php
index ad7295492a..e5bad26eae 100644
--- a/phpBB/ucp/ucp_register.php
+++ b/phpBB/ucp/ucp_register.php
@@ -21,7 +21,7 @@
class ucp_register extends ucp
{
- function main()
+ function main($id)
{
global $config, $db, $user, $SID, $template, $phpEx;
@@ -64,7 +64,7 @@ class ucp_register extends ucp
);
}
- ucp::output($user->lang['REGISTER'], 'ucp_agreement.html');
+ $this->output($user->lang['REGISTER'], 'ucp_agreement.html');
}
// Check and initialize some variables if needed
@@ -72,7 +72,7 @@ class ucp_register extends ucp
if (isset($_POST['submit']))
{
// Load the userdata manipulation methods
- ucp::load('includes/functions_user');
+ $this->loadfile('includes/functions_user');
$userdata = new userdata();
if ($message = $userdata->add_user($coppa))
@@ -130,7 +130,7 @@ class ucp_register extends ucp
}
$db->sql_freeresult($result);
- $code = ucp::gen_rand_string(6);
+ $code = $this->gen_rand_string(6);
$confirm_id = md5(uniqid($user_ip));
$sql = "INSERT INTO " . CONFIRM_TABLE . " (confirm_id, session_id, code)
@@ -176,7 +176,7 @@ class ucp_register extends ucp
);
//
- ucp::output($user->lang['REGISTER'], 'ucp_register.html');
+ $this->output($user->lang['REGISTER'], 'ucp_register.html');
}
}