Update index.php and switch pages from $page->site to $page->settings usage.

This commit is contained in:
Darko
2015-06-08 10:04:13 +02:00
parent b506e1085a
commit 6d46c9e671
56 changed files with 216 additions and 149 deletions
+73 -7
View File
@@ -1,4 +1,5 @@
<?php
use newznab\db\Settings;
if(is_file("config.php")) {
require_once("config.php");
@@ -12,11 +13,76 @@ if(is_file("config.php")) {
require_once 'automated.config.php';
$page = new Page;
$users = new Users;
if ($page->site->style != "default" && file_exists(NN_WWW.'pages/'.$page->site->style."/".$page->page.'.php'))
include(NN_WWW.'pages/'.$page->site->style."/".$page->page.'.php');
elseif (file_exists(WWW_DIR.'pages/'.$page->page.'.php'))
include(NN_WWW.'pages/'.$page->page.'.php');
else
$page->show404();
switch ($page->page) {
case 'ajax_mediainfo':
case 'ajax_mymovies':
case 'ajax_preinfo':
case 'ajax_profile':
case 'ajax_release-admin':
case 'ajax_rarfilelist':
case 'ajax_titleinfo':
case 'ajax_tvinfo':
case 'anime':
case 'apihelp':
case 'bookmodal':
case 'books':
case 'browse':
case 'browsegroup':
case 'calendar':
case 'cart':
case 'console':
case 'consolemodal':
case 'contact-us':
case 'content':
case 'details':
case 'filelist':
case 'forgottenpassword':
case 'forum':
case 'forumpost':
case 'games':
case 'getimage':
case 'logout':
case 'movies':
case 'movie':
case 'music':
case 'musicmodal':
case 'myshows':
case 'mymovies':
case 'mymoviesedit':
case 'newposterwall':
case 'nfo':
case 'nzbgetqueuedata':
case 'predb':
case 'profile':
case 'profileedit':
case 'queue':
case 'register':
case 'rss-info':
case 'sabqueuedata':
case 'search':
case 'sendtoqueue':
case 'series':
case 'sitemap':
case 'sysinfo':
case 'terms-and-conditions':
case 'upcoming':
case 'xxx':
case 'xxxmodal':
// Don't show these pages if it's an API-only site.
if (!$page->users->isLoggedIn() && $page->settings->getSetting('registerstatus') == Settings::REGISTER_STATUS_API_ONLY) {
header("Location: " . $page->settings->getSetting('code'));
break;
}
case 'api':
case 'getnzb':
case 'login':
case 'preinfo':
case 'rss':
include(NN_WWW . 'pages/' . $page->page . '.php');
break;
default:
$page->show404();
break;
}
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
+4 -4
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$um = new UserMovies();
@@ -8,7 +8,7 @@ $um = new UserMovies();
if (isset($_REQUEST["del"]))
{
$usermovies = $um->delMovie($users->currentUserId(), $_REQUEST["del"]);
$usermovies = $um->delMovie($page->users->currentUserId(), $_REQUEST["del"]);
}
elseif (isset($_REQUEST["add"]))
{
@@ -24,7 +24,7 @@ elseif (isset($_REQUEST["add"]))
if (!$mi)
$m->updateMovieInfo($_REQUEST["add"]);
$usermovies = $um->addMovie($users->currentUserId(), $_REQUEST["add"], $cats);
$usermovies = $um->addMovie($page->users->currentUserId(), $_REQUEST["add"], $cats);
}
else
{
@@ -76,7 +76,7 @@ else
}
$userimdbs = array();
$usermovies = $um->getMovies($users->currentUserId());
$usermovies = $um->getMovies($page->users->currentUserId());
foreach ($usermovies as $umovie)
$userimdbs[$umovie["imdbID"]] = $umovie["imdbID"];
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if(!$users->isLoggedIn() || $page->userdata["canpre"] != 1)
if(!$page->users->isLoggedIn() || $page->userdata["canpre"] != 1)
$page->show403();
if(!isset($_REQUEST['searchname']))
+2 -2
View File
@@ -1,12 +1,12 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (isset($_GET['action']) && $_GET['action'] == "1" && isset($_GET['emailto']))
{
$emailto = $_GET['emailto'];
$ret = $users->sendInvite($page->site->title, $page->site->email, $page->serverurl, $users->currentUserId(), $emailto);
$ret = $page->users->sendInvite($page->site->title, $page->site->email, $page->serverurl, $page->users->currentUserId(), $emailto);
if (!$ret)
print "Invite not sent.";
else
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (!isset($_REQUEST["id"]))
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (!isset($_REQUEST["id"]))
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$Releases = new Releases(['Settings' => $page->settings]);
+22 -22
View File
@@ -72,7 +72,7 @@ $hosthash = '';
$catExclusions = [];
$maxRequests = 0;
// Page is accessible only by the apikey, or logged in users.
if ($users->isLoggedIn()) {
if ($page->users->isLoggedIn()) {
$uid = $page->userdata['id'];
$apiKey = $page->userdata['rsstoken'];
$catExclusions = $page->userdata['categoryexclusions'];
@@ -82,7 +82,7 @@ if ($users->isLoggedIn()) {
if (!isset($_GET['apikey'])) {
showApiError(200, 'Missing parameter (apikey)');
}
$res = $users->getByRssToken($_GET['apikey']);
$res = $page->users->getByRssToken($_GET['apikey']);
$apiKey = $_GET['apikey'];
if (!$res) {
@@ -90,12 +90,12 @@ if ($users->isLoggedIn()) {
}
$uid = $res['id'];
$catExclusions = $users->getCategoryExclusion($uid);
$catExclusions = $page->users->getCategoryExclusion($uid);
//
// A hash of the users ip to record against the api hit
//
if ($page->site->storeuserips == 1)
$hosthash = $users->getHostHash($_SERVER["REMOTE_ADDR"], $page->site->siteseed);
$hosthash = $page->users->getHostHash($_SERVER["REMOTE_ADDR"], $page->site->siteseed);
$maxRequests = $res['apirequests'];
}
}
@@ -105,8 +105,8 @@ $page->smarty->assign('rsstoken', $apiKey);
// Record user access to the api, if its been called by a user (i.e. capabilities request do not require a user to be logged in or key provided).
if ($uid != '') {
$users->updateApiAccessed($uid);
$apiRequests = $users->getApiRequests($uid);
$page->users->updateApiAccessed($uid);
$apiRequests = $page->users->getApiRequests($uid);
if ($apiRequests['num'] > $maxRequests) {
showApiError(500, 'Request limit reached (' . $apiRequests['num'] . '/' . $maxRequests . ')');
}
@@ -134,7 +134,7 @@ switch ($function) {
case 's':
verifyEmptyParameter('q');
$maxAge = maxAge();
$users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$categoryID = categoryid();
$limit = limit();
$offset = offset();
@@ -161,7 +161,7 @@ switch ($function) {
verifyEmptyParameter('season');
verifyEmptyParameter('ep');
$maxAge = maxAge();
$users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$offset = offset();
$relData = $releases->searchbyRageId(
@@ -186,7 +186,7 @@ switch ($function) {
if (!isset($_GET["id"]))
showApiError(200);
$users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$reldata = $releases->getByGuid($_GET["id"]);
if (!$reldata)
@@ -226,7 +226,7 @@ switch ($function) {
if (!isset($_GET["id"]))
showApiError(200);
$users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$data = $rc->getCommentsByGuid($_GET["id"]);
if ($data)
@@ -254,7 +254,7 @@ switch ($function) {
if (!isset($_GET["text"]))
showApiError(200);
$users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$reldata = $releases->getByGuid($_GET["id"]);
if ($reldata)
@@ -291,7 +291,7 @@ switch ($function) {
$maxage = $_GET["maxage"];
}
$users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$limit = 100;
if (isset($_GET["limit"]) && is_numeric($_GET["limit"]) && $_GET["limit"] < 100)
@@ -339,7 +339,7 @@ switch ($function) {
else
$genreId[] = -1;
$users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$limit = 100;
if (isset($_GET["limit"]) && is_numeric($_GET["limit"]) && $_GET["limit"] < 100)
@@ -363,7 +363,7 @@ switch ($function) {
verifyEmptyParameter('q');
verifyEmptyParameter('imdbid');
$maxAge = maxAge();
$users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$offset = offset();
$imdbId = (isset($_GET['imdbid']) ? $_GET['imdbid'] : '-1');
@@ -417,7 +417,7 @@ switch ($function) {
showApiError(200, 'Missing parameter (id is required for downloading an NZB)');
}
$users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
$data = $releases->getByGuid($_GET['id']);
$relData = [];
@@ -445,28 +445,28 @@ switch ($function) {
}
// Check email is valid format.
if (!$users->isValidEmail($_GET['email'])) {
if (!$page->users->isValidEmail($_GET['email'])) {
showApiError(106);
}
// Check email isn't taken.
$ret = $users->getByEmail($_GET['email']);
$ret = $page->users->getByEmail($_GET['email']);
if (isset($ret['id'])) {
showApiError(105);
}
// Create username/pass and register.
$username = $users->generateUsername($_GET['email']);
$password = $users->generatePassword();
$username = $page->users->generateUsername($_GET['email']);
$password = $page->users->generatePassword();
// Register.
$userDefault = $users->getDefaultRole();
$uid = $users->signup(
$userDefault = $page->users->getDefaultRole();
$uid = $page->users->signup(
$username, $password, $_GET['email'], $_SERVER['REMOTE_ADDR'], $userDefault['id'], "", $userDefault['defaultinvites'], "", false, false, false, true
);
// Check if it succeeded.
$userData = $users->getById($uid);
$userData = $page->users->getById($uid);
if (!$userData) {
showApiError(107);
}
+1 -1
View File
@@ -2,7 +2,7 @@
$b = new Book;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (isset($_GET["id"]) && ctype_digit($_GET["id"]))
+1 -1
View File
@@ -2,7 +2,7 @@
$b = new Book;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$category = Category::CAT_BOOK_EBOOK;
+1 -1
View File
@@ -2,7 +2,7 @@
$releases = new Releases(['Settings' => $page->settings]);
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$category = -1;
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
+1 -1
View File
@@ -37,7 +37,7 @@ if (isset($_GET["add"])) {
$page->meta_keywords = "search,add,to,cart,nzb,description,details";
$page->meta_description = "Manage Your Nzb Cart";
$results = $users->getCart($page->users->currentUserId());
$results = $page->users->getCart($page->users->currentUserId());
$page->smarty->assign('results', $results);
$page->content = $page->smarty->fetch('cart.tpl');
+1 -1
View File
@@ -4,7 +4,7 @@ $console = new Console;
$cat = new Category;
$gen = new Genres;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
+1 -1
View File
@@ -2,7 +2,7 @@
$console = new Console;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (isset($_GET["id"]) && ctype_digit($_GET["id"]))
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (isset($_GET["id"]))
@@ -14,7 +14,7 @@ if (isset($_GET["id"]))
$page->show404();
if ($page->isPostBack())
$rc->addComment($data["id"], $data["gid"], $_POST["txtAddComment"], $users->currentUserId(), $_SERVER['REMOTE_ADDR']);
$rc->addComment($data["id"], $data["gid"], $_POST["txtAddComment"], $page->users->currentUserId(), $_SERVER['REMOTE_ADDR']);
$nfo = $releases->getReleaseNfo($data["id"], false);
$reVideo = $re->getVideo($data["id"]);
+1 -1
View File
@@ -3,7 +3,7 @@
use newznab\db\Settings;
use newznab\utility\Utility;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$r = new Releases();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
$releases = new Releases(['Settings' => $page->settings]);
$users = new Users();
$page->users = new Users();
$page = new Page();
if (isset($_GET['userid']) && is_numeric($_GET['userid']) && isset($_GET['rsstoken']) && isset($_GET['guid'])) {
+1 -1
View File
@@ -3,7 +3,7 @@
$releases = new Releases;
$nzb = new NZB;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (isset($_GET["id"]))
+2 -2
View File
@@ -2,7 +2,7 @@
$forum = new Forum;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if ($page->isPostBack())
@@ -12,7 +12,7 @@ if ($page->isPostBack())
if (!isset($_POST["addMessage"]) || empty($_POST["addMessage"]))
$page->show403();
$forum->add(0, $users->currentUserId(), $_POST["addSubject"], $_POST["addMessage"]);
$forum->add(0, $page->users->currentUserId(), $_POST["addSubject"], $_POST["addMessage"]);
header("Location:".WWW_TOP."/forum");
die();
}
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$id = $_GET["id"] + 0;
@@ -8,7 +8,7 @@ $id = $_GET["id"] + 0;
$forum = new Forum();
if ($page->isPostBack())
{
$forum->add($id, $users->currentUserId(), "", $_POST["addReply"]);
$forum->add($id, $page->users->currentUserId(), "", $_POST["addReply"]);
header("Location:".WWW_TOP."/forumpost/".$id."#last");
die();
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
+1 -1
View File
@@ -3,7 +3,7 @@
//
// page is accessible only to logged in users.
//
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (!isset($_GET["type"]) || !isset($_GET["id"]) || !ctype_digit($_GET["id"]))
+12 -12
View File
@@ -5,13 +5,13 @@ $rel = new Releases(['Settings' => $page->settings]);
$uid = 0;
// Page is accessible only by the rss token, or logged in users.
if ($users->isLoggedIn()) {
$uid = $users->currentUserId();
if ($page->users->isLoggedIn()) {
$uid = $page->users->currentUserId();
$maxdls = $page->userdata["downloadrequests"];
$rsstoken = $page->userdata['rsstoken'];
} else {
if ($page->site->registerstatus == Sites::REGISTER_STATUS_API_ONLY) {
$res = $users->getById(0);
$res = $page->users->getById(0);
} else {
if ((!isset($_GET["i"]) || !isset($_GET["r"]))) {
header("X-DNZB-RCode: 400");
@@ -19,7 +19,7 @@ if ($users->isLoggedIn()) {
$page->show403();
}
$res = $users->getByIdAndRssToken($_GET["i"], $_GET["r"]);
$res = $page->users->getByIdAndRssToken($_GET["i"], $_GET["r"]);
if (!$res) {
header("X-DNZB-RCode: 401");
header("X-DNZB-RText: Unauthorised, wrong user ID or rss key!");
@@ -40,10 +40,10 @@ if (isset($_GET['id'])) {
//
$hosthash = "";
if ($page->site->storeuserips == 1) {
$hosthash = $users->getHostHash($_SERVER["REMOTE_ADDR"], $page->site->siteseed);
$hosthash = $page->users->getHostHash($_SERVER["REMOTE_ADDR"], $page->site->siteseed);
}
// Check download limit on user role.
$dlrequests = $users->getDownloadRequests($uid);
$dlrequests = $page->users->getDownloadRequests($uid);
if ($dlrequests['num'] > $maxdls) {
header("X-DNZB-RCode: 503");
header("X-DNZB-RText: User has exceeded maximum downloads for the day!");
@@ -61,13 +61,13 @@ if (isset($_GET["id"]) && isset($_GET["zip"]) && $_GET["zip"] == "1") {
$zip = $rel->getZipped($guids);
if (strlen($zip) > 0) {
$users->incrementGrabs($uid, count($guids));
$page->users->incrementGrabs($uid, count($guids));
foreach ($guids as $guid) {
$rel->updateGrab($guid);
$users->addDownloadRequest($uid, $rel['id']);
$page->users->addDownloadRequest($uid, $rel['id']);
if (isset($_GET["del"]) && $_GET["del"] == 1) {
$users->delCartByUserAndRelease($guid, $uid);
$page->users->delCartByUserAndRelease($guid, $uid);
}
}
@@ -93,10 +93,10 @@ if (isset($_GET["id"])) {
if ($reldata) {
$rel->updateGrab($_GET["id"]);
$users->addDownloadRequest($uid, $reldata['id']);
$users->incrementGrabs($uid);
$page->users->addDownloadRequest($uid, $reldata['id']);
$page->users->incrementGrabs($uid);
if (isset($_GET["del"]) && $_GET["del"] == 1) {
$users->delCartByUserAndRelease($_GET["id"], $uid);
$page->users->delCartByUserAndRelease($_GET["id"], $uid);
}
} else {
header("X-DNZB-RCode: 404");
+5 -4
View File
@@ -26,10 +26,11 @@ if ($page->isPostBack())
$rememberMe = (isset($_POST['rememberme']) && $_POST['rememberme'] == 'on') ? 1 : 0;
$page->users->login($res["id"], $_SERVER['REMOTE_ADDR'], $rememberMe);
if (isset($_POST["redirect"]) && $_POST["redirect"] != "")
header("Location: ".$_POST["redirect"]);
else
header("Location: ".WWW_TOP.$page->site->home_link);
if (isset($_POST["redirect"]) && $_POST["redirect"] != "") {
header("Location: " . $_POST["redirect"]);
} else {
header("Location: " . WWW_TOP . $page->settings->getSetting('home_link'));
}
die();
}
else
+1 -1
View File
@@ -1,4 +1,4 @@
<?php
$users->logout();
$page->users->logout();
header("Location: ".WWW_TOP."/");
+1 -1
View File
@@ -2,7 +2,7 @@
$movie = new Movie;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (isset($_GET["id"]) && ctype_digit($_GET["id"]))
+2 -2
View File
@@ -3,7 +3,7 @@
$movie = new Movie;
$cat = new Category(['Settings' => $page->settings]);
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
@@ -17,7 +17,7 @@ $category = (isset($_GET["imdb"]) ? -1 : Category::CAT_PARENT_MOVIE);
if (isset($_REQUEST["t"]) && array_key_exists($_REQUEST['t'], $mtmp))
$category = $_REQUEST["t"] + 0;
$user = $users->getById($users->currentUserId());
$user = $page->users->getById($page->users->currentUserId());
$cpapi = $user['cp_api'];
$cpurl = $user['cp_url'];
$page->smarty->assign('cpapi', $cpapi);
+1 -1
View File
@@ -2,7 +2,7 @@
$movie = new Movie;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (isset($_GET["id"]) && ctype_digit($_GET["id"]))
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
+1 -1
View File
@@ -2,7 +2,7 @@
$music = new Music;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (isset($_GET["id"]) && ctype_digit($_GET["id"]))
+2 -2
View File
@@ -1,7 +1,7 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$page->title = "My Movies";
$page->meta_title = "My Movies";
$page->meta_keywords = "couch,potato,movie,add";
+3 -3
View File
@@ -1,14 +1,14 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$um = new UserMovies();
if (isset($_REQUEST["del"]))
{
$um->delMovie($users->currentUserId(), $_REQUEST["del"]);
$um->delMovie($page->users->currentUserId(), $_REQUEST["del"]);
}
$cat = new Category;
@@ -17,7 +17,7 @@ $categories = array();
foreach($tmpcats as $c)
$categories[$c['ID']] = $c['title'];
$movies = $um->getMovies($users->currentUserId());
$movies = $um->getMovies($page->users->currentUserId());
$results = array();
foreach ($movies as $mov=>$m)
{
+9 -9
View File
@@ -2,7 +2,7 @@
use newznab\db\Settings;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$us = new UserSeries();
@@ -12,12 +12,12 @@ $rid = isset($_REQUEST['subpage']) ? $_REQUEST['subpage'] : '';
switch($action) {
case 'delete':
$show = $us->getShow($users->currentUserId(), $rid);
$show = $us->getShow($page->users->currentUserId(), $rid);
if (!$show)
$page->show404('Not subscribed');
else
$us->delShow($users->currentUserId(), $rid);
$us->delShow($page->users->currentUserId(), $rid);
if (isset($_REQUEST['from']))
header("Location:".WWW_TOP.$_REQUEST['from']);
@@ -26,7 +26,7 @@ switch($action) {
break;
case 'add':
case 'doadd':
$show = $us->getShow($users->currentUserId(), $rid);
$show = $us->getShow($page->users->currentUserId(), $rid);
if ($show)
{
@@ -43,7 +43,7 @@ switch($action) {
if ($action == 'doadd')
{
$category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] :[];
$us->addShow($users->currentUserId(), $rid, $category);
$us->addShow($page->users->currentUserId(), $rid, $category);
if (isset($_REQUEST['from']))
header("Location:".$_REQUEST['from']);
else
@@ -71,7 +71,7 @@ switch($action) {
break;
case 'edit':
case 'doedit':
$show = $us->getShow($users->currentUserId(), $rid);
$show = $us->getShow($page->users->currentUserId(), $rid);
if (!$show)
$page->show404();
@@ -79,7 +79,7 @@ switch($action) {
if ($action == 'doedit')
{
$category = (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category'])) ? $_REQUEST['category'] :[];
$us->updateShow($users->currentUserId(), $rid, $category);
$us->updateShow($page->users->currentUserId(), $rid, $category);
if (isset($_REQUEST['from']))
header("Location:".WWW_TOP.$_REQUEST['from']);
else
@@ -113,7 +113,7 @@ switch($action) {
$page->meta_keywords = "search,add,to,cart,nzb,description,details";
$page->meta_description = "Browse Your Shows";
$shows = $us->getShows($users->currentUserId());
$shows = $us->getShows($page->users->currentUserId());
$releases = new Releases;
$browsecount = $releases->getShowsCount($shows, -1, $page->userdata["categoryexclusions"]);
@@ -160,7 +160,7 @@ switch($action) {
foreach($tmpcats as $c)
$categories[$c['id']] = $c['title'];
$shows = $us->getShows($users->currentUserId());
$shows = $us->getShows($page->users->currentUserId());
$results =[];
foreach ($shows as $showk=>$show)
{
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
@@ -50,7 +50,7 @@ if (!$error) {
$getnewestmovies = $releases->getNewestMovies();
$page->smarty->assign('newest', $getnewestmovies);
$user = $users->getById($users->currentUserId());
$user = $page->users->getById($page->users->currentUserId());
$page->smarty->assign('cpapi', $user['cp_api']);
$page->smarty->assign('cpurl', $user['cp_url']);
$page->smarty->assign('goto', 'movies');
+1 -1
View File
@@ -4,7 +4,7 @@ use newznab\utility\Utility;
$releases = new Releases;
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (isset($_GET["id"])) {
+1 -1
View File
@@ -2,7 +2,7 @@
use newznab\utility\Utility;
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
try
+1 -1
View File
@@ -2,7 +2,7 @@
$PreDB = new PreDB();
if (!$users->isLoggedIn() || $page->userdata["canpre"] != 1)
if (!$page->users->isLoggedIn() || $page->userdata["canpre"] != 1)
$page->show403();
$page->title = 'PreDB';
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
+2 -2
View File
@@ -97,12 +97,12 @@
// You can make this page accessible by all (even people without an API key) by setting this to false :
if (true) {
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
if (!isset($_GET['apikey'])) {
apiError('Missing parameter (apikey)', 200);
}
if (!$users->getByRssToken($_GET['apikey'])) {
if (!$page->users->getByRssToken($_GET['apikey'])) {
apiError('Incorrect user credentials (api key is wrong)', 100);
}
}
+11 -11
View File
@@ -4,7 +4,7 @@ $rc = new ReleaseComments;
$sab = new SABnzbd($page);
$nzbget = new NZBGet($page);
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$userid = 0;
@@ -12,14 +12,14 @@ if (isset($_GET["id"]))
$userid = $_GET["id"] + 0;
elseif (isset($_GET["name"]))
{
$res = $users->getByUsername($_GET["name"]);
$res = $page->users->getByUsername($_GET["name"]);
if ($res)
$userid = $res["id"];
}
else
$userid = $users->currentUserId();
$userid = $page->users->currentUserId();
$privileged = ($users->isAdmin($userid) || $users->isModerator($userid)) ? true : false;
$privileged = ($page->users->isAdmin($userid) || $page->users->isModerator($userid)) ? true : false;
$privateProfiles = ($page->settings->getSetting('privateprofiles') == 1) ? true : false;
$publicView = false;
@@ -30,7 +30,7 @@ if (!$privateProfiles || $privileged) {
// If both 'id' and 'name' are specified, 'id' should take precedence.
if ($altID === false && $altUsername !== false) {
$user = $users->getByUsername($altUsername);
$user = $page->users->getByUsername($altUsername);
if ($user) {
$altID = $user['id'];
}
@@ -42,16 +42,16 @@ if (!$privateProfiles || $privileged) {
$data = $users->getById($userid);
$data = $page->users->getById($userid);
if (!$data)
$page->show404();
$invitedby = '';
if ($data["invitedby"] != "")
$invitedby = $users->getById($data["invitedby"]);
$invitedby = $page->users->getById($data["invitedby"]);
$page->smarty->assign('apihits', $users->getApiRequests($userid));
$page->smarty->assign('grabstoday', $users->getDownloadRequests($userid));
$page->smarty->assign('apihits', $page->users->getApiRequests($userid));
$page->smarty->assign('grabstoday', $page->users->getDownloadRequests($userid));
$page->smarty->assign('userinvitedby',$invitedby);
$page->smarty->assign('user',$data);
$page->smarty->assign('privateprofiles', $privateProfiles);
@@ -73,11 +73,11 @@ $page->smarty->assign('pager', $pager);
$commentslist = $rc->getCommentsForUserRange($userid, $offset, ITEMS_PER_PAGE);
$page->smarty->assign('commentslist',$commentslist);
$downloadlist = $users->getDownloadRequestsForUserAndAllHostHashes($userid);
$downloadlist = $page->users->getDownloadRequestsForUserAndAllHostHashes($userid);
$page->smarty->assign('downloadlist',$downloadlist);
$exccats = $users->getCategoryExclusionNames($userid);
$exccats = $page->users->getCategoryExclusionNames($userid);
$page->smarty->assign('exccats', implode(",", $exccats));
$page->smarty->assign('saburl', $sab->url);
+12 -12
View File
@@ -5,17 +5,17 @@ use newznab\utility\Utility;
$category = new Category;
$sab = new SABnzbd($page);
$nzbGet = new NZBGet($page);
$users = new Users();
$page->users = new Users();
$s = new Sites();
$site = $s->get();
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
$userid = $users->currentUserId();
$data = $users->getById($userid);
$userid = $page->users->currentUserId();
$data = $page->users->getById($userid);
if (!$data)
$page->show404();
@@ -23,7 +23,7 @@ $errorStr = '';
switch ($action) {
case 'newapikey':
$users->updateRssKey($userid);
$page->users->updateRssKey($userid);
header("Location: profileedit");
break;
case 'clearcookies':
@@ -38,14 +38,14 @@ switch ($action) {
if ($_POST['password'] != "" && $_POST['password'] != $_POST['confirmpassword']) {
$errorStr = "Password Mismatch";
} else if ($_POST['password'] != "" && !$users->isValidPassword($_POST['password'])) {
} else if ($_POST['password'] != "" && !$page->users->isValidPassword($_POST['password'])) {
$errorStr = "Your password must be longer than five characters.";
} else if (isset($_POST['nzbgeturl']) && $nzbGet->verifyURL($_POST['nzbgeturl']) === false) {
$errorStr = "The NZBGet URL you entered is invalid!";
} else if (!$users->isValidEmail($_POST['email'])) {
} else if (!$page->users->isValidEmail($_POST['email'])) {
$errorStr = "Your email is not a valid format.";
} else {
$res = $users->getByEmail($_POST['email']);
$res = $page->users->getByEmail($_POST['email']);
if ($res && $res["id"] != $userid) {
$errorStr = "Sorry, the email is already in use.";
} elseif ((empty($_POST['saburl']) && !empty($_POST['sabapikey'])) || (!empty($_POST['saburl']) && empty($_POST['sabapikey']))) {
@@ -56,7 +56,7 @@ switch ($action) {
$_POST['saburl'] = $_POST['sabapikey'] = $_POST['sabpriority'] = $_POST['sabapikeytype'] = false;
}
$users->update(
$page->users->update(
$userid,
$data["username"],
$_POST['email'],
@@ -86,10 +86,10 @@ switch ($action) {
);
$_POST['exccat'] = (!isset($_POST['exccat']) || !is_array($_POST['exccat'])) ? array() : $_POST['exccat'];
$users->addCategoryExclusions($userid, $_POST['exccat']);
$page->users->addCategoryExclusions($userid, $_POST['exccat']);
if ($_POST['password'] != "")
$users->updatePassword($userid, $_POST['password']);
$page->users->updatePassword($userid, $_POST['password']);
header("Location:" . WWW_TOP . "/profile");
die();
@@ -116,7 +116,7 @@ $page->smarty->assign('themelist', $themeList);
$page->smarty->assign('error', $errorStr);
$page->smarty->assign('user', $data);
$page->smarty->assign('userexccat', $users->getCategoryExclusion($userid));
$page->smarty->assign('userexccat', $page->users->getCategoryExclusion($userid));
$page->smarty->assign('saburl_selected', $sab->url);
$page->smarty->assign('sabapikey_selected', $sab->apikey);
+3 -3
View File
@@ -1,10 +1,10 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
$userData = $users->getById($users->currentUserId());
$userData = $page->users->getById($page->users->currentUserId());
if (!$userData) {
$page->show404();
}
@@ -78,7 +78,7 @@ if (!is_null($queue)) {
}
}
$page->smarty->assign(array('queueType' => $queueType, 'error' => $error, 'user', $users));
$page->smarty->assign(array('queueType' => $queueType, 'error' => $error, 'user', $page->users));
$page->title = "Your $queueType Download Queue";
$page->meta_title = "View $queueType Queue";
$page->meta_keywords = "view," . strtolower($queueType) .",queue";
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
$sab = new SABnzbd($page);
+5 -5
View File
@@ -1,6 +1,6 @@
<?php
if ($users->isLoggedIn())
if ($page->users->isLoggedIn())
$page->show404();
$showregister = 1;
@@ -54,11 +54,11 @@ else {
$page->smarty->assign('error', "Password Mismatch");
} else {
//get the default user role
$userdefault = $users->getDefaultRole();
$userdefault = $page->users->getDefaultRole();
$ret = $users->signup($username, $password, $email, $_SERVER['REMOTE_ADDR'], $userdefault['id'], "", $userdefault['defaultinvites'], $invitecode, false);
$ret = $page->users->signup($username, $password, $email, $_SERVER['REMOTE_ADDR'], $userdefault['id'], "", $userdefault['defaultinvites'], $invitecode, false);
if ($ret > 0) {
$users->login($ret, $_SERVER['REMOTE_ADDR']);
$page->users->login($ret, $_SERVER['REMOTE_ADDR']);
header("Location: " . WWW_TOP . "/");
} else {
switch ($ret) {
@@ -94,7 +94,7 @@ else {
//
// see if it is a valid invite
//
$invite = $users->getInvite($invitecode);
$invite = $page->users->getInvite($invitecode);
if (!$invite) {
$page->smarty->assign('error', sprintf("Bad or invite code older than %d days.", Users::DEFAULT_INVITE_EXPIRY_DAYS));
$page->smarty->assign('showregister', "0");
+1 -1
View File
@@ -77,7 +77,7 @@ if (!isset($_GET["t"]) && !isset($_GET["rage"]) && !isset($_GET["anidb"])) {
$usercat = ($_GET["t"] == 0 ? -1 : $_GET["t"]);
}
$userrage = $useranidb = $userseries = -1;
$userrage = $useranidb = $page->userseries = -1;
if (isset($_GET["rage"])) {
$userrage = ($_GET["rage"] == 0 ? -1 : $_GET["rage"] + 0);
} elseif (isset($_GET["anidb"])) {
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
require_once(WWW_DIR."/lib/nzbget.php");
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (empty($_GET["id"]))
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
@@ -8,7 +8,7 @@ if (empty($_GET["id"])) {
$page->show404();
}
$user = $users->getById($users->currentUserId());
$user = $page->users->getById($page->users->currentUserId());
if ($user['queuetype'] != 2) {
$sab = new SABnzbd($page);
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn())
if (!$page->users->isLoggedIn())
$page->show403();
if (empty($_GET["id"]))
+3 -3
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
@@ -26,7 +26,7 @@ if (isset($_GET["id"]) && ctype_digit($_GET['id'])) {
} elseif (!$rel) {
$page->smarty->assign("nodata", "No releases for this series.");
} else {
$myshows = $us->getShow($users->currentUserId(), $rage[0]['rageid']);
$myshows = $us->getShow($page->users->currentUserId(), $rage[0]['rageid']);
// Sort releases by season, episode, date posted.
$season = $episode = $posted = array();
@@ -94,7 +94,7 @@ if (isset($_GET["id"]) && ctype_digit($_GET['id'])) {
$letter = "";
}
$masterserieslist = $tvrage->getSeriesList($users->currentUserId(), $letter, $ragename);
$masterserieslist = $tvrage->getSeriesList($page->users->currentUserId(), $letter, $ragename);
$page->title = 'Series List';
$page->meta_title = "View Series List";
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
@@ -9,7 +9,7 @@ $m = new Film();
if (!isset($_GET["id"])) {
$_GET["id"] = 1;
}
$user = $users->getById($users->currentUserId());
$user = $page->users->getById($page->users->currentUserId());
$cpapi = $user['cp_api'];
$cpurl = $user['cp_url'];
$page->smarty->assign('cpapi', $cpapi);
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}