コード例 #1
0
ファイル: nzb-export.php プロジェクト: sebst3r/nZEDb
<?php

require_once dirname(__FILE__) . '/../../www/config.php';
use nzedb\NZBExport;
$n = PHP_EOL;
// Print usage.
if (count($argv) !== 6) {
    exit('This will export NZB files(to .nzb or .nzb.gz) into sub folders (using group name) of the specified folder.' . $n . $n . 'Usage: ' . $n . $_SERVER['_'] . ' ' . __FILE__ . ' arg1 arg2 arg3 arg4 arg5' . $n . $n . 'arg1 : Path to folder where NZB files are to be stored.          | a folder path' . $n . 'arg2 : The start date in this format: 01/01/2008 or false        | date/false' . $n . 'arg3 : The end date in this format: 01/01/2008 or false          | date/false' . $n . 'arg4 : Group ID for the group or false                           | number/false' . $n . 'arg5 : Gzip the NZB files (recommended, faster/takes less space) | true/false' . $n . $n . 'Examples: ' . $n . $_SERVER['_'] . ' ' . $argv[0] . ' ' . nZEDb_ROOT . 'exportFolder' . DS . ' 01/01/2012 01/01/2014 false true' . $n . $_SERVER['_'] . ' ' . $argv[0] . ' ' . nZEDb_ROOT . 'exportFolder' . DS . ' false 01/01/2014 12 false' . $n);
}
$NE = new NZBExport();
$NE->beginExport(array($argv[1], strtolower($argv[2]) === 'false' ? '' : $argv[2], strtolower($argv[3]) === 'false' ? '' : $argv[3], strtolower($argv[4]) === 'false' ? 0 : (int) $argv[4], strtolower($argv[5]) === 'true' ? true : false));
コード例 #2
0
ファイル: nzb-export.php プロジェクト: sebst3r/nZEDb
require_once './config.php';
use nzedb\NZBExport;
use nzedb\Releases;
use nzedb\utility\Utility;
if (Utility::isCLI()) {
    exit('This script is only for exporting from the web, use the script in misc/testing' . PHP_EOL);
}
$page = new AdminPage();
$rel = new Releases(['Settings' => $page->settings]);
if ($page->isPostBack()) {
    $retVal = $path = '';
    $path = $_POST["folder"];
    $postFrom = isset($_POST["postfrom"]) ? $_POST["postfrom"] : '';
    $postTo = isset($_POST["postto"]) ? $_POST["postto"] : '';
    $group = $_POST["group"] === '-1' ? 0 : (int) $_POST["group"];
    $gzip = $_POST["gzip"] === '1' ? true : false;
    if ($path !== "") {
        $NE = new NZBExport(['Browser' => true, 'Settings' => $page->settings, 'Releases' => $rel]);
        $retVal = $NE->beginExport([$path, $postFrom, $postTo, $group, $gzip]);
    } else {
        $retVal = 'Error, a path is required!';
    }
    $page->smarty->assign(['folder' => $path, 'output' => $retVal, 'fromdate' => $postFrom, 'todate' => $postTo, 'group' => $_POST["group"], 'gzip' => $_POST["gzip"]]);
} else {
    $page->smarty->assign(['fromdate' => $rel->getEarliestUsenetPostDate(), 'todate' => $rel->getLatestUsenetPostDate()]);
}
$page->title = "Export Nzbs";
$page->smarty->assign(['gziplist' => [1 => 'True', 0 => 'False'], 'grouplist' => $rel->getReleasedGroupsForSelect(true)]);
$page->content = $page->smarty->fetch('nzb-export.tpl');
$page->render();