<?php require_once './config.php'; use nzedb\Console; $page = new AdminPage(); $con = new Console(['Settings' => $page->settings]); $page->title = "Console List"; $concount = $con->getCount(); $offset = isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : 0; $page->smarty->assign('pagertotalitems', $concount); $page->smarty->assign('pageroffset', $offset); $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); $page->smarty->assign('pagerquerybase', WWW_TOP . "/console-list.php?offset="); $pager = $page->smarty->fetch("pager.tpl"); $page->smarty->assign('pager', $pager); $consolelist = $con->getRange($offset, ITEMS_PER_PAGE); $page->smarty->assign('consolelist', $consolelist); $page->content = $page->smarty->fetch('console-list.tpl'); $page->render();
<?php use nzedb\Console; if (!$page->users->isLoggedIn()) { $page->show403(); } if (isset($_GET["id"]) && ctype_digit($_GET["id"])) { $console = new Console(['Settings' => $page->settings]); $con = $console->getConsoleInfo($_GET['id']); if (!$con) { $page->show404(); } $page->smarty->assign('console', $con); $page->title = "Info for " . $con['title']; $page->meta_title = ""; $page->meta_keywords = ""; $page->meta_description = ""; $page->smarty->registerPlugin('modifier', 'ss', 'stripslashes'); $modal = false; if (isset($_GET['modal'])) { $modal = true; $page->smarty->assign('modal', true); } $page->content = $page->smarty->fetch('viewconsole.tpl'); if ($modal) { echo $page->content; } else { $page->render(); } }
<?php //This script will update all records in the consoleinfo table require_once dirname(__FILE__) . '/../../../www/config.php'; use nzedb\Console; use nzedb\db\Settings; $pdo = new Settings(); $console = new Console(['Echo' => true, 'Settings' => $pdo]); $res = $pdo->queryDirect(sprintf("SELECT searchname, id FROM releases WHERE consoleinfoid IS NULL AND categoryid BETWEEN 1000 AND 1999 ORDER BY id DESC")); if ($res instanceof \Traversable) { echo $pdo->log->header("Updating console info for " . number_format($res->rowCount()) . " releases."); foreach ($res as $arr) { $starttime = microtime(true); $gameInfo = $console->parseTitle($arr['searchname']); if ($gameInfo !== false) { $game = $console->updateConsoleInfo($gameInfo); if ($game === false) { echo $pdo->log->primary($gameInfo['release'] . ' not found'); } } // 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); } } }
<?php use nzedb\Category; use nzedb\Console; use nzedb\Genres; use nzedb\DnzbFailures; if (!$page->users->isLoggedIn()) { $page->show403(); } $console = new Console(['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_GAME); $ctmp = array(); foreach ($concats as $ccat) { $ctmp[$ccat['id']] = $ccat; } $category = Category::CAT_PARENT_GAME; 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); $browsecount = $console->getConsoleCount($catarray, -1, $page->userdata["categoryexclusions"]); $offset = isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset']) ? $_REQUEST["offset"] : 0; $ordering = $console->getConsoleOrdering(); $orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : ''; $results = $consoles = array();
} if ($xxx && isset($xxx['title'])) { $xxx['title'] = str_replace(['/', '\\'], '', $xxx['title']); $xxx['actors'] = $x->makeFieldLinks($xxx, 'actors'); $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());
<?php require_once './config.php'; use nzedb\Console; use nzedb\Genres; $page = new AdminPage(); $console = new Console(['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"]; $con = $console->getConsoleInfo($id); if (!$con) { $page->show404(); } switch ($action) { case 'submit': $coverLoc = nZEDb_COVERS . "console/" . $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['salesrank'] = empty($_POST['salesrank']) || !ctype_digit($_POST['salesrank']) ? "null" : $_POST['salesrank']; $_POST['releasedate'] = empty($_POST['releasedate']) || !strtotime($_POST['releasedate']) ? $con['releasedate'] : date("Y-m-d H:i:s", strtotime($_POST['releasedate'])); $console->update($id, $_POST["title"], $_POST['asin'], $_POST['url'], $_POST["salesrank"], $_POST["platform"], $_POST["publisher"], $_POST["releasedate"], $_POST["esrb"], $_POST["cover"], $_POST["genre"]);