Gazelle/sections/userhistory/catchup.php

23 lines
771 B
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
authorize();
2013-05-01 08:00:16 +00:00
if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
2013-07-04 08:00:56 +00:00
$DB->query('
SELECT TopicID
FROM users_subscriptions
WHERE UserID = '.db_string($LoggedUser['ID']));
2013-05-01 08:00:16 +00:00
if ($UserSubscriptions = $DB->collect(0)) {
2013-07-04 08:00:56 +00:00
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'], $UserSubscriptions, 0);
2011-03-28 14:21:28 +00:00
}
}
2013-05-01 08:00:16 +00:00
if (!empty($UserSubscriptions)) {
2013-07-04 08:00:56 +00:00
$DB->query("
INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
SELECT '$LoggedUser[ID]', ID, LastPostID
FROM forums_topics
WHERE ID IN (".implode(',', $UserSubscriptions).')
ON DUPLICATE KEY UPDATE PostID = LastPostID');
2011-03-28 14:21:28 +00:00
}
$Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']);
header('Location: userhistory.php?action=subscriptions');
?>