count_rows('categories', "WHERE category_id='" . $parent_id . "'"); $parent_id = ($is_category) ? $parent_id : 0; $_REQUEST['parent_id'] = $parent_id; $user_id = intval($_REQUEST['user_id']); $protected_page = protected_page(0, $parent_id); if ($protected_page['private_category'] && !category_logged_in($parent_id)) { header_redirect('protected_page.php?redirect_url=categories&category_id=' . $parent_id); } else { include_once ('global_header.php'); $template->set('parent_id', $parent_id); define('IS_CATEGORIES', 1); $main_category_id = $db->main_category($parent_id); $category_details = $db->get_sql_row("SELECT image_path, minimum_age FROM " . DB_PREFIX . "categories WHERE category_id='" . $main_category_id . "'"); $category_logo = $category_details['image_path']; $category_logo = (!empty($category_logo)) ? '' : ''; $template->set('category_logo', $category_logo); $categories_header_menu = category_navigator($parent_id, true, true, 'categories.php'); $template->set('categories_header_menu', $categories_header_menu); if ($_REQUEST['option'] == 'agree_adult') { $session->set('adult_category', 1); } if ($category_details['minimum_age'] > 0 && !$session->value('adult_category')) { $template->set('minimum_age', $category_details['minimum_age']); $template_output .= $template->process('adult_category_warning.tpl.php'); } else { $is_subcategories = $db->count_rows('categories', "WHERE parent_id='" . $parent_id . "'"); $template->set('is_subcategories', $is_subcategories); $sql_select_categories = $db->query("SELECT category_id, name, items_counter FROM " . DB_PREFIX . "categories WHERE parent_id='" . $parent_id . "' AND user_id=0 ORDER BY order_id ASC, name ASC"); while ($cat_details = $db->fetch_array($sql_select_categories)) { $background = ($counter++%2) ? 'c1' : 'c2'; $main_lang = unserialize($cat_details['name']); $subcat_link = process_link('categories', array('category' => $main_lang[$setts['site_lang']], 'parent_id' => $cat_details['category_id'])); $category_link = process_link('categories', array('category' => $main_lang[$setts['site_lang']], 'parent_id' => $cat_details['category_id'])); $subcategories_content .= ' '. '  » ' . $db->add_special_chars($main_lang[$setts['site_lang']]) . ' '. (($setts['enable_cat_counters']) ? (($cat_details['items_counter']) ? '(' . $cat_details['items_counter'] . ')' : '') : '') . ' '. ' '; } $template->set('subcategories_content', $subcategories_content); if ($parent_id) { $where_query = " WHERE a.active=1 AND a.approved=1 AND a.closed=0 AND a.deleted=0 AND a.list_in!='auction' AND a.owner_id=us.user_id AND us.active='1' AND us.shop_active='1' AND us.shop_name!=''"; $where_query = browse_filter_query($src_details, $where_query); $sql_select_stores = $db->query("SELECT us.user_id, us.shop_name FROM " . DB_PREFIX . "users us, " . DB_PREFIX . "auctions a " . $where_query . " GROUP BY us.user_id"); $is_shop_stores = $db->num_rows($sql_select_stores); $template->set('is_shop_stores', $is_shop_stores); if ($is_shop_stores) { (string) $shop_stores_content = null; while ($store_details = $db->fetch_array($sql_select_stores)) { $background = ($counter++%2) ? 'c1' : 'c2'; $shop_stores_content .= ' '. '  » ' . $store_details['shop_name'] . ' '. ' '; } $template->set('shop_stores_content', $shop_stores_content); } } $categories_header .= $template->process('categories_header.tpl.php'); $categories_footer = $template->process('categories_footer.tpl.php'); /** * below we have the variables that need to be declared in each separate browse page */ $page_url = 'categories'; $where_query = " WHERE a.active=1 AND a.approved=1 AND a.deleted=0 AND a.creation_in_progress=0"; $order_field = (in_array($_REQUEST['order_field'], $auction_ordering)) ? $_REQUEST['order_field'] : 'a.end_time'; $order_type = (in_array($_REQUEST['order_type'], $order_types)) ? $_REQUEST['order_type'] : 'ASC'; $additional_vars = '&parent_id=' . $parent_id . '&category=' . $current_category . '&keywords_cat_search=' . $_REQUEST['keywords_cat_search'] . '&buyout_price=' . $_REQUEST['buyout_price'] . '&reserve_price=' . $_REQUEST['reserve_price'] . '&quantity=' . $_REQUEST['quantity'] . '&enable_swap=' . $_REQUEST['enable_swap']; $template->set('categories_header', $categories_header); $template->set('categories_footer', $categories_footer); include_once('includes/page_browse_auctions.php'); } include_once ('global_footer.php'); echo $template_output; } ?>