Empty commit

This commit is contained in:
Git 2013-01-14 08:00:16 +00:00
parent c9a38cf2c3
commit 77a334e212
4 changed files with 20 additions and 62 deletions

View File

@ -63,23 +63,6 @@
$ForumName = display_str($Forums[$ForumID]['Name']);
if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); }
$SubscribedForumIDs = $Cache->get("subscribed_forum_ids_".$LoggedUser['ID']);
if(empty($SubscribedForumIDs)) {
$SubscribedForumIDs = array();
$DB->query("SELECT ForumID FROM subscribed_forums WHERE UserID = $LoggedUser[ID]");
if($DB->record_count() > 0) {
$SubscribedForumIDs = $DB->collect('ForumID');
}
$Cache->cache_value("subscribed_forum_ids_".$LoggedUser['ID'], $SubscribedForumIDs, 0);
}
$ForumSubscribeAction = "add";
$ForumSubscribeActionText = "Subscribe";
if(in_array($ForumID, $SubscribedForumIDs)) {
$ForumSubscribeAction = "remove";
$ForumSubscribeActionText = "Unsubscribe";
}
// Start printing
View::show_header('Forums > '. $Forums[$ForumID]['Name']);
?>
@ -90,9 +73,6 @@
[<a href="forums.php?action=new&amp;forumid=<?=$ForumID?>">New Thread</a>]
<? } ?>
[<a href="#" onclick="$('#searchforum').toggle(); this.innerHTML = (this.innerHTML == 'Search this Forum'?'Hide Search':'Search this Forum'); return false;">Search this Forum</a>]
<?if(check_perms("site_moderate_forums")) { ?>
[<a href="forums.php?action=forum_subscribe&do=<?=$ForumSubscribeAction?>&forumid=<?=$ForumID?>"><?=$ForumSubscribeActionText?></a>]
<? } ?>
<div id="searchforum" class="hidden center">
<div style="display: inline-block;">
<h3>Search this forum:</h3>

View File

@ -1,35 +1,14 @@
<?php
$ForumID = (int) ($_GET['forumid']);
if(empty($ForumID)) {
error(403);
}
$SubscribedForumIDs = $Cache->get("subscribed_forum_ids_".$LoggedUser['ID']);
if(empty($SubscribedForumIDs)) {
$SubscribedForumIDs = array();
$DB->query("SELECT ForumID FROM subscribed_forums WHERE UserID = $LoggedUser[ID]");
if($DB->record_count() > 0) {
$SubscribedForumIDs = $DB->collect('ForumID');
}
$Cache->cache_value("subscribed_forum_ids_".$LoggedUser['ID'], $SubscribedForumIDs, 0);
}
if($_GET['do'] == 'add') {
if(!in_array($ForumID, $SubscribedForumIDs)) {
$SubscribedForumIDs[] = $ForumID;
}
ini_set('display_errors', '1');authorize();
$DB->query("INSERT INTO subscribed_forums
(ForumID, UserID)
VALUES($ForumID, $LoggedUser[ID])");
$Cache->replace_value("subscribed_forum_ids_".$LoggedUser['ID'], $SubscribedForumIDs, 0);
$ForumID = db_string($_GET['forumid']);
if($_GET['perform'] == 'add') {
$DB->query("INSERT IGNORE INTO subscribed_forums (ForumID, SubscriberID) VALUES ('$ForumID', '$LoggedUser[ID]')");
}
elseif($_GET['do'] == 'remove') {
$SubscribedForumIDs = array_diff($SubscribedForumIDs, array($ForumID));
if(count($SubscribedForumIDs) > 0) {
$DB->query("DELETE FROM subscribed_forums WHERE UserID = $LoggedUser[ID] AND ForumID = $ForumID");
$Cache->delete_value("subscribed_forum_ids_".$LoggedUser['ID']);
}
elseif($_GET['perform'] == 'remove') {
$DB->query("DELETE FROM subscribed_forums WHERE ForumID = '$ForumID' AND SubscriberID = '$LoggedUser[ID]'");
}
header('Location: forums.php?action=viewforum&forumid=' . $ForumID);
?>

View File

@ -88,17 +88,19 @@
}
//auto subscribe
$DB->query("SELECT UserID FROM subscribed_forums WHERE ForumID = '$ForumID' AND UserID <> '$LoggedUser[ID]'");
if($DB->record_count() > 0) {
$Users = $DB->to_array(false, MYSQLI_BOTH, false);
foreach ($Users as $User) {
$SubscriberID = $User['UserID'];
$DB->query("INSERT INTO users_subscriptions VALUES ($SubscriberID, $TopicID)");
$Cache->delete_value('subscriptions_user_'.$SubscriberID);
}
/*
if(check_perms('users_mod')) {
$DB->query("SELECT SubscriberID FROM subscribed_forums WHERE ForumID = '$ForumID' AND SubscriberID <> '$LoggedUser[ID]'");
while(list($SubscriberID) = $DB->next_record()) {
$DB->query("INSERT INTO users_subscriptions VALUES ($SubscriberID, $TopicID)");
// $DB->query("INSERT INTO forums_last_read_topics
// (UserID, TopicID, PostID) VALUES
// ('$SubscriberID', '".$TopicID ."', '".db_string($PostID)."')
// ON DUPLICATE KEY UPDATE PostID='$LastPost'");
$Cache->delete_value('subscriptions_user_'.$SubscriberID);
}
}
*/
if (empty($_POST['question']) || empty($_POST['answers']) || !check_perms('forums_polls_create')) {
$NoPoll = 1;

View File

@ -2,7 +2,7 @@
/*
User topic subscription page
*/
define('FORUM_AUTO_SUBSCRIPTION_DATE', '2013-01-12');
if(!empty($LoggedUser['DisableForums'])) {
error(403);
}
@ -153,9 +153,6 @@
<a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>" title="<?=display_str($ThreadTitle)?>"><?=Format::cut_string($ThreadTitle, 75)?></a>
<? if($PostID<$LastPostID && !$Locked) { ?>
<span class="new">(New!)</span>
<? }
if($LastPostID == $PostID && !$Locked) { ?>
<span class="new">(New Thread!)</span>
<? } ?>
</span>
<span style="float:left;" class="last_read" title="Jump to last read">