listPages();
if(is_array($tmp))
{
$ns -> tablerender($tmp['title'], $tmp['text']);
require_once(FOOTERF);
exit;
}
}
else
{
$cacheString = 'page_'.$page->pageID;
$cachePageTitle = 'page-t_'.$page->pageID;
if($cacheData = $e107cache->retrieve($cacheString))
{
list($pagetitle,$comment_flag) = explode("^",$e107cache->retrieve($cachePageTitle));
define("e_PAGETITLE", $pagetitle);
require_once(HEADERF);
echo $cacheData;
}
else
{
$tmp = $page -> showPage();
define("e_PAGETITLE", $tmp['title']);
require_once(HEADERF);
if ($tmp['err']) // Need to display error block after header defined
{
$ns -> tablerender($tmp['title'], $tmp['text'],"cpage");
require_once(FOOTERF);
exit;
}
if ($tmp['cachecontrol'] == TRUE)
{
ob_start();
$ns -> tablerender($tmp['title'], $tmp['text']);
$cache_data = ob_get_flush();
$e107cache->set($cacheString, $cache_data);
$e107cache->set($cachePageTitle, $tmp['title']."^".$tmp['comment_flag']);
$comment_flag = $tmp['comment_flag'];
}
else
{
$ns -> tablerender($tmp['title'], $tmp['text'],"cpage");
$comment_flag = $tmp['comment_flag'];
}
}
$page -> title = $tmp['title'];
if($com = $page -> pageComment($comment_flag))
{
echo $com['comment'].$com['comment_form'];
}
}
require_once(FOOTERF);
/* EOF */
class pageClass
{
var $bullet; /* bullet image */
var $pageText; /* main text of selected page, not parsed */
var $multipageFlag; /* flag - true if multiple page page, false if not */
var $pageTitles; /* array containing page titles */
var $pageID; /* id number of page to be displayed */
var $pageSelected; /* selected page of multiple page page */
var $pageToRender; /* parsed page to be sent to screen */
var $debug; /* temp debug flag */
var $title; /* title of page, it if has one (as defined in [newpage=title] tag */
function pageClass($debug=FALSE)
{
/* constructor */
$tmp = explode(".", e_QUERY);
$this -> pageID = intval($tmp[0]);
$this -> pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0);
$this -> pageTitles = array();
if(defined("BULLET"))
{
$this -> bullet = "";
}
elseif(file_exists(THEME."images/bullet2.gif"))
{
$this -> bullet = "";
}
else
{
$this -> bullet = "";
}
$this -> debug = $debug;
if($this -> debug)
{
$this -> debug = "PageID ".$this -> pageID."
";
$this -> debug .= "pageSelected ".$this -> pageSelected."
";
}
}
function listPages()
{
global $pref, $sql, $ns;
if(!isset($pref['listPages']) || !$pref['listPages'])
{
message_handler("MESSAGE", LAN_PAGE_1);
}
else
{
if(!$sql -> db_Select("page", "*", "page_theme='' AND page_class IN (".USERCLASS_LIST.") "))
{
$text = LAN_PAGE_2;
}
else
{
$pageArray = $sql -> db_getList();
foreach($pageArray as $page)
{
extract($page);
$text .= $this -> bullet." ".$page_title."
";
}
$ns -> tablerender(LAN_PAGE_11, $text,"cpage_list");
}
}
}
function showPage()
{
global $sql, $ns;
$query = "SELECT p.*, u.user_id, u.user_name FROM #page AS p
LEFT JOIN #user AS u ON p.page_author = u.user_id
WHERE p.page_id='".intval($this -> pageID)."' AND p.page_class IN (".USERCLASS_LIST.") ";
if(!$sql -> db_Select_gen($query) && !$_GET['elan'])
{
$ret['title'] = LAN_PAGE_12; // ***** CHANGED
$ret['text'] = LAN_PAGE_3;
$ret['comment_flag'] = '';
$ret['err'] = TRUE;
return $ret;
}
extract($sql -> db_Fetch());
$this -> pageText = $page_text;
$this -> pageCheckPerms($page_class, $page_password, $page_title);
if($this -> debug)
{
echo "pageText ".$this -> pageText."
";
}
$this -> parsePage();
$gen = new convert;
$text = ''; // Notice removal
$ptitle = "";
if($page_author)
{
$text .= "
"; print_r($pages); echo ""; echo "pageCount ".$pageCount."
"; print_r($this -> pageTitles); echo ""; } } } function pageIndex() { global $tp,$pref; $itext = ''; if(isset($pref['old_np']) && $pref['old_np']) { $count = 0; foreach($this -> pageTitles as $title) { if (!$count) { $itext = "
"; if ($ratearray = $rater->getrating("page", $this -> pageID)) { if ($ratearray[2] == "") { $ratearray[2] = 0; } $rate_text .= "\n"; $rate_text .= " ".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]." "; $rate_text .= ($ratearray[0] == 1 ? "vote" : "votes"); } else { $rating .= LAN_PAGE_dl_13; } $rate_text .= " | "; if (!$rater->checkrated("page", $this -> pageID) && USER) { $rate_text .= $rater->rateselect(" ".LAN_PAGE_4."", "page", $this -> pageID); } else if(!USER) { $rate_text .= " "; } else { $rate_text .= LAN_PAGE_5; } $rate_text .= " |