if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } if (!(basename($PHP_SELF) == FILENAME_LOGIN . ".php")) { $page = basename($PHP_SELF, ".php"); if ($page != FILENAME_DEFAULT && $page != FILENAME_PRODUCT && $page != FILENAME_LOGOFF && $page != FILENAME_ALT_NAV && $page != FILENAME_PASSWORD_FORGOTTEN && $page != 'denied') { if (check_page($page) == 'false') { header("location: denied.php"); } } if (!isset($_SESSION['admin_id'])) { if (!(basename($PHP_SELF) == FILENAME_PASSWORD_FORGOTTEN . '.php')) { zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL')); } } } // BOF - Admin Profile's Categories // If we're on the categories page and the category, which user want to see is not // allowed for him - redirect to main catrgory $cPath = $_GET['cPath']; $cid = zen_parse_category_path($cPath); $cid = end($cid); // echo '>>> '.$cid; if ($page == FILENAME_CATEGORIES && category_allowed($cid) == 'false' && $cPath != '0') { //header("location: denied.php"); zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=0')); } // EOF - Admin Profile's Categories if (basename($PHP_SELF) == FILENAME_LOGIN . '.php' and (substr_count(dirname($PHP_SELF), '//') > 0 or substr_count(dirname($PHP_SELF), '.php') > 0)) { zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL')); }
function zen_get_categories_products_list($categories_id, $include_deactivated = false, $include_child = true) { global $db; global $categories_products_id_list; if ($include_deactivated) { $products = $db->Execute("select p.products_id\n from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n where p.products_id = p2c.products_id\n and p2c.categories_id = '" . (int) $categories_id . "'"); } else { $products = $db->Execute("select p.products_id\n from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n where p.products_id = p2c.products_id\n and p.products_status = '1'\n and p2c.categories_id = '" . (int) $categories_id . "'"); } while (!$products->EOF) { // categories_products_id_list keeps resetting when category changes ... // echo 'Products ID: ' . $products->fields['products_id'] . '<br>'; if (category_allowed($products->fields['categories_id']) == 'true') { $categories_products_id_list[] = $products->fields['products_id']; } $products->MoveNext(); } if ($include_child && category_allowed(zen_get_products_category_id($products->fields['products_id'])) == 'true') { $childs = $db->Execute("select categories_id from " . TABLE_CATEGORIES . "\n where parent_id = '" . (int) $categories_id . "'"); if ($childs->RecordCount() > 0) { while (!$childs->EOF) { zen_get_categories_products_list($childs->fields['categories_id'], $include_deactivated); $childs->MoveNext(); } } } $products_id_listing = $categories_products_id_list; return $products_id_listing; }