Code

Migrated to get_cfg_value
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Jul 2008 12:11:37 +0000 (12:11 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Jul 2008 12:11:37 +0000 (12:11 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12048 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc
gosa-core/plugins/admin/ogroups/tabs_ogroups.inc
gosa-core/plugins/admin/users/class_userManagement.inc
gosa-core/plugins/personal/generic/class_user.inc
gosa-core/plugins/personal/password/class_password.inc
gosa-core/plugins/personal/posix/class_posixAccount.inc

index 9d5cdf1074e4e70d667a5ca6bc89231e1af9114e..6a5801781932d8242c3b84416bfbd47694f1b61c 100644 (file)
@@ -47,7 +47,7 @@ class ogroupManagement extends plugin
 
     /* Copy & Paste enabled ?
      */
-    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE'] ))){
+    if ($this->config->get_cfg_value("enablecopypaste") == "true"){
       $this->CopyPasteHandler = new CopyPasteHandler($this->config);
     }
 
index 47af9e79ae6ac30f61ecf813c05d62316ca23f65..a2ea7c23e079a19d603f7ecdfff13e3a1c9d9e89 100644 (file)
@@ -123,12 +123,10 @@ class ogrouptabs extends tabs
     /* Add mail group tab , if there is curerntly no mail tab defined */ 
     if(class_available("mailogroup")){
       if((preg_match("/U/",$objects))&&(!isset($this->by_object['mailogroup']))){
-        if(isset($this->config->current['MAILMETHOD'])){
-          if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
-            $this->by_name['mailogroup']= _("Mail");
-            $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
-            $this->by_object['mailogroup']->parent= &$this;
-          }
+        if ($this->config->get_cfg_value("mailmethod") == "kolab"){
+          $this->by_name['mailogroup']= _("Mail");
+          $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
+          $this->by_object['mailogroup']->parent= &$this;
         }
       }
     }
@@ -303,12 +301,10 @@ class ogrouptabs extends tabs
  
           /* Add a user tab used for mail distribution lists */
           if(class_available("mailogroup")){
-            if(isset($this->config->current['MAILMETHOD'])){
-              if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
-                $this->by_name['mailogroup']= _("Mail");
-                $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
-                $this->by_object['mailogroup']->parent= &$this;
-              }
+            if ($this->config->get_cfg_value("mailmethod") == "kolab"){
+              $this->by_name['mailogroup']= _("Mail");
+              $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
+              $this->by_object['mailogroup']->parent= &$this;
             }
           }
 
index 2588483f066fdb6a12ce7df60c74df42776bc1a8..f94edf17232222efb47fb1a6a9ad7b98bae833dd 100644 (file)
@@ -294,8 +294,8 @@ class userManagement extends plugin
             if(!change_password ($this->usertab->dn, $_POST['new_password'],0, $obj->pw_storage)){
               return($smarty->fetch(get_template_path('password.tpl', TRUE)));
             }
-            if (isset($config->data['MAIN']['EXTERNALPWDHOOK'])){
-              exec($config->data['MAIN']['EXTERNALPWDHOOK']." ".$username." ".$_POST['new_password'], $resarr);
+            if ($config->get-cfg_value("externalpwdhook") != ""){
+              exec($config->get-cfg_value("externalpwdhook")." ".$username." ".$_POST['new_password'], $resarr);
             }
             new log("modify","users/".get_class($this),$this->usertab->dn,array(),"Password has been changed");
             unset($this->usertab);
@@ -305,8 +305,8 @@ class userManagement extends plugin
           if(!change_password ($this->dn, $_POST['new_password'])){
             return($smarty->fetch(get_template_path('password.tpl', TRUE)));
           }
-          if (isset($config->data['MAIN']['EXTERNALPWDHOOK'])){
-            exec($config->data['MAIN']['EXTERNALPWDHOOK']." ".$username." ".$_POST['new_password'], $resarr);
+          if ($config->get-cfg_value("externalpwdhook") != ""){
+            exec($config->get-cfg_value("externalpwdhook")." ".$username." ".$_POST['new_password'], $resarr);
           }
           new log("modify","users/".get_class($this),$this->dn,array(),"Password has been changed");
         }
@@ -803,11 +803,7 @@ class userManagement extends plugin
          react on this. */
       $this->dn= "new";
       
-      if (isset($this->config->current['IDGEN'])){
-        $this->got_uid= false;
-      } else {
-        $this->got_uid= true;
-      }
+       $this->got_uid= ($this->config->get_cfg_value("idgen") == "");
 
       /* Create new usertab object */
       $this->usertab= new usertabs($this->config,$this->config->data['TABS']['USERTABS'], $this->dn);
@@ -870,9 +866,8 @@ class userManagement extends plugin
         msg_dialog::displayChecks($message);
       } else {
         $attributes= array('sn' => $this->sn, 'givenName' => $this->givenName);
-        if (isset($this->config->current['IDGEN']) &&
-            $this->config->current['IDGEN'] != ""){
-          $uids= gen_uids ($this->config->current['IDGEN'], $attributes);
+        if ($this->config->get_cfg_value("idgen") != ""){
+          $uids= gen_uids ($this->config->get_cfg_value("idgen"), $attributes);
           if (count($uids)){
             $smarty->assign("edit_uid", "false");
             $smarty->assign("uids", $uids);
@@ -1016,7 +1011,7 @@ class userManagement extends plugin
 
     /* Setup filter depending on selection */
     $filter="";
-    if ($this->config->current['SAMBAVERSION'] == 3){
+    if ($this->config->get_cfg_value("sambaversion") == 3){
       $samba= "sambaSamAccount";
     } else {
       $samba= "sambaAccount";
index 1446d1f009bff740810bb5223626c5d859be73c2..5b7e299f984b2aee42a3ee1bbc449459ff893cbf 100644 (file)
@@ -132,7 +132,7 @@ class user extends plugin
   {
     $this->config= $config;
     /* Configuration is fine, allways */
-    if (isset($this->config->current['GOVERNMENTMODE']) && preg_match("/true/i",$this->config->current['GOVERNMENTMODE'])){
+    if($this->config->get_cfg_value("governmentmode") == "true"){
       $this->governmentmode = TRUE;
       $this->attributes=array_merge($this->attributes,$this->govattrs);
     }
@@ -166,11 +166,7 @@ class user extends plugin
     }
 
     /* Make hash default to md5 if not set in config */
-    if (!isset($this->config->current['HASH'])){
-      $hash= "md5";
-    } else {
-      $hash= $this->config->current['HASH'];
-    }
+    $hash= $this->config->get_cfg_value("hash", "crypt/md5");
 
     /* Load data from LDAP? */
     if ($dn !== NULL){
@@ -579,7 +575,7 @@ class user extends plugin
 
     /* Prepare password hashes */
     if ($this->pw_storage == ""){
-      $this->pw_storage= $this->config->current['HASH'];
+      $this->pw_storage= $this->config->get_cfg_value("hash");
     }
 
     $temp= passwordMethod::get_available_methods();
@@ -1074,11 +1070,11 @@ class user extends plugin
         die ("Could not connect to LDAP server");
       }
       ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
-      if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
+      if (function_exists("ldap_set_rebind_proc") && $this->config->get_cfg_value("recursive") == "true") {
         ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
         ldap_set_rebind_proc($ds, array(&$this, "rebind"));
       }
-      if(isset($config->current['TLS']) && $config->current['TLS'] == "true"){
+      if($this->config->get_cfg_value("tls") == "true"){
         ldap_start_tls($ds);
       }
       if (!($res = @ldap_bind($ds, $this->config->current['ADMIN'],
@@ -1121,7 +1117,7 @@ class user extends plugin
   function update_new_dn()
   {
     $pt= "";
-    if(isset($this->config->current['INCLUDE_PERSONAL_TITLE']) && preg_match("/true/i",$this->config->current['INCLUDE_PERSONAL_TITLE'])){
+    if($this->config->get_cfg_value("include_personal_title") == "true"){
       if(!empty($this->personalTitle)){
         $pt = $this->personalTitle." ";
       }
@@ -1129,7 +1125,7 @@ class user extends plugin
     $this->cn= $pt.$this->givenName." ".$this->sn;
 
     /* Permissions for that base? */
-    if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
+    if ($this->config->get_cfg_value("dnmode") == "uid"){
       $this->new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
     } else {
       /* Don't touch dn, if cn hasn't changed */
@@ -1200,7 +1196,7 @@ class user extends plugin
       if ($this->uid == ""){
         $message[]= msgPool::required(_("Login"));
       }
-      if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){
+      if ($this->config->get_cfg_value("dnmode") != "uid"){
         $ldap->cat($this->new_dn);
         if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){
           $message[]= msgPool::duplicated(_("Name"));
@@ -1285,13 +1281,11 @@ class user extends plugin
   {
     $ds= ldap_connect($this->config->current['SERVER']);
     ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
-    if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
+    if (function_exists("ldap_set_rebind_proc") && $this->config->get_cfg_value("recursive") == "true"){
       ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
       ldap_set_rebind_proc($ds, array(&$this, "rebind"));
     }
-    if(isset($this->config->current['TLS']) &&
-        $this->config->current['TLS'] == "true"){
-
+    if ($this->config->get_cfg_value("tls") == "true"){
       ldap_start_tls($ds);
     }
 
@@ -1544,7 +1538,7 @@ class user extends plugin
 
     /* Append government attributes if required */
       global $config;
-    if (isset($config->current['GOVERNMENTMODE']) &&  preg_match('/true/i', $config->current['GOVERNMENTMODE'])){
+    if($this->config->get_cfg_value("governmentmode") == "true"){
       foreach($govattrs as $attr => $desc){
         $ret["plProvidedAcls"][$attr] = $desc;
       }
index ee88461232f75177821c6efbd960bc4e1404ec91..d4899ec2efe63d9a0af591d9c5b6bfb5355a5ae9 100644 (file)
@@ -44,8 +44,7 @@ class password extends plugin
     $smarty->assign("NotAllowed" , !preg_match("/w/i",$password_ACLS));
 
     /* Display expiration template */
-    if((isset($this->config->data['MAIN']['ACCOUNT_EXPIRATION'])) &&
-        preg_match('/true/i', $this->config->data['MAIN']['ACCOUNT_EXPIRATION'])){
+    if ($this->config->get_cfg_value("account_expiration") == "true"){
       $expired= ldap_expired_account($this->config, $ui->dn, $ui->username);
       if($expired == 4){
         return($smarty->fetch(get_template_path("nochange.tpl", TRUE)));
@@ -56,16 +55,16 @@ class password extends plugin
     if (isset($_POST['password_finish'])){
 
       /* Should we check different characters in new password */
-      $check_differ = isset($this->config->data['MAIN']['PWDIFFER']);
-      $differ       = @$this->config->data['MAIN']['PWDIFFER'];
+      $check_differ = $this->config->get_cfg_value("pwdiffer") != "";
+      $differ       = $this->config->get_cfg_value("pwdiffer", 0);
 
       /* Enable length check ? */
-      $check_length = isset($this->config->data['MAIN']['PWMINLEN']);
-      $length       = @$this->config->data['MAIN']['PWMINLEN'];
+      $check_length = $this->config->get_cfg_value("pwminlen") != "";
+      $length       = $this->config->get_cfg_value("pwminlen", 0);
 
       /* Call external password quality hook ?*/
-      $check_hook   = isset($this->config->data['MAIN']['EXTERNALPWDHOOK']);
-      $hook         = @$this->config->data['MAIN']['EXTERNALPWDHOOK']." ".$ui->username." ".$_POST['current_password']." ".$_POST['new_password'];
+      $check_hook   = $this->config->get_cfg_value("externalpwdhook") != "";
+      $hook         = $this->config->get_cfg_value("externalpwdhook")." ".$ui->username." ".$_POST['current_password']." ".$_POST['new_password'];
       if($check_hook){
         exec($hook,$resarr);
         $check_hook_output = "";
@@ -100,8 +99,8 @@ class password extends plugin
             $ui->dn, 
             $_POST['current_password'],
             $this->config->current['SERVER'],
-            isset($this->config->current['RECURSIVE'])  && preg_match("/true/i",$this->config->current['RECURSIVE']),
-            isset($this->config->current['TLS'])        && preg_match("/true/i",$this->config->current['TLS']));
+            $this->config->get_cfg-value("recursive") == "true",
+            $this->config->get_cfg-value("tls") == "true");
 
         /* connection Successfull ? */
         if (!$tldap->success()){
index 8a3971073415f14d7bab3b264fc2989e8495fb57..f2471b602a9b0d211764ad2d6d2a4251f99943a6 100644 (file)
@@ -953,7 +953,7 @@ class posixAccount extends plugin
 
       /* Create group if it doesn't exist */
       if ($ldap->count() == 0){
-        $groupdn= preg_replace ('/^'.$this->config->current['DNMODE'].'=[^,]+,'.get_people_ou().'/i', 'cn='.$this->uid.','.get_groups_ou(), $this->dn);
+        $groupdn= preg_replace ('/^'.$this->config->get_cfg_value("dnmode").'=[^,]+,'.get_people_ou().'/i', 'cn='.$this->uid.','.get_groups_ou(), $this->dn);
 
         $g= new group($this->config, $groupdn);
         $g->cn= $this->uid;
@@ -1028,15 +1028,15 @@ class posixAccount extends plugin
       if (!tests::is_id($this->uidNumber)){
         $message[]= msgPool::invalid(_("UID"), $this->uidNumber, "/[0-9]/");
       } else {
-        if ($this->uidNumber < $this->config->current['MINID']){
-          $message[]= msgPool::toosmall(_("UID"), $this->config->current['MINID']);
+        if ($this->uidNumber < $this->config->get_cfg_value("minid")){
+          $message[]= msgPool::toosmall(_("UID"), $this->config->get_cfg_value("minid"));
         }
       }
       if (!tests::is_id($this->gidNumber)){
         $message[]= msgPool::invalid(_("GID"), $this->gidNumber, "/[0-9]/");
       } else {
-        if ($this->gidNumber < $this->config->current['MINID']){
-          $message[]= msgPool::toosmall(_("GID"), $this->config->current['MINID']);
+        if ($this->gidNumber < $this->config->get_cfg_value("minid")){
+          $message[]= msgPool::toosmall(_("GID"), $this->config->get_cfg_value("minid"));
         }
       }
     }
@@ -1302,10 +1302,10 @@ class posixAccount extends plugin
 
     /* get the ranges */
     $tmp = array('0'=> 1000); 
-    if (preg_match('/posixAccount/', $oc) && isset($this->config->current['UIDBASE'])) {
-      $tmp= split('-',$this->config->current['UIDBASE']);
-    } elseif(isset($this->config->current['GIDBASE'])){
-      $tmp= split('-',$this->config->current['GIDBASE']);
+    if (preg_match('/posixAccount/', $oc) && $this->config->get_cfg_value("uidbase") != ""){
+      $tmp= split('-',$this->config->get_cfg_value("uidbase"));
+    } elseif($this->config->get_cfg_value("gidbase") != "")){
+      $tmp= split('-',$this->config->get_cfg_value("gidbase"));
     }
 
     /* Set hwm to max if not set - for backward compatibility */
@@ -1317,7 +1317,7 @@ class posixAccount extends plugin
     }
 
     /* Find out next free id near to UID_BASE */
-    if (!isset($this->config->current['BASE_HOOK'])){
+    if ($this->config->get_cfg_value("base_hook") == ""){
       $base= $lwm;
     } else {
       /* Call base hook */