示例#1
0
文件: add.php 项目: Kufirc/Gazelle
<?php

include SERVER_ROOT . '/classes/feed.class.php';
// RSS feeds
authorize();
if (!Bookmarks::can_bookmark($_GET['type'])) {
    error(404);
}
$Feed = new FEED();
$Type = $_GET['type'];
list($Table, $Col) = Bookmarks::bookmark_schema($Type);
if (!is_number($_GET['id'])) {
    error(0);
}
$PageID = $_GET['id'];
$DB->query("\n\tSELECT UserID\n\tFROM {$Table}\n\tWHERE UserID = '{$LoggedUser['ID']}'\n\t\tAND {$Col} = {$PageID}");
if (!$DB->has_results()) {
    if ($Type === 'torrent') {
        $DB->query("\n\t\t\tSELECT MAX(Sort)\n\t\t\tFROM `bookmarks_torrents`\n\t\t\tWHERE UserID = {$LoggedUser['ID']}");
        list($Sort) = $DB->next_record();
        if (!$Sort) {
            $Sort = 0;
        }
        $Sort += 1;
        $DB->query("\n\t\t\tINSERT IGNORE INTO {$Table} (UserID, {$Col}, Time, Sort)\n\t\t\tVALUES ('{$LoggedUser['ID']}', {$PageID}, '" . sqltime() . "', {$Sort})");
    } else {
        $DB->query("\n\t\t\tINSERT IGNORE INTO {$Table} (UserID, {$Col}, Time)\n\t\t\tVALUES ('{$LoggedUser['ID']}', {$PageID}, '" . sqltime() . "')");
    }
    $Cache->delete_value('bookmarks_' . $Type . '_' . $LoggedUser['ID']);
    if ($Type == 'torrent') {
        $Cache->delete_value("bookmarks_group_ids_{$UserID}");
示例#2
0
// the data to the database and the torrent to the disk.						//
//******************************************************************************//
// Maximum allowed size for uploaded files.
// http://php.net/upload-max-filesize
ini_set('upload_max_filesize', 2097152);
// 2 Mibibytes
ini_set('max_file_uploads', 100);
define(MAX_FILENAME_LENGTH, 180);
include SERVER_ROOT . '/classes/validate.class.php';
include SERVER_ROOT . '/classes/feed.class.php';
include SERVER_ROOT . '/sections/torrents/functions.php';
include SERVER_ROOT . '/classes/file_checker.class.php';
enforce_login();
authorize();
$Validate = new VALIDATE();
$Feed = new FEED();
define('QUERY_EXCEPTION', true);
// Shut up debugging
//******************************************************************************//
//--------------- Set $Properties array ----------------------------------------//
// This is used if the form doesn't validate, and when the time comes to enter	//
// it into the database.														//
$Properties = array();
$Type = $Categories[(int) $_POST['type']];
$TypeID = $_POST['type'] + 1;
$Properties['CategoryName'] = $Type;
$Properties['Title'] = $_POST['title'];
$Properties['Remastered'] = isset($_POST['remaster']) ? 1 : 0;
if ($Properties['Remastered'] || isset($_POST['unknown'])) {
    $Properties['UnknownRelease'] = isset($_POST['unknown']) ? 1 : 0;
    $Properties['RemasterYear'] = $_POST['remaster_year'];