Code

Updated in
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jul 2011 07:41:10 +0000 (07:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jul 2011 07:41:10 +0000 (07:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@20957 594d385d-05f5-0310-b6e9-bd551577e9d8

29 files changed:
gosa-core/include/class_CopyPasteHandler.inc
gosa-core/include/class_config.inc
gosa-core/include/class_filter.inc
gosa-core/include/class_gosaSupportDaemon.inc
gosa-core/include/class_ldap.inc
gosa-core/include/class_listing.inc
gosa-core/include/class_log.inc
gosa-core/include/class_management.inc
gosa-core/include/class_msg_dialog.inc
gosa-core/include/class_multi_plug.inc
gosa-core/include/class_plugin.inc
gosa-core/include/class_sortableListing.inc
gosa-core/include/class_tabs.inc
gosa-core/include/exporter/class_pdfExporter.inc
gosa-core/include/functions.inc
gosa-core/include/utils/class_tests.inc
gosa-core/include/utils/class_xml.inc
gosa-core/plugins/admin/departments/class_department.inc
gosa-core/plugins/admin/groups/class_group.inc
gosa-core/plugins/admin/ogroups/class_ogroup.inc
gosa-core/plugins/admin/ogroups/objectSelect/class_objectSelect.inc
gosa-core/plugins/admin/ogroups/tabs_ogroups.inc
gosa-core/plugins/admin/users/class_userManagement.inc
gosa-core/plugins/generic/references/class_reference.inc
gosa-core/plugins/personal/generic/class_user.inc
gosa-core/plugins/personal/posix/class_posixAccount.inc
gosa-core/plugins/personal/posix/groupSelect/class_filterLDAPBlacklist.inc
gosa-core/setup/class_setupStep_Ldap.inc
gosa-core/setup/class_setupStep_Migrate.inc

index db0a5df52679753bf75c8adcd1629c042e85ae56..30bfe2b709453409d0d447b796b6bb341780baf1 100644 (file)
@@ -73,7 +73,7 @@ class CopyPasteHandler {
       return(FALSE);
     }
 
-    if(!in_array($action,array("cut","copy"))){
+    if(!in_array_strict($action,array("cut","copy"))){
       trigger_error(sprintf("Specified action '%s' does not exists for copy & paste.",$action));
       return(FALSE);
     } 
index dd922df9649b76bde51fab9c5bec92e232ce33ec..70ef9fa5cacb9c027d12e8936caabb2be8f19bd3 100644 (file)
@@ -738,7 +738,7 @@ class config  {
       /* Detect department type */
       $type_data = array();
       foreach($types as $t => $data){
-        if(in_array($data['OC'],$attrs['objectClass'])){
+        if(in_array_strict($data['OC'],$attrs['objectClass'])){
           $type_data = $data;
           break;
         }
index 76c794911643ede8025ad024d02e2ab0ce648a87..2303a410bd030524f6c6762abeff2302d2ca086a 100644 (file)
@@ -393,7 +393,7 @@ class filter {
       $attributes= $query['attribute'];
 
       // ObjectClass is required to check permissions later.
-      if(!in_array('objectClass', $attributes)) $attributes[] = 'objectClass';
+      if(!in_array_strict('objectClass', $attributes)) $attributes[] = 'objectClass';
 
       // Generate final filter
       foreach ($this->elements as $tag => $element) {
@@ -494,7 +494,7 @@ class filter {
     }
 
     // ObjectClass is required to check permissions later.
-    if(!in_array('objectClass', $attributes)) $attributes[] = 'objectClass';
+    if(!in_array_strict('objectClass', $attributes)) $attributes[] = 'objectClass';
 
     // Make filter
     $filter= preg_replace("/\\$$tag/", normalizeLdap($value), $filter);
index 3a7d09ce4365793cfab00b120f92e54893d34566..d31996fbb0a07a22be5c139f8cdeaf986ada64c0 100644 (file)
@@ -177,7 +177,7 @@ class gosaSupportDaemon
     $line = __LINE__;
     $class = __CLASS__;
     foreach($debug as $info){
-      if(!in_array($info['function'],array("send_data","_send","set_error","connect"))){
+      if(!in_array_strict($info['function'],array("send_data","_send","set_error","connect"))){
         $file = $info['file'];
         $line = $info['line'];
         $class = get_class($this);
@@ -1039,7 +1039,7 @@ class gosaSupportDaemon
     $line = __LINE__;
     $class = __CLASS__;
     foreach($debug as $info){
-      if(!in_array($info['function'],array("send_data","_send"))){
+      if(!in_array_strict($info['function'],array("send_data","_send"))){
         $file = $info['file'];
         $line = $info['line'];
         $class = get_class($this);
index 2227e664e613cdd5b3985de69691093f8a666fa1..a73a1eeb304d113597a9d4271b24f734a4d7f5d1 100644 (file)
@@ -673,7 +673,7 @@ class LDAP{
           /* Get name of first matching objectClass */
           $ocname= "";
           foreach($classes as $class){
-            if (isset($class['MUST']) && in_array($type, $class['MUST'])){
+            if (isset($class['MUST']) && in_array_strict($type, $class['MUST'])){
 
               /* Look for first classes that is structural... */
               if (isset($class['STRUCTURAL'])){
@@ -878,7 +878,7 @@ class LDAP{
 
       // Check scope values
       $scope = trim($scope);
-      if(!empty($scope) && !in_array($scope, array('base', 'one', 'sub', 'children'))){
+      if(!empty($scope) && !in_array_strict($scope, array('base', 'one', 'sub', 'children'))){
           trigger_error(sprintf("Invalid parameter for scope '%s', please use 'base', 'one', 'sub' or 'children'."), $scope);
           return(NULL);
       }
@@ -1194,7 +1194,7 @@ class LDAP{
           $attrs = $this->fetch($srp);
           foreach($attrs as $name => $value ){
             if(!is_numeric($name)){
-              if(in_array($name,array("dn","count"))) continue;
+              if(in_array_strict($name,array("dn","count"))) continue;
               if(!isset($data[$name])){
                 $data[$name] = array();
               }
@@ -1296,7 +1296,7 @@ class LDAP{
 
           case ')': if ($name != ""){
                       $v = $this->value2container($value);
-                      if(in_array($name, array('MUST', 'MAY')) && !is_array($v)){
+                      if(in_array_strict($name, array('MUST', 'MAY')) && !is_array($v)){
                         $v = array($v);
                       }
                       $objectclasses[$ocname][$name]= $v;
@@ -1315,7 +1315,7 @@ class LDAP{
           case 'MAY':
                     if ($name != ""){
                       $v = $this->value2container($value);
-                      if(in_array($name, array('MUST', 'MAY')) && !is_array($v)){
+                      if(in_array_strict($name, array('MUST', 'MAY')) && !is_array($v)){
                         $v = array($v);
                       }
                       $objectclasses[$ocname][$name]= $v;
index f49960ad0775760071ec5bc0fd3488f9c471dbf4..723647ca29dddf9ccbe79633fd3ad60555c3937f 100644 (file)
@@ -792,11 +792,11 @@ class listing {
       foreach ($ocs as $oc){
         if (preg_match('/^!(.*)$/', $oc, $match)) {
           $oc= $match[1];
-          if (in_array($oc, $classes)) {
+          if (in_array_strict($oc, $classes)) {
             $found= false;
           }
         } else {
-          if (!in_array($oc, $classes)) {
+          if (!in_array_strict($oc, $classes)) {
             $found= false;
           }
         }
@@ -871,12 +871,12 @@ class listing {
         $objectclass= $action['objectclass'];
         if (preg_match('/^!(.*)$/', $objectclass, $m)){
           $objectclass= $m[1];
-          if(in_array($objectclass, $classes)) {
+          if(in_array_strict($objectclass, $classes)) {
             $result.= "<img src='images/empty.png' alt=' ' class='center' style='padding:1px'>";
             continue;
           }
         } elseif (is_string($objectclass)) {
-          if(!in_array($objectclass, $classes)) {
+          if(!in_array_strict($objectclass, $classes)) {
             $result.= "<img src='images/empty.png' alt=' ' class='center' style='padding:1px'>";
             continue;
           }
@@ -1330,14 +1330,14 @@ class listing {
 
     // Analyze list of departments
     foreach ($res as $department) {
-      if (!in_array($department['dn'], $validDepartments)) {
+      if (!in_array_strict($department['dn'], $validDepartments)) {
         continue;
       }
 
       // Add the attribute where we use for sorting
       $oc= null;
       foreach(array_keys($types) as $type) {
-        if (in_array($type, $department['objectClass'])) {
+        if (in_array_strict($type, $department['objectClass'])) {
           $oc= $type;
           break;
         }
index ebaeff5a611b0eaf079a05c1f0ed3c178a1336aa..5ec94448e6583682063918a4763dcc79984f53a1 100644 (file)
@@ -98,7 +98,7 @@ class log {
   {
     $msgs = array();
 
-    if(!isset($entry['action']) || !in_array($entry['action'],array("modify","create","remove","copy","snapshot","view","security","debug"))){
+    if(!isset($entry['action']) || !in_array_strict($entry['action'],array("modify","create","remove","copy","snapshot","view","security","debug"))){
       $msgs[] = sprintf(_("Invalid option '%s' specified!"), $entry['action']);
     }
 
index b2681dab074be94864f9e39ee2278ac5f71fadc9..8c2f6ab1be227073383dace92741e4ce3f6672ea 100644 (file)
@@ -886,7 +886,7 @@ class management
    */
   function handle_post_events($mode, $addAttrs= array())
   {
-      if(!in_array($mode, array('add','remove','modify'))){
+      if(!in_array_strict($mode, array('add','remove','modify'))){
           trigger_error(sprintf("Invalid post event type given %s! Valid types are [add,modify,remove].", $mode));
           return;
       }
index 6cd25e6d6f4c0bbe45ab5f8e05ac57ed63d30bd4..e13389a0399359300a6ab3b1697be670acb1982b 100644 (file)
@@ -41,7 +41,7 @@ class msg_dialog
 
                if(empty($s_message)) return;
        
-               if(!in_array($i_type,array(INFO_DIALOG,WARNING_DIALOG,ERROR_DIALOG,CONFIRM_DIALOG,FATAL_ERROR_DIALOG,OK_CANCEL_DIALOG))){
+               if(!in_array_strict($i_type,array(INFO_DIALOG,WARNING_DIALOG,ERROR_DIALOG,CONFIRM_DIALOG,FATAL_ERROR_DIALOG,OK_CANCEL_DIALOG))){
                        trigger_error("Invalid msg_dialog type.");
                        $i_type = INFO_DIALOG;
                }
index af39e67d72956abc368808cdf6179ba01236735d..46fa9c5629e41a4205c2511880ada978836358fb 100644 (file)
@@ -213,7 +213,7 @@ class multi_plug
             $add[$key]['count'] = count($add[$key]);
           }
           for($i=0;$i<$add[$key]['count'];$i++){
-            if(!in_array($add[$key][$i],$base[$key])){
+            if(!in_array_strict($add[$key][$i],$base[$key])){
               $base[$key][] = $add[$key][$i];
               $base[$key]['count']++;
             }
@@ -245,7 +245,7 @@ class multi_plug
             $base[$key]['count'] = count($base[$key]);
           }
         for($i = 0 ; $i < $base[$key]['count'] ; $i ++){
-          if(isset($base[$key][$i]) && in_array($base[$key][$i],$minus[$key])){
+          if(isset($base[$key][$i]) && in_array_strict($base[$key][$i],$minus[$key])){
             $tmp[] = $base[$key][$i];
           }
         }
index 42e2a4422d4e681d823eac55fb15557aa98c0126..1b172526472dd21cdccbc4a237033de61317dfba 100644 (file)
@@ -544,7 +544,7 @@ class plugin
     foreach ($this->attributes as $val){
 
       /* Skip the ones in skip list */
-      if (in_array($val, $skip)){
+      if (in_array_strict($val, $skip)){
         continue;
       }
 
@@ -1057,7 +1057,7 @@ class plugin
     // Update 'manager' attributes from gosaDepartment and inetOrgPerson 
     $filter = "(&(objectClass=inetOrgPerson)(manager=".LDAP::prepare4filter(LDAP::fix($src_dn))."))";
     $ocs = $ldap->get_objectclasses();
-    if(isset($ocs['gosaDepartment']['MAY']) && in_array('manager', $ocs['gosaDepartment']['MAY'])){
+    if(isset($ocs['gosaDepartment']['MAY']) && in_array_strict('manager', $ocs['gosaDepartment']['MAY'])){
       $filter = "(|".$filter."(&(objectClass=gosaDepartment)(manager=".LDAP::prepare4filter(LDAP::fix($src_dn)).")))";
     }
     $leaf_deps=  get_list($filter,array("all"),$this->config->current['BASE'], 
@@ -1158,7 +1158,7 @@ class plugin
    */
   function handle_post_events($mode, $addAttrs= array())
   {
-    if(!in_array($mode, array('add','remove','modify'))){
+    if(!in_array_strict($mode, array('add','remove','modify'))){
       trigger_error(sprintf("Invalid post event type given %s! Valid types are [add,modify,remove].", $mode));
       return;
     }
@@ -1183,7 +1183,7 @@ class plugin
    */
   function handle_pre_events($mode, $addAttrs= array())
   {
-    if(!in_array($mode, array('add','remove','modify'))){
+    if(!in_array_strict($mode, array('add','remove','modify'))){
       trigger_error(sprintf("Invalid pre event type given %s! Valid types are [add,modify,remove].", $mode));
       return;
     }
@@ -1299,7 +1299,7 @@ class plugin
     if(count($this->objectclasses)){
       $this->is_account = TRUE;
       foreach($this->objectclasses as $class){
-        if(!in_array($class,$source['objectClass'])){
+        if(!in_array_strict($class,$source['objectClass'])){
           $this->is_account = FALSE;
         }
       }
@@ -2038,7 +2038,7 @@ class plugin
   {
     $ret = array();
     foreach($this->attributes as $attr){
-      if(in_array($attr,$this->multi_boxes)){
+      if(in_array_strict($attr,$this->multi_boxes)){
         $ret[$attr] = $this->$attr;
       }
     }
index 8269c9da95f048181c903be7de7c11d2e3d73a60..8cd22382134b4762f62c0494e312b6c035e896ee 100644 (file)
@@ -68,7 +68,7 @@ class sortableListing {
 
     // Generate instance wide unique ID
     $id = "";
-    while($id == "" || in_array($id, $usedIds)){
+    while($id == "" || in_array_strict($id, $usedIds)){
 
         // Wait 1 msec to ensure that we definately get a new id
         if($id != "") usleep(1);
@@ -538,7 +538,7 @@ class sortableListing {
   {
     // Only add if not already there
     if (!$key) {
-      if (in_array($entry, $this->data)) {
+      if (in_array_strict($entry, $this->data)) {
         return;
       }
     } else {
index e1a2954bb3d3b6d8162382a976bd2b8553a68c7b..9ef40efb4d4783758f99721281dbc17c685e4cd7 100644 (file)
@@ -96,7 +96,7 @@ class tabs
     $baseobject= NULL;
     foreach($this->by_object as $name => $object){
       $class = get_class($object);
-      if(in_array($class,array("reference","acl"))) continue;
+      if(in_array_strict($class,array("reference","acl"))) continue;
       if ($baseobject === NULL){
         $baseobject= new $class($this->config, $this->dn);
         $baseobject->enable_CSN_check();
index d1c836e79e0296e0db033ac865126d856744bd59..35e8325aa5f15d9b3e56c0e3e5749e939175d221 100644 (file)
@@ -4,7 +4,7 @@
 
 // Load supporter class only if FPDF is loaded
 $classes= get_declared_classes();
-if(in_array('FPDF', $classes)) {
+if(in_array_strict('FPDF', $classes)) {
   include('class_PDF.inc');
 }
 
@@ -141,7 +141,7 @@ class pdfExporter
   {
     // Check if class defined
     $classes= get_declared_classes();
-    if(in_array('FPDF', $classes)) {
+    if(in_array_strict('FPDF', $classes)) {
       return array("exportPDF" => array( "label" => _("PDF"), "image" => "images/lists/pdf.png", "class"=> "pdfExporter", "mime" => "application/pdf", "filename" => "export.pdf" ));
     } else {
       return null;
index 3b98e099ac921a58ae7311a2abd470f55811174a..608aa4d5fdd2244c84d00dbe1ec0d79adbf98a0f 100644 (file)
@@ -579,7 +579,7 @@ function ldap_login_user ($username, $password)
   if($config->get_cfg_value("loginAttribute") != ""){
     $tmp = explode(",", $config->get_cfg_value("loginAttribute")); 
     foreach($tmp as $attr){
-      if(in_array($attr,$allowed_attributes)){
+      if(in_array_strict($attr,$allowed_attributes)){
         $verify_attr[] = $attr;
       }
     }
@@ -3551,7 +3551,7 @@ function get_next_id_traditional($attrib, $dn)
     $base= get_base_from_hook($dn, $attrib);
   }
   for ($id= $base; $id++; $id < $hwm){
-    if (!in_array($id, $ids)){
+    if (!in_array_strict($id, $ids)){
       return ($id);
     }
   }
@@ -3577,5 +3577,12 @@ function mark($needle, $haystack, $ignorecase= true)
   return $result.$haystack;
 }
 
+/*\brief    Our own in_array method which defaults to a strict mode.
+ */
+function in_array_strict($needle, $haystack, $strict = TRUE)
+{
+    return(in_array($needle, $haystack, $strict));
+}
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 02ba9bc31a07cc574366458ca6c03a71632bcc27..13f3e558573e1dc9f2264e57bbd9c5b383ebe609 100644 (file)
@@ -154,7 +154,7 @@ class tests {
                           "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/","",$ip);
 
                   $mask = preg_replace("/^\//","",$mask);
-                  if((in_array("$mask",$res)) && preg_match("/^[0-9\.]/",$mask)){
+                  if((in_array_strict("$mask",$res)) && preg_match("/^[0-9\.]/",$mask)){
                           return(TRUE);
                   }
           }
index 5824e805a3c9ddc81216333db61840310d70f23f..95c0174442d13a75ad2e4eaf924309065f313574 100644 (file)
@@ -109,7 +109,7 @@ class xml {
         //See tag status and do the needed.
         if($type == "open") {//The starting of the tag '<tag>'
             $parent[$level-1] = &$current;
-            if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag
+            if(!is_array($current) or (!in_array_strict($tag, array_keys($current)))) { //Insert New tag
                 $current[$tag] = $result;
                 if($attributes_data) $current[$tag. '_attr'] = $attributes_data;
                 $repeated_tag_index[$tag.'_'.$level] = 1;
index 8407f2f74c51bb006417ce182abff9dec7a8b7da..52a9a913615bf45d5383c5a7ed403b828990d57e 100644 (file)
@@ -130,7 +130,7 @@ class department extends plugin
     // If the 'manager' attribute is present in gosaDepartment allow to manage it.
     $ldap = $this->config->get_ldap_link();
     $ocs = $ldap->get_objectclasses();
-    if(isset($ocs['gosaDepartment']['MAY']) && in_array('manager', $ocs['gosaDepartment']['MAY'])){
+    if(isset($ocs['gosaDepartment']['MAY']) && in_array_strict('manager', $ocs['gosaDepartment']['MAY'])){
       $this->manager_enabled = TRUE;
 
       // Detect the managers name
index 90405849df414c314b7714b497d4ee360b7dd1b5..45658dd418130d36035769c57f35190bac97eceb 100644 (file)
@@ -127,7 +127,7 @@ class group extends plugin
     }
 
     /* Set mail flag */
-    if (isset($this->attrs['objectClass']) && in_array('gosaMailAccount', $this->attrs['objectClass'])){
+    if (isset($this->attrs['objectClass']) && in_array_strict('gosaMailAccount', $this->attrs['objectClass'])){
       $this->has_mailAccount= TRUE;
     }
 
@@ -499,14 +499,14 @@ class group extends plugin
     $smarty->assign("memberUid_Some",$this->memberUid_used_by_some);
 
     foreach($this->attributes as $val){
-      if(in_array($val,$this->multi_boxes)){
+      if(in_array_strict($val,$this->multi_boxes)){
         $smarty->assign("use_".$val,TRUE);
       }else{
         $smarty->assign("use_".$val,FALSE);
       }
     }
     foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group","nagios_group","trustmode") as $val){
-      if(in_array($val,$this->multi_boxes)){
+      if(in_array_strict($val,$this->multi_boxes)){
         $smarty->assign("use_".$val,TRUE);
       }else{
         $smarty->assign("use_".$val,FALSE);
@@ -650,7 +650,7 @@ class group extends plugin
 
     /* Fetch all users and skip already used users */
     foreach($res as $attrs){
-      if(in_array($attrs['uid'][0], $this->memberUid)) {
+      if(in_array_strict($attrs['uid'][0], $this->memberUid)) {
         continue;
       }
       $i ++;
@@ -1276,12 +1276,12 @@ class group extends plugin
     $ret = plugin::get_multi_edit_values();
 
     foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group","nagios_group") as $attr){    
-      if(in_array($attr,$this->multi_boxes)){
+      if(in_array_strict($attr,$this->multi_boxes)){
         $ret[$attr] = $this->$attr;
       }
     }
 
-    if(in_array("trustmode",$this->multi_boxes)){
+    if(in_array_strict("trustmode",$this->multi_boxes)){
       $ret['trustModel'] = $this->trustModel;
       $ret['accessTo'] = $this->accessTo;
     }
@@ -1314,7 +1314,7 @@ class group extends plugin
 
     if (isset($all['memberUid'])){
       for ($i= 0; $i<$all['memberUid']['count']; $i++){
-        if(!in_array($all['memberUid'][$i],$this->memberUid)){
+        if(!in_array_strict($all['memberUid'][$i],$this->memberUid)){
           $this->memberUid_used_by_some[$all['memberUid'][$i]]= $all['memberUid'][$i];
         }
       }
@@ -1369,7 +1369,7 @@ class group extends plugin
 
 
     // Detect samba groups and adapt its values.
-    $this->smbgroup = in_array('sambaGroupMapping', $source['objectClass']);
+    $this->smbgroup = in_array_strict('sambaGroupMapping', $source['objectClass']);
     if ($this->smbgroup) { 
       $this->sambaSID = $this->getSambaSID(); 
     } 
@@ -1396,7 +1396,7 @@ class group extends plugin
 
     /* Update groupMembership, keep optinal group */
     foreach($attrs['memberUid_used_by_some'] as $uid){
-      if(in_array($uid,$this->memberUid)){
+      if(in_array_strict($uid,$this->memberUid)){
         $users[$uid] = $uid;
       }
     }
index 54fa03b4c4bb26a5fadacff3c350cb37aecfc44b..24deb4586146fbcf406526e749976b1d136a2652 100644 (file)
@@ -558,7 +558,7 @@ class ogroup extends plugin
           /* Skip workstations which are already assigned to an object group.
            */
           if ($this->gosaGroupObjects == "[W]" || $this->gosaGroupObjects == "[T]"){
-            if(in_array($attrs['dn'],$this->used_workstations)){
+            if(in_array_strict($attrs['dn'],$this->used_workstations)){
               continue;
             }
           }
@@ -702,7 +702,7 @@ class ogroup extends plugin
           "T" => "gotoTerminal",
           "F" => "goFonHardware",
           "P" => "gotoPrinter") as $index => $class){
-      if (in_array($class, $attrs['objectClass'])){
+      if (in_array_strict($class, $attrs['objectClass'])){
         $type= $index;
         break;
       }
@@ -716,7 +716,7 @@ class ogroup extends plugin
   {
     /* Person? */
     $name =""; 
-    if (in_array('gosaAccount', $attrs['objectClass'])){
+    if (in_array_strict('gosaAccount', $attrs['objectClass'])){
       if(isset($attrs['sn']) && isset($attrs['givenName'])){
         $name= $attrs['sn'][0].", ".$attrs['givenName'][0];
       } else {
index 13163d5a74c4eb7fd6c4b9af55111a14530a38e8..af942be6c2ff1beebcb14322b502c2170c730bdf 100644 (file)
@@ -69,7 +69,7 @@ class objectSelect extends management
   static function filterDepLabel($row,$dn,$pid,$base,$objectClass, $cn)
   {
     $cn = $cn[0];
-    if(!in_array('gosaDepartment', $objectClass)){
+    if(!in_array_strict('gosaDepartment', $objectClass)){
        return($cn);
     }
     if($dn == $base){
index bea1067d843ef66cfd6ef26bf4e66d62154df018..be7db75cd196ecd71b5dd11ca960e70363702196 100644 (file)
@@ -46,7 +46,7 @@ class ogrouptabs extends tabs
         if(isset($this->by_object['ogroup']->objcache[$dn])){
           $obj = $this->by_object['ogroup']->objcache[$dn];
           if(isset($obj['objectClass'])){
-            if(in_array("goFonAccount",$obj['objectClass'])){
+            if(in_array_strict("goFonAccount",$obj['objectClass'])){
               $usePhoneTab = true;
             }
           }
@@ -129,7 +129,7 @@ class ogrouptabs extends tabs
           if(isset($this->by_object['ogroup']->objcache[$dn])){
             $obj = $this->by_object['ogroup']->objcache[$dn];
             if(isset($obj['objectClass'])){
-              if(in_array("goFonAccount",$obj['objectClass'])){
+              if(in_array_strict("goFonAccount",$obj['objectClass'])){
                 $this->by_name['phonequeue']= _("Phone queue");
                 $this->by_object['phonequeue']= new phonequeue($this->config, $this->dn);
                 $this->by_object['phonequeue']->parent= &$this;
index a3817e77ea083942846f25935b96812558892aac..29eb9e1613f4126f6f74af8765b2c638109b291c 100644 (file)
@@ -274,8 +274,8 @@ class userManagement extends management
           $ldap->cat($this->dn);
           $attrs = $ldap->fetch();
           $this->passwordChangeForceable =
-              in_array('sambaAccount', $attrs['objectClass']) ||
-              (in_array('posixAccount', $attrs['objectClass']) && isset($attrs['shadowMax']));
+              in_array_strict('sambaAccount', $attrs['objectClass']) ||
+              (in_array_strict('posixAccount', $attrs['objectClass']) && isset($attrs['shadowMax']));
           $smarty->assign("passwordChangeForceable" , $this->passwordChangeForceable);
           $smarty->assign("enforcePasswordChange" , $this->enforcePasswordChange);
 
@@ -365,8 +365,8 @@ class userManagement extends management
                   $ldap->cd($this->config->current['BASE']);
                   $ldap->cat($this->dn);
                   $attrs = $ldap->fetch();
-                  $samba = in_array('sambaSamAccount', $attrs['objectClass']);
-                  $posix = in_array('posixAccount', $attrs['objectClass']);
+                  $samba = in_array_strict('sambaSamAccount', $attrs['objectClass']);
+                  $posix = in_array_strict('posixAccount', $attrs['objectClass']);
 
                   // Update the posix shadow flag...
                   if($posix){
index d121b0b0c7bface60e20b305f62dda6026e54b93..4b1753531865d1517e9cfed7baf4f9da67d55611 100644 (file)
@@ -113,7 +113,7 @@ class reference extends plugin
 
                /* Add more information? */
                $addon= "";
-               if (in_array($attrs['dn'], $this->fold)){
+               if (in_array_strict($attrs['dn'], $this->fold)){
                        $memberattr= "";
                        if (isset($attrs['memberUid'])){
                                unset($attrs['memberUid']['count']);
index b4224693b103b36dbbe60156af71e863e68984d1..0de16e5188d466c0eb5b922fad42311cf3731725 100644 (file)
@@ -608,14 +608,14 @@ class user extends plugin
     $ui =get_userinfo();
     foreach($this->attributes as $val){
       $smarty->assign("$val", $this->$val);
-      if(in_array($val,$this->multi_boxes)){
+      if(in_array_strict($val,$this->multi_boxes)){
         $smarty->assign("use_".$val,TRUE);
       }else{
         $smarty->assign("use_".$val,FALSE);
       }
     }
     foreach(array("base","pw_storage","edit_picture") as $val){
-      if(in_array($val,$this->multi_boxes)){
+      if(in_array_strict($val,$this->multi_boxes)){
         $smarty->assign("use_".$val,TRUE);
       }else{
         $smarty->assign("use_".$val,FALSE);
@@ -739,7 +739,7 @@ class user extends plugin
     // Update 'manager' attributes from gosaDepartment and inetOrgPerson
     $filter = "(&(objectClass=inetOrgPerson)(manager=".LDAP::prepare4filter($this->dn)."))";
     $ocs = $ldap->get_objectclasses();
-    if(isset($ocs['gosaDepartment']['MAY']) && in_array('manager', $ocs['gosaDepartment']['MAY'])){
+    if(isset($ocs['gosaDepartment']['MAY']) && in_array_strict('manager', $ocs['gosaDepartment']['MAY'])){
       $filter = "(|".$filter."(&(objectClass=gosaDepartment)(manager=".LDAP::prepare4filter($this->dn).")))";
     }
     $leaf_deps=  get_list($filter,array("all"),$this->config->current['BASE'],
@@ -1375,7 +1375,7 @@ class user extends plugin
       return(FALSE);
     }else{
 
-      if(in_array("pw_storage",$this->multi_boxes)){
+      if(in_array_strict("pw_storage",$this->multi_boxes)){
         return(TRUE);
       }
       return($this->pw_storage != $this->last_pw_storage && !$this->is_template);
@@ -1497,7 +1497,7 @@ class user extends plugin
       /* Walk through govattrs */
       foreach ($this->govattrs as $val){
 
-        if (in_array($val, $skip)){
+        if (in_array_strict($val, $skip)){
           continue;
         }
 
@@ -1721,10 +1721,10 @@ class user extends plugin
   function get_multi_edit_values()
   {
     $ret = plugin::get_multi_edit_values();
-    if(in_array("pw_storage",$this->multi_boxes)){
+    if(in_array_strict("pw_storage",$this->multi_boxes)){
       $ret['pw_storage'] = $this->pw_storage;
     }
-    if(in_array("edit_picture",$this->multi_boxes)){
+    if(in_array_strict("edit_picture",$this->multi_boxes)){
       $ret['jpegPhoto'] = $this->jpegPhoto;
       $ret['photoData'] = $this->photoData;
       $ret['old_jpegPhoto'] = $this->old_jpegPhoto;
@@ -1737,7 +1737,7 @@ class user extends plugin
       unset($ret['cn']);
     }
     $ret['is_modified'] = $this->is_modified;
-    if(in_array("base",$this->multi_boxes)){
+    if(in_array_strict("base",$this->multi_boxes)){
       $ret['orig_base']="Changed_by_Multi_Plug";
       $ret['base']=$this->base;
     }
@@ -1804,25 +1804,25 @@ class user extends plugin
     if($this->dn == "new") {
       $this->set_acl_base($this->base);
     }
-    if (!tests::is_url($this->labeledURI) && in_array("labeledURI",$this->multi_boxes)){
+    if (!tests::is_url($this->labeledURI) && in_array_strict("labeledURI",$this->multi_boxes)){
       $message[]= msgPool::invalid(_("Homepage"));
     }
-    if (!tests::is_phone_nr($this->telephoneNumber) && in_array("telephoneNumber",$this->multi_boxes)){
+    if (!tests::is_phone_nr($this->telephoneNumber) && in_array_strict("telephoneNumber",$this->multi_boxes)){
       $message[]= msgPool::invalid(_("Phone"), $this->telephoneNumber, "/[\/0-9 ()+*-]/");
     }
-    if (!tests::is_phone_nr($this->facsimileTelephoneNumber) &&  in_array("facsimileTelephoneNumber",$this->multi_boxes)){
+    if (!tests::is_phone_nr($this->facsimileTelephoneNumber) &&  in_array_strict("facsimileTelephoneNumber",$this->multi_boxes)){
       $message[]= msgPool::invalid(_("Fax"), $this->facsimileTelephoneNumber, "/[\/0-9 ()+*-]/");
     }
-    if (!tests::is_phone_nr($this->mobile) && in_array("mobile",$this->multi_boxes)){
+    if (!tests::is_phone_nr($this->mobile) && in_array_strict("mobile",$this->multi_boxes)){
       $message[]= msgPool::invalid(_("Mobile"), $this->mobile, "/[\/0-9 ()+*-]/");
     }
-    if (!tests::is_phone_nr($this->pager) && in_array("pager",$this->multi_boxes)){
+    if (!tests::is_phone_nr($this->pager) && in_array_strict("pager",$this->multi_boxes)){
       $message[]= msgPool::invalid(_("Pager"), $this->pager, "/[\/0-9 ()+*-]/");
     }
-    if (preg_match ('/[,+"?\'()=<>;\\\\]/', $this->givenName) && in_array("givenName",$this->multi_boxes)){
+    if (preg_match ('/[,+"?\'()=<>;\\\\]/', $this->givenName) && in_array_strict("givenName",$this->multi_boxes)){
       $message[]= msgPool::invalid(_("Given name"), $this->giveName, '/[^,+"?\'()=<>;\\\\]/');
     }
-    if (preg_match ('/[,+"?\'()=<>;\\\\]/', $this->sn) && in_array("sn",$this->multi_boxes)){
+    if (preg_match ('/[,+"?\'()=<>;\\\\]/', $this->sn) && in_array_strict("sn",$this->multi_boxes)){
       $message[]= msgPool::invalid(_("Name"), $this->sn, '/[^,+"?\'()=<>;\\\\]/');
     }
     return($message);
@@ -1888,7 +1888,7 @@ class user extends plugin
 
     // Update loginRestrictions, keep my settings while ip is optional
     foreach($attrs['gosaLoginRestriction_some'] as $ip){
-      if(in_array($ip, $this->gosaLoginRestriction) && in_array($ip, $attrs['gosaLoginRestriction'])){
+      if(in_array_strict($ip, $this->gosaLoginRestriction) && in_array_strict($ip, $attrs['gosaLoginRestriction'])){
         $lR[] = $ip;
       }
     }
@@ -1911,7 +1911,7 @@ class user extends plugin
     $data = array();
     foreach($all as $ip){
       $data['data'][] = $ip;
-      if(!in_array($ip, $this->gosaLoginRestriction)){
+      if(!in_array_strict($ip, $this->gosaLoginRestriction)){
         $data['displayData'][] = array('mode' => LIST_MARKED , 'data' => array($ip.' ('._("Entries differ").')'));
       }else{
         $data['displayData'][] = array('mode' => 0 , 'data' => array($ip));
index bf082a736177fb0eff4e73b9c800881b7d05ef06..2befec7c1c1fc1eabc5b41b53a9a2ee55537a45c 100644 (file)
@@ -133,7 +133,7 @@ class posixAccount extends plugin
 
       /* Correct is_account. shadowAccount is not required. */
       if (isset($this->attrs['objectClass']) &&
-          in_array ('posixAccount', $this->attrs['objectClass'])){
+          in_array_strict('posixAccount', $this->attrs['objectClass'])){
 
         $this->is_account= TRUE;
       }
@@ -239,7 +239,7 @@ class posixAccount extends plugin
     }
 
     /* Insert possibly missing loginShell */
-    if ($this->loginShell != "" && !in_array($this->loginShell, $this->loginShellList)){
+    if ($this->loginShell != "" && !in_array_strict($this->loginShell, $this->loginShellList)){
       $this->loginShellList[]= $this->loginShell;
     }
 
@@ -521,7 +521,7 @@ class posixAccount extends plugin
     $smarty->assign("force_idsACL", $this->getacl("uidNumber",$SkipWrite).$this->getacl("gidNumber",$SkipWrite));
 
     foreach(array("primaryGroup","trustmode","activate_shadowWarning","activate_shadowInactive","activate_shadowMin","activate_shadowMax","activate_shadowExpire","mustchangepassword") as $val){
-      if(in_array($val,$this->multi_boxes)){
+      if(in_array_strict($val,$this->multi_boxes)){
         $smarty->assign("use_".$val,TRUE);
       }else{
         $smarty->assign("use_".$val,FALSE);
@@ -531,7 +531,7 @@ class posixAccount extends plugin
 
     /* Load attributes and acl's */
     foreach($this->attributes as $val){
-      if(in_array($val,$this->multi_boxes)){
+      if(in_array_strict($val,$this->multi_boxes)){
         $smarty->assign("use_".$val,TRUE);
       }else{
         $smarty->assign("use_".$val,FALSE);
@@ -1101,47 +1101,47 @@ class posixAccount extends plugin
   function multiple_check()
   {
     $message = plugin::multiple_check();
-    if ($this->homeDirectory == "" && in_array("homeDirectory",$this->multi_boxes)){
+    if ($this->homeDirectory == "" && in_array_strict("homeDirectory",$this->multi_boxes)){
       $message[]= msgPool::required(_("Home directory"));
     }
-    if (!tests::is_path($this->homeDirectory) && in_array("homeDirectory",$this->multi_boxes)){
+    if (!tests::is_path($this->homeDirectory) && in_array_strict("homeDirectory",$this->multi_boxes)){
       $message[]= msgPool::invalid(_("Home directory"), "", "", "/home/yourname" );
     }
 
     /* Check shadow settings, well I like spaghetties... */
-    if ($this->activate_shadowMin && in_array("activate_shadowMin",$this->multi_boxes)){
+    if ($this->activate_shadowMin && in_array_strict("activate_shadowMin",$this->multi_boxes)){
       if (!tests::is_id($this->shadowMin)){
         $message[]= msgPool::invalid(_("shadowMin"), $this->shadowMin, "/[0-9]/");
       }
     }
-    if ($this->activate_shadowMax && in_array("activate_shadowMax",$this->multi_boxes)){
+    if ($this->activate_shadowMax && in_array_strict("activate_shadowMax",$this->multi_boxes)){
       if (!tests::is_id($this->shadowMax)){
         $message[]= msgPool::invalid(_("shadowMax"), $this->shadowMax, "/[0-9]/");
       }
     }
-    if ($this->activate_shadowWarning && in_array("activate_shadowWarning",$this->multi_boxes)){
+    if ($this->activate_shadowWarning && in_array_strict("activate_shadowWarning",$this->multi_boxes)){
       if (!tests::is_id($this->shadowWarning)){
         $message[]= msgPool::invalid(_("shadowWarning"), $this->shadowWarning, "/[0-9]/");
       }
-      if (!$this->activate_shadowMax && in_array("activate_shadowMax",$this->multi_boxes)){
+      if (!$this->activate_shadowMax && in_array_strict("activate_shadowMax",$this->multi_boxes)){
         $message[]= msgPool::depends("shadowWarning", "shadowMax");
       }
-      if ($this->shadowWarning > $this->shadowMax && in_array("activate_shadowWarning",$this->multi_boxes)){
+      if ($this->shadowWarning > $this->shadowMax && in_array_strict("activate_shadowWarning",$this->multi_boxes)){
         $message[]= msgPool::toobig("shadowWarning", "shadowMax");
       }
-      if ($this->activate_shadowMin && $this->shadowWarning < $this->shadowMin && in_array("activate_shadowMin",$this->multi_boxes)){
+      if ($this->activate_shadowMin && $this->shadowWarning < $this->shadowMin && in_array_strict("activate_shadowMin",$this->multi_boxes)){
         $message[]= msgPool::tosmall("shadowWarning", "shadowMin");
       }
     }
-    if ($this->activate_shadowInactive && in_array("activate_shadowInactive",$this->multi_boxes)){
+    if ($this->activate_shadowInactive && in_array_strict("activate_shadowInactive",$this->multi_boxes)){
       if (!tests::is_id($this->shadowInactive)){
         $message[]= msgPool::invalid(_("shadowInactive"), $this->shadowInactive, "/[0-9]/");
       }
-      if (!$this->activate_shadowMax && in_array("activate_shadowMax",$this->multi_boxes)){
+      if (!$this->activate_shadowMax && in_array_strict("activate_shadowMax",$this->multi_boxes)){
         $message[]= msgPool::depends("shadowInactive", "shadowMax");
       }
     }
-    if ($this->activate_shadowMin && $this->activate_shadowMax && in_array("activate_shadowMin",$this->multi_boxes)){
+    if ($this->activate_shadowMin && $this->activate_shadowMax && in_array_strict("activate_shadowMin",$this->multi_boxes)){
       if ($this->shadowMin > $this->shadowMax){
         $message[]= msgPool::toobig("shadowMin", "shadowMax");
       }
@@ -1479,21 +1479,21 @@ class posixAccount extends plugin
     $ret['groupMembership']     = $this->groupMembership;
     $ret['groupMembership_some']= $this->groupMembership_some;
 
-    if(in_array("primaryGroup",$this->multi_boxes)){
+    if(in_array_strict("primaryGroup",$this->multi_boxes)){
       $ret['primaryGroup'] = $this->primaryGroup;
     }
-    if(in_array("trustmode",$this->multi_boxes)){
+    if(in_array_strict("trustmode",$this->multi_boxes)){
       $ret['trustModel'] = $this->trustModel;
       $ret['accessTo'] = $this->accessTo;
     }
     foreach(array("shadowWarning","shadowInactive","shadowMin","shadowMax", "shadowExpire") as $entry){
       $active = "activate_".$entry;
-      if(in_array($active,$this->multi_boxes)){
+      if(in_array_strict($active,$this->multi_boxes)){
         $ret[$entry] = $this->$entry;
         $ret[$active] = $this->$active;
       }
     }
-    if(in_array("mustchangepassword",$this->multi_boxes)){
+    if(in_array_strict("mustchangepassword",$this->multi_boxes)){
       $ret['mustchangepassword'] = $this->mustchangepassword;
     }
     return($ret);
@@ -1523,7 +1523,7 @@ class posixAccount extends plugin
       foreach(array("shadowMin","shadowMax","shadowExpire","shadowInactive","shadowWarning") as $var) {
         if($this->acl_is_writeable($var)){
           $activate_var = "activate_".$var;
-          if(in_array($activate_var, $this->multi_boxes)){
+          if(in_array_strict($activate_var, $this->multi_boxes)){
             if(isset($_POST['activate_'.$var])){
               $this->$activate_var  = true;
               $this->$var      = $_POST[$var];
@@ -1536,7 +1536,7 @@ class posixAccount extends plugin
       }
 
       /* Restore shadow value, if the shadow attribute isn't used */
-      if(!in_array("activate_shadowExpire",$this->multi_boxes)){
+      if(!in_array_strict("activate_shadowExpire",$this->multi_boxes)){
         $this->shadowExpire = $expire_tmp;
       }
 
@@ -1611,7 +1611,7 @@ class posixAccount extends plugin
     $groups_all = $groups_some;
     foreach($groups_all as $id => $group){
       foreach($uids as $uid){
-        if(!in_array($uid,$groups_uid[$id])){
+        if(!in_array_strict($uid,$groups_uid[$id])){
           unset($groups_all[$id]);
           break;
         }
index cd150dd7ec46f8c5b21300c3b3bc788f0ecfcc43..e3d7473a1fbd09382e35b1fc4c2f0d5966cb9382 100644 (file)
@@ -18,7 +18,7 @@ class filterLDAPBlacklist {
             if(isset($entry[$attr_name])){
               $test = $entry[$attr_name];
               if(!is_array($test)) $test = array($test);
-              if(in_array($match, $test)) unset($entries[$id]);
+              if(in_array_strict($match, $test)) unset($entries[$id]);
             }
           }
         }
index eca54c38a809806ade702a4075aba2d716336055..d6cea388deba9f8186cdde96eca4bc7515a27248 100644 (file)
@@ -150,7 +150,7 @@ class Step_Ldap extends setup_step
     $reset = FALSE;
     foreach($this->attributes as $attr){
       if(isset($_POST[$attr])){
-        if(in_array($attr,array("base","connection")) && $this->$attr != get_post($attr)){
+        if(in_array_strict($attr,array("base","connection")) && $this->$attr != get_post($attr)){
           $reset = TRUE;
         }
         $this->$attr = get_post($attr);
@@ -160,7 +160,7 @@ class Step_Ldap extends setup_step
     if($reset){
       $this->parent->disable_steps_from(($this->parent->step_name_to_id(get_class($this))) +1);
       $attr = @LDAP::get_naming_contexts($this->connection);
-      if(is_array($attr) && !in_array(get_post("base"),$attr)){
+      if(is_array($attr) && !in_array_strict(get_post("base"),$attr)){
         if(isset($attr[0])){
           $this->base = $attr[0];
         }
index ce3ec46331815db156ed011ba525f569027eac71..c52b14cf4f2c650945e7356197da89fe3564d784 100644 (file)
@@ -432,7 +432,7 @@ class Step_Migrate extends setup_step
        *  and verify that he is in a valid department
        */
       if( !preg_match("/".preg_quote("dc=addressbook,", '/')."/",$group_db_base) &&
-          !in_array($group_db_base,$valid_deps)
+          !in_array_strict($group_db_base,$valid_deps)
         ){
         $attrs['selected'] = FALSE;
         $attrs['ldif']     = "";
@@ -510,7 +510,7 @@ class Step_Migrate extends setup_step
        *  and verify that he is in a valid department
        */
       if( !preg_match("/dc=addressbook,/",$people_db_base) &&
-          !in_array($people_db_base,$valid_deps)
+          !in_array_strict($people_db_base,$valid_deps)
          ){
         $attrs['selected'] = FALSE;
         $attrs['ldif']     = "";
@@ -773,7 +773,7 @@ class Step_Migrate extends setup_step
        */
       if(preg_match("/^.*,[ ]*cn=/",$dn)){
         $cn_dn = preg_replace("/^.*,[ ]*cn=/","cn=",$dn);
-        if(in_array($cn_dn,$this->group_list)){
+        if(in_array_strict($cn_dn,$this->group_list)){
           $skip = true;
         }
       }
@@ -2044,7 +2044,7 @@ class Step_Migrate extends setup_step
 
     /* Root object doesn't exists 
      */
-    if(!in_array("gosaDepartment",$attrs['objectClass'])){
+    if(!in_array_strict("gosaDepartment",$attrs['objectClass'])){
       if($just_check){
 
         $this->rootOC_details = array();       
@@ -2066,7 +2066,7 @@ class Step_Migrate extends setup_step
         $dep_types = departmentManagement::get_support_departments();
         $dep_type ="";
         foreach($dep_types as $dep_name => $dep_class){
-          if(in_array($dep_class['CLASS'], $attrs['objectClass'])){
+          if(in_array_strict($dep_class['CLASS'], $attrs['objectClass'])){
             $dep_type = $dep_name;
             break;
           }
@@ -2457,7 +2457,7 @@ class Step_Migrate extends setup_step
   function cleanup_array($attrs)
   {
     foreach($attrs as $key => $value) {
-      if(is_numeric($key) || in_array($key,array("count","dn"))){
+      if(is_numeric($key) || in_array_strict($key,array("count","dn"))){
         unset($attrs[$key]);
       }
       if(is_array($value) && isset($value['count'])){
@@ -2610,7 +2610,7 @@ class Step_Migrate extends setup_step
         $ldap->cd($cv['base']);
         $ldap->cat($device['DN']);
         $attrs = $ldap->fetch();
-        if(in_array($device['OLD_DEVICE'],$attrs['gotoHotplugDevice'])){
+        if(in_array_strict($device['OLD_DEVICE'],$attrs['gotoHotplugDevice'])){
 
           /* Create new hotplug device object 'gotoDevice'
            */ 
@@ -2848,7 +2848,7 @@ class Step_Migrate extends setup_step
         for ($j= 0; $j < $info['gosaApplicationParameter']['count']; $j++){
           $p= preg_replace("/^([^:]+):.*$/", "$1", $info['gosaApplicationParameter'][$j]);
 
-          if(!isset($amap[$info['cn'][0]]) || !in_array($p, $amap[$info['cn'][0]])){
+          if(!isset($amap[$info['cn'][0]]) || !in_array_strict($p, $amap[$info['cn'][0]])){
             $amap[$info['cn'][0]][]= $p;
           }
         }
@@ -3196,7 +3196,7 @@ class Step_Migrate extends setup_step
     for($i=0;$i< $base_attrs['objectClass']['count']; $i++){
       $ocs[] = $base_attrs['objectClass'][$i];
     }
-    if(!in_array("gosaACL",$ocs)){
+    if(!in_array_strict("gosaACL",$ocs)){
       $ocs[] = "gosaACL";
     }
 
@@ -3261,7 +3261,7 @@ class Step_Migrate extends setup_step
       for($i=0;$i<$base_data['objectClass']['count'];$i++){
         $base_entry .= "objectClass: ".$base_data['objectClass'][$i]."\n";
       }
-      if(!in_array("gosaACL",$base_data['objectClass'])){
+      if(!in_array_strict("gosaACL",$base_data['objectClass'])){
         $base_entry .= "<b>objectClass: gosaACL</b>\n";
       }
       if(isset($base_data['gosaAclEntry'])){