Esempio n. 1
0
function getOddGames()
{
    global $pdo;
    $res = $pdo->query('
				SELECT searchname, id, categoryid
				FROM releases
				WHERE nzbstatus = 1
				AND gamesinfo_id = 0
				AND categoryid BETWEEN 4010 AND 4020
				ORDER BY postdate DESC LIMIT 150');
    if ($res !== false) {
        $pdo->log->doEcho($pdo->log->header("Processing... 150 release(s)."));
        $gen = new Games(['Echo' => true, 'Settings' => $pdo]);
        //Match on 78% title
        $gen->matchPercentage = 78;
        foreach ($res as $arr) {
            $startTime = microtime(true);
            $usedgb = true;
            $gameInfo = $gen->parseTitle($arr['searchname']);
            if ($gameInfo !== false) {
                $pdo->log->doEcho($pdo->log->headerOver('Looking up: ') . $pdo->log->primary($gameInfo['title']));
                // Check for existing games entry.
                $gameCheck = $gen->getGamesInfoByName($gameInfo['title']);
                if ($gameCheck === false) {
                    $gameId = $gen->updateGamesInfo($gameInfo);
                    $usedgb = true;
                    if ($gameId === false) {
                        $gameId = -2;
                        //If result is empty then set gamesinfo_id back to 0 so we can parse it at a later time.
                        if ($gen->maxHitRequest === true) {
                            $gameId = 0;
                        }
                    }
                } else {
                    $gameId = $gameCheck['id'];
                }
                if ($gameId != -2 && $gameId != 0) {
                    $arr['categoryid'] = 4050;
                }
                $pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d, categoryid = %d WHERE id = %d', $gameId, $arr['categoryid'], $arr['id']));
            } else {
                // Could not parse release title.
                $pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', -2, $arr['id']));
                echo '.';
            }
            // Sleep so not to flood giantbomb.
            $diff = floor((microtime(true) - $startTime) * 1000000);
            if ($gen->sleepTime * 1000 - $diff > 0 && $usedgb === true) {
                usleep($gen->sleepTime * 1000 - $diff);
            }
        }
    } else {
        $pdo->log->doEcho($pdo->log->header('No games in 0day/ISO to process.'));
    }
}
Esempio n. 2
0
<?php

use nzedb\Category;
use nzedb\Games;
use nzedb\Genres;
use nzedb\DnzbFailures;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
$games = new Games(['Settings' => $page->settings]);
$cat = new Category(['Settings' => $page->settings]);
$gen = new Genres(['Settings' => $page->settings]);
$fail = new DnzbFailures(['Settings' => $page->settings]);
$concats = $cat->getChildren(Category::CAT_PARENT_PC);
$ctmp = array();
foreach ($concats as $ccat) {
    $ctmp[$ccat['id']] = $ccat;
}
$category = Category::CAT_PC_GAMES;
if (isset($_REQUEST["t"]) && array_key_exists($_REQUEST['t'], $ctmp)) {
    $category = $_REQUEST["t"] + 0;
}
$catarray = array();
$catarray[] = $category;
$page->smarty->assign('catlist', $ctmp);
$page->smarty->assign('category', $category);
$offset = isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset']) ? $_REQUEST["offset"] : 0;
$ordering = $games->getGamesOrdering();
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
$results = $games2 = array();
$results = $games->getGamesRange($catarray, $offset, ITEMS_PER_COVER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]);
Esempio n. 3
0
<?php

