diff options
author | Henry Sudhof <kellanved@phpbb.com> | 2008-08-21 15:50:21 +0000 |
---|---|---|
committer | Henry Sudhof <kellanved@phpbb.com> | 2008-08-21 15:50:21 +0000 |
commit | 3a3b9eb8efe08f086bcbd1d88a34355e31df7650 (patch) | |
tree | 08305a29fb8ea7fac59c507187243436ac2827b4 /phpBB/includes/functions_display.php | |
parent | 76a542a03e11db7fbe61e8c151f0d7f8124fd7d1 (diff) | |
download | forums-3a3b9eb8efe08f086bcbd1d88a34355e31df7650.tar forums-3a3b9eb8efe08f086bcbd1d88a34355e31df7650.tar.gz forums-3a3b9eb8efe08f086bcbd1d88a34355e31df7650.tar.bz2 forums-3a3b9eb8efe08f086bcbd1d88a34355e31df7650.tar.xz forums-3a3b9eb8efe08f086bcbd1d88a34355e31df7650.zip |
merge
git-svn-id: file:///svn/phpbb/trunk@8776 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_display.php')
-rw-r--r-- | phpBB/includes/functions_display.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index f2bcf36859..f90f451801 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -985,8 +985,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE; $where_sql = ($mode == 'forum') ? 'forum_id' : 'topic_id'; $match_id = ($mode == 'forum') ? $forum_id : $topic_id; - - $u_url = ($mode == 'forum') ? 'f' : 'f=' . $forum_id . '&t'; + $u_url = "uid={$user->data['user_id']}&hash=" . generate_link_hash("{$mode}_$topic_id"); + $u_url .= ($mode == 'forum') ? '&f' : '&f=' . $forum_id . '&t'; // Is user watching this thread? if ($user_id != ANONYMOUS) @@ -1007,8 +1007,16 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if (!is_null($notify_status) && $notify_status !== '') { + if (isset($_GET['unwatch'])) { + $uid = request_var('uid', 0); + if ($uid != $user_id) + { + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + trigger_error($message); + } if ($_GET['unwatch'] == $mode) { $is_watching = 0; @@ -1044,19 +1052,25 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { if (isset($_GET['watch'])) { - if ($_GET['watch'] == $mode) + $token = request_var('hash', ''); + $redirect_url = append_sid("view$mode", "$u_url=$match_id&start=$start"); + + if ($_GET['watch'] == $mode && check_link_hash($token, "{$mode}_$topic_id")) { $is_watching = true; $sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status) VALUES ($user_id, $match_id, 0)"; $db->sql_query($sql); + $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); } - - $redirect_url = append_sid("view$mode", "$u_url=$match_id&start=$start"); + else + { + $message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + } + meta_refresh(3, $redirect_url); - $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); } else |