1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 16:27:38 +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

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