get_item_cat($_GET['cat']); if ( $row_cat['ic_secure'] && empty($_SESSION['wu_id']) && empty($_SESSION['u_id']) ) { header("Location: " . $C->url . "/logout.php"); exit(); } } // get template for specific category or get genarel template if category_id is not set: if ( !empty($_GET['cat']) ) { $category_template = (int)$_GET['cat']; unset($row, $cond); $cond['ic_id'] = $category_template; $row = $DB->db_select('ps_item_categories', $cond); $category_template = (int)$row['ic_template_set']; $S->val['item_list_template'] = $category_template; } else { $category_template = $S->val['item_list_template']; } $tpl = new TemplatePower($T->get($category_template, "global"), T_BYVAR); $tpl->assignInclude("BODY", $T->get($S->val['item_list_template'], "items_browse"), T_BYVAR); $tpl->assignInclude("MENU", $T->get($S->val['item_list_template'], "menu"), T_BYVAR); $tpl->assignInclude("ARTICLES_PREVIEW", $T->get($S->val['item_list_template'], "articles_preview"), T_BYVAR); $tpl->assignInclude("ITEMS_PREVIEW", $T->get_page_set($S->val['item_list_template'], "items_preview"), T_BYVAR); $tpl->assignInclude("ARTICLE_RANDOM", $T->get_page_set($S->val['item_list_template'], "article_random"), T_BYVAR); $tpl->assignInclude("ITEM_RANDOM", $T->get_page_set($S->val['item_list_template'], "item_random"), T_BYVAR); $tpl->prepare(); $tpl->assign("Stylesheet", $T->get($S->val['item_list_template'], "stylesheet")); $tpl->assign("Site_Name", $S->val['site_name']); $tpl->assign("Keywords", $S->val['item_alias'] . " listing"); $tpl->assign("Description", $S->val['site_name'] . " " . $S->val['item_alias'] . " listing"); $tpl->assign("Date", date($S->val['date_format'])); $HTML->make_menu_site($S->val['item_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['items_per_page']; function sql_item_categories($DB, $ic_id, &$sql_cat) { $sql = "SELECT * FROM ps_item_categories WHERE ic_parent_id = $ic_id"; $q_id = $DB->sql_query($sql); while ( $row = $DB->sql_fetchrow($q_id) ) { $sql_cat .= " OR `i_category` = " . $row['ic_id']; sql_item_categories($DB, $row['ic_id'], $sql_cat); } } if ( empty($_GET['cat']) ) $_GET['cat'] = -1; sql_item_categories($DB, $_GET['cat'], $sql_cat); $sql_cat = " AND ( `i_category` = " . $_GET['cat'] . " " . $sql_cat . " ) "; // Check if item is on if ( empty($_SESSION['u_id']) ) $sql_status = " AND `i_status` != 0 AND ( `ic_status` != 0 OR `ic_status` IS NULL )"; else $sql_status = " "; if ( empty($_SESSION['u_id']) && empty($_SESSION['wu_id']) && $C->secure_on == true ) $sql_secure = " AND ( `ic_secure` != 1 OR `ic_secure` IS NULL )"; else $sql_secure = " "; $sql_query = "SELECT * FROM `ps_items` LEFT JOIN `ps_item_categories` ON `i_category` = `ic_id` WHERE 1 " . $sql_status . " " . $sql_cat . " " . $sql_secure . " ORDER BY `i_preview_priority` DESC, `i_sort_order` ASC"; //echo $sql_query; if ( empty($_GET['row']) ) $_GET['row'] = ""; if ( empty($_GET['cat']) ) $_GET['cat'] = ""; $q_id = $nav->execute($sql_query, $_GET['row']); $tpl->newBlock("item_list"); $tpl->assign("i_category_list", $HTML->dm_item_categories_site("cat", $_GET['cat'])); $tpl->assign("i_cat_button", $HTML->button_submit("View")); $tpl->assign("item_alias", $S->val['item_alias']); $cond_ic_descr['ic_id'] = $_GET['cat']; $row_ic_descr = $DB->db_select("ps_item_categories", $cond_ic_descr); $tpl->assign("ic_title", $row_ic_descr['ic_title']); $tpl->assign("ic_description", $row_ic_descr['ic_description']); ## Breadcrum if ( empty($_GET['cat']) || $_GET['cat'] == '-1' ) { //$B->add($S->val['item_alias'], "", 1); } else { $Bcond['ic_id'] = $_GET['cat']; $Brow = $DB->db_select("ps_item_categories", $Bcond); $B->add($S->val['item_alias'], "item_list.php", 1); $B->add($Brow['ic_title'], "", 0); } $B->output(); $tpl->assign("breadcrum", $B->html); // Assign rss href: $tpl->assign("rss_item_href", $C->url . "/rss_feed_item.php"); if ( !empty($row_ic_descr['ic_image']) ) $tpl->assign("ic_image", "url_items_thumbs . "/" . $row_ic_descr['ic_image'] . "\" />"); while ( $row = $DB->sql_fetchrow($q_id) ) { if ( !$C->secure_on || !empty($_SESSION['wu_id']) || ($C->secure_on && empty($_SESSION['wu_id']) && $row['i_secure'] == 0) ) { $tpl->newBlock("item"); $tpl->assign("i_id", $row['i_id']); $tpl->assign("i_title", $row['i_title']); $tpl->assign("i_pub_date", date($S->val['date_format'], $row['i_u_date'])); $tpl->assign("i_description", $row['i_description']); $tpl->assign("i_field1", $row['i_field1']); $tpl->assign("i_field2", $row['i_field2']); $tpl->assign("i_field3", $row['i_field3']); $tpl->assign("i_field4", $row['i_field4']); $tpl->assign("i_field5", $row['i_field5']); if ( !empty($row['i_thumb']) ) { $tpl->newBlock("il_thumb"); $tpl->assign("i_id", $row['i_id']); $tpl->assign("i_thumb", $C->url_items_thumbs . "/" . $row['i_thumb']); $tpl->assign("i_field1", $row['i_field1']); $tpl->assign("i_field2", $row['i_field2']); $tpl->assign("i_field3", $row['i_field3']); $tpl->assign("i_field4", $row['i_field4']); $tpl->assign("i_field5", $row['i_field5']); } } } $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] . " "); } $tpl->assignGlobal("i_field_1_alias", $S->val['i_field_1_alias']); $tpl->assignGlobal("i_field_2_alias", $S->val['i_field_2_alias']); $tpl->assignGlobal("i_field_3_alias", $S->val['i_field_3_alias']); $tpl->assignGlobal("i_field_4_alias", $S->val['i_field_4_alias']); $tpl->assignGlobal("i_field_5_alias", $S->val['i_field_5_alias']); $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(); ?>