db_select("ps_pages",$cond)) { // Check if Page is on if( $row['p_status'] == false && empty($_SESSION['u_id'])) $FV->error("Page '" . $_GET['p_id'] ."' is off and cannot be viewed",$C); // Check if page is secure if ( $row['p_secure'] && empty($_SESSION['wu_id']) && empty($_SESSION['u_id']) ) $FV->error("Page '" . $_GET['p_id'] ."' is secure and cannot be viewed, please login to view the page",$C); // Check if it a link page and direct if ( $row['p_link_page'] == true ) { header("Location: " . $row['p_meta_title']); exit(); } if ( $S->val['cache'] == false || !empty($_SESSION['wu_id']) || ( $S->val['cache'] >= $row['p_cache_date']) ) { $tpl = new TemplatePower($T->get_page_set($_GET['p_id'],"global"),T_BYVAR); $tpl->assignInclude("BODY",$T->get_page_set($_GET['p_id'],"page_view"),T_BYVAR); $tpl->assignInclude("MENU",$T->get_page_set($_GET['p_id'],"menu"),T_BYVAR); $tpl->assignInclude("ARTICLES_PREVIEW",$T->get_page_set($_GET['p_id'],"articles_preview"),T_BYVAR); $tpl->assignInclude("ITEMS_PREVIEW",$T->get_page_set($_GET['p_id'],"items_preview"),T_BYVAR); $tpl->assignInclude("ARTICLE_RANDOM",$T->get_page_set($_GET['p_id'],"article_random"),T_BYVAR); $tpl->assignInclude("ITEM_RANDOM",$T->get_page_set($_GET['p_id'],"item_random"),T_BYVAR); $tpl->prepare(); $tpl->assign("Stylesheet",$T->get_page_set($_GET['p_id'],"stylesheet")); $tpl->assign("Site_Name",$S->val['site_name']); $tpl->assign("Page_Title",$row['p_meta_title']); $tpl->assign("Keywords",$row['p_keywords']); $tpl->assign("Description",$row['p_description']); $tpl->assign("Date",date($S->val['date_format'])); $tpl->assign("news_link_name",$S->val['article_alias']); // assign bread crum: $B->getPage($_GET['p_id']); $HTML->make_menu_site($row['p_template_set'],$tpl,$S,$C,$T); $HTML->make_preview_articles($tpl,$S,$C); $HTML->make_preview_items($tpl,$S,$C); $HTML->make_random_article($tpl,$S,$C); $HTML->make_random_item($tpl,$S,$C); // Show Page $tpl->newBlock("page"); $tpl->assign("p_id",$row['p_id']); $tpl->assign("p_title",$row['p_title']); $tpl->assign("p_u_date",date($S->val['date_format'],$row['p_u_date'])); $tpl->assign("p_description",$row['p_description']); $tpl->assign("p_content",$row['p_content']); $tpl->assign("breadcrum", $B->html); // Assign rss href: $tpl->assign("rss_article_href", $C->url . "/rss_feed_article.php"); //Attachmrents $sql_query = "SELECT * FROM `ps_page_attach`, `ps_pages` WHERE `pa_p_id` = `p_id` AND `pa_p_id` = ".$row['p_id']; $query_id = $DB->sql_query($sql_query); if($DB->sql_numrows($query_id) > 0) { $tpl->newBlock("attachments"); while ( $attach = $DB->sql_fetchrow($query_id) ) { $tpl->newBlock("attach_row"); $real_file_name = substr($attach['pa_file_name'], strpos($attach['pa_file_name'],"_")+1); $tpl->assign("filename", $real_file_name); $kilobytes = round(($attach['pa_size'] / 1000), 1); $tpl->assign("size", $kilobytes."KB"); $tpl->assign("post", date($S->val['date_format'], $attach['pa_date'])); $tpl->assign("downloads", $attach['pa_count']); $tpl->assign("pa_id", $attach['pa_id']); $sql_query = "SELECT `ft_id` FROM `ps_file_types`, `ps_page_attach` WHERE `ft_name` = '".$attach['pa_type']."'"; $query_id2 = $DB->sql_query($sql_query); if ( $row3 = $DB->sql_fetchrow($query_id2)) {$tpl->assign("pa_type",$attach['pa_type']);} else {$tpl->assign("pa_type","def");} } } $end = benchit(); $tpl->assignGlobal("C_Time",round( $end - $start, 3 )); $tpl->assignGlobal("S_Time",date("H:i:s")); $tpl->assignGlobal("Q_Count",$DB->num_queries['total']); if( ($S->val['cache'] != '0') && ($S->val['cache'] >= $row['p_cache_date']) ) { $cond1['p_id'] = $_GET['p_id']; $val1['p_cache'] = addslashes($tpl->getOutputContent()); $val1['p_cache_date'] = mktime(); $DB->db_update("ps_pages", $val1, $cond1); } $tpl->printToScreen(); } else { $end = benchit(); echo $row['p_cache']; } } else $FV->error("Page '" . $_GET['p_id'] ."' is invalid and cannot be found",$C); ?>