コード例 #1
0
ファイル: nfo.php プロジェクト: nubzzz/newznab
<?php

require_once WWW_DIR . "/lib/releases.php";
require_once WWW_DIR . "/lib/util.php";
$releases = new Releases();
if (!$users->isLoggedIn()) {
    $page->show403();
}
if (isset($_GET["id"])) {
    $rel = $releases->getByGuid($_GET["id"]);
    if (!$rel) {
        $page->show404();
    }
    $nfo = $releases->getReleaseNfo($rel['ID']);
    $nfo['nfoUTF'] = cp437toUTF($nfo['nfo']);
    $page->smarty->assign('rel', $rel);
    $page->smarty->assign('nfo', $nfo);
    $page->title = "NFO File";
    $page->meta_title = "View Nfo";
    $page->meta_keywords = "view,nzb,nfo,description,details";
    $page->meta_description = "View Nfo File";
    $modal = false;
    if (isset($_GET['modal'])) {
        $modal = true;
        $page->smarty->assign('modal', true);
    }
    $page->content = $page->smarty->fetch('viewnfo.tpl');
    if ($modal) {
        echo $page->content;
    } else {
        $page->render();
コード例 #2
0
 // get nfo
 //
 case "gn":
     if (!isset($_GET["id"])) {
         showApiError(200);
     }
     $users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
     $reldata = $releases->getByGuid($_GET["id"]);
     if (!$reldata) {
         showApiError(300);
     }
     $nfo = $releases->getReleaseNfo($reldata["ID"], true);
     if (!$nfo) {
         showApiError(300);
     }
     $nforaw = cp437toUTF($nfo["nfo"]);
     $page->smarty->assign('release', $reldata);
     $page->smarty->assign('nfo', $nfo);
     $page->smarty->assign('nfoutf', $nforaw);
     if (isset($_GET["raw"])) {
         header("Content-type: text/x-nfo");
         header("Content-Disposition: attachment; filename=" . str_replace(" ", "_", $reldata["searchname"]) . ".nfo");
         echo $nforaw;
         die;
     } else {
         $page->smarty->assign('rsstitle', "NFO");
         $page->smarty->assign('rssdesc', "NFO");
         $page->smarty->assign('rsshead', $page->smarty->fetch('rssheader.tpl'));
         $content = trim($page->smarty->fetch('apinfo.tpl'));
         if ($outputtype == "xml") {
             header("Content-type: text/xml");
コード例 #3
0
<?php

//
// Script will dump out all nfos in the system into a folder based on the date posted to usenet ./YYYYMMDD/release.nfo
//
define('FS_ROOT', realpath(dirname(__FILE__)));
require_once FS_ROOT . "/../../www/config.php";
require_once FS_ROOT . "/../../www/lib/util.php";
$db = new DB();
$res = $db->queryDirect("select releases.searchname, releases.postdate, uncompress(releasenfo.nfo) as nfo from releases inner join releasenfo on releases.ID = releasenfo.releaseID and releasenfo.nfo is not null order by postdate");
while ($row = $db->getAssocArray($res)) {
    $dir = date("Ymd", strtotime($row["postdate"]));
    if (!file_exists($dir)) {
        mkdir($dir);
    }
    $filename = $dir . "/" . safeFilename($row["searchname"]) . ".nfo";
    if (!file_exists($filename)) {
        $fh = fopen($filename, 'w');
        fwrite($fh, cp437toUTF($row["nfo"]));
        fclose($fh);
    }
}