diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-04-20 00:22:29 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-04-20 00:22:29 +0000 |
commit | 5b0bba72b1c619af2f39859ec0c262f860f991ac (patch) | |
tree | 9fb003cf223ff6bf2e26feb78a35603dff88a471 /phpBB/includes | |
parent | 65aa92182826eb06830626df49ab7a0210b06718 (diff) | |
download | forums-5b0bba72b1c619af2f39859ec0c262f860f991ac.tar forums-5b0bba72b1c619af2f39859ec0c262f860f991ac.tar.gz forums-5b0bba72b1c619af2f39859ec0c262f860f991ac.tar.bz2 forums-5b0bba72b1c619af2f39859ec0c262f860f991ac.tar.xz forums-5b0bba72b1c619af2f39859ec0c262f860f991ac.zip |
merged from 2.0.0 branch (marked merge_point_20020420) + assorted updates and trial stuff for example session alterations
git-svn-id: file:///svn/phpbb/trunk@2532 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/bbcode.php | 10 | ||||
-rwxr-xr-x | phpBB/includes/emailer.php | 12 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_post.php | 12 | ||||
-rw-r--r-- | phpBB/includes/functions_search.php | 5 | ||||
-rw-r--r-- | phpBB/includes/functions_validate.php | 8 | ||||
-rw-r--r-- | phpBB/includes/page_header.php | 10 | ||||
-rw-r--r-- | phpBB/includes/sessions.php | 120 | ||||
-rw-r--r-- | phpBB/includes/usercp_avatar.php | 6 | ||||
-rw-r--r-- | phpBB/includes/usercp_email.php | 12 | ||||
-rw-r--r-- | phpBB/includes/usercp_register.php | 20 |
11 files changed, 116 insertions, 101 deletions
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index c90ab8145a..7084a34622 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -251,7 +251,7 @@ function bbencode_first_pass($text, $uid) // [QUOTE] and [/QUOTE] for posting replies with quote, or just for quoting stuff. $text = bbencode_first_pass_pda($text, $uid, '[quote]', '[/quote]', '', false, ''); - $text = bbencode_first_pass_pda($text, $uid, '/\[quote=(\\\\".*?\\\\")\]/is', '[/quote]', '', false, '', "[quote:$uid=\\1]"); + $text = bbencode_first_pass_pda($text, $uid, '/\[quote=(\\\\"[^"]*?\\\\")\]/is', '[/quote]', '', false, '', "[quote:$uid=\\1]"); // [list] and [list=x] for (un)ordered lists. $open_tag = array(); @@ -433,7 +433,13 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_ // Push its position, the text we matched, and its index in the open_tag array on to the stack, and then keep going to the right. $match = array("pos" => $curr_pos, "tag" => $which_start_tag, "index" => $start_tag_index); bbcode_array_push($stack, $match); - ++$curr_pos; + // + // Rather than just increment $curr_pos + // Set it to the ending of the tag we just found + // Keeps error in nested tag from breaking out + // of table structure.. + // + $curr_pos = $curr_pos + strlen($possible_start); } else { diff --git a/phpBB/includes/emailer.php b/phpBB/includes/emailer.php index a6e8aaf5f0..331d8fc3e8 100755 --- a/phpBB/includes/emailer.php +++ b/phpBB/includes/emailer.php @@ -178,17 +178,7 @@ class emailer // function send() { - global $phpEx, $phpbb_root_dir; - - if (isset($phpbb_root_dir)) - { - // we must be in the admin section. - $phpbb_root_path = $phpbb_root_dir; - } - else - { - $phpbb_root_path = "./"; - } + global $phpEx, $phpbb_root_path; if ($this->address == NULL) { diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 13fe5bd60c..f43ba358c0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -491,7 +491,7 @@ function obtain_word_list(&$orig_word, &$replacement_word) // function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '') { - global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path, $nav_links; + global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path, $nav_links, $gen_simple_header; global $userdata, $user_ip, $session_length; global $starttime; diff --git a/phpBB/includes/functions_post.php b/phpBB/includes/functions_post.php index 3d5e8e6b24..901a1bbbda 100644 --- a/phpBB/includes/functions_post.php +++ b/phpBB/includes/functions_post.php @@ -22,7 +22,7 @@ if ( !defined('IN_PHPBB') ) { - die("Hacking attempt"); + die('Hacking attempt'); } $html_entities_match = array('#&#', '#<#', '#>#'); @@ -380,7 +380,7 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i { global $db; - $sign = ( $mode == 'delete' ) ? "- 1" : "+ 1"; + $sign = ( $mode == 'delete' ) ? '- 1' : '+ 1'; $forum_update_sql = "forum_posts = forum_posts $sign"; $topic_update_sql = ''; @@ -395,7 +395,7 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i else { - $topic_update_sql = "topic_replies = topic_replies - 1"; + $topic_update_sql .= "topic_replies = topic_replies - 1"; $sql = "SELECT MAX(post_id) AS post_id FROM " . POSTS_TABLE . " @@ -439,9 +439,13 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i if ( $row = $db->sql_fetchrow($result) ) { - $topic_update_sql = 'topic_replies = topic_replies - 1, topic_first_post_id = ' . $row['post_id']; + $topic_update_sql .= 'topic_replies = topic_replies - 1, topic_first_post_id = ' . $row['post_id']; } } + else + { + $topic_update_sql .= 'topic_replies = topic_replies - 1'; + } } else if ( $mode != 'poll_delete' ) { diff --git a/phpBB/includes/functions_search.php b/phpBB/includes/functions_search.php index f42ff475c4..b02d094b6b 100644 --- a/phpBB/includes/functions_search.php +++ b/phpBB/includes/functions_search.php @@ -428,7 +428,9 @@ function remove_search_post($post_id_sql) function username_search($search_match) { global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path; - global $starttime; + global $starttime, $gen_simple_header; + + $gen_simple_header = TRUE; $username_list = ''; if ( !empty($search_match) ) @@ -459,7 +461,6 @@ function username_search($search_match) $db->sql_freeresult($result); } - $gen_simple_header = TRUE; $page_title = $lang['Search']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); diff --git a/phpBB/includes/functions_validate.php b/phpBB/includes/functions_validate.php index 4d61a44458..22b4c1c185 100644 --- a/phpBB/includes/functions_validate.php +++ b/phpBB/includes/functions_validate.php @@ -63,7 +63,7 @@ function validate_username($username) { while( $row = $db->sql_fetchrow($result) ) { - if ( preg_match("#\b(" . str_replace("\*", "\w*?", preg_quote($row['disallow_username'])) . ")\b#i", $username) ) + if ( preg_match("#\b(" . str_replace("\*", ".*?", preg_quote($row['disallow_username'])) . ")\b#i", $username) ) { return array('error' => true, 'error_msg' => $lang['Username_disallowed']); } @@ -76,7 +76,7 @@ function validate_username($username) { while( $row = $db->sql_fetchrow($result) ) { - if ( preg_match("#\b(" . str_replace("\*", "\w*?", preg_quote($row['word'])) . ")\b#i", $username) ) + if ( preg_match("#\b(" . str_replace("\*", ".*?", preg_quote($row['word'])) . ")\b#i", $username) ) { return array('error' => true, 'error_msg' => $lang['Username_disallowed']); } @@ -102,7 +102,7 @@ function validate_email($email) if ( $email != '' ) { - if ( preg_match('/^[a-z0-9\.\-_]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $email) ) + if ( preg_match('/^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $email) ) { $sql = "SELECT ban_email FROM " . BANLIST_TABLE; @@ -110,7 +110,7 @@ function validate_email($email) { while( $row = $db->sql_fetchrow($result) ) { - $match_email = str_replace('*', '.*', $row['ban_email']); + $match_email = str_replace('*', '.*?', $row['ban_email']); if ( preg_match('/^' . $match_email . '$/is', $email) ) { return array('error' => true, 'error_msg' => $lang['Email_banned']); diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index 65154e1822..c04b9f16fd 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.php @@ -85,13 +85,11 @@ $s_last_visit = ( $userdata['session_logged_in'] ) ? create_date($board_config[' // Get basic (usernames + totals) online // situation // -$user_forum_sql = ( !empty($forum_id) ) ? "AND ( u.user_session_page = $forum_id - OR s.session_page = $forum_id)" : ''; +$user_forum_sql = ( !empty($forum_id) ) ? "AND s.session_page = $forum_id" : ''; $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s WHERE u.user_id = s.session_user_id - AND ( s.session_time >= ".( time() - 300 ) . " - OR u.user_session_time >= " . ( time() - 300 ) . " ) + AND s.session_time >= ".( time() - 300 ) . " $user_forum_sql ORDER BY u.username ASC, s.session_ip ASC"; if( !($result = $db->sql_query($sql)) ) @@ -364,6 +362,8 @@ $template->assign_vars(array( 'L_SEARCH_SELF' => $lang['Search_your_posts'], 'L_WHOSONLINE_ADMIN' => sprintf($lang['Admin_online_color'], '<span style="color:#' . $theme['fontcolor3'] . '">', '</span>'), 'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'), + 'L_WHOSONLINE_USER' => sprintf($lang['User_online_color'], '<span style="color:#' . $theme['fontcolor1'] . '">', '</span>'), + 'L_LEGEND' => $lang['Legend'], 'U_SEARCH_UNANSWERED' => append_sid('search.'.$phpEx.'?search_id=unanswered'), 'U_SEARCH_SELF' => append_sid('search.'.$phpEx.'?search_id=egosearch'), @@ -386,7 +386,7 @@ $template->assign_vars(array( 'S_CONTENT_ENCODING' => $lang['ENCODING'], 'S_CONTENT_DIR_LEFT' => $lang['LEFT'], 'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'], - 'S_TIMEZONE' => sprintf($lang['All_times'], $lang[$board_config['board_timezone']]), + 'S_TIMEZONE' => sprintf($lang['All_times'], $lang[number_format($board_config['board_timezone'])]), 'S_LOGIN_ACTION' => append_sid('login.'.$phpEx), 'T_HEAD_STYLESHEET' => $theme['head_stylesheet'], diff --git a/phpBB/includes/sessions.php b/phpBB/includes/sessions.php index 81f2441fbd..7663aa8818 100644 --- a/phpBB/includes/sessions.php +++ b/phpBB/includes/sessions.php @@ -21,8 +21,6 @@ ***************************************************************************/ // -// session_begin() -// // Adds/updates a new session to the database for the given userid. // Returns the new session ID on success. // @@ -54,8 +52,7 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a $expiry_time = $current_time - $board_config['session_length']; // - // Try and pull the last time stored - // in a cookie, if it exists + // Try and pull the last time stored in a cookie, if it exists // $sql = "SELECT * FROM " . USERS_TABLE . " @@ -81,8 +78,6 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a // autologinid matches password $login = 1; $enable_autologin = 1; - - $last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time; } else { @@ -102,7 +97,6 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a } else { - $last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time; $login = 1; } } @@ -146,27 +140,29 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login WHERE session_id = '" . $session_id . "' AND session_ip = '$user_ip'"; - if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() ) + if ( !$db->sql_query($sql) || !$db->sql_affectedrows() ) { $session_id = md5(uniqid($user_ip)); $sql = "INSERT INTO " . SESSIONS_TABLE . " (session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in) VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login)"; - if ( !($result = $db->sql_query($sql)) ) + if ( !$db->sql_query($sql) ) { - message_die(CRITICAL_ERROR, 'Error creating new session : session_begin', '', __LINE__, __FILE__, $sql); + message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql); } } if ( $user_id != ANONYMOUS ) - { + {// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : ( + $last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time; + $sql = "UPDATE " . USERS_TABLE . " SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit WHERE user_id = $user_id"; if ( !$db->sql_query($sql) ) { - message_die(CRITICAL_ERROR, 'Error updating last visit time : session_begin', '', __LINE__, __FILE__, $sql); + message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql); } $userdata['user_lastvisit'] = $last_visit; @@ -185,8 +181,6 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure); setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure); -// header('Set-cookie: ' . $cookiename . '_data=' . urlencode(serialize($sessiondata)) . '; expires=' . gmdate("l, d-M-Y H:i:s", $current_time + 31536000) . ' GMT; domain=' . $cookiedomain . '; path=' . $cookiepath . $cookiesecure); -// header('Set-cookie: ' . $cookiename . '_sid=' . $session_id . '; domain=' . $cookiedomain . '; path=' . $cookiepath . $cookiesecure); $SID = ( $sessionmethod == SESSION_METHOD_GET ) ? 'sid=' . $session_id : ''; @@ -194,8 +188,8 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a } // -// Checks for a given user session, tidies session -// table and updates user sessions at each page refresh +// Checks for a given user session, tidies session table and updates user +// sessions at each page refresh // function session_pagestart($user_ip, $thispage_id) { @@ -206,7 +200,6 @@ function session_pagestart($user_ip, $thispage_id) $cookiepath = $board_config['cookie_path']; $cookiedomain = $board_config['cookie_domain']; $cookiesecure = $board_config['cookie_secure']; - $cookiesecure = ( $board_config['cookie_secure'] ) ? '; secure' : ''; $current_time = time(); unset($userdata); @@ -240,7 +233,7 @@ function session_pagestart($user_ip, $thispage_id) AND s.session_ip = '$user_ip'"; if ( !($result = $db->sql_query($sql)) ) { - message_die(CRITICAL_ERROR, 'Error doing DB query userdata row fetch : session_pagestart', '', __LINE__, __FILE__, $sql); + message_die(CRITICAL_ERROR, 'Error doing DB query userdata row fetch', '', __LINE__, __FILE__, $sql); } $userdata = $db->sql_fetchrow($result); @@ -255,32 +248,66 @@ function session_pagestart($user_ip, $thispage_id) // // Only update session DB a minute or so after last update // - $last_update = ( $userdata['user_id'] == ANONYMOUS ) ? $userdata['session_time'] : $userdata['user_session_time']; - - if ( $current_time - $last_update > 60 ) - { // || $userdata['user_session_page'] != $thispage_id - $sql = ( $userdata['user_id'] == ANONYMOUS ) ? "UPDATE " . SESSIONS_TABLE . " SET session_time = $current_time, session_page = $thispage_id WHERE session_id = '" . $userdata['session_id'] . "' AND session_ip = '$user_ip'" : "UPDATE " . USERS_TABLE . " SET user_session_time = $current_time, user_session_page = $thispage_id WHERE user_id = " . $userdata['user_id']; + if ( $current_time - $userdata['session_time'] > 60 || $userdata['session_page'] != $thispage_id ) + { + $sql = "UPDATE " . SESSIONS_TABLE . " + SET session_time = $current_time, session_page = $thispage_id + WHERE session_id = '" . $userdata['session_id'] . "' + AND session_ip = '$user_ip'"; if ( !$db->sql_query($sql) ) { - message_die(CRITICAL_ERROR, 'Error updating sessions table : session_pagestart', '', __LINE__, __FILE__, $sql); + message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql); } - // - // Delete expired sessions - // - $expiry_time = $current_time - $board_config['session_length']; - $sql = "DELETE FROM " . SESSIONS_TABLE . " - WHERE session_time < $expiry_time - AND session_id <> '$session_id'"; - if ( !($result = $db->sql_query($sql)) ) + if ( $current_time - $board_config['session_gc'] > $board_config['session_last_gc'] ) { - message_die(CRITICAL_ERROR, 'Error clearing sessions table : session_pagestart', '', __LINE__, __FILE__, $sql); + $sql = "SELECT * + FROM " . SESSIONS_TABLE . " + WHERE session_time < " . ( $current_time - $board_config['session_length'] ) . " + AND session_logged_in = 1"; + if ( !($result = $db->sql_query($sql)) ) + { + message_die(CRITICAL_ERROR, 'Could not obtain expired session list', '', __LINE__, __FILE__, $sql); + } + + $del_session_id = ''; + while ( $row = $db->sql_fetchrow($result) ) + { + $sql = "UPDATE " . USERS_TABLE . " + SET user_lastvisit = " . $row['session_time'] . ", user_session_page = " . $row['session_page'] . " + WHERE user_id = " . $row['session_user_id']; + if ( !$db->sql_query($sql) ) + { + message_die(CRITICAL_ERROR, 'Could not update user session info', '', __LINE__, __FILE__, $sql); + } + + $del_session_id .= ( ( $del_session_id != '' ) ? ', ' : '' ) . '\'' . $row['session_id'] . '\''; + } + + if ( $del_session_id != '' ) + { + // + // Delete expired sessions + // + $sql = "DELETE FROM " . SESSIONS_TABLE . " + WHERE session_id IN ($del_session_id)"; + if ( !$db->sql_query($sql) ) + { + message_die(CRITICAL_ERROR, 'Error clearing sessions table', '', __LINE__, __FILE__, $sql); + } + } + + echo $sql = "UPDATE " . CONFIG_TABLE . " + SET config_value = '$current_time' + WHERE config_name = 'session_last_gc'"; + if ( !$db->sql_query($sql) ) + { + message_die(CRITICAL_ERROR, 'Could not update session gc time', '', __LINE__, __FILE__, $sql); + } } setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure); setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure); -// header('Set-cookie: ' . $cookiename . '_data=' . urlencode(serialize($sessiondata)) . '; expires=' . gmdate("l, d-M-Y H:i:s", $current_time + 31536000) . ' GMT; domain=' . $cookiedomain . '; path=' . $cookiepath . $cookiesecure); -// header('Set-cookie: ' . $cookiename . '_sid=' . $session_id . '; domain=' . $cookiedomain . '; path=' . $cookiepath . $cookiesecure); } return $userdata; @@ -295,7 +322,7 @@ function session_pagestart($user_ip, $thispage_id) if ( !($userdata = session_begin($user_id, $user_ip, $thispage_id, TRUE)) ) { - message_die(CRITICAL_ERROR, 'Error creating user session : session_pagestart', '', __LINE__, __FILE__, $sql); + message_die(CRITICAL_ERROR, 'Error creating user session', '', __LINE__, __FILE__, $sql); } return $userdata; @@ -316,7 +343,6 @@ function session_end($session_id, $user_id) $cookiepath = $board_config['cookie_path']; $cookiedomain = $board_config['cookie_domain']; $cookiesecure = $board_config['cookie_secure']; -// $cookiesecure = ( $board_config['cookie_secure'] ) ? '; secure' : ''; // // Pull cookiedata or grab the URI propagated sid @@ -324,12 +350,10 @@ function session_end($session_id, $user_id) if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) ) { $session_id = isset( $HTTP_COOKIE_VARS[$cookiename . '_sid'] ) ? $HTTP_COOKIE_VARS[$cookiename . '_sid'] : ''; - $sessionmethod = SESSION_METHOD_COOKIE; } else { $session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : ''; - $sessionmethod = SESSION_METHOD_GET; } // @@ -338,27 +362,19 @@ function session_end($session_id, $user_id) $sql = "DELETE FROM " . SESSIONS_TABLE . " WHERE session_id = '$session_id' AND session_user_id = $user_id"; - if ( !($result = $db->sql_query($sql)) ) + if ( !$db->sql_query($sql) ) { - message_die(CRITICAL_ERROR, 'Error removing user session : session_end', '', __LINE__, __FILE__, $sql); + message_die(CRITICAL_ERROR, 'Error removing user session', '', __LINE__, __FILE__, $sql); } setcookie($cookiename . '_data', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure); setcookie($cookiename . '_sid', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure); -// header('Set-cookie: ' . $cookiename . '_data=0; expires=' . gmdate("l, d-M-Y H:i:s", 0) . ' GMT; domain=' . $cookiedomain . '; path=' . $cookiepath. $cookiesecure); -// header('Set-cookie: ' . $cookiename . '_sid=0; expires=' . gmdate("l, d-M-Y H:i:s", 0) . ' GMT; domain=' . $cookiedomain . '; path=' . $cookiepath . $cookiesecure); - - $SID = ( $sessionmethod == SESSION_METHOD_GET ) ? 'sid=' . $session_id : ''; - - return TRUE; + return true; } // -// Append $SID to a url. Borrowed from phplib and modified. This is an -// extra routine utilised by the session code above and acts as a wrapper -// around every single URL and form action. If you replace the session -// code you must include this routine, even if it's empty. +// Append $SID to a url. Borrowed from phplib and modified. // function append_sid($url, $non_html_amp = false) { @@ -372,4 +388,4 @@ function append_sid($url, $non_html_amp = false) return($url); } -?> +?>
\ No newline at end of file diff --git a/phpBB/includes/usercp_avatar.php b/phpBB/includes/usercp_avatar.php index 9ba50399ee..61544d6eb6 100644 --- a/phpBB/includes/usercp_avatar.php +++ b/phpBB/includes/usercp_avatar.php @@ -233,7 +233,7 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ return $avatar_sql; } -function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popuppm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$allowviewonline, &$style, &$language, &$timezone, &$dateformat) +function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popuppm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat) { global $board_config, $db, $template, $lang, $images, $theme; global $phpbb_root_path, $phpEx; @@ -309,7 +309,7 @@ function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current } } - $params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popuppm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'allowviewonline', 'style', 'language', 'timezone', 'dateformat'); + $params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popuppm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat'); $s_hidden_vars = '<input type="hidden" name="agreed" value="true" />'; @@ -333,4 +333,4 @@ function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current return; } -?> +?>
\ No newline at end of file diff --git a/phpBB/includes/usercp_email.php b/phpBB/includes/usercp_email.php index 7970c4f1c8..0878da61ba 100644 --- a/phpBB/includes/usercp_email.php +++ b/phpBB/includes/usercp_email.php @@ -27,12 +27,6 @@ if ( !defined('IN_PHPBB') ) exit; } -if ( !$userdata['session_logged_in'] ) -{ - header('Location: ' . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=email&" . POST_USERS_URL . "=$user_id", true)); - exit; -} - if ( !empty($HTTP_GET_VARS[POST_USERS_URL]) || !empty($HTTP_POST_VARS[POST_USERS_URL]) ) { $user_id = ( !empty($HTTP_GET_VARS[POST_USERS_URL]) ) ? $HTTP_GET_VARS[POST_USERS_URL] : $HTTP_POST_VARS[POST_USERS_URL]; @@ -42,6 +36,12 @@ else message_die(GENERAL_MESSAGE, $lang['No_user_specified']); } +if ( !$userdata['session_logged_in'] ) +{ + header('Location: ' . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=email&" . POST_USERS_URL . "=$user_id", true)); + exit; +} + $sql = "SELECT username, user_email, user_viewemail, user_lang FROM " . USERS_TABLE . " WHERE user_id = $user_id"; diff --git a/phpBB/includes/usercp_register.php b/phpBB/includes/usercp_register.php index d8a7352fc2..f2d29d7d65 100644 --- a/phpBB/includes/usercp_register.php +++ b/phpBB/includes/usercp_register.php @@ -27,11 +27,11 @@ if ( !defined('IN_PHPBB') ) exit; } -// +// --------------------------------------- // Load agreement template since user has not yet // agreed to registration conditions/coppa // -function show_coppa(&$coppa) +function show_coppa() { global $template, $lang, $phpbb_root_path, $phpEx; @@ -40,7 +40,6 @@ function show_coppa(&$coppa) ); $template->assign_vars(array( - 'COPPA' => $coppa, 'REGISTRATION' => $lang['Registration'], 'AGREEMENT' => $lang['Reg_agreement'], "AGREE_OVER_13" => $lang['Agree_over_13'], @@ -55,8 +54,7 @@ function show_coppa(&$coppa) } // -// -// +// --------------------------------------- $error = FALSE; $page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register']; @@ -65,12 +63,12 @@ if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GE { include($phpbb_root_path . 'includes/page_header.'.$phpEx); - show_coppa($coppa); + show_coppa(); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } -$coppa = ( ( !$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa'] ) || $mode == 'register' ) ? 0 : TRUE; +$coppa = ( empty($HTTP_POST_VARS['coppa']) && empty($HTTP_GET_VARS['coppa']) ) ? 0 : TRUE; // // Check and initialize some variables if needed @@ -223,14 +221,12 @@ if ( isset($HTTP_POST_VARS['submit']) ) } else if ( $mode == 'register' ) { - $coppa = (!$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa']) ? 0 : TRUE; - if ( empty($username) || empty($password) || empty($password_confirm) || empty($email) ) { $error = TRUE; $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty']; } - + } $passwd_sql = ''; @@ -707,6 +703,8 @@ if( isset($HTTP_POST_VARS['avatargallery']) && !$error ) 'body' => 'profile_avatar_gallery.tpl') ); + $allowviewonline = !$allowviewonline; + display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popuppm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat); } else @@ -787,7 +785,7 @@ else // us from doing file uploads.... // $ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; - $form_enctype = ( !@$ini_val('file_uploads') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"'; + $form_enctype = ( @$ini_val('file_uploads') == '0' || strtolower(@$ini_val('file_uploads') == 'off') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"'; $template->assign_vars(array( 'USERNAME' => $username, |