Gazelle/sections/forums/catchup.php

28 lines
765 B
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
authorize();
2013-05-05 08:00:31 +00:00
if (!isset($_GET['forumid']) || ($_GET['forumid'] != 'all' && !is_number($_GET['forumid']))) {
error(403);
}
2011-03-28 14:21:28 +00:00
2013-05-05 08:00:31 +00:00
if ($_GET['forumid'] == 'all') {
$DB->query("
UPDATE users_info
SET CatchupTime=NOW()
WHERE UserID=$LoggedUser[ID]");
2011-03-28 14:21:28 +00:00
$Cache->delete_value('user_info_'.$LoggedUser['ID']);
header('Location: forums.php');
} else {
// Insert a value for each topic
2013-05-05 08:00:31 +00:00
$DB->query("
INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
SELECT '$LoggedUser[ID]', ID, LastPostID
FROM forums_topics
WHERE (LastPostTime>'".time_minus(3600 * 24 * 30)."' OR IsSticky='1')
AND ForumID = ".$_GET['forumid']."
ON DUPLICATE KEY UPDATE PostID=LastPostID");
2011-03-28 14:21:28 +00:00
header('Location: forums.php?action=viewforum&forumid='.$_GET['forumid']);
}
?>