1
0
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:
Ludovic Arnaud
2002-11-05 04:50:55 +00:00
parent 5b73ad4cbd
commit bc6e36ef4f
12 changed files with 225 additions and 111 deletions

View File

@@ -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 . '&amp;mode=viewprofile&amp;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 . '&amp;mode=viewprofile&amp;u=' . $forum_last_poster_id . '">' . $forum_last_poster_name . '</a> ';
$last_post .= '<a href="viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;p=' . $forum_last_post_id . '#' . $forum_last_post_id . '">' . $user->img('goto_post_latest', 'View_latest_post') . '</a>';
}

View File

@@ -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

View File

@@ -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 )
{