phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] qmailldap/inc class.soqmailldap.inc.php, 1.19 class.b


From: ceb
Subject: [Phpgroupware-cvs] qmailldap/inc class.soqmailldap.inc.php, 1.19 class.boqmailldap.inc.php, 1.19 class.uiqmailldap.inc.php, 1.16 class.uiuserdata.inc.php, 1.9 hook_preferences.inc.php, 1.7 hook_admin.inc.php, 1.4 hook_about.inc.php, 1.4
Date: Mon, 14 Mar 2005 13:03:00 +0100

Update of qmailldap/inc

Modified Files:
     Branch: MAIN
            class.soqmailldap.inc.php lines: +55 -73
            class.boqmailldap.inc.php lines: +25 -32
            class.uiqmailldap.inc.php lines: +46 -56
            class.uiuserdata.inc.php lines: +47 -64
            hook_preferences.inc.php lines: +0 -0
            hook_admin.inc.php lines: +0 -0
            hook_about.inc.php lines: +0 -0

Log Message:
update 16 to head

====================================================
Index: qmailldap/inc/class.soqmailldap.inc.php
diff -u qmailldap/inc/class.soqmailldap.inc.php:1.18 
qmailldap/inc/class.soqmailldap.inc.php:1.19
--- qmailldap/inc/class.soqmailldap.inc.php:1.18        Mon Jan 17 14:36:54 2005
+++ qmailldap/inc/class.soqmailldap.inc.php     Mon Mar 14 12:03:10 2005
@@ -55,19 +55,17 @@
                        }
                        else
                        {
-                               return false;
+                               return False;
                        }
                }

                function getLDAPData($_serverid)
                {
-                       global $phpgw;
-
                        $storageData = $this->getLDAPStorageData($_serverid);

-                       $ldap = $phpgw->common->ldapConnect();
+                       $ldap = $GLOBALS['phpgw']->common->ldapConnect();
                        $filter = "cn=".$storageData['qmail_servername'];
-
+
                        $sri = 
@ldap_read($ldap,$storageData['ldap_basedn'],$filter);
                        if ($sri)
                        {
@@ -79,8 +77,8 @@

                                $data = array
                                (
-                                       'rcpthosts'     => 
$allValues[0]['rcpthosts'],
-                                       'locals'        => 
$allValues[0]['locals'],
+                                       'rcpthosts'             => 
$allValues[0]['rcpthosts'],
+                                       'locals'                => 
$allValues[0]['locals'],
                                        'smtproutes'    => 
$allValues[0]['smtproutes'],
                                        'ldapbasedn'    => 
$allValues[0]['ldapbasedn'][0]
                                );
@@ -115,11 +113,10 @@
                        }
                        else
                        {
-                               return false;
+                               return False;
                        }
-
                }
