Gazelle/sections/forums/catchup.php

29 lines
778 B
PHP
Raw Permalink 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
2013-09-06 08:00:41 +00:00
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
2013-09-06 08:00:41 +00:00
WHERE (LastPostTime > '".time_minus(3600 * 24 * 30)."' OR IsSticky = '1')
2013-05-05 08:00:31 +00:00
AND ForumID = ".$_GET['forumid']."
2013-09-06 08:00:41 +00:00
ON DUPLICATE KEY UPDATE
PostID = LastPostID");
2011-03-28 14:21:28 +00:00
header('Location: forums.php?action=viewforum&forumid='.$_GET['forumid']);
}
?>