Jump to content

Problems with notfound and nopermission page templates


Recommended Posts

Posted

Hi everyone,

I am having issues with the tpl files pages_nopermission and pages_notfound. When pilots go to a wrong links in my website, they're redirected to the nopermission pagen instead of the notfound one. I have checked the Pages.php file and it seems to be correct. Do you know how I can solve it?. Thanks.

<?php
/**
* phpVMS - Virtual Airline Administration Software
* Copyright (c) 2008 Nabeel Shahzad
* For more information, visit www.phpvms.net
* Forums: http://www.phpvms.net/forum
* Documentation: http://www.phpvms.net/docs
*
* phpVMS is licenced under the following license:
* Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
* View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
*
* @author Nabeel Shahzad
* @copyright Copyright (c) 2008, Nabeel Shahzad
* @link http://www.phpvms.net
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/
*/
class Pages extends CodonModule
{
public function NavBar()
{
$this->set('allpages', SiteData::getAllPages(true, Auth::$loggedin));
$this->render('pages_items.tpl');
}

public function __call($name, $args)
{
// $name here is the filename, but we don't call it in directly
// for security reasons

$page = DB::escape($name);
$pageinfo = SiteData::GetPageDataByName($page);

if($pageinfo->public == 0 && Auth::LoggedIn() == false)
{
$this->render('pages_nopermission.tpl');
return;
}

$content = SiteData::GetPageContent($page);
if(!$content)
{
$this->render('pages_notfound.tpl');
}
else
{
// Do it this way, so then that this page/template
// can be customized on a skin-by-skin basis
$this->title = $content->pagename;
$this->set('pagename', $content->pagename);

# Do entity encoding, compensate for a html_entity_decode() in the templates
$this->set('content', htmlentities($content->content));

$this->render('pages_content.tpl');
}
}
}

  • Moderators
Posted

Can you please give it a try maybe? Check this:

if($pageinfo->public == 0 && Auth::LoggedIn() == false)

with this:

if(isset($pageinfo) && $pageinfo->public == 0 && Auth::LoggedIn() == false)

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...