- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
// expressions to parse
$input_pars = array(
's:2'=>'(sort(\d+)/?)?', //1-2
'id:2'=>'((\d+)/?)?', //3-4
'utkonos_id-shop_id:2-2'=>'(u(\d+)(s(\d+))?/)?', //5-6 7-8
'iid:1'=>'([0-9a-zA-Z_]+)/?', //9
'page:2'=>'(pg(\d+)/)?', //10-11
'chpsize:2'=>'(chp(\d+)/)?', //12-13
'chlist:2'=>'(chlist_(grid|list)/)?', //14-15
'p_other:1'=>'(.*)', //16
);
if(!$class)unset($input_pars['iid:1']);
$m = array();
$i=0;
if(isset($_REQUEST['p_'])&&preg_match('[^'.implode('',$input_pars).'$]',$_REQUEST['p_'],$m)) {
//vd($m);
foreach($input_pars as $key=>$line) {
list($par_name,$num) = explode(':', $key);
$par_name_arr = explode('-',$par_name);
$num_arr = explode('-',$num);
if(count($par_name_arr)>1) {
foreach($par_name_arr as $kluch => $par_name) {
$i += $num_arr[$kluch];
$_REQUEST[$par_name] = $m[$i];
}
}else{
$i += $num;
$_REQUEST[$par_name] = $m[$i];
}
}
$_REQUEST['id'] += 0;
if ($_REQUEST['s'] === '0') {
$_REQUEST['s'] = 0;
}
if ($_REQUEST['chpsize'] === '0') {
$_REQUEST['chpsize'] = 0;
}
vd($_REQUEST);
}else{
$_REQUEST['s'] = grv('s',-1); /// Сортировка
$_REQUEST['id'] = grv('id',0);
$_REQUEST['shop_id'] = grv('shop_id',0);
$_REQUEST['page'] = grv('page',0);
$_REQUEST['chpsize'] = (int)grv('chpsize',-1);
}
Lure Of Chaos 23.04.2012 22:55 # +1
медсестра пошла туда, куда ее послали?
JavaGovno 23.04.2012 23:01 # +1