1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-19 23:32:02 +02:00

[feature/notify_status] Define'd constants for notify_status

define'd constants NOTIFY_YES, NOTIFY_NO to replace magic numbers in
forums_watch table and topics_watch table

PHPBB3-9179
This commit is contained in:
Mark 2010-03-31 14:44:39 +02:00 committed by Nils Adermann
parent e36da18b1c
commit cc8d22bed6
3 changed files with 16 additions and 11 deletions

View File

@ -117,6 +117,11 @@ define('NOTIFY_EMAIL', 0);
define('NOTIFY_IM', 1);
define('NOTIFY_BOTH', 2);
// Notify status
define('NOTIFY_YES', 0);
define('NOTIFY_NO', 1);
// Email Priority Settings
define('MAIL_LOW_PRIORITY', 4);
define('MAIL_NORMAL_PRIORITY', 3);

View File

@ -1112,10 +1112,10 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
{
$is_watching = true;
if ($notify_status)
if ($notify_status != NOTIFY_YES)
{
$sql = 'UPDATE ' . $table_sql . "
SET notify_status = 0
SET notify_status = " . NOTIFY_YES . "
WHERE $where_sql = $match_id
AND user_id = $user_id";
$db->sql_query($sql);
@ -1134,7 +1134,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
$is_watching = true;
$sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status)
VALUES ($user_id, $match_id, 0)";
VALUES ($user_id, $match_id, " . NOTIFY_YES . ')';
$db->sql_query($sql);
$message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
}

View File

@ -1201,8 +1201,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
FROM ' . (($topic_notification) ? TOPICS_WATCH_TABLE : FORUMS_WATCH_TABLE) . ' w, ' . USERS_TABLE . ' u
WHERE w.' . (($topic_notification) ? 'topic_id' : 'forum_id') . ' = ' . (($topic_notification) ? $topic_id : $forum_id) . "
AND w.user_id NOT IN ($sql_ignore_users)
AND w.notify_status = 0
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
AND w.notify_status = " . NOTIFY_YES . '
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
AND u.user_id = w.user_id';
$result = $db->sql_query($sql);
@ -1234,8 +1234,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
FROM ' . FORUMS_WATCH_TABLE . ' fw, ' . USERS_TABLE . " u
WHERE fw.forum_id = $forum_id
AND fw.user_id NOT IN ($sql_ignore_users)
AND fw.notify_status = 0
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
AND fw.notify_status = " . NOTIFY_YES . '
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
AND u.user_id = fw.user_id';
$result = $db->sql_query($sql);
@ -1344,8 +1344,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
if (!empty($update_notification['topic']))
{
$sql = 'UPDATE ' . TOPICS_WATCH_TABLE . "
SET notify_status = 1
$sql = 'UPDATE ' . TOPICS_WATCH_TABLE . '
SET notify_status = ' . NOTIFY_NO . "
WHERE topic_id = $topic_id
AND " . $db->sql_in_set('user_id', $update_notification['topic']);
$db->sql_query($sql);
@ -1353,8 +1353,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
if (!empty($update_notification['forum']))
{
$sql = 'UPDATE ' . FORUMS_WATCH_TABLE . "
SET notify_status = 1
$sql = 'UPDATE ' . FORUMS_WATCH_TABLE . '
SET notify_status = ' . NOTIFY_NO . "
WHERE forum_id = $forum_id
AND " . $db->sql_in_set('user_id', $update_notification['forum']);
$db->sql_query($sql);