Exemple #1
0
 sleep(10);
 $DB->query("\n\t\tSELECT t.ID, t.ForumID\n\t\tFROM forums_topics AS t\n\t\t\tJOIN forums AS f ON t.ForumID = f.ID\n\t\tWHERE t.IsLocked = '0'\n\t\t\tAND t.IsSticky = '0'\n\t\t\tAND DATEDIFF(CURDATE(), DATE(t.LastPostTime)) / 7 > f.AutoLockWeeks\n\t\t\tAND f.AutoLock = '1'");
 $IDs = $DB->collect('ID');
 $ForumIDs = $DB->collect('ForumID');
 if (count($IDs) > 0) {
     $LockIDs = implode(',', $IDs);
     $DB->query("\n\t\t\tUPDATE forums_topics\n\t\t\tSET IsLocked = '1'\n\t\t\tWHERE ID IN({$LockIDs})");
     sleep(2);
     $DB->query("\n\t\t\tDELETE FROM forums_last_read_topics\n\t\t\tWHERE TopicID IN({$LockIDs})");
     foreach ($IDs as $ID) {
         $Cache->begin_transaction("thread_{$ID}" . '_info');
         $Cache->update_row(false, array('IsLocked' => '1'));
         $Cache->commit_transaction(3600 * 24 * 30);
         $Cache->expire_value("thread_{$ID}" . '_catalogue_0', 3600 * 24 * 30);
         $Cache->expire_value("thread_{$ID}" . '_info', 3600 * 24 * 30);
         Forums::add_topic_note($ID, 'Locked automatically by schedule', 0);
     }
     $ForumIDs = array_flip(array_flip($ForumIDs));
     foreach ($ForumIDs as $ForumID) {
         $Cache->delete_value("forums_{$ForumID}");
     }
 }
 echo "Old threads locked\n";
 //------------- Delete dead torrents ------------------------------------//
 sleep(10);
 $DB->query("\n\t\tSELECT\n\t\t\tt.ID,\n\t\t\tt.GroupID,\n\t\t\ttg.Name,\n\t\t\tt.Format,\n\t\t\tt.Encoding,\n\t\t\tt.UserID,\n\t\t\tt.Media,\n\t\t\tHEX(t.info_hash) AS InfoHash\n\t\tFROM torrents AS t\n\t\t\tJOIN torrents_group AS tg ON tg.ID = t.GroupID\n\t\tWHERE\n\t\t\t(t.last_action < '" . time_minus(3600 * 24 * 28) . "' AND t.last_action != 0)\n\t\t\tOR\n\t\t\t(t.Time < '" . time_minus(3600 * 24 * 2) . "' AND t.last_action = 0)");
 $Torrents = $DB->to_array(false, MYSQLI_NUM, false);
 echo 'Found ' . count($Torrents) . " inactive torrents to be deleted.\n";
 $LogEntries = $DeleteNotes = array();
 // Exceptions for inactivity deletion
 $InactivityExceptionsMade = array();
Exemple #2
0
<?php

authorize();
if (!check_perms('site_moderate_forums')) {
    error(403);
}
if (!isset($_POST['topicid'], $_POST['body']) || !is_number($_POST['topicid']) || $_POST['body'] == '') {
    error(404);
}
$TopicID = (int) $_POST['topicid'];
Forums::add_topic_note($TopicID, $_POST['body']);
header("Location: forums.php?action=viewthread&threadid={$TopicID}#thread_notes");
die;
Exemple #3
0
<?php

enforce_login();
authorize();
if (!check_perms('site_moderate_forums')) {
    error(403);
}
$ThreadID = $_GET['threadid'];
$PostID = $_GET['postid'];
$Delete = !empty($_GET['remove']);
if (!$ThreadID || !$PostID || !is_number($ThreadID) || !is_number($PostID)) {
    error(404);
}
$DB->query("\n\tSELECT\n\t\tCEIL(COUNT(ID)/" . POSTS_PER_PAGE . ") AS Pages,\n\t\tCEIL(SUM(IF(ID<={$PostID},1,0))/" . POSTS_PER_PAGE . ") AS Page\n\tFROM forums_posts\n\tWHERE TopicID={$ThreadID}\n\tGROUP BY TopicID");
if ($DB->has_results()) {
    list($Pages, $Page) = $DB->next_record();
    if ($Delete) {
        $DB->query("\n\t\t\tUPDATE forums_topics\n\t\t\tSET StickyPostID = 0\n\t\t\tWHERE ID = {$ThreadID}");
        Forums::add_topic_note($ThreadID, "Post {$PostID} unstickied");
    } else {
        $DB->query("\n\t\t\tUPDATE forums_topics\n\t\t\tSET StickyPostID = {$PostID}\n\t\t\tWHERE ID = {$ThreadID}");
        Forums::add_topic_note($ThreadID, "Post {$PostID} stickied");
    }
    $Cache->delete_value('thread_' . $ThreadID . '_info');
    $ThisCatalogue = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE);
    $LastCatalogue = floor((POSTS_PER_PAGE * $Pages - POSTS_PER_PAGE) / THREAD_CATALOGUE);
    for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
        $Cache->delete_value('thread_' . $ThreadID . '_catalogue_' . $i);
    }
}
header('Location: forums.php?action=viewthread&threadid=' . $ThreadID);
Exemple #4
0
                }
            }
            if ($OldSticky != $Sticky) {
                if (!$OldSticky) {
                    $TopicNotes[] = 'Stickied';
                } else {
                    $TopicNotes[] = 'Unstickied';
                }
            }
            if ($OldRanking != $Ranking) {
                $TopicNotes[] = "Ranking changed from \"{$OldRanking}\" to \"{$Ranking}\"";
            }
            if ($ForumID != $OldForumID) {
                $TopicNotes[] = "Moved from [url=" . site_url() . "forums.php?action=viewforum&forumid={$OldForumID}]{$OldForumName}[/url] to [url=" . site_url() . "forums.php?action=viewforum&forumid={$ForumID}]{$ForumName}[/url]";
            }
            break;
        case 'trashing':
            $TopicNotes[] = "Trashed (moved from [url=" . site_url() . "forums.php?action=viewforum&forumid={$OldForumID}]{$OldForumName}[/url] to [url=" . site_url() . "forums.php?action=viewforum&forumid={$ForumID}]{$ForumName}[/url])";
            $Notification = "Your thread \"{$NewLastTitle}\" has been trashed";
            break;
        default:
            break;
    }
    if (isset($Notification)) {
        NotificationsManager::notify_user($ThreadAuthorID, NotificationsManager::FORUMALERTS, $Notification, "forums.php?action=viewthread&threadid={$TopicID}");
    }
    if (count($TopicNotes) > 0) {
        Forums::add_topic_note($TopicID, implode("\n", $TopicNotes));
    }
    header("Location: forums.php?action=viewthread&threadid={$TopicID}&page={$Page}");
}