Пример #1
0
<?php

//******************************************************************************//
//--------------- Add a recommendation -----------------------------------------//
authorize();
if (!check_perms('site_recommend_own') && !check_perms('site_manage_recommendations')) {
    error(403);
}
$URL = trim($_POST['url']);
// Make sure the URL they entered is on our site, and is a link to a torrent
$URLRegex = '/^https?:\\/\\/(www\\.|ssl\\.)?' . NONSSL_SITE_URL . '\\/torrents\\.php\\?id=([0-9]+)$/i';
$Val->SetFields('url', '1', 'regex', 'The URL must be a link to a torrent on the site.', array('regex' => '/^' . TORRENT_GROUP_REGEX . '/i'));
$Err = $Val->ValidateForm($_POST);
// Validate the form
if ($Err) {
    // if something didn't validate
    error($Err);
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
}
// Get torrent ID
preg_match('/^' . TORRENT_GROUP_REGEX . '/i', $URL, $Matches);
$GroupID = $Matches[4];
if (empty($GroupID) || !is_number($GroupID)) {
    error(404);
}
$DB->query("INSERT INTO torrents_recommended (GroupID, UserID, Time) VALUES ('" . db_string($GroupID) . "', {$LoggedUser['ID']}, '" . sqltime() . "')");
Torrents::freeleech_groups($GroupID, 2, 3);
$Cache->delete_value('recommend');
header('Location: ' . $_SERVER['HTTP_REFERER']);
Пример #2
0
<?php

//******************************************************************************//
//--------------- Restore all VH-recommended torrents to NL --------------------//
//---- For use after resetting the FL/NL database (after sitewide freeleech) ---//
authorize();
if (!check_perms('site_manage_recommendations')) {
    error(403);
}
$DB->query('
	SELECT GroupID
	FROM torrents_recommended');
$ToNL = $DB->next_record();
Torrents::freeleech_groups($ToNL, 2, 3);
?>
Done
Пример #3
0
    }
}
if (check_perms('torrents_freeleech') && (isset($_POST['freeleech']) xor isset($_POST['neutralleech']) xor isset($_POST['unfreeleech']))) {
    if (isset($_POST['freeleech'])) {
        $Free = 1;
    } elseif (isset($_POST['neutralleech'])) {
        $Free = 2;
    } else {
        $Free = 0;
    }
    if (isset($_POST['freeleechtype']) && in_array($_POST['freeleechtype'], array(0, 1, 2, 3))) {
        $FreeType = $_POST['freeleechtype'];
    } else {
        error(404);
    }
    Torrents::freeleech_groups($GroupID, $Free, $FreeType);
}
//Escape fields
$Year = db_string((int) $_POST['year']);
$RecordLabel = db_string($_POST['record_label']);
$CatalogueNumber = db_string($_POST['catalogue_number']);
// Get some info for the group log
$DB->query("\n\tSELECT Year\n\tFROM torrents_group\n\tWHERE ID = {$GroupID}");
list($OldYear) = $DB->next_record();
$DB->query("\n\tUPDATE torrents_group\n\tSET\n\t\tYear = '{$Year}',\n\t\tRecordLabel = '" . $RecordLabel . "',\n\t\tCatalogueNumber = '" . $CatalogueNumber . "'\n\tWHERE ID = {$GroupID}");
if ($OldYear != $Year) {
    $DB->query("\n\t\tINSERT INTO group_log (GroupID, UserID, Time, Info)\n\t\tVALUES ('{$GroupID}', " . $LoggedUser['ID'] . ", '" . sqltime() . "', '" . db_string("Year changed from {$OldYear} to {$Year}") . "')");
}
$DB->query("\n\tSELECT ID\n\tFROM torrents\n\tWHERE GroupID = '{$GroupID}'");
while (list($TorrentID) = $DB->next_record()) {
    $Cache->delete_value("torrent_download_{$TorrentID}");