get_article_cat($_GET['cat']); if ( $row_cat['ac_secure'] && empty($_SESSION['wu_id']) && empty($_SESSION['u_id']) ) { header("Location: " . $C->url . "/logout.php"); exit(); } } // get listing template for this category, if there is not a category then get default template: if(!empty($_GET['cat'])) { $category_template = (int) $_GET['cat']; unset($row,$cond); $cond['ac_id'] = $category_template; $row = $DB->db_select('ps_article_categories', $cond); $category_template = (int) $row['ac_template_set']; $S->val['articles_list_template'] = $category_template; } else { $category_template = $S->val['articles_list_template']; } $tpl = new TemplatePower($T->get($category_template, "global"), T_BYVAR); $tpl->assignInclude("BODY",$T->get($S->val['articles_list_template'],"articles_browse"),T_BYVAR); $tpl->assignInclude("MENU",$T->get($S->val['articles_list_template'],"menu"),T_BYVAR); $tpl->assignInclude("ARTICLES_PREVIEW",$T->get($S->val['articles_list_template'],"articles_preview"),T_BYVAR); $tpl->assignInclude("ITEMS_PREVIEW",$T->get_article_set($_GET['a_id'],"items_preview"),T_BYVAR); $tpl->assignInclude("ARTICLE_RANDOM",$T->get_article_set($_GET['a_id'],"article_random"),T_BYVAR); $tpl->assignInclude("ITEM_RANDOM",$T->get_article_set($_GET['a_id'],"item_random"),T_BYVAR); $tpl->prepare(); $tpl->assign("Stylesheet",$T->get($S->val['articles_list_template'],"stylesheet")); $tpl->assign("Site_Name",$S->val['site_name']); $tpl->assign("Page_Title",$S->val['article_alias'] ." listing"); $tpl->assign("Keywords",$S->val['article_alias'] ." listing"); $tpl->assign("Description",$S->val['site_name'] . " " .$S->val['article_alias'] ." listing"); $tpl->assign("Date",date($S->val['date_format'])); $HTML->make_menu_site($S->val['articles_list_template'],$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); require($C->root_class . "/class.Navbar.php"); $nav = new navbar($DB); $nav->numrowsperpage = $S->val['articles_per_page']; function sql_article_categories($DB,$ac_id,&$sql_cat) { $sql = "SELECT * FROM ps_article_categories WHERE ac_parent_id = " . $ac_id; $q_id = $DB->sql_query($sql); while ( $row = $DB->sql_fetchrow($q_id) ) { $sql_cat .= " OR `a_category` = ". $row['ac_id']; sql_article_categories($DB,$row['ac_id'],$sql_cat); } } // Return the Articles if ( empty($_GET['cat']) ) $_GET['cat'] = -1; $sql_cat = ""; sql_article_categories($DB,$_GET['cat'],$sql_cat); $sql_cat = " AND ( `a_category` = " . $_GET['cat'] . " " . $sql_cat . " ) "; // Check if item is on if( empty($_SESSION['u_id'])) $sql_status = " AND `a_status` != 0 AND ( `ac_status` != 0 OR `ac_status` IS NULL )"; else $sql_status = " "; if( empty($_SESSION['u_id']) && empty($_SESSION['wu_id']) && $C->secure_on == true ) $sql_secure = " AND ( `ac_secure` != 1 OR `ac_secure` IS NULL )"; else $sql_secure = " "; $sql_query = "SELECT * FROM `ps_articles` LEFT JOIN `ps_article_categories` ON `a_category` = `ac_id` WHERE `a_pub_date` < " . mktime() . " " . $sql_status . " " . $sql_cat . " " . $sql_secure . " ORDER BY `a_pub_date` DESC"; if ( empty($_GET['row'])) $_GET['row'] = 0; $q_id = $nav->execute($sql_query,$_GET['row']); $tpl->newBlock("article_list"); if ( !empty($category['ac_description']) ) $tpl->assign("ac_description",$category['ac_description']); else $tpl->assign("ac_description",""); if( empty($_GET['cat']) ) $_GET['cat'] = ""; ## Breadcrum if ( empty($_GET['cat']) || $_GET['cat'] == '-1' ) { //$B->add($S->val['article_alias'], "", 1); } else { $Bcond['ac_id'] = $_GET['cat']; $Brow = $DB->db_select("ps_article_categories", $Bcond); $B->add($S->val['article_alias'], "list.php", 1); $B->add($Brow['ac_title'], "", 0); } $B->output(); $tpl->assign("breadcrum", $B->html); $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']); // Assign rss href: $tpl->assign("rss_article_href", $C->url . "/rss_feed_article.php"); while ( $row = $DB->sql_fetchrow($q_id) ) { $tpl->newBlock("article"); $tpl->assign("a_id", $row['a_id']); $tpl->assign("a_title", $row['a_title']); $tpl->assign("a_href_target",$row['a_href_target']); $tpl->assign("a_pub_date", date($S->val['date_format'],$row['a_pub_date'])); $tpl->assign("a_description", $row['a_description']); if ( !empty($row['a_thumb']) ) { $tpl->newBlock("al_thumb"); $tpl->assign("a_thumb",$C->url_articles_thumbs."/".$row['a_thumb']); } } $links = $nav->getlinks("all", "on", $_GET['row'], $_GET['cat']); for ($y = 0; $y < count($links); $y++) { $tpl->newBlock("pages_list"); $tpl->assign("pages", $links[$y]. " "); } $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']); $tpl->printToScreen(); ?>