Example #1
0
 function Page()
 {
     parent::BasePage();
     $role = Users::ROLE_GUEST;
     if ($this->userdata != null) {
         $role = $this->userdata["role"];
     }
     $content = new Contents();
     $menu = new Menu();
     $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();
     if ($this->userdata != null) {
         $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]);
     } else {
         $parentcatlist = $category->getForMenu();
     }
     $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"]);
     }
     $header_menu = $this->smarty->fetch('headermenu.tpl');
     $this->smarty->assign('header_menu', $header_menu);
 }
Example #2
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 = array();
     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);
 }
Example #3
0
 /**
  * Default constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $role = Users::ROLE_GUEST;
     if ($this->userdata != null) {
         $role = $this->userdata["role"];
     }
     $content = new Contents(['Settings' => $this->settings]);
     $f = new Forum();
     $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));
     if ($this->userdata != null) {
         $this->smarty->assign('recentforumpostslist', $f->getRecentPosts($this->settings->getSetting('showrecentforumposts')));
     }
     $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();
     }
     $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);
 }
     if ($outputtype == "xml") {
         header("Content-type: text/xml");
         echo $content;
     } else {
         header('Content-type: application/json');
         echo json_encode(responseXmlToObject($content));
     }
     break;
     //
     // capabilities request
     //
 //
 // capabilities request
 //
 case "c":
     $parentcatlist = $category->getForMenu();
     $page->smarty->assign('parentcatlist', $parentcatlist);
     $grps = $grp->getActive();
     $page->smarty->assign('grps', $grps);
     $genres = $gen->getGenres('', true);
     $page->smarty->assign('genres', $genres);
     header("Content-type: text/xml");
     $output = $page->smarty->fetch('apicaps.tpl');
     if ($outputtype == "xml") {
         header("Content-type: text/xml");
         echo $output;
     } else {
         header('Content-type: application/json');
         echo json_encode(responseXmlToObject($output));
     }
     break;
Example #5
0
// If no content id provided then show user the rss selection page.
if (!isset($_GET["t"]) && !isset($_GET["rage"]) && !isset($_GET["anidb"])) {
    // User has to either be logged in, or using rsskey.
    if (!$page->users->isLoggedIn()) {
        if ($page->settings->getSetting('registerstatus') != Settings::REGISTER_STATUS_API_ONLY) {
            header('X-newznab: ERROR: You must be logged in or provide a valid User ID and API key!');
            $page->show403();
        } else {
            header("Location: " . $page->settings->getSetting('code'));
        }
    }
    $page->title = "Rss Feeds";
    $page->meta_title = "Rss Nzb Feeds";
    $page->meta_keywords = "view,nzb,description,details,rss,atom";
    $page->meta_description = "View available Rss Nzb feeds.";
    $page->smarty->assign(['categorylist' => $category->get(true, $page->userdata["categoryexclusions"]), 'parentcategorylist' => $category->getForMenu($page->userdata["categoryexclusions"])]);
    $page->content = $page->smarty->fetch('rssdesc.tpl');
    $page->render();
} else {
    $rssToken = $uid = -1;
    // User requested a feed, ensure either logged in or passing a valid token.
    if ($page->users->isLoggedIn()) {
        $uid = $page->userdata["id"];
        $rssToken = $page->userdata["rsstoken"];
        $maxRequests = $page->userdata['apirequests'];
    } else {
        if ($page->settings->getSetting('registerstatus') == Settings::REGISTER_STATUS_API_ONLY) {
            $res = $page->users->getById(0);
        } else {
            if (!isset($_GET["i"]) || !isset($_GET["r"])) {
                header('X-newznab: ERROR: Both the User ID and API key are required for viewing the RSS!');
Example #6
0
     if (!isset($_GET['id'])) {
         showApiError(200, 'Missing parameter (id is required for downloading an NZB)');
     }
     $page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
     $data = $releases->getByGuid($_GET['id']);
     $relData = [];
     if ($data) {
         $relData[] = $data;
     }
     printOutput($relData, $outputXML, $page, offset());
     break;
     // Capabilities request.
 // Capabilities request.
 case 'c':
     $category = new Category(['Settings' => $page->settings]);
     $page->smarty->assign('parentcatlist', $category->getForMenu());
     header('Content-type: text/xml');
     echo $page->smarty->fetch('apicaps.tpl');
     break;
     // Register request.
 // Register request.
 case 'r':
     verifyEmptyParameter('email');
     if (!in_array((int) $page->settings->getSetting('registerstatus'), [Settings::REGISTER_STATUS_OPEN, Settings::REGISTER_STATUS_API_ONLY])) {
         showApiError(104);
     }
     // Check email is valid format.
     if (!$page->users->isValidEmail($_GET['email'])) {
         showApiError(106);
     }
     // Check email isn't taken.
Example #7
0
// if no content id provided then show user the rss selection page
//
if (!isset($_GET["t"]) && !isset($_GET["rage"])) {
    //
    // must be logged in to view this help page
    //
    if (!$users->isLoggedIn()) {
        $page->show403();
    }
    $page->title = "Rss Feeds";
    $page->meta_title = "Rss Nzb Feeds";
    $page->meta_keywords = "view,nzb,description,details,rss,atom";
    $page->meta_description = "View available Rss Nzb feeds.";
    $categorylist = $category->get(true, $page->userdata["categoryexclusions"]);
    $page->smarty->assign('categorylist', $categorylist);
    $parentcategorylist = $category->getForMenu($page->userdata["categoryexclusions"]);
    $page->smarty->assign('parentcategorylist', $parentcategorylist);
    $page->content = $page->smarty->fetch('rssdesc.tpl');
    $page->render();
} else {
    $uid = -1;
    $rsstoken = -1;
    if (!$users->isLoggedIn()) {
        if (!isset($_GET["i"]) || !isset($_GET["r"])) {
            $page->show403();
        }
        $res = $users->getByIdAndRssToken($_GET["i"], $_GET["r"]);
        if (!$res) {
            $page->show403();
        }
        $uid = $_GET["i"];