Gazelle/sections/collages/collage.php

83 lines
2.1 KiB
PHP
Raw Normal View History

2013-11-10 08:00:49 +00:00
<?
2013-07-13 08:00:46 +00:00
ini_set('max_execution_time', 600);
2012-07-21 08:00:14 +00:00
2011-03-28 14:21:28 +00:00
//~~~~~~~~~~~ Main collage page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
2013-11-10 08:00:49 +00:00
if (empty($_GET['id']) || !is_number($_GET['id'])) {
2012-11-03 08:00:19 +00:00
error(0);
}
2013-11-10 08:00:49 +00:00
$CollageID = $_GET['id'];
2011-03-28 14:21:28 +00:00
2013-11-10 08:00:49 +00:00
$CollageData = $Cache->get_value("collage_$CollageID");
if ($CollageData) {
list($Name, $Description, $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers) = $CollageData;
2011-03-28 14:21:28 +00:00
} else {
2013-07-13 08:00:46 +00:00
$DB->query("
2013-10-29 08:01:29 +00:00
SELECT
Name,
Description,
UserID,
Deleted,
CategoryID,
Locked,
MaxGroups,
MaxGroupsPerUser,
Updated,
Subscribers
2013-07-13 08:00:46 +00:00
FROM collages
WHERE ID = '$CollageID'");
2013-07-10 00:08:53 +00:00
if ($DB->has_results()) {
2013-11-10 08:00:49 +00:00
list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers) = $DB->next_record(MYSQLI_NUM);
$CommentList = null;
2011-03-28 14:21:28 +00:00
} else {
$Deleted = '1';
}
2013-11-10 08:00:49 +00:00
$SetCache = true;
2011-03-28 14:21:28 +00:00
}
2013-07-13 08:00:46 +00:00
if ($Deleted === '1') {
header("Location: log.php?search=Collage+$CollageID");
2011-03-28 14:21:28 +00:00
die();
}
2013-11-10 08:00:49 +00:00
// Handle subscriptions
2013-04-13 08:00:19 +00:00
if (($CollageSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) === false) {
2013-07-13 08:00:46 +00:00
$DB->query("
SELECT CollageID
FROM users_collage_subs
WHERE UserID = '$LoggedUser[ID]'");
$CollageSubscriptions = $DB->collect(0);
2013-07-13 08:00:46 +00:00
$Cache->cache_value('collage_subs_user_'.$LoggedUser['ID'], $CollageSubscriptions, 0);
}
2013-11-10 08:00:49 +00:00
if (!empty($CollageSubscriptions) && in_array($CollageID, $CollageSubscriptions)) {
$DB->query("
UPDATE users_collage_subs
SET LastVisit = NOW()
WHERE UserID = ".$LoggedUser['ID']."
AND CollageID = $CollageID");
$Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']);
}
2013-11-10 08:00:49 +00:00
if ($CollageCategoryID == array_search(ARTIST_COLLAGE, $CollageCats)) {
2013-05-25 08:01:03 +00:00
include(SERVER_ROOT.'/sections/collages/artist_collage.php');
2012-10-28 08:00:19 +00:00
} else {
2013-05-25 08:01:03 +00:00
include(SERVER_ROOT.'/sections/collages/torrent_collage.php');
2011-03-28 14:21:28 +00:00
}
2013-11-10 08:00:49 +00:00
if (isset($SetCache)) {
$CollageData = array(
2013-10-29 08:01:29 +00:00
$Name,
$Description,
$CommentList,
(bool)$Deleted,
(int)$CollageCategoryID,
(int)$CreatorID,
(bool)$Locked,
(int)$MaxGroups,
(int)$MaxGroupsPerUser,
2013-11-10 08:00:49 +00:00
$Updated,
(int)$Subscribers);
$Cache->cache_value("collage_$CollageID", $CollageData, 3600);
}