gunnar: server/php-kolab/Kolab_Webadmin/Webadmin sieveutils.class.php, 1.2, 1.3 user.class.php, 1.1, 1.2 webadmin.class.php, 1.3, 1.4

cvs at kolab.org cvs at kolab.org
Mon Aug 20 12:11:28 CEST 2007


Author: gunnar

Update of /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin
In directory doto:/tmp/cvs-serv13622/Kolab_Webadmin/Webadmin

Modified Files:
	sieveutils.class.php user.class.php webadmin.class.php 
Log Message:
Corrected some typos in the draft.

Index: sieveutils.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/sieveutils.class.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sieveutils.class.php	20 Aug 2007 09:43:15 -0000	1.2
+++ sieveutils.class.php	20 Aug 2007 10:11:26 -0000	1.3
@@ -22,13 +22,13 @@
 require_once('Net/Sieve.php');
 
 /** The name of the forward sieve script */
-define('KOLAB_SIEVE_FORWARD', 'kolab-forward.siv')
+define('KOLAB_SIEVE_FORWARD', 'kolab-forward.siv');
 
 /** The name of the vacation sieve script */
-define('KOLAB_SIEVE_VACATION', 'kolab-vacation.siv')
+define('KOLAB_SIEVE_VACATION', 'kolab-vacation.siv');
 
 /** The name of the deliver sieve script */
-define('KOLAB_SIEVE_DELIVER', 'kolab-deliver.siv')
+define('KOLAB_SIEVE_DELIVER', 'kolab-deliver.siv');
 
 class KolabSieve {
 
@@ -161,7 +161,7 @@
      *
      * @return mixed True on success, a PEAR error otherwise
      */
-    function storeForwardSieve($addresses, $maildomain, $reacttospam, $text, $days, $active)
+    function storeVacationSieve($addresses, $maildomain, $reacttospam, $text, $days, $active)
     {
         $script = 
             "require \"vacation\";\r\n\r\n".
@@ -231,7 +231,7 @@
             $keep = true;
         }
         $active = ( $this->_sieve->getActive() === $scriptname );
-        return ($address, $keep, $active);
+        return array($address, $keep, $active);
     }
 
     /**
@@ -272,7 +272,7 @@
                 $date);
         }
         $active = ( $this->_sieve->getActive() === KOLAB_SIEVE_VACATION);  
-        return ($addresses, $maildomain, $reacttospam, $text, $days, $active);
+        return array($addresses, $maildomain, $reacttospam, $text, $days, $active);
     }
 
     /**
@@ -292,6 +292,7 @@
         }
         if( $inbox === false ) $inbox = 'Inbox';
         $active = ( $this->_sieve->getActive() === $scriptname );  
+        return array($inbox, $active);
     }
 }
 

Index: user.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/user.class.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- user.class.php	20 Aug 2007 09:43:15 -0000	1.1
+++ user.class.php	20 Aug 2007 10:11:26 -0000	1.2
@@ -68,9 +68,10 @@
      *
      * @return KolabUsers The initialized KolabUsers object
      */
-    function KolabUsers($ldap, $params)
+    function KolabUsers($ldap, $dn, $params)
     {
         $this->_ldap = $ldap;
+        $this->_dn = $dn;
         $this->_params = $params;
     }
 
@@ -86,14 +87,14 @@
      *
      * @return KolabUsers The initialized KolabUsers object
      */
-    function getVisibleUsers($dn, $filterattr = false, $filtertype = false,
-							 $filtervalue = false, $alphalimit = false,
-							 $alphagroup = false)
+    function getVisibleUsers($filterattr = false, $filtertype = false,
+                             $filtervalue = false, $alphalimit = false,
+                             $alphagroup = false)
     {
         // Get all entries & dynamically split the letters with growing entries
         $entries = array();
         if (isset($this->_params['base_dn'])) {
-            $base_dn = $this->params['base_dn'];
+            $base_dn = $this->_params['base_dn'];
         } else {
             $base_dn = 'k=kolab';
         }
@@ -161,7 +162,7 @@
                 $alphalimit = '';
             }
         }
