aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-02-12 17:04:11 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-02-12 17:04:11 +0000
commit4b80d45e8ed50d5fe5f6f0eaebc20ef8897d2e57 (patch)
tree6e4a7d24086c5fc1556c6d1613a67ab0b5d63855
parent84163cb816039f2593beba7366542493b46a5e70 (diff)
downloadforums-4b80d45e8ed50d5fe5f6f0eaebc20ef8897d2e57.tar
forums-4b80d45e8ed50d5fe5f6f0eaebc20ef8897d2e57.tar.gz
forums-4b80d45e8ed50d5fe5f6f0eaebc20ef8897d2e57.tar.bz2
forums-4b80d45e8ed50d5fe5f6f0eaebc20ef8897d2e57.tar.xz
forums-4b80d45e8ed50d5fe5f6f0eaebc20ef8897d2e57.zip
Minor update to topic notification which should put an end to a rare bug
git-svn-id: file:///svn/phpbb/trunk@2110 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/viewtopic.php34
1 files changed, 15 insertions, 19 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 684dd01bd4..92c44ffa2d 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -215,12 +215,9 @@ if ( !empty($post_id) )
}
//
-// Is user watching this thread? This could potentially
-// be combined into the above query but the LEFT JOIN causes
-// a number of problems which will probably end up in this
-// solution being practically as fast and certainly simpler!
+// Is user watching this thread?
//
-if( $userdata['user_id'] != ANONYMOUS )
+if( $userdata['session_logged_in'] )
{
$can_watch_topic = TRUE;
@@ -228,11 +225,12 @@ if( $userdata['user_id'] != ANONYMOUS )
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
- if( !$result = $db->sql_query($sql) )
+ if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain topic watch information", "", __LINE__, __FILE__, $sql);
}
- else if( $db->sql_numrows($result) )
+
+ if( $row = $db->sql_fetchrow($result) )
{
if( isset($HTTP_GET_VARS['unwatch']) )
{
@@ -254,16 +252,14 @@ if( $userdata['user_id'] != ANONYMOUS )
"META" => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . '">')
);
- $message = $lang['No_longer_watching']. "<br /><br />" . sprintf($lang['Click_return_topic'], "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . "\">", "</a>");
+ $message = $lang['No_longer_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
$is_watching_topic = TRUE;
- $watch_data = $db->sql_fetchrow($result);
-
- if( $watch_data['notify_status'] )
+ if( $row['notify_status'] )
{
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
$sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . "
@@ -298,7 +294,7 @@ if( $userdata['user_id'] != ANONYMOUS )
"META" => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . '">')
);
- $message = $lang['You_are_watching']. "<br /><br />" . sprintf($lang['Click_return_topic'], "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . "\">", "</a>");
+ $message = $lang['You_are_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
@@ -362,13 +358,13 @@ else
$post_days = 0;
}
-$select_post_days = "<select name=\"postdays\">";
+$select_post_days = '<select name="postdays">';
for($i = 0; $i < count($previous_days); $i++)
{
$selected = ($post_days == $previous_days[$i]) ? ' selected="selected"' : '';
- $select_post_days .= "<option value=\"" . $previous_days[$i] . "\"$selected>" . $previous_days_text[$i] . "</option>";
+ $select_post_days .= '<option value="' . $previous_days[$i] . '"' . $selected . '>' . $previous_days_text[$i] . '</option>';
}
-$select_post_days .= "</select>";
+$select_post_days .= '</select>';
//
// Decide how to order the post display
@@ -384,16 +380,16 @@ else
$post_time_order = "ASC";
}
-$select_post_order = "<select name=\"postorder\">";
+$select_post_order = '<select name="postorder">';
if($post_time_order == "ASC")
{
- $select_post_order .= "<option value=\"asc\" selected=\"selected\">" . $lang['Oldest_First'] . "</option><option value=\"desc\">" . $lang['Newest_First'] . "</option>";
+ $select_post_order .= '<option value="asc" selected="selected">' . $lang['Oldest_First'] . '</option><option value="desc">' . $lang['Newest_First'] . '</option>';
}
else
{
- $select_post_order .= "<option value=\"asc\">" . $lang['Oldest_First'] . "</option><option value=\"desc\" selected=\"selected\">" . $lang['Newest_First'] . "</option>";
+ $select_post_order .= '<option value="asc">' . $lang['Oldest_First'] . '</option><option value="desc" selected="selected">' . $lang['Newest_First'] . '</option>';
}
-$select_post_order .= "</select>";
+$select_post_order .= '</select>';
//
// Go ahead and pull all data for this topic