Beispiel #1
0
 public function __construct()
 {
     parent::__construct();
     $role = Users::ROLE_GUEST;
     if ($this->userdata != null) {
         $role = $this->userdata["role"];
     }
     $content = new Contents(['Settings' => $this->settings]);
     $menu = new Menu($this->settings);
     $this->smarty->assign('menulist', $menu->get($role, $this->serverurl));
     $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role));
     $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role));
     $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl'));
     $this->smarty->assign('useful_menu', $this->smarty->fetch('usefullinksmenu.tpl'));
     $this->smarty->assign('article_menu', $this->smarty->fetch('articlesmenu.tpl'));
     $category = new Category(['Settings' => $content->pdo]);
     if ($this->userdata != null) {
         $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]);
     } else {
         $parentcatlist = $category->getForMenu();
     }
     // Add in system types to console categories to make the boot strap drop down list less long.
     $consoleCatList = [];
     foreach ($parentcatlist as $parent) {
         if ($parent['title'] === 'Console') {
             foreach ($parent['subcatlist'] as $consoleCat) {
                 if (preg_match('/^XBOX/i', $consoleCat['title'])) {
                     $consoleCatList['Microsoft'][] = $consoleCat;
                 } else {
                     if (preg_match('/^([3N]DS|N?GC)$|^WII/i', $consoleCat['title'])) {
                         $consoleCatList['Nintendo'][] = $consoleCat;
                     } else {
                         if (preg_match('/PS[\\dXP ]/i', $consoleCat['title'])) {
                             $consoleCatList['Sony'][] = $consoleCat;
                         } else {
                             $consoleCatList['Other'][] = $consoleCat;
                         }
                     }
                 }
             }
             break;
         }
     }
     $this->smarty->assign('consolecatlist', $consoleCatList);
     $this->smarty->assign('parentcatlist', $parentcatlist);
     $searchStr = '';
     if ($this->page == 'search' && isset($_REQUEST["id"])) {
         $searchStr = (string) $_REQUEST["id"];
     }
     $this->smarty->assign('header_menu_search', $searchStr);
     if (isset($_REQUEST["t"])) {
         $this->smarty->assign('header_menu_cat', $_REQUEST["t"]);
     } else {
         $this->smarty->assign('header_menu_cat', '');
     }
     $header_menu = $this->smarty->fetch('headermenu.tpl');
     $this->smarty->assign('header_menu', $header_menu);
 }
Beispiel #2
0
<?php

require_once './config.php';
use nzedb\Contents;
$page = new AdminPage();
$contents = new Contents(['Settings' => $page->settings]);
$contentlist = $contents->getAll();
$page->smarty->assign('contentlist', $contentlist);
$page->title = "Content List";
$page->content = $page->smarty->fetch('content-list.tpl');
$page->render();
Beispiel #3
0
<?php

use nzedb\Contents;
require_once './config.php';
$contents = new Contents(['Settings' => $page->settings]);
$role = 0;
if ($page->userdata != null) {
    $role = $page->userdata["role"];
}
/* The role column in the content table values are :
 * 0 = everyone
 * 1 = logged in users
 * 2 = admins
 *
 * The user role values are:
 * 0 = guest
 * 1 = user
 * 2 = admin
 * 3 = disabled
 * 4 = moderator
 *
 * Admins and mods should be the only ones to see admin content.
 */
$page->smarty->assign('admin', $role == 2 || $role == 4 ? 'true' : 'false');
$contentid = 0;
if (isset($_GET["id"])) {
    $contentid = $_GET["id"];
}
$request = false;
if (isset($_REQUEST['page'])) {
    $request = $_REQUEST['page'];
Beispiel #4
0
<?php

use nzedb\Contents;
use nzedb\SiteMap;
$te = $page->smarty;
$arPages = array();
$arPages[] = buildURL("Home", "Home Page", "/", 'daily', '1.0');
$role = 0;
if ($page->userdata != null) {
    $role = $page->userdata["role"];
}
// Useful links.
$contents = new Contents(['Settings' => $page->settings]);
$contentlist = $contents->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role);
foreach ($contentlist as $content) {
    $arPages[] = buildURL("Useful Links", $content->title, '/content/' . $content->id . $content->url, 'monthly', '0.50');
}
// Articles.
$contentlist = $contents->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role);
foreach ($contentlist as $content) {
    $arPages[] = buildURL("Articles", $content->title, '/content/' . $content->id . $content->url, 'monthly', '0.50');
}
// Static pages.
$arPages[] = buildURL("Useful Links", "Contact Us", "/contact-us", 'yearly', '0.30');
$arPages[] = buildURL("Useful Links", "Contents", "/content", 'weekly', '0.50');
$arPages[] = buildURL("Useful Links", "Site Map", "/sitemap", 'weekly', '0.50');
if ($page->userdata != null) {
    $arPages[] = buildURL("Useful Links", "Rss Feeds", "/rss", 'weekly', '0.50');
    $arPages[] = buildURL("Useful Links", "API", "/apihelp", 'weekly', '0.50');
    $arPages[] = buildURL("Nzb", "Search Nzb", "/search", 'weekly', '0.50');
    $arPages[] = buildURL("Nzb", "New Releases", "/newposter", 'daily', '0.50');
Beispiel #5
0
<?php

require_once './config.php';
use nzedb\Content;
use nzedb\Contents;
use nzedb\Users;
$page = new AdminPage();
$contents = new Contents(['Settings' => $page->settings]);
$id = 0;
// Set the current action.
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
    case 'add':
        $page->title = "Content Add";
        $content = new Content();
        $content->showinmenu = "1";
        $content->status = "1";
        $content->contenttype = "2";
        $page->smarty->assign('content', $content);
        break;
    case 'submit':
        // Validate and add or update.
        $returnid = 0;
        if (!isset($_POST["id"]) || $_POST["id"] == "") {
            $returnid = $contents->add($_POST);
        } else {
            $content = $contents->update($_POST);
            $returnid = $content->id;
        }
        header("Location:content-add.php?id=" . $returnid);
        break;
Beispiel #6
0
<?php

require_once './config.php';
use nzedb\Contents;
$page = new AdminPage();
if (isset($_GET['id'])) {
    $contents = new Contents(['Settings' => $page->settings]);
    $contents->delete($_GET['id']);
}
$referrer = $_SERVER['HTTP_REFERER'];
header("Location: " . $referrer);