-        $domains = $this->_ldap->domainsForMaintainerDn($smarty->auth->dn());
+        $domains = $this->_ldap->domainsForMaintainerDn($this->_dn);
         if( is_array($domains) ) {
             $domainfilter='';
             foreach( $domains as $dom ) {

Index: webadmin.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/webadmin.class.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- webadmin.class.php	20 Aug 2007 09:43:15 -0000	1.3
+++ webadmin.class.php	20 Aug 2007 10:11:26 -0000	1.4
@@ -51,6 +51,9 @@
 /** We need some form tools. */
 require_once 'Kolab/Webadmin/form.class.php';
 
+/** Provide access to the users db. */
+require_once 'Kolab/Webadmin/user.class.php';
+
 /**
  * This class combines methods common to most pages of the Kolab web
  * admin frontend.
@@ -79,6 +82,13 @@
     var $_auth;
 
     /**
+     * A class that handles access to the Kolab user db.
+     *
+     * @var KolabUsers
+     */
+    var $_users;
+
+    /**
      * A sieve connection.
      *
      * @var KolabSieve
@@ -86,6 +96,13 @@
     var $_sieve;
 
     /**
+     * The configuration for the webadmin.
+     *
+     * @var array
+     */
+    var $_config;
+
+    /**
      * An array of section accessible to the current user.
      *
      * @var array
@@ -199,9 +216,9 @@
         $this->assign( 'group', $this->_auth->group() );
 
         // Get the menu the user is able to see
-        $this->_menuitems = generate_menu($this->_auth, $params['topdir']);
+        $this->_menuitems = generate_menu($this->_auth, $config['topdir']);
 
-        // Leave it to the calling class to display stuff
+	$this->_config = $config;
     }
 
     /**
@@ -212,13 +229,13 @@
      */
     function domains_valid() 
     {
-        $domains = $this->ldap->domains();
+        $domains = $this->_ldap->domains();
         foreach( $domains as $domain ) {
-            if( !$this->ldap->exists_group( 'hostmaster@' . $domain ) ||
-                !$this->ldap->exists_group( 'postmaster@' . $domain ) ||
-                !$this->ldap->exists_group( 'abuse@' . $domain ) ||
-                !$this->ldap->exists_group( 'virusalert@' . $domain ) ||
-                !$this->ldap->exists_group( 'MAILER-DAEMON@' . $domain ) ) {
+            if( !$this->_ldap->exists_group( 'hostmaster@' . $domain ) ||
+                !$this->_ldap->exists_group( 'postmaster@' . $domain ) ||
+                !$this->_ldap->exists_group( 'abuse@' . $domain ) ||
+                !$this->_ldap->exists_group( 'virusalert@' . $domain ) ||
+                !$this->_ldap->exists_group( 'MAILER-DAEMON@' . $domain ) ) {
                 return false;
             }
         }
@@ -292,7 +309,7 @@
         $this->output_headers();
 
         // Set the visible menu
-        $this->assign( 'menuitems', $this->menuitems );
+        $this->assign( 'menuitems', $this->_menuitems );
 
         // Render the page
         $this->display($template);
@@ -335,12 +352,25 @@
     function getSieve()
     {
         if (empty($this->_sieve)) {
-            $obj = $ldap->read( $auth->dn() );
-            $this->_sieve =& new KolabSieve( $auth->uid(), 
-                                             $auth->password(), 
+            $obj = $this->_ldap->read( $this->_auth->dn() );
+            $this->_sieve =& new KolabSieve( $this->_auth->uid(), 
+                                             $this->_auth->password(), 
                                              $obj['kolabHomeServer'][0] );
         }
-        return $this->_sieve
+        return $this->_sieve;
+    }
+
+    /**
+     * Return a connection to the users class.
+     */
+    function getUsersInterface()
+    {
+        if (empty($this->_users)) {
+            $this->_users =& new KolabUsers( $this->_ldap,
+                                             $this->_auth->dn(),
+                                             $this->_config );
+        }
+        return $this->_users;
     }
 
     /**
@@ -352,7 +382,7 @@
      */
     function htmlentitites($text)
     {
-        return KolabForm::htmlentities($text)
+        return KolabForm::htmlentities($text);
     }
     
 };





More information about the commits mailing list