Possible fix for role error on content page when not logged in

This commit is contained in:
DariusIII
2017-03-20 09:05:07 +01:00
parent 596a9ef018
commit 0e5fed6a71
2 changed files with 7 additions and 5 deletions
+2
View File
@@ -1,3 +1,5 @@
2017-03-20 DariusIII
* Fix: Possible fix for role error on content page when not logged in
2017-03-17 DariusIII
* Chg: Remove now unused pixelead0 tmdb library, update jquery
2017-03-16 DariusIII
+5 -5
View File
@@ -5,7 +5,7 @@ use nntmux\Contents;
$contents = new Contents(['Settings' => $page->settings]);
$role = 0;
if (isset($page->userdata)) {
if (!empty($page->userdata) && $page->users->isLoggedIn()) {
$role = $page->userdata['role'];
}
@@ -26,12 +26,12 @@ if (isset($page->userdata)) {
$page->smarty->assign('admin', (($role === 2 || $role === 4) ? 'true' : 'false'));
$contentId = 0;
if (isset($_GET['id'])) {
if (!empty($_GET['id'])) {
$contentId = $_GET['id'];
}
$request = false;
if (isset($_REQUEST['page'])) {
if (!empty($_REQUEST['page'])) {
$request = $_REQUEST['page'];
}
@@ -42,7 +42,7 @@ if ($contentId === 0 && $request === 'content') {
$page->meta_keywords = 'contents';
$page->meta_description = 'This is the contents page.';
} else if ($contentId !== 0 && $request !== false) {
$content = array($contents->getByID($contentId, $role));
$content = [$contents->getByID($contentId, $role)];
$page->smarty->assign('front', false);
$page->meta_title = 'Contents page';
$page->meta_keywords = 'contents';
@@ -56,7 +56,7 @@ if ($contentId === 0 && $request === 'content') {
$page->meta_description = $index->metadescription;
}
if ($content === null) {
if (empty($content)) {
$page->show404();
}