Exemplo n.º 1
0
                $db = new newznab\db\Settings();
                $preData = $db->query(sprintf('SELECT * FROM prehash p WHERE p.title %s %s %s LIKE %s LIMIT %d OFFSET %d', $newer, $older, $nuked, $db->likeString(urldecode($_GET['title'])), $limit, $offset));
            }
            break;
        case 'm':
        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'] : '') . '"', '/>';
Exemplo n.º 2
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";
    }
}