[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.bocommon.php, 1.1.1.10
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.bocommon.php, 1.1.1.10 |
Date: |
Sun, 23 May 2004 10:08:12 -0000 |
Update of /property
Modified Files:
Branch:
class.bocommon.php
date: 2004/04/28 21:15:15; author: sigurdne; state: Exp; lines: +129 -1
Log Message:
temp fix for get_var
=====================================================================
Index: property/class.bocommon.php
diff -u property/class.bocommon.php:1.1.1.9 property/class.bocommon.php:1.1.1.10
--- property/class.bocommon.php:1.1.1.9 Wed Apr 28 07:00:51 2004
+++ property/class.bocommon.php Wed Apr 28 21:15:15 2004
@@ -58,6 +58,7 @@
$this->currentapp = 'property';
//$GLOBALS['phpgw_data']['flags']['req_app'];
$this->socommon =
CreateObject($this->currentapp.'_socommon');
+ $this->functions =
CreateObject($this->currentapp.'_functions');
$this->join = $this->socommon->join;
$this->left_join = $this->socommon->left_join;
@@ -1558,6 +1559,133 @@
}
}
return date($format,$t);
+ }
+
+ function get_var2($variable,$method='any',$default_value='')
+ {
+ return
$this->reg_var($variable,$method,'any',$default_value,False);
+ }
+
+ function reg_var($varname, $method = 'any', $valuetype =
'alphanumeric',$default_value='',$register=True)
+ {
+ if($method == 'any')
+ {
+ $method =
Array('POST','GET','COOKIE','SERVER','GLOBAL','DEFAULT');
+ }
+ elseif(!is_array($method))
+ {
+ $method = Array($method);
+ }
+ $cnt = count($method);
+ for($i=0;$i<$cnt;$i++)
+ {
+ switch(strtoupper($method[$i]))
+ {
+ case 'DEFAULT':
+ if($default_value)
+ {
+ $value = $default_value;
+ $i = $cnt+1; /* Found
what we were looking for, now we end the loop */
+ }
+ break;
+ case 'GLOBAL':
+ if(@isset($GLOBALS[$varname]))
+ {
+ $value =
$GLOBALS[$varname];
+ $i = $cnt+1;
+ }
+ break;
+ case 'POST':
+ case 'GET':
+ case 'COOKIE':
+ case 'SERVER':
+ if(phpversion() >= '4.1.0')
+ {
+ $meth =
'_'.strtoupper($method[$i]);
+ }
+ else
+ {
+ $meth =
'HTTP_'.strtoupper($method[$i]).'_VARS';
+ }
+
if(@isset($GLOBALS[$meth][$varname]))
+ {
+ $value =
$GLOBALS[$meth][$varname];
+ $i = $cnt+1;
+ }
+ break;
+ default:
+
if(@isset($GLOBALS[strtoupper($method[$i])][$varname]))
+ {
+ $value =
$GLOBALS[strtoupper($method[$i])][$varname];
+ $i = $cnt+1;
+ }
+ break;
+ }
+ }
+
+ if (@!isset($value))
+ {
+ $value = $default_value;
+ }
+
+ if (@!is_array($value))
+ {
+ if ($value == '')
+ {
+ $result = $value;
+ }
+ else
+ {
+ if
($this->functions->sanitize($value,$valuetype) == 1)
+ {
+ $result = $value;
+ }
+ else
+ {
+ $result = $default_value;
+ }
+ }
+ }
+ else
+ {
+//html_print_r($value);
+ reset($value);
+ while(list($k, $v) = each($value))
+ {
+ if ($v == '')
+ {
+ $result[$k] = $v;
+ }
+ else
+ {
+ if (is_array($valuetype))
+ {
+ $vt = $valuetype[$k];
+ }
+ else
+ {
+ $vt = $valuetype;
+ }
+
+ if
($this->functions->sanitize($v,$vt) == 1)
+ {
+ $result[$k] = $v;
+ }
+ else
+ {
+ if
(is_array($default_value))
+ {
+ $result[$k] =
$default_value[$k];
+ }
+ else
+ {
+ $result[$k] =
$default_value;
+ }
+ }
+ }
+ }
+ }
+ return $result;
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.bocommon.php, 1.1.1.10,
nomail <=