diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/forums_display.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 33 | ||||
-rw-r--r-- | phpBB/includes/usercp_register.php | 18 |
3 files changed, 42 insertions, 11 deletions
diff --git a/phpBB/includes/forums_display.php b/phpBB/includes/forums_display.php index 820d7cb2e3..7810118158 100644 --- a/phpBB/includes/forums_display.php +++ b/phpBB/includes/forums_display.php @@ -77,7 +77,7 @@ foreach ($forum_rows as $row) { $last_post = $user->format_date($forum_last_post_time) . '<br />'; - $last_post .= ($forum_last_poster_id == ANONYMOUS) ? (($forum_last_poster_name != '') ? $forum_last_poster_name . ' ' : $user->lang['Guest'] . ' ') : '<a href="profile.' . $phpEx . $SID . '&mode=viewprofile&u=' . $forum_last_poster_id . '">' . $username . '</a> '; + $last_post .= ($forum_last_poster_id == ANONYMOUS) ? (($forum_last_poster_name != '') ? $forum_last_poster_name . ' ' : $user->lang['Guest'] . ' ') : '<a href="profile.' . $phpEx . $SID . '&mode=viewprofile&u=' . $forum_last_poster_id . '">' . $forum_last_poster_name . '</a> '; $last_post .= '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&p=' . $forum_last_post_id . '#' . $forum_last_post_id . '">' . $user->img('goto_post_latest', 'View_latest_post') . '</a>'; } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 970c727d4d..555a2f0774 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -19,6 +19,11 @@ * ***************************************************************************/ +function sql_addslashes($msg) +{ + return str_replace("'", "''", str_replace('\\', '\\\\', $msg)); +} + function sql_quote($msg) { return str_replace("\'", "''", $msg); @@ -394,7 +399,7 @@ function tz_select($default, $select_name = 'timezone') } // Topic and forum watching common code -function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $match_id) +function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $match_id, $notify_status = 'unset') { global $template, $db, $user, $phpEx, $SID, $start; @@ -407,13 +412,25 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat { $can_watch = TRUE; - $sql = "SELECT notify_status - FROM " . $table_sql . " - WHERE $where_sql = $match_id - AND user_id = $user_id"; - $result = $db->sql_query($sql); + if ($notify_status == 'unset') + { + $sql = "SELECT notify_status + FROM $table_sql + WHERE $where_sql = $match_id + AND user_id = $user_id"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $notify_status = $row['notify_status']; + } + else + { + $notify_status = NULL; + } + } - if ( $row = $db->sql_fetchrow($result) ) + if (!is_null($notify_status)) { if ( isset($_GET['unwatch']) ) { @@ -438,7 +455,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat { $is_watching = TRUE; - if ( $row['notify_status'] ) + if ($notify_status) { $sql = "UPDATE " . $table_sql . " SET notify_status = 0 diff --git a/phpBB/includes/usercp_register.php b/phpBB/includes/usercp_register.php index e443f37e59..81d66f07af 100644 --- a/phpBB/includes/usercp_register.php +++ b/phpBB/includes/usercp_register.php @@ -288,6 +288,13 @@ if (isset($_POST['submit'])) else { $username_sql = "username = '" . sql_quote($username) . "', "; + if ($mode != 'register') + { + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_last_poster_name = '" . sql_quote($username) . "' + WHERE forum_last_poster_id = " . $user_id; + $db->sql_query($sql); + } } } } @@ -359,7 +366,6 @@ if (isset($_POST['submit'])) 'user_dateformat' => $user_dateformat, 'user_lang' => $user_lang, 'user_style' => $user_style, - 'user_level' => 0, 'user_allow_pm' => 1, 'user_active' => $user_active, 'user_actkey' => $user_actkey @@ -367,7 +373,15 @@ if (isset($_POST['submit'])) if ($mode == 'editprofile') { - $db->sql_query_array('UPDATE ' . USERS_TABLE . ' SET WHERE user_id = ' . $user_id, &$sql_ary); + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_id); + + if ($config['newest_user_id'] == $user_id) + { + $sql = 'UPDATE ' . CONFIG_TABLE . " + SET config_value = '" . sql_quote($username) . "' + WHERE config_name = 'newest_username'"; + $db->sql_query($sql); + } if ( !$user_active ) { |