phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property/class.acl2.php, 1.1.1.6


From: nomail
Subject: [Phpgroupware-cvs] property/class.acl2.php, 1.1.1.6
Date: Sun, 23 May 2004 06:17:28 -0000

Update of /property
Modified Files:
        Branch: 
          class.acl2.php

date: 2004/04/28 21:15:15;  author: sigurdne;  state: Exp;  lines: +3 -178

Log Message:
temp fix for get_var
=====================================================================
Index: property/class.acl2.php
diff -u property/class.acl2.php:1.1.1.5 property/class.acl2.php:1.1.1.6
--- property/class.acl2.php:1.1.1.5     Tue Apr 27 09:27:45 2004
+++ property/class.acl2.php     Wed Apr 28 21:15:15 2004
@@ -42,6 +42,8 @@
                        $this->account_id = $args['account_id'];
                        $this->host_id = $args['host_id'];
                        $this->app_id = 6;//$args['app_id'];
+                       $this->functions                = 
CreateObject($this->currentapp.'_functions');
+
                }
 
 
@@ -255,183 +257,6 @@
                }
 
 
-
-               function sanitize($string,$type)
-               {
-                       switch ($type)
-                       {
-                               case 'bool':
-                                       if ($string == 1 || $string == 0)
-                                       {
-                                               return True;
-                                       }
-                                       break;
-                               case 'isprint':
-                                       $length = strlen($string);
-                                       $position = 0;
-                                       while ($length > $position)
-                                       {
-                                               $char = substr($string, 
$position, 1);
-                                               if ($char < ' ' || $char > '~')
-                                               {
-                                                       return False;
-                                               }
-                                               $position = $position + 1;
-                                       }
-                                       return True;
-                                       break;
-                               case 'alpha':
-                                       if (preg_match("/^[a-z]+$/i", $string))
-                                       {
-                                               return True;
-                                       }
-                                       break;
-                               case 'number':
-                                       if (preg_match("/^[0-9]+$/i", $string))
-                                       {
-                                               return True;
-                                       }
-                                       break;
-                               case 'alphanumeric':
-                                       if (preg_match("/^[a-z0-9 -._]+$/i", 
$string))
-                                       {
-                                               return True;
-                                       }
-                                       break;
-                               case 'string':
-                                       if (preg_match("/^[a-z]+$/i", $string))
-                                       {
-                                               return True;
-                                       }
-                                       break;
-                               case 'ip':
-                                       if 
(eregi("^[0-9]{1,3}(\.[0-9]{1,3}){3}$",$string))
-                                       {
-                                               $octets = split('\.',$string);
-                                               for ($i=0; $i != 
count($octets); $i++)
-                                               {
-                                                       if ($octets[$i] < 0 || 
$octets[$i] > 255)
-                                                       {
-                                                               return False;
-                                                       }
-                                               }
-                                               return True;
-                                       }
-                                       return False;
-                                       break;
-                               case 'file':
-                                       if 
(preg_match("/^[a-z0-9_]+\.+[a-z]+$/i", $string))
-                                       {
-                                               return True;
-                                       }
-                                       break;
-                               case 'email':
-                                       if 
(eregi("^([[:alnum:]_%+=.-]+)@([[:alnum:]_.-]+)\.([a-z]{2,3}|[0-9]{1,3})$",$string))
-                                       {
-                                               return True;
-                                       }
-                                       break;
-                               case 'password':
-                                       $password_length = strlen($string);
-                                       $password_numbers = 
Array('0','1','2','3','4','5','6','7','8','9');
-                                       $password_special_chars = Array(' 
','~','`','!','@','#','$','%','^','&','*','(',')','_','+','-','=','{','}','|','[',']',"\\",':','"',';',"'",'<','>','?',',','.','/');
-
-                                       
if(@isset($GLOBALS['phpgw_info']['server']['pass_min_length']) && 
is_int($GLOBALS['phpgw_info']['server']['pass_min_length']) && 
$GLOBALS['phpgw_info']['server']['pass_min_length'] > 1)
-                                       {
-                                               $min_length = 
$GLOBALS['phpgw_info']['server']['pass_min_length'];
-                                       }
-                                       else
-                                       {
-                                               $min_length = 1;
-                                       }
-
-                                       
if(@isset($GLOBALS['phpgw_info']['server']['pass_require_non_alpha']) && 
$GLOBALS['phpgw_info']['server']['pass_require_non_alpha'] == True)
-                                       {
-                                               $pass_verify_non_alpha = False;
-                                       }
-                                       else
-                                       {
-                                               $pass_verify_non_alpha = True;
-                                       }
-
-                                       
if(@isset($GLOBALS['phpgw_info']['server']['pass_require_numbers']) && 
$GLOBALS['phpgw_info']['server']['pass_require_numbers'] == True)
-                                       {
-                                               $pass_verify_num = False;
-                                       }
-                                       else
-                                       {
-                                               $pass_verify_num = True;
-                                       }
-
-                                       
if(@isset($GLOBALS['phpgw_info']['server']['pass_require_special_char']) && 
$GLOBALS['phpgw_info']['server']['pass_require_special_char'] == True)
-                                       {
-                                               $pass_verify_special_char = 
False;
-                                       }
-                                       else
-                                       {
-                                               $pass_verify_special_char = 
True;
-                                       }
-
-                                       if ($password_length >= $min_length)
-                                       {
-                                               for ($i=0; $i != 
$password_length; $i++)
-                                               {
-                                                       $cur_test_string = 
substr($string, $i, 1);
-                                                       if 
(in_array($cur_test_string, $password_numbers) || in_array($cur_test_string, 
$password_special_chars))
-                                                       {
-                                                               
$pass_verify_non_alpha = True;
-                                                               if 
(in_array($cur_test_string, $password_numbers))
-                                                               {
-                                                                       
$pass_verify_num = True;
-                                                               }
-                                                               elseif 
(in_array($cur_test_string, $password_special_chars))
-                                                               {
-                                                                       
$pass_verify_special_char = True;
-                                                               }
-                                                       }
-                                               }
-
-                                               if ($pass_verify_num == False)
-                                               {
-                                                       
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Password requires at least one 
non-alpha character']=False;
-                                               }
-
-                                               if ($pass_verify_num == False)
-                                               {
-                                                       
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Password requires at least one 
numeric character']=False;
-                                               }
-
-                                               if ($pass_verify_special_char 
== False)
-                                               {
-                                                       
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Password requires at least one 
special character (non-letter and non-number)']=False;
-                                               }
-
-                                               if ($pass_verify_num == True && 
$pass_verify_special_char == True)
-                                               {
-                                                       return True;
-                                               }
-                                               return False;
-                                       }
-                                       
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Password must be at least 
'.$min_length.' characters']=False;
-                                       return False;
-                                       break;
-                               case 'any':
-                                       return True;
-                                       break;
-                               default :
-                                       if 
(isset($GLOBALS['phpgw_info']['server']['sanitize_types'][$type]['type']))
-                                       {
-                                               if 
($GLOBALS['phpgw_info']['server']['sanitize_types'][$type]['type']($GLOBALS['phpgw_info']['server']['sanitize_types'][$type]['string'],
 $string))
-                                               {
-                                                       return True;
-                                               }
-                                       }
-                                       return False;
-                       }
-               }
-
-
-
                function safe_args($expected, $recieved, $line='??', $file='??')
                {
 //html_print_r($expected);
@@ -466,7 +291,7 @@
                                        {
                                                if(isset($recieved[$i]) && 
$recieved[$i] !== '##DEFAULT##')
                                                {
-                                                       
if($this->sanitize($recieved[$i],$expected[$i]['type']))
+                                                       
if($this->functions->sanitize($recieved[$i],$expected[$i]['type']))
                                                        {
                                                                
$args[$expected[$i]['name']] = $recieved[$i];
                                                                
unset($required[$expected[$i]['name']]);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]