if ($_REQUEST['page'] != 'register') { header('Location: ' . _HTML_ROOT_PATH . "/?page=register"); } break; default: header('Location: ' . _HTML_ROOT_PATH . "/?page=login"); break; } } } if (isset($_REQUEST['csrfkey']) && $_REQUEST['csrfkey'] == CSRF_KEY) { switch ($_REQUEST['ajax_act']) { case 'get_rules_json': $arr_offers = get_rules_offers(); $condition_types = array('geo_country' => 'Страна', 'lang' => 'Язык', 'referer' => 'Реферер', 'city' => 'Город', 'region' => 'Регион', 'provider' => 'Провайдер', 'ip' => 'IP адрес', 'os' => 'ОС', 'platform' => 'Платформа', 'browser' => 'Браузер', 'agent' => 'User-agent', 'get' => 'GET'); $arr_rules = get_rules_list($arr_offers); $arr = array(); $i = 0; foreach ($arr_rules as $cur) { $arr['rules'][$i] = array('id' => $cur['id'], 'name' => $cur['name'], 'url' => tracklink() . "/{$cur['name']}/source/campaign-ads"); $arr_destinations = array(); $default_destination_id = ''; foreach ($cur['items'] as $cur_item_val) { if ($cur_item_val['inner'][0]['value'] != '') { $arr_destinations[$cur_item_val['inner'][0]['value']]++; } // Set default out for this link, separate section if ($cur_item_val['root']['type'] == 'geo_country' && $cur_item_val['root']['value'] == 'default') { $default_destination_id = $cur_item_val['inner'][0]['value']; continue; }
list($user_ntf_cnt, $user_ntf_unread_cnt, $user_ntf_arr) = user_notifications(-1, 0); $out = array('cnt' => $user_ntf_cnt + $global_ntf_cnt, 'unread_cnt' => $user_ntf_unread_cnt, 'unread_cnt_all' => $user_ntf_unread_cnt + $global_ntf_cnt); echo json_encode($out); exit; break; case 'get_rules_json': $arr_offers = get_rules_offers(); $limit = 50; $offset = rq('offset', 2); //dmp($arr_offers); $source = rq('source'); if (empty($source_config[$source])) { $source = 'source'; } $condition_types = array('geo_country' => 'Страна', 'lang' => 'Язык', 'referer' => 'Реферер', 'city' => 'Город', 'region' => 'Регион', 'provider' => 'Провайдер', 'ip' => 'IP адрес', 'os' => 'ОС', 'platform' => 'Платформа', 'browser' => 'Браузер', 'agent' => 'User-agent', 'get' => 'GET', 'device' => 'Устройство'); $rules_list = get_rules_list($arr_offers, $offset, $limit); $arr_rules = $rules_list['rules']; $total_rules = $rules_list['total']; $arr = array(); $i = 0; foreach ($arr_rules as $cur) { $lnk = tracklink() . "/{$cur['name']}/" . $source . "/campaign-ads/"; if ($source != 'source' and !empty($source_config[$source]['params'])) { $tmp = array(); foreach ($source_config[$source]['params'] as $param_name => $param_value) { if (empty($param_value['url']) or strstr($lnk, $param_value['url']) !== false) { continue; } $tmp[] = $param_name . '=' . $param_value['url']; } if (count($tmp) > 0) {