diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-10-12 11:59:23 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-10-12 11:59:23 +0000 |
commit | eeb4907112d4d6e3064e2ccac80d77f9b02d2375 (patch) | |
tree | a2c15d05a6de1eee86b97400121c0096878da8fc /phpBB/includes | |
parent | 3bd421878006906888b65d9b070e20b7ff4a0f65 (diff) | |
download | forums-eeb4907112d4d6e3064e2ccac80d77f9b02d2375.tar forums-eeb4907112d4d6e3064e2ccac80d77f9b02d2375.tar.gz forums-eeb4907112d4d6e3064e2ccac80d77f9b02d2375.tar.bz2 forums-eeb4907112d4d6e3064e2ccac80d77f9b02d2375.tar.xz forums-eeb4907112d4d6e3064e2ccac80d77f9b02d2375.zip |
Let's break lots of things
git-svn-id: file:///svn/phpbb/trunk@4578 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/bbcode.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 49 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 12 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 29 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 4 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 6 | ||||
-rw-r--r-- | phpBB/includes/session.php | 16 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_activate.php | 4 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_prefs.php | 84 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 2 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_remind.php | 11 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_zebra.php | 2 |
12 files changed, 149 insertions, 74 deletions
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 3e4a294529..a18a2c4942 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -184,7 +184,7 @@ class bbcode )); break; case 4: - if ($user->data['user_viewimg']) + if ($user->optionget('viewimg')) { $this->bbcode_cache[$bbcode_id] = array('preg' => array( '#\[img:$uid\](.*?)\[/img:$uid\]#s' => $this->bbcode_tpl('img', $bbcode_id) @@ -240,7 +240,7 @@ class bbcode )); break; case 11: - if ($user->data['user_viewflash']) + if ($user->optionget('viewflash')) { $this->bbcode_cache[$bbcode_id] = array('preg' => array( '#\[flash=([0-9]+),([0-9]+):$uid\](.*?)\[/flash:$uid\]#' => $this->bbcode_tpl('flash', $bbcode_id) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9a39a38b63..e36eadf2db 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -32,7 +32,11 @@ function request_var($var_name, $default) if ($type == 'string') { - $var[$k] = htmlspecialchars(trim(stripslashes(preg_replace(array("#[ \xFF]{2,}#s", "#[\r\n]{2,}#s"), array(' ', "\n"), $var[$k])))); + $var[$k] = htmlspecialchars(trim(preg_replace(array("#[ \xFF]{2,}#s", "#[\r\n]{2,}#s"), array(' ', "\n"), $var[$k]))); + if (STRIP) + { + $var[$k] = stripslashes($var[$k]); + } } } } @@ -44,7 +48,11 @@ function request_var($var_name, $default) // not generally applicable elsewhere if ($type == 'string') { - $var = htmlspecialchars(trim(stripslashes(preg_replace(array("#[ \xFF]{2,}#s", "#[\r\n]{2,}#s"), array(' ', "\n"), $var)))); + $var = htmlspecialchars(trim(preg_replace(array("#[ \xFF]{2,}#s", "#[\r\n]{2,}#s"), array(' ', "\n"), $var))); + if (STRIP) + { + $var = stripslashes($var); + } } } @@ -205,7 +213,7 @@ function discover_auth($user_id_ary, $opts = false, $forum_id = false) $user_id_ary = array($user_id_ary); } - $sql_forum = ($forum_id) ? ((!is_array($forum_id)) ? "AND a.forum_id = $forum_id" : implode(', ', $forum_id)) : ''; + $sql_forum = ($forum_id) ? ((!is_array($forum_id)) ? "AND a.forum_id = $forum_id" : 'AND a.forum_id IN (' . implode(', ', $forum_id) . ')') : ''; $sql_opts = ($opts) ? ((!is_array($opts)) ? "AND ao.auth_option = '$opts'" : 'AND ao.auth_option IN (' . implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#e', "\"'\" . $db->sql_escape('\\1') . \"'\"", $opts)) . ')') : ''; $hold_ary = array(); @@ -241,7 +249,7 @@ function discover_auth($user_id_ary, $opts = false, $forum_id = false) while ($row = $db->sql_fetchrow($result)) { - if (!isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) || (isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) && $hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] !== ACL_NO)) + if (!isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) || (isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) && $hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] != ACL_NO)) { $hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] = $row['min_setting']; } @@ -256,7 +264,7 @@ function gen_forum_rules($mode, &$forum_id) { global $SID, $template, $auth, $user; - $rules = array('post', 'reply', 'lock', 'edit', 'delete', 'attach', 'download'); + $rules = array('post', 'reply', 'edit', 'delete', 'attach'); foreach ($rules as $rule) { @@ -448,7 +456,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat $u_url = ($mode == 'forum') ? 'f' : 't'; // Is user watching this thread? - if ($user_id) + if ($user_id != ANONYMOUS) { $can_watch = TRUE; @@ -818,7 +826,7 @@ function obtain_word_list(&$censors) { global $db, $cache, $user; - if (!$user->optionget('viewcensors') && !$user->data['coppa'] && $config['allow_nocensors']) + if (!$user->optionget('viewcensors') && $config['allow_nocensors']) { return; } @@ -1022,6 +1030,10 @@ function login_box($s_action, $s_hidden_fields = '', $login_explain = '') if (($result = $auth->login($_POST['username'], $_POST['password'], $autologin, $viewonline)) === true) { + // TODO + // Force change password ... plugin for EVENT_LOGIN in future + // but for now we'll do it here + return true; } @@ -1369,18 +1381,18 @@ function page_header($page_title = '') } else { - $l_privmsgs_text = $user->lang['No_new_pm']; + $l_privmsgs_text = $user->lang['NO_NEW_PM']; $s_privmsg_new = 0; } if ($user->data['user_unread_privmsg']) { - $l_message_unread = ($user->data['user_unread_privmsg'] == 1) ? $user->lang['Unread_pm'] : $user->lang['Unread_pms']; + $l_message_unread = ($user->data['user_unread_privmsg'] == 1) ? $user->lang['UNREAD_PM'] : $user->lang['UNREAD_PMS']; $l_privmsgs_text_unread = sprintf($l_message_unread, $user->data['user_unread_privmsg']); } else { - $l_privmsgs_text_unread = $user->lang['No_unread_pm']; + $l_privmsgs_text_unread = $user->lang['NO_UNREAD_PM']; } } @@ -1423,7 +1435,7 @@ function page_header($page_title = '') 'U_SEARCH_UNANSWERED' => 'search.'.$phpEx.$SID.'&search_id=unanswered', 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false, - 'S_USER_PM_POPUP' => ($user->optionget('popuppm')) ? true : false, + 'S_USER_PM_POPUP' => $user->optionget('popuppm'), 'S_USER_BROWSER' => $user->data['session_browser'], 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], 'S_CONTENT_ENCODING' => $user->lang['ENCODING'], @@ -1455,7 +1467,7 @@ function page_header($page_title = '') function page_footer() { - global $db, $config, $template, $SID, $user, $auth, $cache, $starttime, $phpEx; + global $db, $config, $template, $SID, $user, $auth, $cache, $messenger, $starttime, $phpbb_root_path, $phpEx; // Output page creation time if (defined('DEBUG')) @@ -1472,7 +1484,7 @@ function page_footer() if ($auth->acl_get('a_')) { - $debug_output .= ' | <a href="' . htmlspecialchars($_SERVER['REQUEST_URI']) . '&explain=1">Explain</a>'; + $debug_output .= ' | <a href="' . request_var($_SERVER['REQUEST_URI'], "index.$phpEx$SID") . '&explain=1">Explain</a>'; } $debug_output .= ' ]'; } @@ -1485,6 +1497,17 @@ function page_footer() $template->display('body'); + // Handle email/cron queue. + if (time() - $config['queue_interval'] >= $config['last_queue_run'] && !defined('IN_ADMIN')) + { + if (file_exists($phpbb_root_path . 'cache/queue.' . $phpEx)) + { + include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); + $queue = new queue(); + $queue->process(); + } + } + // Unload cache, must be done before the DB connection if closed if (!empty($cache)) { diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index bffe9451a8..40991815a6 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1707,18 +1707,18 @@ function add_log() switch ($mode) { case 'admin': - $sql = "INSERT INTO " . LOG_TABLE . " (log_type, user_id, log_ip, log_time, log_operation, log_data) - VALUES (" . LOG_ADMIN . ", " . $user->data['user_id'] . ", '$user->ip', " . time() . ", '$action', '$data')"; + $sql = 'INSERT INTO ' . LOG_TABLE . ' (log_type, user_id, log_ip, log_time, log_operation, log_data) + VALUES (' . LOG_ADMIN . ', ' . $user->data['user_id'] . ", '$user->ip', " . time() . ", '$action', '$data')"; break; case 'mod': - $sql = "INSERT INTO " . LOG_TABLE . " (log_type, user_id, forum_id, topic_id, log_ip, log_time, log_operation, log_data) - VALUES (" . LOG_MOD . ", " . $user->data['user_id'] . ", $forum_id, $topic_id, '$user->ip', " . time() . ", '$action', '$data')"; + $sql = 'INSERT INTO ' . LOG_TABLE . ' (log_type, user_id, forum_id, topic_id, log_ip, log_time, log_operation, log_data) + VALUES (' . LOG_MOD . ', ' . $user->data['user_id'] . ", $forum_id, $topic_id, '$user->ip', " . time() . ", '$action', '$data')"; break; case 'critical': - $sql = "INSERT INTO " . LOG_TABLE . " (log_type, user_id, log_ip, log_time, log_operation, log_data) - VALUES (" . LOG_CRITICAL . ", " . $user->data['user_id'] . ", '$user->ip', " . time() . ", '$action', '$data')"; + $sql = 'INSERT INTO ' . LOG_TABLE . ' (log_type, user_id, log_ip, log_time, log_operation, log_data) + VALUES (' . LOG_CRITICAL . ', ' . $user->data['user_id'] . ", '$user->ip', " . time() . ", '$action', '$data')"; break; default: diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index f67bfb41b1..79fc1bdd14 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -821,6 +821,35 @@ function server_parse($socket, $response) return 0; } +// Encodes the given string for proper display for this encoding ... nabbed +// from php.net and modified. There is an alternative encoding method which +// may produce less output but it's questionable as to its worth in this +// scenario IMO +function mail_encode($str) +{ + if ($this->encoding == '') + { + return $str; + } + + // define start delimimter, end delimiter and spacer + $end = "?="; + $start = "=?$this->encoding?B?"; + $spacer = "$end\r\n $start"; + + // determine length of encoded text within chunks and ensure length is even + $length = 75 - strlen($start) - strlen($end); + $length = floor($length / 2) * 2; + + // encode the string and split it into chunks with spacers after each chunk + $str = chunk_split(base64_encode($str), $length, $spacer); + + // remove trailing spacer and add start and end delimiters + $str = preg_replace('#' . preg_quote($spacer) . '$#', '', $str); + + return $start . $str . $end; +} + function md5_digest() { } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 9ec7859d27..f63b797373 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -29,6 +29,7 @@ function generate_smilies($mode, $forum_id) WHERE forum_id = $forum_id"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); $user->setup(FALSE, (int) $row['forum_style']); @@ -46,10 +47,13 @@ function generate_smilies($mode, $forum_id) FROM ' . SMILIES_TABLE . ' WHERE display_on_posting = 0'; $result = $db->sql_query_limit($sql, 1, 0, 3600); + $row = $db->sql_fetchrow($result); + if ($row = $db->sql_fetchrow($result)) { $display_link = TRUE; } + $db->sql_freeresult($result); } $sql = 'SELECT * diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 2ab41d4df5..bf1b0f0d53 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -957,9 +957,6 @@ class fulltext_search return; } -// $mtime = explode(' ', microtime()); -// $starttime = $mtime[1] + $mtime[0]; - // Split old and new post/subject to obtain array of 'words' $stopped_words = array(); $split_text = $this->split_words('post', $message, $stopped_words); @@ -1089,9 +1086,6 @@ class fulltext_search unset($words); -// $mtime = explode(' ', microtime()); -// echo "Search parser time taken >> " . ($mtime[1] + $mtime[0] - $starttime); - // Run the cleanup infrequently, once per session cleanup if ($config['search_last_gc'] < time() - $config['search_gc']) { diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 8264472ce6..ca559076ff 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -33,14 +33,14 @@ class session if (isset($_COOKIE[$config['cookie_name'] . '_sid']) || isset($_COOKIE[$config['cookie_name'] . '_data'])) { - $sessiondata = (isset($_COOKIE[$config['cookie_name'] . '_data'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_data'])) : ''; - $this->session_id = (isset($_COOKIE[$config['cookie_name'] . '_sid'])) ? $_COOKIE[$config['cookie_name'] . '_sid'] : ''; + $sessiondata = unserialize(request_var($config['cookie_name'] . '_data', '')); + $this->session_id = request_var($config['cookie_name'] . '_sid', ''); $SID = (defined('NEED_SID')) ? '?sid=' . $this->session_id : '?sid='; } else { $sessiondata = ''; - $this->session_id = (isset($_GET['sid'])) ? $_GET['sid'] : ''; + $this->session_id = request_var('sid', ''); $SID = '?sid=' . $this->session_id; } @@ -65,11 +65,11 @@ class session // Load limit check (if applicable) if (@file_exists('/proc/loadavg')) { - if ($config['limit_load'] && $load = @file('/proc/loadavg')) + if ($load = @file('/proc/loadavg')) { list($this->load) = explode(' ', $load[0]); - if ($this->load > doubleval($config['limit_load'])) + if ($config['limit_load'] && $this->load > doubleval($config['limit_load'])) { trigger_error('BOARD_UNAVAILABLE'); } @@ -138,7 +138,7 @@ class session $sessiondata = array(); $current_time = time(); - if (intval($config['active_sessions'])) + if ($config['active_sessions']) { // Limit sessions in 1 minute period $sql = 'SELECT COUNT(*) AS sessions @@ -302,7 +302,7 @@ class session if ($this->data['user_id'] != ANONYMOUS) { - // Trigger EVT_END_SESSION + // Trigger EVENT_END_SESSION } return true; @@ -721,7 +721,7 @@ class auth while ($row = $db->sql_fetchrow($result)) { - if (!isset($hold_ary[$row['forum_id']][$row['auth_option']]) || (isset($hold_ary[$row['forum_id']][$row['auth_option']]) && $hold_ary[$row['forum_id']][$row['auth_option']] !== ACL_NO)) + if (!isset($hold_ary[$row['forum_id']][$row['auth_option']]) || (isset($hold_ary[$row['forum_id']][$row['auth_option']]) && $hold_ary[$row['forum_id']][$row['auth_option']] != ACL_NO)) { $hold_ary[$row['forum_id']][$row['auth_option']] = $row['min_setting']; } diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index da43668294..dbd992fbf2 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -35,7 +35,7 @@ class ucp_activate extends module { $sql_update_pass = ($row['user_newpasswd'] != '') ? ", user_password = '" . $db->sql_escape($row['user_newpasswd']) . "', user_newpasswd = ''" : ''; - $sql = "UPDATE " . USERS_TABLE . " + $sql = 'UPDATE ' . USERS_TABLE . " SET user_active = 1, user_actkey = ''" . $sql_update_pass . " WHERE user_id = " . $row['user_id']; $result = $db->sql_query($sql); @@ -63,7 +63,7 @@ class ucp_activate extends module else { meta_refresh(3, "index.$phpEx$SID"); - $message = ($sql_update_pass == '') ? $user->lang['Account_active'] : $user->lang['Password_activated']; + $message = (!$sql_update_pass) ? $user->lang['ACCOUNT_ACTIVE'] : $user->lang['PASSWORD_ACTIVATED']; trigger_error($message); } diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index d368188f01..11efb5a64d 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -35,8 +35,10 @@ class ucp_prefs extends module 'viewemail' => false, 'massemail' => true, 'hideonline' => false, + 'notifymethod' => 0, 'notifypm' => true, 'popuppm' => false, + 'allowpm' => true, ); foreach ($var_ary as $var => $default) @@ -54,14 +56,19 @@ class ucp_prefs extends module extract($data); unset($data); + // Set the popuppm option + $user->optionset('popuppm', $popuppm); + if (!sizeof($error)) { $sql_ary = array( + 'user_allow_pm' => $allowpm, 'user_allow_viewemail' => $viewemail, 'user_allow_massemail' => $massemail, 'user_allow_viewonline' => ($auth->acl_get('u_hideonline')) ? !$hideonline : $user->data['user_allow_viewonline'], + 'user_notify_type' => $notifymethod, 'user_notify_pm' => $notifypm, - 'user_popup_pm' => $popuppm, + 'user_options' => $user->data['user_options'], 'user_dst' => $dst, 'user_dateformat' => $dateformat, @@ -87,20 +94,24 @@ class ucp_prefs extends module $massemail = (isset($massemail)) ? $massemail : $user->data['user_allow_massemail']; $mass_email_yes = ($massemail) ? ' checked="checked"' : ''; $mass_email_no = (!$massemail) ? ' checked="checked"' : ''; + $allowpm = (isset($allowpm)) ? $allowpm : $user->data['user_allow_pm']; + $allow_pm_yes = ($allowpm) ? ' checked="checked"' : ''; + $allow_pm_no = (!$allowpm) ? ' checked="checked"' : ''; $hideonline = (isset($hideonline)) ? $hideonline : !$user->data['user_allow_viewonline']; $hide_online_yes = ($hideonline) ? ' checked="checked"' : ''; $hide_online_no = (!$hideonline) ? ' checked="checked"' : ''; $notifypm = (isset($notifypm)) ? $notifypm : $user->data['user_notify_pm']; $notify_pm_yes = ($notifypm) ? ' checked="checked"' : ''; $notify_pm_no = (!$notifypm) ? ' checked="checked"' : ''; - $popuppm = (isset($popuppm)) ? $popuppm : $user->data['user_popup_pm']; + $popuppm = (isset($popuppm)) ? $popuppm : $user->optionget('popuppm'); $popup_pm_yes = ($popuppm) ? ' checked="checked"' : ''; $popup_pm_no = (!$popuppm) ? ' checked="checked"' : ''; $dst = (isset($dst)) ? $dst : $user->data['user_dst']; $dst_yes = ($dst) ? ' checked="checked"' : ''; $dst_no = (!$dst) ? ' checked="checked"' : ''; + + $notifymethod = (isset($notifymethod)) ? $notifymethod : $user->data['user_notify_type']; $dateformat = (isset($dateformat)) ? $dateformat : $user->data['user_dateformat']; - $lang = (isset($lang)) ? $lang : $user->data['user_lang']; $style = (isset($style)) ? $style : $user->data['user_style']; $tz = (isset($tz)) ? $tz : $user->data['user_timezone']; @@ -114,19 +125,25 @@ class ucp_prefs extends module 'ADMIN_EMAIL_NO' => $mass_email_no, 'HIDE_ONLINE_YES' => $hide_online_yes, 'HIDE_ONLINE_NO' => $hide_online_no, + 'ALLOW_PM_YES' => $allow_pm_yes, + 'ALLOW_PM_NO' => $allow_pm_no, 'NOTIFY_PM_YES' => $notify_pm_yes, 'NOTIFY_PM_NO' => $notify_pm_no, 'POPUP_PM_YES' => $popup_pm_yes, 'POPUP_PM_NO' => $popup_pm_no, 'DST_YES' => $dst_yes, 'DST_NO' => $dst_no, + 'NOTIFY_EMAIL' => ($notifymethod == NOTIFY_EMAIL) ? 'checked="checked"' : '', + 'NOTIFY_IM' => ($notifymethod == NOTIFY_IM) ? 'checked="checked"' : '', + 'NOTIFY_BOTH' => ($notifymethod == NOTIFY_BOTH) ? 'checked="checked"' : '', 'DATE_FORMAT' => $dateformat, 'S_LANG_OPTIONS' => language_select($lang), 'S_STYLE_OPTIONS' => style_select($style), 'S_TZ_OPTIONS' => tz_select($tz), - 'S_CAN_HIDE_ONLINE' => true, + 'S_CAN_HIDE_ONLINE' => true, + 'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false, ) ); break; @@ -140,6 +157,7 @@ class ucp_prefs extends module 'sd' => (string) 'd', 'st' => 0, 'minkarma' => (int) -5, + 'images' => true, 'flash' => false, 'smilies' => true, @@ -164,13 +182,18 @@ class ucp_prefs extends module if (!sizeof($error)) { + $user->optionset('viewimg', $images); + $user->optionset('viewflash', $flash); + $user->optionset('viewsmilies', $smilies); + $user->optionset('viewsigs', $sigs); + $user->optionset('viewavatars', $avatars); + if ($auth->acl_get('u_chgcensors')) + { + $user->optionset('viewcensors', $wordcensor); + } + $sql_ary = array( - 'user_viewimg' => $images, - 'user_viewflash' => $flash, - 'user_viewsmilies' => $smilies, - 'user_viewsigs' => $sigs, - 'user_viewavatars' => $avatars, - 'user_viewcensors' => ($auth->acl_get('u_chgcensors')) ? $wordcensor : $user->data['user_viewcensors'], + 'user_options' => $user->data['user_options'], 'user_sortby_type' => $sk, 'user_sortby_dir' => $sd, 'user_show_days' => $st, @@ -209,22 +232,22 @@ class ucp_prefs extends module $s_min_karma_options .= "<option value=\"$i\"$selected>$i</option>"; } - $images = (isset($images)) ? $images : $user->data['user_viewimg']; + $images = (isset($images)) ? $images : $user->optionget('viewimg'); $images_yes = ($images) ? ' checked="checked"' : ''; $images_no = (!$images) ? ' checked="checked"' : ''; - $flash = (isset($flash)) ? $flash : $user->data['user_viewflash']; + $flash = (isset($flash)) ? $flash : $user->optionget('viewflash'); $flash_yes = ($flash) ? ' checked="checked"' : ''; $flash_no = (!$flash) ? ' checked="checked"' : ''; - $smilies = (isset($smilies)) ? $smilies : $user->data['user_viewsmilies']; + $smilies = (isset($smilies)) ? $smilies : $user->optionget('viewsmilies'); $smilies_yes = ($smilies) ? ' checked="checked"' : ''; $smilies_no = (!$smilies) ? ' checked="checked"' : ''; - $sigs = (isset($sigs)) ? $sigs : $user->data['user_viewsigs']; + $sigs = (isset($sigs)) ? $sigs : $user->optionget('viewsigs'); $sigs_yes = ($sigs) ? ' checked="checked"' : ''; $sigs_no = (!$sigs) ? ' checked="checked"' : ''; - $avatars = (isset($avatars)) ? $avatars : $user->data['user_viewavatars']; + $avatars = (isset($avatars)) ? $avatars : $user->optionget('viewavatars'); $avatars_yes = ($avatars) ? ' checked="checked"' : ''; $avatars_no = (!$avatars) ? ' checked="checked"' : ''; - $wordcensor = (isset($wordcensor)) ? $wordcensor : $user->data['user_viewcensors']; + $wordcensor = (isset($wordcensor)) ? $wordcensor : $user->optionget('viewcensors'); $wordcensor_yes = ($wordcensor) ? ' checked="checked"' : ''; $wordcensor_no = (!$wordcensor) ? ' checked="checked"' : ''; @@ -270,14 +293,16 @@ class ucp_prefs extends module $$var = request_var($var, $default); } + $user->optionset('bbcode', $bbcode); + $user->optionset('html', $html); + $user->optionset('smile', $smilies); + $user->optionset('attachsig', $sig); + if (!sizeof($error)) { $sql_ary = array( - 'user_allowbbcode' => $bbcode, - 'user_allowhtml' => $html, - 'user_allowsmile' => $smilies, - 'user_attachsig' => $sig, - 'user_notify' => $notify, + 'user_options' => $user->data['user_options'], + 'user_notify' => $notify, ); $sql = 'UPDATE ' . USERS_TABLE . ' @@ -291,16 +316,16 @@ class ucp_prefs extends module } } - $bbcode = (isset($bbcode)) ? $bbcode : $user->data['user_allowbbcode']; + $bbcode = (isset($bbcode)) ? $bbcode : $user->optionget('bbcode'); $bbcode_yes = ($bbcode) ? ' checked="checked"' : ''; $bbcode_no = (!$bbcode) ? ' checked="checked"' : ''; - $html = (isset($html)) ? $html : $user->data['user_allowhtml']; + $html = (isset($html)) ? $html : $user->optionget('html'); $html_yes = ($html) ? ' checked="checked"' : ''; $html_no = (!$html) ? ' checked="checked"' : ''; - $smilies = (isset($smilies)) ? $smilies : $user->data['user_allowsmile']; + $smilies = (isset($smilies)) ? $smilies : $user->optionget('smile'); $smilies_yes = ($smilies) ? ' checked="checked"' : ''; $smilies_no = (!$smilies) ? ' checked="checked"' : ''; - $sig = (isset($sig)) ? $sig : $user->data['user_attachsig']; + $sig = (isset($sig)) ? $sig : $user->optionget('attachsig'); $sig_yes = ($sig) ? ' checked="checked"' : ''; $sig_no = (!$sig) ? ' checked="checked"' : ''; $notify = (isset($notify)) ? $notify : $user->data['user_notify']; @@ -325,14 +350,13 @@ class ucp_prefs extends module } $template->assign_vars(array( - 'L_TITLE' => $user->lang['UCP_' . strtoupper($mode)], + 'L_TITLE' => $user->lang['UCP_' . strtoupper($mode)], - 'S_DISPLAY_' . strtoupper($mode) => true, - 'S_HIDDEN_FIELDS' => $s_hidden_fields, - 'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$mode") + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_UCP_ACTION' => "ucp.$phpEx$SID&i=$id&mode=$mode") ); - $this->display($user->lang['UCP_PROFILE'], 'ucp_prefs.html'); + $this->display($user->lang['UCP_PROFILE'], 'ucp_prefs_' . $mode . '.html'); } } diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 83dde01154..3df484b502 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -321,7 +321,7 @@ class ucp_register extends module { if ($row['attempts'] > 3) { -// trigger_error($user->lang['TOO_MANY_REGISTERS']); + trigger_error($user->lang['TOO_MANY_REGISTERS']); } } $db->sql_freeresult($result); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 9f5a19bb58..cf706de6f6 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -17,7 +17,9 @@ class ucp_remind extends module { global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; - if (isset($_POST['submit'])) + $submit = (isset($_POST['submit'])) ? true : false; + + if ($submit) { $username = (!empty($_POST['username'])) ? trim($_POST['username']) : ''; $email = (!empty($_POST['email'])) ? trim($_POST['email']) : ''; @@ -38,11 +40,11 @@ class ucp_remind extends module $server_url = generate_board_url(); $username = $row['username']; - $user_actkey = $this->gen_rand_string(10); + $user_actkey = gen_rand_string(10); $key_len = 54 - strlen($server_url); $key_len = ($str_len > 6) ? $key_len : 6; $user_actkey = substr($user_actkey, 0, $key_len); - $user_password = $this->gen_rand_string(false); + $user_password = gen_rand_string(false); $sql = 'UPDATE ' . USERS_TABLE . " SET user_newpasswd = '" . md5($user_password) . "', user_actkey = '$user_actkey' @@ -84,8 +86,7 @@ class ucp_remind extends module } else { - $username = ''; - $email = ''; + $username = $email = ''; } $template->assign_vars(array( diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index 4dd1e43fa5..e0c08cca16 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -97,7 +97,7 @@ class ucp_zebra extends module { foreach ($forum_ary as $forum_id => $option_ary) { - if (array_sum(array_values($forum_ary))) + if (array_sum(array_values($option_ary))) { $perms[] = $user_id; break; |