mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-08 01:36:57 +02:00
viewforum queries update + a couple of bugfixes.
git-svn-id: file:///svn/phpbb/trunk@3007 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -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>';
|
||||
}
|
||||
|
@@ -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) )
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$notify_status = $row['notify_status'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$notify_status = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
@@ -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 )
|
||||
{
|
||||
|
Reference in New Issue
Block a user