-
+
                function getServerList()
                {
                        $query = "select id,qmail_servername,description from 
phpgw_qmailldap";
@@ -128,12 +125,12 @@
                        $i=0;
                        while ($this->db->next_record())
                        {
-                               $serverList[$i]['id']                   = 
$this->db->f('id');
+                               $serverList[$i]['id']                           
= $this->db->f('id');
                                $serverList[$i]['qmail_servername']     = 
$this->db->f('qmail_servername');
                                $serverList[$i]['description']          = 
$this->db->f('description');
                                $i++;
                        }
-
+
                        if ($i>0)
                        {
                                return $serverList;
@@ -146,84 +143,79 @@

                function getUserData($_accountID)
                {
-                       global $phpgw, $phpgw_info;
-
-                       $ldap = $phpgw->common->ldapConnect();
+                       $ldap = $GLOBALS['phpgw']->common->ldapConnect();
                        $filter = "(&(uidnumber=$_accountID))";
-
+
                        $mail_address           = $this->mail_address;
                        $routing_address        = $this->routing_address;

-                       $sri = 
@ldap_search($ldap,$phpgw_info['server']['ldap_context'],$filter);
+                       $sri = 
@ldap_search($ldap,$GLOBALS['phpgw_info']['server']['ldap_context'],$filter);
                        if ($sri)
                        {
                                $allValues = ldap_get_entries($ldap, $sri);
                                if ($allValues['count'] > 0)
                                {
                                        //print "found something<br>";
-                                       $userData["mailLocalAddress"]           
= $allValues[0][$mail_address][0];
-                                       $userData["mailAlternateAddress"]       
= $allValues[0]["mailalternateaddress"];
-                                       $userData["accountStatus"]              
        = $allValues[0]["accountstatus"][0];
-                                       $userData["mailRoutingingAddress"]      
= $allValues[0][$routing_address][0];
-                                       $userData["qmailDotMode"]               
        = $allValues[0]["qmaildotmode"][0];
-                                       $userData["deliveryProgramPath"]        
= $allValues[0]["deliveryprogrampath"][0];
-                                       if 
($userData["mailAlternateAddress"]["count"] == 0)
+                                       $userData['mailLocalAddress']           
= $allValues[0][$mail_address][0];
+                                       $userData['mailAlternateAddress']       
= $allValues[0]['mailalternateaddress'];
+                                       $userData['accountStatus']              
        = $allValues[0]['accountstatus'][0];
+                                       $userData['mailRoutingingAddress']      
= $allValues[0][$routing_address][0];
+                                       $userData['qmailDotMode']               
        = $allValues[0]['qmaildotmode'][0];
+                                       $userData['deliveryProgramPath']        
= $allValues[0]['deliveryprogrampath'][0];
+                                       if 
($userData['mailAlternateAddress']['count'] == 0)
                                        {
-                                               
$userData["mailAlternateAddress"]='';
+                                               
$userData['mailAlternateAddress']='';
                                        }
                                        else
                                        {
-                                               
unset($userData["mailAlternateAddress"]["count"]);
+                                               
unset($userData['mailAlternateAddress']['count']);
                                        }
                                        return $userData;
                                }
                        }
-
                        // if we did not return before, return false
-                       return false;
+                       return False;
                }

                function saveUserData($_accountID, $_accountData)
                {
-                       global $phpgw, $phpgw_info;
-
-                       $ldap = $phpgw->common->ldapConnect();
-                       $filter = "uidnumber=$_accountID";
-
-                       $sri = 
@ldap_search($ldap,$phpgw_info['server']['ldap_context'],$filter);
+                       $ldap = $GLOBALS['phpgw']->common->ldapConnect();
+                       $filter = 'uidnumber=' . $_accountID;
+
+                       $sri = 
@ldap_search($ldap,$GLOBALS['phpgw_info']['server']['ldap_context'],$filter);
                        if ($sri)
                        {
-                               $allValues      = ldap_get_entries($ldap, $sri);
-                               $accountDN      = $allValues[0]['dn'];
-                               $uid            = $allValues[0]['uid'][0];
+                               $allValues              = 
ldap_get_entries($ldap, $sri);
+                               $accountDN              = $allValues[0]['dn'];
+                               $uid                    = 
$allValues[0]['uid'][0];
                                $homedirectory  = 
$allValues[0]['homedirectory'][0];
                        }
                        else
                        {
-                               return false;
+                               return False;
                        }
-
+
                        $mail_address           = $this->mail_address;
                        $routing_address        = $this->routing_address;

                        $newData = array
                        (
-                               $mail_address   => 
$_accountData["mailLocalAddress"],
-                               'objectclass'   => "qmailUser"
+                               $mail_address   => 
$_accountData['mailLocalAddress'],
+                               'objectclass'   => 'qmailUser'
                        );

                        @ldap_mod_add($ldap, $accountDN, $newData);

                        if(empty($homedirectory))
                        {
-                               $homedirectory = "/home/".$uid;
+                               $homedirectory = '/home/' . $uid;
                        }

                        $newData = array
                        (
                                $mail_address           => 
(isset($_accountData['mailLocalAddress'])?$_accountData['mailLocalAddress']:$uid
 . '@localhost'),
                 'homeDirectory'     => $homedirectory,
-                'mailMessageStore'  => $homedirectory."/Maildir/",
+                'mailMessageStore'  => $homedirectory . '/Maildir/',
                 'qmailDotMode'      => 
(isset($_accountData['qmailDotMode'])?$_accountData['qmailDotMode']:'ldaponly')
                        );

@@ -232,25 +224,22 @@
                                $newData['accountStatus'] = 
$_accountData['accountStatus'];
                        }

-                       if ($_accountData["mailAlternateAddress"])
+                       if ($_accountData['mailAlternateAddress'])
                        {
-                               $newData['mailAlternateAddress'] = 
$_accountData["mailAlternateAddress"];
+                               $newData['mailAlternateAddress'] = 
$_accountData['mailAlternateAddress'];
                        }

-                       if ($_accountData["mailRoutingAddress"])
+                       if ($_accountData['mailRoutingAddress'])
                        {
-                               $newData[$routing_address] = 
$_accountData["mailRoutingAddress"];
+                               $newData[$routing_address] = 
$_accountData['mailRoutingAddress'];
                        }

-                       if ($_accountData["deliveryProgramPath"])
+                       if ($_accountData['deliveryProgramPath'])
                        {
-                               $newData['deliveryProgramPath'] = 
$_accountData["deliveryProgramPath"];
+                               $newData['deliveryProgramPath'] = 
$_accountData['deliveryProgramPath'];
                        }
-
                        //_debug_array($newData);
-
                        ldap_mod_replace ($ldap, $accountDN, $newData);
-
                        //print ldap_error($ldap);
                }

@@ -258,24 +247,19 @@
                {
                        switch ($_action)
                        {
-                               case "add_server":
-                                       $query = sprintf("insert into 
phpgw_qmailldap (description, ldap_basedn, qmail_servername)
-                                                       values 
('%s','%s','%s')",
+                               case 'add_server':
+                                       $query = sprintf("insert into 
phpgw_qmailldap (description, ldap_basedn, qmail_servername) values 
('%s','%s','%s')",
                                                        $_data['description'],
                                                        $_data['ldap_basedn'],
-                                                       
$_data["qmail_servername"]);
+                                                       
$_data['qmail_servername']);
                                        $this->db->query($query);
                                        break;
-
-                               case "update_server":
-                                       $query = sprintf("update 
phpgw_qmailldap set
-                                                         description='%s',
-                                                         ldap_basedn='%s',
-                                                         qmail_servername='%s' 
where id='%s'",
+                               case 'update_server':
+                                       $query = sprintf("update 
phpgw_qmailldap set description='%s',ldap_basedn='%s',qmail_servername='%s' 
where id='%s'",
                                                $_data['description'],
                                                $_data['ldap_basedn'],
-                                               $_data["qmail_servername"],
-                                               $_data["id"]);
+                                               $_data['qmail_servername'],
+                                               $_data['id']);
                                        $this->db->query($query);
                                        break;
                        }
@@ -283,28 +267,26 @@

                function writeConfigData($_data, $_serverid)
                {
-                       global $phpgw;
-
                        $storageData = $this->getLDAPStorageData($_serverid);

                        #print "write Data for 
".$storageData['qmail_servername']."<br>";

-                       $ds = $phpgw->common->ldapConnect();
+                       $ds = $GLOBALS['phpgw']->common->ldapConnect();

                        // check if the DN exists, if not create it
                        $filter = "objectclass=*";
                        @ldap_read($ds,$storageData['ldap_basedn'], $filter);
                        if (ldap_errno($ds) == 32)
                        {
-                               $ldapData["objectclass"][0]     = 
"qmailcontrol";
-                               $ldapData["cn"]                 = 
$storageData['qmail_servername'];
+                               $ldapData['objectclass'][0] = 'qmailcontrol';
+                               $ldapData['cn']                 = 
$storageData['qmail_servername'];
                                
ldap_add($ds,$storageData['ldap_basedn'],$ldapData);
                        }

-                       $ldapData['rcpthosts']          = $_data['rcpthosts'];
+                       $ldapData['rcpthosts']  = $_data['rcpthosts'];
                        $ldapData['locals']             = $_data['locals'];
-                       $ldapData['smtproutes']         = $_data['smtproutes'];
-
+                       $ldapData['smtproutes'] = $_data['smtproutes'];
+
                        ldap_modify($ds,$storageData['ldap_basedn'],$ldapData);
                }
        }

====================================================
Index: qmailldap/inc/class.boqmailldap.inc.php
diff -u qmailldap/inc/class.boqmailldap.inc.php:1.18 
qmailldap/inc/class.boqmailldap.inc.php:1.19
--- qmailldap/inc/class.boqmailldap.inc.php:1.18        Mon Jan 17 14:36:54 2005
+++ qmailldap/inc/class.boqmailldap.inc.php     Mon Mar 14 12:03:10 2005
@@ -39,9 +39,7 @@

                function getLDAPData($_serverid, $_nocache=0)
                {
-                       $HTTP_GET_VARS = get_var('HTTP_GET_VARS',array('GET'));
-
-                       if ($HTTP_GET_VARS['nocache'] == '1' || $_nocache == 
'1')
+                       if ($_GET['nocache'] == '1' || $_nocache == '1')
                        {
                                #print "option1<br>";
                                $LDAPData = 
$this->soqmailldap->getLDAPData($_serverid);
@@ -107,17 +105,13 @@
                        #print "restored Session<br>";
                }

-               function save($_postVars, $_getVars)
+               function save($values)
                {
-                       $serverid = $_getVars['serverid'];
-
-                       if (isset($_postVars['bo_action']))
-                       {
-                               $bo_action = $_postVars['bo_action'];
-                       }
-                       elseif (isset($_getVars['bo_action']))
+                       $serverid = $values['serverid'];
+
+                       if (isset($values['bo_action']))
                        {
-                               $bo_action = $_getVars['bo_action'];
+                               $bo_action = $values['bo_action'];
                        }
                        else
                        {
@@ -130,18 +124,18 @@
                        {
                                case 'add_locals':
                                        $count = 
count($this->sessionData[$serverid]['locals']);
-                                       
$this->sessionData[$serverid]['locals'][$count] = $_postVars['new_local'];
+                                       
$this->sessionData[$serverid]['locals'][$count] = $values['new_local'];
                                        
$this->sessionData[$serverid]['needActivation'] = 1;
                                        $this->saveSessionData();
                                        break;
                                case 'add_rcpthosts':
                                        $count = 
count($this->sessionData[$serverid]['rcpthosts']);
-                                       
$this->sessionData[$serverid]['rcpthosts'][$count] = $_postVars['new_rcpthost'];
-                                       if ($_postVars['add_to_local'] == 'on')
+                                       
$this->sessionData[$serverid]['rcpthosts'][$count] = $values['new_rcpthost'];
+                                       if ($values['add_to_local'] == 'on')
                                        {
                                                $count = 
count($this->sessionData[$serverid]['locals']);

-                                               
$this->sessionData[$serverid]['locals'][$count] = $_postVars['new_rcpthost'];
+                                               
$this->sessionData[$serverid]['locals'][$count] = $values['new_rcpthost'];
                                        }
                                        
$this->sessionData[$serverid]['needActivation'] = 1;
                                        $this->saveSessionData();
@@ -151,9 +145,9 @@

                                        
$this->sessionData[$serverid]['smtproutes'][$count] =
                                                sprintf("%s:%s:%s",
-                                                       
$_postVars['domain_name'],
-                                                       
$_postVars['remote_server'],
-                                                       
$_postVars['remote_port']
+                                                       $values['domain_name'],
+                                                       
$values['remote_server'],
+                                                       $values['remote_port']
                                                );
                                        
$this->sessionData[$serverid]['needActivation'] = 1;
                                        $this->saveSessionData();
@@ -164,7 +158,7 @@
                                        while(list($key, $value) = 
each($this->sessionData[$serverid]['locals']))
                                        {
                                                #print ".. $key: $value<br>";
-                                               if ($key != 
$_postVars['locals'])
+                                               if ($key != $values['locals'])
                                                {
                                                        $newLocals[$i]=$value;
                                                        #print "!! $i: 
$value<br>";
@@ -181,11 +175,11 @@
                                        while(list($key, $value) = 
each($this->sessionData[$serverid]['rcpthosts']))
                                        {
                                                #print ".. $key: $value<br>";
-                                               if ($key != 
$_postVars['rcpthosts'])
+                                               if ($key != 
$values['rcpthosts'])
                                                {
                                                        
$newRcpthosts[$i]=$value;
                                                        #print "!! $i: 
$value<br>";
-                                                       $i++;
+                                                       ++$i;
                                                }
                                        }
                                        
$this->sessionData[$serverid]['rcpthosts'] = $newRcpthosts;
@@ -194,15 +188,14 @@
                                        break;
                                case 'remove_smtproute':
                                        $i=0;
-
                                        while(list($key, $value) = 
each($this->sessionData[$serverid]['smtproutes']))
                                        {
                                                #print ".. $key: $value : 
".$_getVars["smtproute_id"]."<br>";
-                                               if ($key != 
$_getVars['smtproute_id'])
+                                               if ($key != 
$values['smtproute_id'])
                                                {
                                                        
$newSmtproutes[$i]=$value;
                                                        #print "!! $i: 
$value<br>";
-                                                       $i++;
+                                                       ++$i;
                                                }
                                        }
                                        
$this->sessionData[$serverid]['smtproutes'] = $newSmtproutes;
@@ -213,12 +206,12 @@
                                        #print "hallo".$_getVars["serverid"]." 
".$_postVars["servername"]."<br>";
                                        $data = array
                                        (
-                                               'qmail_servername'      => 
$_postVars['qmail_servername'],
-                                               'description'           => 
$_postVars['description'],
-                                               'ldap_basedn'           => 
$_postVars['ldap_basedn'],
-                                               'id'                            
=> $_getVars['serverid']
+                                               'qmail_servername'      => 
$values['qmail_servername'],
+                                               'description'           => 
$values['description'],
+                                               'ldap_basedn'           => 
$values['ldap_basedn'],
+                                               'id'                            
=> $values['serverid']
                                        );
-                                       if (!isset($_getVars['serverid']))
+                                       if (!isset($values['serverid']))
                                        {
                                                
$this->soqmailldap->update('add_server',$data);
                                        }
@@ -226,7 +219,7 @@
                                        {
                                                
$this->soqmailldap->update('update_server',$data);
                                        }
-                                       
$this->getLDAPData($_getVars['serverid'],'1');
+                                       
$this->getLDAPData($values['serverid'],'1');
                                        break;
                                case 'write_to_ldap':
                                        
$this->soqmailldap->writeConfigData($this->sessionData[$serverid], $serverid);

====================================================
Index: qmailldap/inc/class.uiqmailldap.inc.php
diff -u qmailldap/inc/class.uiqmailldap.inc.php:1.15 
qmailldap/inc/class.uiqmailldap.inc.php:1.16
--- qmailldap/inc/class.uiqmailldap.inc.php:1.15        Mon Jan 17 14:36:54 2005
+++ qmailldap/inc/class.uiqmailldap.inc.php     Mon Mar 14 12:03:10 2005
@@ -1,6 +1,6 @@
 <?php
        
/***************************************************************************\
-       * phpGroupWare - Notes                                                  
    *
+       * phpGroupWare - QMailLDAP                                              
    *
        * http://www.phpgroupware.org                                           
    *
        * Written by: Lars Kneschke address@hidden                            *
        * ----------------------------------------------                        
    *
@@ -26,17 +26,14 @@

                function uiqmailldap()
                {
-                       $this->cats                             = 
CreateObject('phpgwapi.categories');
-                       $this->nextmatchs               = 
CreateObject('phpgwapi.nextmatchs');
-                       $this->boqmailldap              = 
CreateObject('qmailldap.boqmailldap');
-
-                       $this->rowColor[0]              = 
$GLOBALS['phpgw_info']['theme']['row_on'];
-                       $this->rowColor[1]              = 
$GLOBALS['phpgw_info']['theme']['row_off'];
+                       //$this->cats           = 
CreateObject('phpgwapi.categories');
+                       $this->nextmatchs       = 
CreateObject('phpgwapi.nextmatchs');
+                       $this->boqmailldap      = 
CreateObject('qmailldap.boqmailldap');

-                       $this->dataRowColor[0]  = 
$GLOBALS['phpgw_info']['theme']['bg01'];
-                       $this->dataRowColor[1]  = 
$GLOBALS['phpgw_info']['theme']['bg02'];
+                       $this->rowColor[0]      = 
$GLOBALS['phpgw_info']['theme']['row_on'];
+                       $this->rowColor[1]      = 
$GLOBALS['phpgw_info']['theme']['row_off'];
                }
-
+
                function addServer()
                {
                        $this->display_app_header();
@@ -62,17 +59,13 @@
                                'menuaction' => 'qmailldap.uiqmailldap.save'
                        );
                        
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php',$linkData));
-
                        $GLOBALS['phpgw']->template->pfp('out','main');
                }

                function addSmtpRoute()
                {
                        $this->display_app_header();
-
                        $this->translate();
-
-                       $GLOBALS['phpgw']->common->phpgw_footer();
                }

                function createMenu($_serverid, $_pagenumber, $_ldapData)
@@ -108,7 +101,7 @@

                        reset($menu);
                        $i=0;
-                       while (list($key,$value) = each($menu))
+                       foreach($menu as $key => $value)
                        {
                                
$GLOBALS['phpgw']->template->set_var('menu_description',$value['name']);
                                $linkData = array
@@ -127,7 +120,7 @@
                                {
                                        
$GLOBALS['phpgw']->template->parse('menu_rows','menu_row',True);
                                }
-                               $i++;
+                               ++$i;
                        }

                        if ($_ldapData['needActivation'] == 1)
@@ -154,10 +147,10 @@

                function deleteServer()
                {
-                       
$this->boqmailldap->deleteServer($GLOBALS['HTTP_GET_VARS']['serverid']);
+                       $this->boqmailldap->deleteServer($_GET['serverid']);
                        $this->listServers();
                }
-
+
                function display_app_header()
                {
                        $GLOBALS['phpgw']->common->phpgw_header();
@@ -167,7 +160,6 @@
                function editServer($_serverid='', $_pagenumber='')
                {
                        $serverid               = 
get_var('serverid',array('POST','GET'));
-                       $HTTP_GET_VARS  = get_var('HTTP_GET_VARS',array('GET'));
                        $pagenumber             = 
get_var('pagenumber',array('POST','GET'));

                        if(!empty($_serverid))
@@ -194,7 +186,7 @@
                        (
                                'menuaction'    => 'qmailldap.uiqmailldap.save',
                                'pagenumber'    => $pagenumber,
-                               'serverid'      => $serverid
+                               'serverid'              => $serverid
                        );
                        
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php',$linkData));

@@ -203,39 +195,32 @@
                                case '0':
                                        if (count($ldapData['rcpthosts']) > 0)
                                        {
-                                               $selectBox  = "<select 
size=\"10\" name=\"rcpthosts\">\n";
-                                               for ($i=0;$i < 
count($ldapData['rcpthosts']); $i++)
+                                               $selectBox  = '<select 
size="10" name="values[rcpthosts]">' . "\n";
+                                               for ($i=0;$i < 
count($ldapData['rcpthosts']);++$i)
                                                {
-                                                       $selectBox .= "<option 
value=\"$i\">".
-                                                                       
$ldapData['rcpthosts'][$i].
-                                                                       
"</option>\n";
+                                                       $selectBox .= '<option 
value="' . $i .'">' . $ldapData['rcpthosts'][$i] . '</option>' . "\n";
                                                }
-                                               $selectBox .= "</select>\n";
+                                               $selectBox .= '</select>' . 
"\n";
                                                
$GLOBALS['phpgw']->template->set_var('rcpt_selectbox',$selectBox);
                                        }
                                        else
                                        {
-                                               
$GLOBALS['phpgw']->template->set_var('rcpt_selectbox',
-                                                       "<b>" . lang("We don't 
accept any email!") . "</b>");
+                                               
$GLOBALS['phpgw']->template->set_var('rcpt_selectbox','<b>' . lang('We do not 
accept any email') . '</b>');
                                        }

-
                                        if (count($ldapData['locals']) > 0)
                                        {
-                                               $selectBox  = "<select 
size=\"10\" name=\"locals\">\n";
-                                               for ($i=0;$i < 
count($ldapData['locals']); $i++)
+                                               $selectBox  = '<select 
size="10" name="values[locals]">' . "\n";
+                                               for ($i=0;$i < 
count($ldapData['locals']);++$i)
                                                {
-                                                       $selectBox .= "<option 
value=\"$i\">".
-                                                                       
$ldapData['locals'][$i].
-                                                                       
"</option>\n";
+                                                       $selectBox .= '<option 
value="' . $i . '">' . $ldapData['locals'][$i] . '</option>' . "\n";
                                                }
-                                               $selectBox .= "</select>\n";
+                                               $selectBox .= '</select>' . 
"\n";
                                                
$GLOBALS['phpgw']->template->set_var('locals_selectbox',$selectBox);
                                        }
                                        else
                                        {
-                                               
$GLOBALS['phpgw']->template->set_var('locals_selectbox',
-                                                       "<b>".lang('We do not 
deliver any email locally !')."</b>");
+                                               
$GLOBALS['phpgw']->template->set_var('locals_selectbox','<b>' . lang('We do not 
deliver any email locally') . '</b>');
                                        }
                                        break;
                                case '15':
@@ -243,13 +228,13 @@

                                        if (count($ldapData['smtproutes']) > 0)
                                        {
-                                               for ($i=0;$i < 
count($ldapData['smtproutes']); $i++)
+                                               for 
($i=0;$i<count($ldapData['smtproutes']);++$i)
                                                {
                                                        $smtproute = 
explode(':',$ldapData['smtproutes'][$i]);
                                                        
$GLOBALS['phpgw']->template->set_var('domain_name',$smtproute[0]);
                                                        
$GLOBALS['phpgw']->template->set_var('remote_server',$smtproute[1]);
                                                        
$GLOBALS['phpgw']->template->set_var('remote_port',$smtproute[2]);
-                                                       
$GLOBALS['phpgw']->template->set_var('row_color',$this->dataRowColor[($i)%2]);
+
                                                        $linkData = array
                                                        (
                                                                'menuaction'    
=> 'qmailldap.uiqmailldap.save',
@@ -258,6 +243,7 @@
                                                                'pagenumber'    
=> 15,
                                                                'serverid'      
        => $serverid
                                                        );
+                                                       
$this->nextmatchs->template_alternate_row_color(&$GLOBALS['phpgw']->template);
                                                        
$GLOBALS['phpgw']->template->set_var('delete_route_link',$GLOBALS['phpgw']->link('/index.php',$linkData));
                                                        
$GLOBALS['phpgw']->template->parse('smtproute_rows','smtproute_row',True);
                                                }
@@ -269,7 +255,6 @@
                                                'pagenumber'    => 15,
                                                'serverid'              => 
$serverid
                                        );
-                                       
$GLOBALS['phpgw']->template->set_var('last_row_color',$this->dataRowColor[($i)%2]);
                                        
$GLOBALS['phpgw']->template->set_var('add_route_link',$GLOBALS['phpgw']->link('/index.php',$linkData));
                                        break;
                                case '20':
@@ -291,8 +276,7 @@

                function editSettings($_serverid='')
                {
-                       $serverid               = 
get_var('serverid',array('POST','GET'));
-                       $HTTP_GET_VARS  = get_var('HTTP_GET_VARS',array('GET'));
+                       $serverid = get_var('serverid',array('POST','GET'));

                        if(!empty($_serverid))
                        {
@@ -352,22 +336,22 @@

                        if ($serverList)
                        {
-                               for ($i=0; $i < count($serverList); $i++)
+                               for ($i=0; $i < count($serverList);++$i)
                                {
                                        
$GLOBALS['phpgw']->template->set_var('server_name',$serverList[$i]['qmail_servername']);
                                        
$GLOBALS['phpgw']->template->set_var('server_description',$serverList[$i]['description']);
                                        $linkData = array
                                        (
                                                'menuaction'    => 
'qmailldap.uiqmailldap.editServer',
-                                               'nocache'               => '1',
-                                               'pagenumber'    => '0',
+                                               'nocache'               => 1,
+                                               'pagenumber'    => 0,
                                                'serverid'              => 
$serverList[$i]['id']
                                        );
                                        
$GLOBALS['phpgw']->template->set_var('edit_link',$GLOBALS['phpgw']->link('/index.php',$linkData));
                                        $linkData = array
                                        (
                                                'menuaction'    => 
'qmailldap.uiqmailldap.editSettings',
-                                               'nocache'               => '1',
+                                               'nocache'               => 1,
                                                'serverid'              => 
$serverList[$i]['id']
                                        );
                                        
$GLOBALS['phpgw']->template->set_var('settings_link',$GLOBALS['phpgw']->link('/index.php',$linkData));
@@ -377,34 +361,40 @@
                                                'serverid'              => 
$serverList[$i]['id']
                                        );
                                        
$GLOBALS['phpgw']->template->set_var('delete_link',$GLOBALS['phpgw']->link('/index.php',$linkData));
-                                       
$GLOBALS['phpgw']->template->set_var('row_color',$this->rowColor[$i%2]);
+                                       
$this->nextmatchs->template_alternate_row_color(&$GLOBALS['phpgw']->template);
                                        
$GLOBALS['phpgw']->template->parse('rows','row',True);
                                }
                        }

                        $linkData = array
                        (
-                               'menuaction'    => 
'qmailldap.uiqmailldap.addServer'
+                               'menuaction' => 
'qmailldap.uiqmailldap.addServer'
                        );
                        
$GLOBALS['phpgw']->template->set_var('add_link',$GLOBALS['phpgw']->link('/index.php',$linkData));
-
                        $GLOBALS['phpgw']->template->pfp('out','main');
                }

-
                function save()
                {
-                       $HTTP_POST_VARS = 
get_var('HTTP_POST_VARS',array('POST'));
-                       $HTTP_GET_VARS  = get_var('HTTP_GET_VARS',array('GET'));
+                       $bo_action      = 
get_var('bo_action',array('POST','GET'));
+                       $serverid       = 
get_var('serverid',array('POST','GET'));
+                       $pagenumber     = 
get_var('pagenumber',array('POST','GET'));
+                       $smtproute_id = $_GET['smtproute_id'];
+
+                       $values = get_var('values',array('POST','GET'));
+
+                       $values['bo_action']    = $bo_action;
+                       $values['serverid']             = $serverid;
+                       $values['smtproute_id'] = $_GET['smtproute_id'];

-                       $this->boqmailldap->save($HTTP_POST_VARS, 
$HTTP_GET_VARS);
-                       if ($HTTP_POST_VARS['bo_action'] == 'save_ldap' || 
$HTTP_GET_VARS['bo_action'] == 'save_ldap')
+                       $this->boqmailldap->save($values);
+                       if ($bo_action == 'save_ldap')
                        {
                                $this->listServers();
                        }
                        else
                        {
-                               
$this->editServer($HTTP_GET_VARS['serverid'],$HTTP_GET_VARS['pagenumber']);
+                               $this->editServer($serverid,$pagenumber);
                        }
                }


====================================================
Index: qmailldap/inc/class.uiuserdata.inc.php
diff -u qmailldap/inc/class.uiuserdata.inc.php:1.8 
qmailldap/inc/class.uiuserdata.inc.php:1.9
--- qmailldap/inc/class.uiuserdata.inc.php:1.8  Mon Jan 17 14:36:54 2005
+++ qmailldap/inc/class.uiuserdata.inc.php      Mon Mar 14 12:03:10 2005
@@ -2,7 +2,6 @@
        
/***************************************************************************\
        * phpGroupWare - QMailLDAP                                              
    *
        * http://www.phpgroupware.org                                           
    *
-       * http://www.linux-at-work.de                                           
    *
        * Written by : Lars Kneschke address@hidden                   *
        * -------------------------------------------------------               
    *
        * This program is free software; you can redistribute it and/or modify 
it   *
@@ -23,84 +22,61 @@
                function uiuserdata()
                {
                        $this->boqmailldap      = 
CreateObject('qmailldap.boqmailldap');
-
-                       $this->rowColor[0]      = 
$GLOBALS['phpgw_info']["theme"]["bg01"];
-                       $this->rowColor[1]      = 
$GLOBALS['phpgw_info']["theme"]["bg02"];
-
                }
-
+
                function display_app_header()
                {
                        $GLOBALS['phpgw']->common->phpgw_header();
                        echo parse_navbar();
                }

-               function editUserData($_useCache='0')
+               function editUserData($_useCache = False)
                {
-                       $HTTP_GET_VARS = get_var('HTTP_GET_VARS',array('GET'));
-
-                       $accountID = $HTTP_GET_VARS['account_id'];
+                       $account_id = get_var('account_id',array('GET'));

                        $this->display_app_header();
-
                        $this->translate();
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('qmailldap') . ': ' . lang('edit user data');

-
                        
$GLOBALS['phpgw']->template->set_file(array('editUserData' => 
'edituserdata.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('editUserData','form','form');
                        
$GLOBALS['phpgw']->template->set_block('editUserData','link_row','link_row');
-
-                       
$GLOBALS['phpgw']->template->set_var('lang_email_config',lang('edit email 
settings'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_emailAddress',lang('email address'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_emailaccount_active',lang('email 
account active'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_mailAlternateAddress',lang('alternate
 email address'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_mailRoutingAddress',lang('forward 
emails to'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_forward_also_to',lang('forward also 
to'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_button',lang('save'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_deliver_extern',lang('deliver 
extern'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_edit_email_settings',lang('edit 
email settings'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_ready',lang('Done'));
                        
$GLOBALS['phpgw']->template->set_var('link_back',$GLOBALS['phpgw']->link('/admin/accounts.php'));

                        $linkData = array
                        (
                                'menuaction'    => 
'qmailldap.uiuserdata.saveUserData',
-                               'account_id'    => $accountID
+                               'account_id'    => $account_id
                        );
                        
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php',$linkData));

                        // only when we show a existing user
-                       if($userData = 
$this->boqmailldap->getUserData($accountID, $_useCache))
+                       if($userData = 
$this->boqmailldap->getUserData($account_id, $_useCache))
                        {
                                if ($userData['mailAlternateAddress'] != '')
                                {
-                                       $options_mailAlternateAddress = 
"<select size=\"6\" name=\"mailAlternateAddress\">\n";
+                                       $options_mailAlternateAddress = 
'<select size="6" name="mailAlternateAddress">' . "\n";
                                        for ($i=0;$i < 
count($userData['mailAlternateAddress']); $i++)
                                        {
-                                               $options_mailAlternateAddress 
.= "<option value=\"$i\">".
-                                                       
$userData['mailAlternateAddress'][$i].
-                                                       "</option>\n";
+                                               $options_mailAlternateAddress 
.= '<option value="' . $i . '">' . $userData['mailAlternateAddress'][$i] . 
'</option>' . "\n";
                                        }
-                                       $options_mailAlternateAddress .= 
"</select>\n";
+                                       $options_mailAlternateAddress .= 
'</select>' . "\n";
                                }
                                else
                                {
                                        $options_mailAlternateAddress = 
lang('no alternate email address');
                                }
-
+
                                
$GLOBALS['phpgw']->template->set_var('mailLocalAddress',$userData['mailLocalAddress']);
                                
$GLOBALS['phpgw']->template->set_var('mailAlternateAddress','');
                                
$GLOBALS['phpgw']->template->set_var('options_mailAlternateAddress',$options_mailAlternateAddress);
                                
$GLOBALS['phpgw']->template->set_var('mailRoutingAddress',$userData['mailRoutingAddress']);
                                
$GLOBALS['phpgw']->template->set_var('selected_'.$userData['qmailDotMode'],'selected');
-                               
$GLOBALS['phpgw']->template->set_var('deliveryProgramPath',$userData["deliveryProgramPath"]);
+                               
$GLOBALS['phpgw']->template->set_var('deliveryProgramPath',$userData['deliveryProgramPath']);

                                
$GLOBALS['phpgw']->template->set_var('uid',rawurlencode($_accountData['dn']));
-                               if ($userData['accountStatus'] == 'active')
-                                       
$GLOBALS['phpgw']->template->set_var('account_checked','checked');
-                               if ($_accountData['deliverExtern'] == 'active')
-                                       
$GLOBALS['phpgw']->template->set_var('deliver_checked','checked');
+                               
$GLOBALS['phpgw']->template->set_var('account_checked',($userData['accountStatus']
 == 'active'?'checked':''));
+                               
$GLOBALS['phpgw']->template->set_var('deliver_checked',($_accountData['deliverExtern']
 == 'active'?'checked':''));
                        }
                        else
                        {
@@ -114,37 +90,35 @@
                        // create the menu on the left, if needed
                        $menuClass = CreateObject('admin.uimenuclass');
                        
$GLOBALS['phpgw']->template->set_var('rows',$menuClass->createHTMLCode('edit_user'));
-
                        $GLOBALS['phpgw']->template->pfp('out','form');
-
                }
-
+
                function saveUserData()
                {
-                       $HTTP_POST_VARS = 
get_var('HTTP_POST_VARS',array('POST'));
-                       $HTTP_GET_VARS  = get_var('HTTP_GET_VARS',array('GET'));
-
-                       if($HTTP_POST_VARS['accountStatus'] == 'on')
-                       {
-                               $accountStatus = 'active';
-                       }
-
                        $formData = array
                        (
-                               'mailLocalAddress'                              
=> $HTTP_POST_VARS['mailLocalAddress'],
-                               'mailRoutingAddress'                    => 
$HTTP_POST_VARS['mailRoutingAddress'],
-                               'add_mailAlternateAddress'              => 
$HTTP_POST_VARS['mailAlternateAddressInput'],
-                               'remove_mailAlternateAddress'   => 
$HTTP_POST_VARS['mailAlternateAddress'],
-                               'qmailDotMode'                                  
=> $HTTP_POST_VARS['qmailDotMode'],
-                               'deliveryProgramPath'                   => 
$HTTP_POST_VARS['deliveryProgramPath'],
-                               'accountStatus'                                 
=> $accountStatus
+                               'mailLocalAddress'                              
=> $_POST['mailLocalAddress'],
+                               'mailRoutingAddress'                    => 
$_POST['mailRoutingAddress'],
+                               'add_mailAlternateAddress'              => 
$_POST['mailAlternateAddressInput'],
+                               'remove_mailAlternateAddress'   => 
$_POST['mailAlternateAddress'],
+                               'qmailDotMode'                                  
=> $_POST['qmailDotMode'],
+                               'deliveryProgramPath'                   => 
$_POST['deliveryProgramPath'],
+                               'accountStatus'                                 
=> $_POST['accountStatus']
                        );
-
-                       if($HTTP_POST_VARS['add_mailAlternateAddress']) 
$bo_action='add_mailAlternateAddress';
-                       if($HTTP_POST_VARS['remove_mailAlternateAddress']) 
$bo_action='remove_mailAlternateAddress';
-                       if($HTTP_POST_VARS['save']) $bo_action='save';

-                       
$this->boqmailldap->saveUserData($HTTP_GET_VARS['account_id'], $formData, 
$bo_action);
+                       if($_POST['save'])
+                       {
+                               $bo_action='save';
+                       }
+                       elseif($_POST['add_mailAlternateAddress'])
+                       {
+                               $bo_action='add_mailAlternateAddress';
+                       }
+                       elseif($_POST['remove_mailAlternateAddress'])
+                       {
+                               $bo_action='remove_mailAlternateAddress';
+                       }
+                       $this->boqmailldap->saveUserData($_GET['account_id'], 
$formData, $bo_action);

                        if ($bo_action == 'save')
                        {
@@ -154,23 +128,32 @@
                        else
                        {
                                // use cached data
-                               $this->editUserData('1');
+                               $this->editUserData(True);
                        }
                }
-
+
                function translate()
                {
                        
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
                        
$GLOBALS['phpgw']->template->set_var('tr_color1',$GLOBALS['phpgw_info']['theme']['row_on']);
                        
$GLOBALS['phpgw']->template->set_var('tr_color2',$GLOBALS['phpgw_info']['theme']['row_off']);
                        
$GLOBALS['phpgw']->template->set_var('lang_add',lang('add'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Done'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_remove',lang('remove'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_save',lang('save'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_done',lang('done'));
                        
$GLOBALS['phpgw']->template->set_var('lang_remove',lang('remove'));
                        
$GLOBALS['phpgw']->template->set_var('lang_advanced_options',lang('advanced 
options'));
                        
$GLOBALS['phpgw']->template->set_var('lang_qmaildotmode',lang('qmaildotmode'));
                        
$GLOBALS['phpgw']->template->set_var('lang_default',lang('default'));
                        
$GLOBALS['phpgw']->template->set_var('lang_deliveryProgramPath',lang('deliveryProgramPath'));
+
+                       
$GLOBALS['phpgw']->template->set_var('lang_email_config',lang('edit email 
settings'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_emailAddress',lang('email address'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_emailaccount_active',lang('email 
account active'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_mailAlternateAddress',lang('alternate
 email address'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_mailRoutingAddress',lang('forward 
emails to'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_forward_also_to',lang('forward also 
to'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_deliver_extern',lang('deliver 
extern'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_edit_email_settings',lang('edit 
email settings'));
                }
        }
 ?>

====================================================

====================================================

====================================================






reply via email to

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