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

require_once dirname(__FILE__) . '/../../../www/config.php';
passthru('clear');
$pdo = new newznab\db\Settings();
if (!isset($argv[1]) || isset($argv[1]) && $argv[1] !== 'true') {
    exit($pdo->log->error("\nThis script renames all table columns to lowercase, it can be dangerous. Please BACKUP your database before running this script.\n" . "php rename_to_lower.php true      ...: To rename all table columns to lowercase.\n"));
}
echo $pdo->log->warning("This script renames all table colums to lowercase.");
echo $pdo->log->header("Have you backed up your database? Type 'BACKEDUP' to continue:  \n");
echo $pdo->log->warningOver("\n");
$line = fgets(STDIN);
if (trim($line) != 'BACKEDUP') {
    exit($pdo->log->error("This script is dangerous you must type BACKEDUP for it function."));
}
echo "\n";
echo $pdo->log->header("Thank you, continuing...\n\n");
if ($argc == 1 || $argv[1] != 'true') {
    exit($pdo->log->error("\nThis script will rename every table column to lowercase that is not already lowercase.\nTo run:\nphp {$argv['0']} true\n"));
}
$database = DB_NAME;
$count = 0;
$list = $pdo->query("SELECT TABLE_NAME, COLUMN_NAME, UPPER(COLUMN_TYPE), EXTRA FROM information_schema.columns WHERE table_schema = '" . $database . "'");
if (count($list) == 0) {
    echo $pdo->log->info("No table columns to rename");
} else {
    foreach ($list as $column) {
        if ($column['column_name'] !== strtolower($column['column_name'])) {
            echo $pdo->log->header("Renaming Table " . $column['table_name'] . " Column " . $column['column_name']);
            if (isset($column['extra'])) {
                $extra = strtoupper($column['extra']);
Пример #2
0
        case 'md5':
            if (isset($_GET['md5']) && strlen($_GET['title']) === 32) {
                $db = new newznab\db\Settings();
                $preData = $db->query(sprintf('SELECT * FROM prehash p INNER JOIN predbhash ph ON ph.pre_id = p.id WHERE MATCH(hashes) AGAINST (%s) %s %s %s LIMIT %d OFFSET %d', $db->escapeString($_GET['md5']), $newer, $older, $nuked, $limit, $offset));
            }
            break;
        case 's':
        case 'sha1':
            if (isset($_GET['sha1']) && strlen($_GET['sha1']) === 40) {
                $db = new newznab\db\Settings();
                $preData = $db->query(sprintf('SELECT * FROM prehash p INNER JOIN predbhash ph ON ph.pre_id = p.id WHERE MATCH(hashes) AGAINST (%s) %s %s %s LIMIT %d OFFSET %d', $db->escapeString($_GET['sha1']), $newer, $older, $nuked, $limit, $offset));
            }
            break;
        case 'a':
        case 'all':
            $db = new newznab\db\Settings();
            $preData = $db->query(sprintf('SELECT * FROM prehash p WHERE 1=1 %s %s %s ORDER BY p.predate DESC LIMIT %d OFFSET %d', $newer, $older, $nuked, $limit, $offset));
            break;
    }
}
if ($json === false) {
    header('Content-type: text/xml');
    echo '<?xml version="1.0" encoding="UTF-8"?>', PHP_EOL, '<requests>', PHP_EOL;
    if (count($preData) > 0) {
        foreach ($preData as $data) {
            echo '<request', ' reqid="' . (!empty($data['requestid']) ? $data['requestid'] : '') . '"', ' md5="' . (!empty($data['md5']) ? $data['md5'] : '') . '"', ' sha1="' . (!empty($data['sha1']) ? $data['sha1'] : '') . '"', ' nuked="' . (!empty($data['nuked']) ? $data['nuked'] : '') . '"', ' category="' . (!empty($data['category']) ? $data['category'] : '') . '"', ' source="' . (!empty($data['source']) ? $data['source'] : '') . '"', ' nukereason="' . (!empty($data['nukereason']) ? $data['nukereason'] : '') . '"', ' files="' . (!empty($data['files']) ? $data['files'] : '') . '"', ' name="' . (!empty($data['title']) ? sanitize($data['title']) : '') . '"', ' date="' . (!empty($data['predate']) ? strtotime($data['predate']) : '') . '"', ' size="' . (!empty($data['size']) && $data['size'] != 'NULL' ? $data['size'] : '') . '"', '/>';
        }
    }
    echo '</requests>';
} else {
    header('Content-type: application/json');
Пример #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
// Its not very efficient to pull them all out, should really work out which day you need and go from there.
//
require_once dirname(__FILE__) . '/../../www/config.php';
$db = new \newznab\db\Settings();
$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, \newznab\utility\Utility::cp437toUTF($row["nfo"]));
        fclose($fh);
    }
}
Пример #4
0
unset($s->amazonprivkey);
unset($s->tmdbkey);
unset($s->rottentomatokey);
if ($s->newznabID != "") {
    $s->newznabID = "SET";
}
if ($s->spotnabsiteprvkey != "") {
    $s->spotnabsiteprvkey = "SET";
}
unset($s->nzprekey);
unset($s->recaptchaprivatekey);
unset($s->saburl);
unset($s->sabapikey);
unset($s->sabcompletedir);
unset($s->sabvdir);
$db = new newznab\db\Settings();
$totalsize = 0;
$alltables = $db->query("show table status");
foreach ($alltables as $tablename) {
    $ret[] = $tablename['Name'];
    //$row = $db->queryOneRow("check table `".$tablename['Name']."`");
    //$mysql[]  = array ("name" => $row["Table"].":".$row["Msg_type"]."=".$row["Msg_text"], "indexsize" => $tablename["Index_length"], "datasize" => $tablename["Data_length"]) ;
    $mysql[] = array("name" => $tablename['name'], "indexsize" => $tablename["index_length"], "datasize" => $tablename["data_length"]);
    $totalsize = $totalsize + ($tablename["index_length"] + $tablename["data_length"]);
}
$page->title = "Site Debug";
$page->smarty->assign('mysql', $mysql);
$page->smarty->assign('mysqltotalsize', $totalsize);
$page->smarty->assign('site', $s);
$page->content = $page->smarty->fetch('site-debug.tpl');
$page->render();
Пример #5
0
<?php

