Esempio n. 1
0
    /**
     * Send a NZB URL to NZBGet.
     *
     * @param string $guid Release identifier.
     *
     * @return bool|mixed
     *
     * @access public
     */
    public function sendURLToNZBGet($guid)
    {
        $reldata = $this->Releases->getByGuid($guid);
        $url = "{$this->serverurl}getnzb/{$guid}&i={$this->uid}&r={$this->rsstoken}";
        $header = <<<NZBGet_URL
<?xml version="1.0"?>
<methodCall>
\t<methodName>appendurl</methodName>
\t<params>
\t\t<param>
\t\t\t<value><string>{$reldata['searchname']}.nzb</string></value>
\t\t</param>
\t\t<param>
\t\t\t<value><string>{$reldata['category_name']}</string></value>
\t\t</param>
\t\t<param>
\t\t\t<value><i4>0</i4></value>
\t\t</param>
\t\t<param>
\t\t\t<value><boolean>>False</boolean></value>
\t\t</param>
\t\t<param>
\t\t\t<value>
\t\t\t\t<string>{$url}</string>
\t\t\t</value>
\t\t</param>
\t</params>
</methodCall>
NZBGet_URL;
        Utility::getUrl(['url' => $this->fullURL . 'appendurl', 'method' => 'post', 'postdata' => $header, 'verifycert' => false]);
    }
Esempio n. 2
0
            }
        }
        header("Content-type: application/octet-stream");
        header("Content-disposition: attachment; filename=" . date("Ymdhis") . ".nzb.zip");
        exit($zip);
    } else {
        $page->show404();
    }
}
$nzbPath = (new NZB($page->settings))->getNZBPath($_GET["id"]);
if (!file_exists($nzbPath)) {
    header("X-DNZB-RCode: 404");
    header("X-DNZB-RText: NZB file not found!");
    $page->show404();
}
$relData = $rel->getByGuid($_GET["id"]);
if ($relData) {
    $rel->updateGrab($_GET["id"]);
    $page->users->addDownloadRequest($uid);
    $page->users->incrementGrabs($uid);
    if (isset($_GET["del"]) && $_GET["del"] == 1) {
        $page->users->delCartByUserAndRelease($_GET["id"], $uid);
    }
} else {
    header("X-DNZB-RCode: 404");
    header("X-DNZB-RText: Release not found!");
    $page->show404();
}
// Start reading output buffer.
ob_start();
// De-gzip the NZB and store it in the output buffer.
Esempio n. 3
0
<?php

use nzedb\Releases;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
if (!isset($_REQUEST["id"])) {
    $page->show404();
}
$r = new Releases(['Settings' => $page->settings]);
$rel = $r->getByGuid($_REQUEST["id"]);
if (!$rel) {
    print "No release info found";
} else {
    print "<table>\n";
    print "<tr><th>Title:</th><td>" . htmlentities($rel["searchname"], ENT_QUOTES) . "</td></tr>\n";
    if (isset($rel["category_name"]) && $rel["category_name"] != "") {
        print "<tr><th>Cat:</th><td>" . htmlentities($rel["category_name"], ENT_QUOTES) . "</td></tr>\n";
    }
    print "<tr><th>Group:</th><td>" . htmlentities($rel["group_name"], ENT_QUOTES) . "</td></tr>\n";
    if (isset($rel["size"])) {
        if (preg_match('/\\d+/', $rel["size"], $size)) {
        }
        if ($size[0] > 0) {
            print "<tr><th>Size:</th><td>" . htmlentities(floor($rel["size"] / 1024 / 1024), ENT_QUOTES) . " MB</td></tr>\n";
        }
    }
    print "<tr><th>Posted:</th><td>" . htmlentities($rel["postdate"], ENT_QUOTES) . "</td></tr>\n";
    print "</table>";
}
Esempio n. 4
0
<?php

