function.url4_sex_kite.php
1.65 KB
1
2
3
4
5
6
7
8
9
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {math} function plugin
*
* Type: function<br>
* Name: math<br>
* Purpose: handle math computations in template<br>
* @link http://smarty.php.net/manual/en/language.function.math.php {math}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param array
* @param Smarty
* @return string
*/
function smarty_function_url4_sex_kite($params, &$smarty)
{
$str = (isset($_GET['sex']) && strlen($_GET['sex'])>0) ? $_GET['sex'] : '';
if(strlen($str)>0)$l = explode(';',$str);
else $l = array();
$f=0;
$params['n'] = str_replace(",", ".", $params['n']);
foreach($l as $key=>$q){
if($params['s']==$q){$f++;unset($l[$key]);}
}
if($f==0)if($params['s']!='unisex' && $params['s']!='child'){foreach($l as $key=>$q){if('unisex'==$q)unset($l[$key]);}$l[] = 'unisex';}
if($f==0)if($params['s']=='unisex'){foreach($l as $key=>$q){if('male'==$q or 'female'==$q)unset($l[$key]);}$l[] = 'male';$l[] = 'female';}
if($f==0)$l[] = $params['s'];
sort($l);
$h = array();
$param='';
//$param = (count($l)) ? ("sex=".implode(",",$l)) : null;
if(trim($_GET['search_str'])!='') $h[] = "search_str=".trim($_GET['search_str']);
if(trim($_GET['brend'])!='') $h[] = "brend=".trim($_REQUEST['brend']);
if(count($l))$h[] = ("sex=".implode(",",$l));
if(trim($_GET['what'])!='') $h[] = "what=".trim($_GET['what']);
if(trim($_GET['filter'])!='') $h[] = "filter=".trim($_REQUEST['filter']);
if(count($h)>0) $g = ";";
else $g = "";
return '/kite/index.php?rubID='.$_REQUEST['rubID']."&dataFilter=filter;" . implode(";",$h) . $g . $param."/";
}
/* vim: set expandtab: */
?>