require_once dirname(__FILE__) . '/../../www/config.php';
$db = new \newznab\db\Settings();
$sql = "select distinct rageid from tvrage where rageid in (select rageid from tvrage where rageid != -2 group by rageid having count(*) > 1)";
$rows = $db->query($sql);
foreach ($rows as $row) {
    $sql = "select id, rageid, tvdbid from tvrage where rageid = " . $row["rageid"] . "\n";
    $tvrows = $db->query($sql);
    $count = 0;
    $keeprow = "0";
    $firstrow = "0";
    foreach ($tvrows as $tvrow) {
        $count++;
        if ($tvrow["tvdbid"] != 0) {
            $keeprow = $tvrow["id"];
        }
        if ($count == 1) {
            $firstrow = $tvrow["id"];
        }
    }
    if ($keeprow != "0") {
        $firstrow = "0";
    }
    $sql = "delete from tvrage where rageid = " . $row["rageid"] . " and (id != " . $keeprow . " and id != " . $firstrow . ")";
    $db->exec($sql);
    echo "Cleaned - " . $row["rageid"] . "\n";
}
Пример #6
0
<?php

require_once dirname(__FILE__) . '/../../www/config.php';
$db = new \newznab\db\Settings();
//query to find rough matches
$rows = $db->query("SELECT ID, searchname from releases where searchname like '%QWERTY%'");
//loop around them applying some ham fisted regex
foreach ($rows as $row) {
    $reg = '/^(\\[QWERTY\\] ")(?P<name>.*?(xvid|x264)\\-.*?)"/i';
    preg_match($reg, $row["searchname"], $matches);
    if (isset($matches["name"])) {
        $db->exec(sprintf("update releases set searchname = %s, name = %s where ID = %d", $db->escapeString($matches["name"]), $db->escapeString($matches["name"]), $row["id"]));
        echo $matches["name"] . "\n";
    }
}