use nzedb\NZB;
use nzedb\Releases;
use nzedb\utility\Utility;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
if (isset($_GET["id"])) {
    $releases = new Releases(['Settings' => $page->settings]);
    $rel = $releases->getByGuid($_GET["id"]);
    if (!$rel) {
        $page->show404();
    }
    $nzb = new NZB($page->settings);
    $nzbpath = $nzb->getNZBPath($_GET["id"]);
    if (!file_exists($nzbpath)) {
        $page->show404();
    }
    $nzbfile = Utility::unzipGzipFile($nzbpath);
    $ret = $nzb->nzbFileList($nzbfile);
    $offset = isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset']) ? $_REQUEST["offset"] : 0;
    $page->smarty->assign('pagertotalitems', sizeof($ret));
    $page->smarty->assign('pageroffset', $offset);
    $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
    $page->smarty->assign('pagerquerybase', WWW_TOP . "/filelist/" . $_GET["id"] . "/&amp;offset=");
    $page->smarty->assign('pagerquerysuffix', "#results");
    $pager = $page->smarty->fetch("pager.tpl");
    $page->smarty->assign('pager', $pager);
    $page->smarty->assign('rel', $rel);
    $page->smarty->assign('files', array_slice($ret, $offset, ITEMS_PER_PAGE));
Esempio n. 5
0
     $offset = offset();
     $imdbId = isset($_GET['imdbid']) ? $_GET['imdbid'] : '-1';
     $relData = $releases->searchbyImdbId($imdbId, $offset, limit(), isset($_GET['q']) ? $_GET['q'] : '', categoryID(), $maxAge);
     addCoverURL($relData, function ($release) {
         return Misc::getCoverURL(['type' => 'movies', 'id' => $release['imdbid']]);
     });
     addLanguage($relData, $page->settings);
     printOutput($relData, $outputXML, $page, $offset);
     break;
     // Get NZB.
 // Get NZB.
 case 'g':
     if (!isset($_GET['id'])) {
         showApiError(200, 'Missing parameter (id is required for downloading an NZB)');
     }
     $relData = $releases->getByGuid($_GET['id']);
     if ($relData) {
         header('Location:' . WWW_TOP . '/getnzb?i=' . $uid . '&r=' . $apiKey . '&id=' . $relData['guid'] . (isset($_GET['del']) && $_GET['del'] == '1' ? '&del=1' : ''));
     } else {
         showApiError(300, 'No such item (the guid you provided has no release in our database)');
     }
     break;
     // Get individual NZB details.
 // Get individual NZB details.
 case 'd':
     if (!isset($_GET['id'])) {
         showApiError(200, 'Missing parameter (id is required for downloading an NZB)');
     }
     $page->users->addApiRequest($uid, $_SERVER['REQUEST_URI']);
     $data = $releases->getByGuid($_GET['id']);
     $relData = [];
Esempio n. 6
0
<?php

use nzedb\Category;
use nzedb\Releases;
$page = new AdminPage(true);
$releases = new Releases(['Settings' => $page->settings]);
$category = new Category(['Settings' => $page->settings]);
// Set the current action.
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
// Request is for id, but guid is actually being provided
if (isset($_REQUEST['id']) && is_array($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
    //Get info for first guid to populate form
    $rel = $releases->getByGuid($_REQUEST['id'][0]);
} else {
    $id = $rel = '';
}
$page->smarty->assign('action', $action);
$page->smarty->assign('idArr', $id);
switch ($action) {
    case 'doedit':
    case 'edit':
        $success = false;
        if ($action == 'doedit') {
            $success = $releases->updateMulti($_POST["id"], $_POST["category"], $_POST["grabs"], $_POST["videosid"], $_POST["episodesid"], $_POST["anidbid"], $_POST['imdbid']);
        }
        $page->smarty->assign('release', $rel);
        $page->smarty->assign('success', $success);
        $page->smarty->assign('from', isset($_POST['from']) ? $_POST['from'] : '');
        $page->smarty->assign('catlist', $category->getForSelect(false));
        $page->content = $page->smarty->fetch('ajax_release-edit.tpl');
Esempio n. 7
0
<?php

require_once './config.php';
use nzedb\Releases;
use nzedb\NZB;
use nzedb\utility\Misc;
$page = new AdminPage();
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
if (isset($_GET['id'])) {
    $releases = new Releases(['Settings' => $page->settings]);
    $release = $releases->getByGuid($_GET['id']);
    if ($release === false) {
        $page->show404();
    }
    $nzb = new NZB($page->settings);
    $nzbPath = $nzb->getNZBPath($_GET['id']);
    if (!file_exists($nzbPath)) {
        $page->show404();
    }
    $nzbFile = Misc::unzipGzipFile($nzbPath);
    $files = $nzb->nzbFileList($nzbFile);
    $page->smarty->assign('release', $release);
    $page->smarty->assign('files', $files);
    $page->title = "File List";
    $page->meta_title = "View Nzb file list";
    $page->meta_keywords = "view,nzb,file,list,description,details";
    $page->meta_description = "View Nzb File List";
    $page->content = $page->smarty->fetch('release-files.tpl');
    $page->render();
Esempio n. 8
0
<?php

use nzedb\Releases;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
if (isset($_GET["add"])) {
    $releases = new Releases(['Settings' => $page->settings]);
    $guids = explode(',', $_GET['add']);
    $data = $releases->getByGuid($guids);
    if (!$data) {
        $page->show404();
    }
    foreach ($data as $d) {
        $page->users->addCart($page->users->currentUserId(), $d["id"]);
    }
} elseif (isset($_REQUEST["delete"])) {
    if (isset($_GET['delete']) && !empty($_GET['delete'])) {
        $ids = array($_GET['delete']);
    } elseif (isset($_POST['delete']) && is_array($_POST['delete'])) {
        $ids = $_POST['delete'];
    }
    if (isset($ids)) {
        $page->users->delCart($ids, $page->users->currentUserId());
    }
    if (!isset($_POST['delete'])) {
        header("Location: " . WWW_TOP . "/cart");
    }
    exit;
} else {
    $page->meta_title = "My Nzb Cart";