\"\'\%\;\)\(\&\+\s]+/', $_GET['lang_id'])) { ## XSS defence redirect('index.php'); } ## old-style redirect, used on every page of store to change language and get back open_backend_session($lang_id = $_GET['lang_id']); reload_package(); redirect($_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : 'index.php'); break; case 'view_all_products': if (!is_array($_SESSION['domains'])) { unset($_SESSION['domain_package']); unset($_SESSION['check_domains_cache']); } $redirect_params = array(); if($_GET['type_id']) { $redirect_params[] = 'type_id='.preg_replace("/\D/", "", $_GET['type_id']); } if(array_key_exists('category_id', $_GET)) { $redirect_params[] = 'category_id='.preg_replace("/\D/", "", $_GET['category_id']); } unset($_SESSION['sb_node']); redirect('plans.php'.(count($redirect_params) ? '?' : '').implode('&', $redirect_params)); break; } } function _cancel_order() { unset($_SESSION['ps']); unset($_SESSION['package']); unset($_SESSION['package_period_id']); unset($_SESSION['addons']); unset($_SESSION['domains']); unset($_SESSION['ssl']); unset($_SESSION['check_domains_cache']); unset($_SESSION['promotions']); unset($_SESSION['configuration']); unset($_SESSION['contact_error']); unset($_SESSION['domain_contacts']); unset($_SESSION['sub_steps_order']); } function _stringify_period($period_num) { switch ($period_num) { case 1: return string(STR_MONTH); case 3: return string(STR_THREE_MONTHS); case 6: return string(STR_SIX_MONTHS); case 12: return string(STR_YEAR); } return $period_num . ' ' . string(STR_MONTHS); } function teaser_step() { _cancel_order(); if (!$_SESSION['provider_config']['store']['is_opened']) { $_SESSION['warning_message'] = string(STR_STORE_CLOSED); } else { $plans_to_show = get_sellable_plan_list( NULL, $_SESSION['campaign']['promotion']['promo_id'], NULL ##$_SESSION['account']['account_id'] to speed up plan loading ); load_domain_package(); if (!$_SESSION['domain_package'] && !(is_array($plans_to_show) && count($plans_to_show))) $_SESSION['warning_message'] = string(STR_STORE_CLOSED); } $plan_types = array(); foreach ($plans_to_show AS $type_id => $plans) { if(!PLAN_CATEGORY) { ## show plans by type if ($type_id != HP_TYPE_ONETIME_FEE_ITEM) { $name = $plans[0]['type']['name']; $subscr_fee_min = $plans[0]['fee_list'][0]['subscr_fee']['price']; $period_min = $plans[0]['fee_list'][0]['period'] / 2592000; foreach ($plans AS $plan) { foreach ($plan['fee_list'] AS $fee) { if ($fee['subscr_fee']['price'] < $subscr_fee_min) { $subscr_fee_min = $fee['subscr_fee']['price']; $period_min = $fee['period'] / 2592000; } } } $plan_types[] = array('type_id' => $type_id, 'name' => $name, 'subscr_fee_min' => $subscr_fee_min, 'period_min' => _stringify_period($period_min), 'categories' => array()); } } else if(strtolower(PLAN_CATEGORY) == 'both') { $name = $plans[0]['type']['name']; $categories = array(); $subscr_fee_min = null; $period_min = null; if ($type_id != HP_TYPE_ONETIME_FEE_ITEM) { $subscr_fee_min = $plans[0]['fee_list'][0]['subscr_fee']['price']; $period_min = $plans[0]['fee_list'][0]['period'] / 2592000; } foreach ($plans AS $plan) { $cat_subscr_fee_min = -1; $cat_period_min = -1; if ($type_id != HP_TYPE_ONETIME_FEE_ITEM) { foreach ($plan['fee_list'] AS $fee) { if ($fee['subscr_fee']['price'] < $subscr_fee_min) { $subscr_fee_min = $fee['subscr_fee']['price']; $period_min = $fee['period'] / 2592000; } if (is_array($plan['category']) && ($cat_subscr_fee_min == -1 || $fee['subscr_fee']['price'] < $cat_subscr_fee_min)) { $cat_subscr_fee_min = $fee['subscr_fee']['price']; $cat_period_min = $fee['period'] / 2592000; } } } if(is_array($plan['category'])) { if ($type_id != HP_TYPE_ONETIME_FEE_ITEM) { $plan['category']['cat_subscr_fee_min'] = $cat_subscr_fee_min; $plan['category']['cat_period_min'] = _stringify_period($cat_period_min); } if(!is_array($categories[$plan['category']['id']]) || $categories[$plan['category']['id']]['cat_subscr_fee_min'] > $plan['category']['cat_subscr_fee_min']) { $categories[$plan['category']['id']] = $plan['category']; } } } $plan_types[] = array('type_id' => $type_id, 'name' => $name, 'subscr_fee_min' => $subscr_fee_min, 'period_min' => _stringify_period($period_min), 'categories' => $categories); } else { ## show plans only by categories foreach ($plans AS $plan) { if(is_array($plan['category'])) { $cat_id = $plan['category']['id']; } else { $cat_id = 0; $name[0] = string(STR_OTHER_PRODUCTS); } if ($type_id != HP_TYPE_ONETIME_FEE_ITEM && !isset($subscr_fee_min[$cat_id])) { ## temporarily, have not clue about this for one time fee $subscr_fee_min[$cat_id] = $plan['fee_list'][0]['subscr_fee']['price']; $period_min[$cat_id] = $plan['fee_list'][0]['period'] / 2592000; } foreach ($plan['fee_list'] AS $fee) { if ($type_id != HP_TYPE_ONETIME_FEE_ITEM) { if ($fee['subscr_fee']['price'] < $subscr_fee_min[$cat_id]) { $subscr_fee_min[$cat_id] = $fee['subscr_fee']['price']; $period_min[$cat_id] = $fee['period'] / 2592000; } } if(is_array($plan['category'])) { $name[$cat_id] = $plan['category']['name']; } } } } } if(PLAN_CATEGORY == 1) { foreach ($name as $category_id => $name_value) { $plan_types[] = array('type_id' => $category_id, 'name' => $name_value, 'subscr_fee_min' => (isset($subscr_fee_min[$category_id]) ? $subscr_fee_min[$category_id] : null), 'period_min' => (isset($period_min[$category_id]) ? _stringify_period($period_min[$category_id]) : null), 'categories' => array()); } } get_domain_list(); if(!count($_SESSION['sub_steps_order'])) { $_SESSION['sub_steps_order'] = array(); } $step = 'index'; include('templates/general_home.inc'); } ?>