//This script will update all records in the gamesinfo table
require_once dirname(__FILE__) . '/../../../www/config.php';
use nzedb\Games;
use nzedb\db\Settings;
$pdo = new Settings();
$game = new Games(['Echo' => true, 'Settings' => $pdo]);
$res = $pdo->query(sprintf("SELECT id, title FROM gamesinfo WHERE cover = 0 ORDER BY id DESC LIMIT 100"));
$total = count($res);
if ($total > 0) {
    echo $pdo->log->header("Updating game covers for " . number_format($total) . " releases.");
    foreach ($res as $arr) {
        $starttime = microtime(true);
        $gameInfo = $game->parseTitle($arr['title']);
        if ($gameInfo !== false) {
            echo $pdo->log->primary('Looking up: ' . $gameInfo['release']);
            $gameData = $game->updateGamesInfo($gameInfo);
            if ($gameData === false) {
                echo $pdo->log->primary($gameInfo['release'] . ' not found');
            } else {
                if (file_exists(nZEDb_COVERS . 'games' . DS . $gameData . '.jpg')) {
                    $pdo->queryExec(sprintf('UPDATE gamesinfo SET cover = 1 WHERE id = %d', $arr['id']));
                }
            }
        }
        // amazon limits are 1 per 1 sec
        $diff = floor((microtime(true) - $starttime) * 1000000);
        if (1000000 - $diff > 0) {
            echo $pdo->log->alternate("Sleeping");
            usleep(1000000 - $diff);
Esempio n. 4
0
<?php

require_once './config.php';
use nzedb\Games;
$page = new AdminPage();
$game = new Games(['Settings' => $page->settings]);
$page->title = "Game List";
$gamecount = $game->getCount();
$offset = isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : 0;
$page->smarty->assign('pagertotalitems', $gamecount);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/game-list.php?offset=");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
$gamelist = $game->getRange($offset, ITEMS_PER_PAGE);
$page->smarty->assign('gamelist', $gamelist);
$page->content = $page->smarty->fetch('game-list.tpl');
$page->render();
Esempio n. 5
0
         $xxx['genre'] = $x->makeFieldLinks($xxx, 'genre');
         $xxx['director'] = $x->makeFieldLinks($xxx, 'director');
     } else {
         $xxx = false;
     }
 }
 if ($data['musicinfoid'] != '') {
     $music = new Music(['Settings' => $page->settings]);
     $mus = $music->getMusicInfo($data['musicinfoid']);
 }
 if ($data['consoleinfoid'] != '') {
     $c = new Console(['Settings' => $page->settings]);
     $con = $c->getConsoleInfo($data['consoleinfoid']);
 }
 if ($data['gamesinfo_id'] != '') {
     $g = new Games(['Settings' => $page->settings]);
     $game = $g->getgamesInfo($data['gamesinfo_id']);
 }
 if ($data['bookinfoid'] != '') {
     $b = new Books(['Settings' => $page->settings]);
     $boo = $b->getBookInfo($data['bookinfoid']);
 }
 $rf = new ReleaseFiles($page->settings);
 $releasefiles = $rf->get($data['id']);
 $predb = new PreDb(['Settings' => $page->settings]);
 $pre = $predb->getForRelease($data['preid']);
 $user = $page->users->getById($page->users->currentUserId());
 $page->smarty->assign('cpapi', $user['cp_api']);
 $page->smarty->assign('cpurl', $user['cp_url']);
 $page->smarty->assign('releasefiles', $releasefiles);
 $page->smarty->assign('release', $data);
Esempio n. 6
0
<?php

require_once './config.php';
use nzedb\Games;
use nzedb\Genres;
$page = new AdminPage();
$games = new Games(['Settings' => $page->settings]);
$gen = new Genres(['Settings' => $page->settings]);
$id = 0;
// Set the current action.
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
if (isset($_REQUEST["id"])) {
    $id = $_REQUEST["id"];
    $game = $games->getGamesInfo($id);
    if (!$game) {
        $page->show404();
    }
    switch ($action) {
        case 'submit':
            $coverLoc = nZEDb_COVERS . "games/" . $id . '.jpg';
            if ($_FILES['cover']['size'] > 0) {
                $tmpName = $_FILES['cover']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['cover']['tmp_name'], $coverLoc);
                }
            }
            $_POST['cover'] = file_exists($coverLoc) ? 1 : 0;
            $_POST['releasedate'] = empty($_POST['releasedate']) || !strtotime($_POST['releasedate']) ? $game['releasedate'] : date("Y-m-d H:i:s", strtotime($_POST['releasedate']));
            $games->update($id, $_POST["title"], $_POST['asin'], $_POST['url'], $_POST["publisher"], $_POST["releasedate"], $_POST["esrb"], $_POST["cover"], $_POST['trailerurl'], $_POST["genre"]);
            header("Location:" . WWW_TOP . "/game-list.php");