error("Article id is empty",$C); // Make Sure $_GET['a_id'] = integer $a_id = (int) $_GET['a_id']; // Get The Article $sql = 'SELECT * FROM `ps_articles` LEFT JOIN `ps_article_categories` ON `ac_id`=`a_category` WHERE `a_id` = ' . $a_id ; $q_id = $DB->sql_query($sql); if ( $row = $DB->sql_fetchrow($q_id) ) { // Check if article is on if( $row['a_status'] == false && empty($_SESSION['u_id'])) $FV->error("Article '" . $_GET['a_id'] ."' is off and cannot be viewed",$C); // Check if article Category is On if( $row['ac_status'] === 0 && empty($_SESSION['u_id']) && empty($_SESSION['wu_id']) ) $FV->error("Article '" . $_GET['a_id'] ."' category is off and cannot be viewed",$C); // Check if article is secure if( $row['ac_secure'] == true && empty($_SESSION['u_id']) && empty($_SESSION['wu_id']) ) $FV->error("Article '" . $_GET['a_id'] ."' is secure and cannot be viewed, please login to view the article",$C); // check if the article is a link page, if it is then redirect to that page: if($row['a_link_page'] == 1) { header("Location: ".$row['a_href']); exit(); } // Fnally Display the Page if ( $S->val['cache'] == false || !empty($_SESSION['wu_id']) || $S->val['cache'] >= $row['a_cache_date'] ) { $tpl = new TemplatePower($T->get_article_set($a_id,"global"),T_BYVAR); $tpl->assignInclude("BODY",$T->get_article_set($a_id,"article_view"),T_BYVAR); $tpl->assignInclude("MENU",$T->get_article_set($a_id,"menu"),T_BYVAR); $tpl->assignInclude("ARTICLES_PREVIEW",$T->get_article_set($a_id,"articles_preview"),T_BYVAR); $tpl->assignInclude("ITEMS_PREVIEW",$T->get_article_set($a_id,"items_preview"),T_BYVAR); $tpl->assignInclude("ARTICLE_RANDOM",$T->get_article_set($a_id,"article_random"),T_BYVAR); $tpl->assignInclude("ITEM_RANDOM",$T->get_article_set($a_id,"item_random"),T_BYVAR); $tpl->prepare(); $tpl->assign("Stylesheet",$T->get_article_set($a_id,"stylesheet")); $tpl->assign("Site_Name",$S->val['site_name']); $tpl->assign("Page_Title",$row['a_title']); $tpl->assign("Keywords",$row['a_keywords']); $tpl->assign("Description",$row['a_description']); $tpl->assign("Date",date($S->val['date_format'])); if( !empty($row['ac_template_set']) ) $HTML->make_menu_site($row['ac_template_set'],$tpl,$S,$C,$T); else $HTML->make_menu_site("",$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("article"); $tpl->assign("a_id",$row['a_id']); $tpl->assign("a_title",$row['a_title']); $tpl->assign("a_pub_date",date($S->val['date_format'],$row['a_pub_date'])); $tpl->assign("a_u_date",date($S->val['date_format'],$row['a_u_date'])); $tpl->assign("a_description",$row['a_description']); $tpl->assign("a_content",$row['a_content']); $thumb_image_wrapper = ''; $tpl->assign("a_thumb",$thumb_image_wrapper); ## breadcrum: if(!empty($row['ac_title']) && $row['a_category'] > 0) { $B->add($S->val['article_alias'], "list.php", 1); $B->add($row['ac_title'], "", 0); $B->output(); $tpl->assign("breadcrum", $B->html); } // category list: $tpl->assign("a_category_list",$HTML->dm_article_categories_site("cat",$_GET['cat'])); $tpl->assign("a_cat_button",$HTML->button_submit("View")); $tpl->assign("articles_alias", $S->val['article_alias']); //Attachments $sql_query = "SELECT * FROM `ps_article_attach`, `ps_articles` WHERE `aa_a_id` = `a_id` AND `aa_a_id` = ".$a_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['aa_file_name'], strpos($attach['aa_file_name'],"_")+1); $tpl->assign("filename", $real_file_name); $kilobytes = round(($attach['aa_size'] / 1000), 1); $tpl->assign("size", $kilobytes."KB"); $tpl->assign("post", date($S->val['date_format'], $attach['aa_date'])); $tpl->assign("downloads", $attach['aa_count']); $tpl->assign("aa_id", $attach['aa_id']); $sql_query = "SELECT `ft_id` FROM `ps_file_types`, `ps_article_attach` WHERE `ft_name` = '".$attach['aa_type']."'"; $query_id2 = $DB->sql_query($sql_query); if ( $row3 = $DB->sql_fetchrow($query_id2)) $tpl->assign("aa_type",$attach['aa_type']); else $tpl->assign("aa_type","def"); } } // Assign rss href: $tpl->assign("rss_article_href", $C->url . "/rss_feed_article.php"); if( ($S->val['cache'] != '0') && ($S->val['cache'] >= $row['a_cache_date']) ) { $cache = $tpl->getOutputContent(); $clean = addslashes($cache); $cond1['a_id'] = $_GET['a_id']; $val1['a_cache'] = $clean; $val1['a_cache_date'] = mktime(); $DB->db_update("ps_articles",$val1,$cond1); } $end = benchit(); $tpl->assignGlobal("C_Time",round($end - $start,3)); $tpl->assignGlobal("S_Time",date($S->val['date_format'])); $tpl->assignGlobal("Q_Count",$DB->num_queries['total']); $tpl->printToScreen(); } else { echo $row['a_cache']; } } else $FV->error("Article '" . $_GET['a_id'] ."' is invalid and cannot be found",$C); ?>