phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [20980] Improvement: convert deprecated - 4512:4565


From: Sigurd Nes
Subject: [Phpgroupware-cvs] [20980] Improvement: convert deprecated - 4512:4565
Date: Fri, 22 Jan 2010 09:51:24 +0000

Revision: 20980
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20980
Author:   sigurdne
Date:     2010-01-22 09:51:24 +0000 (Fri, 22 Jan 2010)
Log Message:
-----------
Improvement: convert deprecated  - 4512:4565

Modified Paths:
--------------
    people/sigurdne/modules/phpgwapi/trunk/inc/class.preferences.inc.php
    people/sigurdne/modules/phpgwapi/trunk/inc/sso/include_login.inc.php

Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.preferences.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.preferences.inc.php        
2010-01-22 09:50:50 UTC (rev 20979)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.preferences.inc.php        
2010-01-22 09:51:24 UTC (rev 20980)
@@ -12,7 +12,7 @@
 
        /**
         * Preferences class for setting application preferences
-        * 
+        *
         * @package phpgwapi
         * @subpackage application
         * @internal the prefs are read into 4 arrays:
@@ -24,15 +24,15 @@
        class preferences
        {
                /**
-                * @var account_id 
+                * @var account_id
                 */
                var $account_id;
                /**
-                * @var account_type 
+                * @var account_type
                 */
                var $account_type;
                /**
-                * @var data effectiv user prefs, used by all apps 
+                * @var data effectiv user prefs, used by all apps
                 */
                var $data = array();
 
@@ -42,19 +42,19 @@
                var $debug = false;
 
                /**
-                * @var user set user prefs for saveing (no defaults/forced 
prefs merged) 
+                * @var user set user prefs for saveing (no defaults/forced 
prefs merged)
                 */
                var $user = array();
                /**
-                * @var default default prefs 
+                * @var default default prefs
                 */
                var $default = array();
                /**
-                * @var forced forced prefs 
+                * @var forced forced prefs
                 */
                var $forced = array();
                /**
-                * @var db 
+                * @var db
                 */
                var $db;
 
@@ -170,10 +170,10 @@
                                'fullname'  => $user->__toString(),
                                'firstname' => $user->firstname,
                                'lastname'  => $user->lastname,
-                                       'domain'    => 
$GLOBALS['phpgw_info']['server']['mail_suffix'],
-                                       'email'     => 
$this->email_address($this->account_id),
-                                       'date'      => 
$GLOBALS['phpgw']->common->show_date('',$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
-                                       );
+                               'domain'    => 
$GLOBALS['phpgw_info']['server']['mail_suffix'],
+                               'email'     => 
$this->email_address($this->account_id),
+                               'date'      => 
$GLOBALS['phpgw']->common->show_date('',$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
+                       );
                        // do this first, as it might be already contain some 
substitues
                        //
                        $this->values['email'] = 
$this->parse_notify($this->values['email']);
@@ -181,13 +181,13 @@
                        // langs have to be in common !!!
                        $this->vars = array
                        (
-                                       'fullname'  => lang('name of the user, 
eg. %1',$this->values['fullname']),
-                                       'firstname' => lang('first name of the 
user, eg. %1',$this->values['firstname']),
-                                       'lastname'  => lang('last name of the 
user, eg. %1',$this->values['lastname']),
-                                       'domain'    => lang('domain name for 
mail-address, eg. %1',$this->values['domain']),
-                                       'email'     => lang('email-address of 
the user, eg. %1',$this->values['email']),
-                                       'date'      => lang('todays date, eg. 
%1',$this->values['date'])
-                                       );
+                               'fullname'  => lang('name of the user, eg. 
%1',$this->values['fullname']),
+                               'firstname' => lang('first name of the user, 
eg. %1',$this->values['firstname']),
+                               'lastname'  => lang('last name of the user, eg. 
%1',$this->values['lastname']),
+                               'domain'    => lang('domain name for 
mail-address, eg. %1',$this->values['domain']),
+                               'email'     => lang('email-address of the user, 
eg. %1',$this->values['email']),
+                               'date'      => lang('todays date, eg. 
%1',$this->values['date'])
+                       );
                        // do the substituetion in the effective prefs (data)
                        //
                        foreach($this->data as $app => $data)
@@ -232,7 +232,7 @@
                                }
                                else
                                {
-                                       $arr[$key] = stripslashes($value);      
+                                       $arr[$key] = stripslashes($value);
                                }
                        }
                }
@@ -269,30 +269,30 @@
                        {
                                $this->db->query('SELECT * FROM 
phpgw_preferences WHERE preference_owner IN 
(-1,-2,'.intval($this->account_id).')',__LINE__,__FILE__);
 
-                                               $this->forced = $this->default 
= $this->user = array();
-                                               while($this->db->next_record())
-                                               {
-                                               // The following ereg is 
required for PostgreSQL to work
-                                               $app = ereg_replace(' 
','',$this->db->f('preference_app'));
-                                               $value = 
unserialize($this->db->f('preference_value'));
-                                               $this->unquote($value);
-                                               if (!is_array($value))
-                                               {
+                               $this->forced = $this->default = $this->user = 
array();
+                               while($this->db->next_record())
+                               {
+                                       // The following ereg is required for 
PostgreSQL to work
+                                       $app = str_replace(' 
','',$this->db->f('preference_app'));
+                                       $value = 
unserialize($this->db->f('preference_value'));
+                                       $this->unquote($value);
+                                       if (!is_array($value))
+                                       {
                                                continue;
-                                               }
-                                               
switch($this->db->f('preference_owner'))
-                                               {
+                                       }
+                                       switch($this->db->f('preference_owner'))
+                                       {
                                                case -1:        // forced
-                                               $this->forced[$app] = $value;
-                                               break;
+                                                       $this->forced[$app] = 
$value;
+                                                       break;
                                                case -2:        // default
-                                               $this->default[$app] = $value;
-                                               break;
+                                                       $this->default[$app] = 
$value;
+                                                       break;
                                                default:        // user
-                                               $this->user[$app] = $value;
-                                               break;
-                                               }
-                                               }
+                                                       $this->user[$app] = 
$value;
+                                                       break;
+                                       }
+                               }
 
                                if 
($GLOBALS['phpgw']->acl->check('session_only_preferences',1,'preferences'))
                                {
@@ -339,7 +339,7 @@
                                echo "user<pre>";    print_r($this->user); echo 
"</pre>\n";
                                echo "forced<pre>";  print_r($this->forced); 
echo "</pre>\n";
                                echo "default<pre>"; print_r($this->default); 
echo "</pre>\n";
-                               echo "effectiv<pre>";print_r($this->data); echo 
"</pre>\n"; 
+                               echo "effectiv<pre>";print_r($this->data); echo 
"</pre>\n";
                        }
                        return $this->data;
                }
@@ -564,7 +564,7 @@
                 * save the the preferences to the repository
                 *
                 * @param $update_session_info old param, seems not to be used
-                * @param $type which prefs to update: user/default/forced 
+                * @param $type which prefs to update: user/default/forced
                 * the user prefs for saveing are in $this->user not in 
$this->data, which are the effectiv prefs only
                 */
                public function save_repository($update_session_info = 
False,$type='user')
@@ -597,7 +597,7 @@
                                }
                                else
                                {
-                               $this->db->transaction_begin();
+                                       $this->db->transaction_begin();
                                }
 
                                $this->db->query("delete from phpgw_preferences 
where preference_owner='$account_id'",
@@ -617,9 +617,9 @@
 
                                if ( !$this->global_lock )
                                {
-                               $this->db->transaction_commit();
+                                       $this->db->transaction_commit();
+                               }
                        }
-                       }
                        else
                        {
                                switch($type)
@@ -677,7 +677,7 @@
                /**
                 * update the preferences array
                 *
-                * 
+                *
                 * @param $data array of preferences
                 */
                public function update_data($data)
@@ -724,37 +724,37 @@
                                $preferences_update = True;
                        }
                        /* This takes care of new users who dont have proper 
default prefs setup */
-                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) 
|| 
+                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) ||
                                        
!$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'])
                        {
                                $this->add('common','maxmatchs',15);
                                $preferences_update = True;
                        }
-                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme']) || 
+                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme']) ||
                                        
!$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'])
                        {
                                $this->add('common','theme','default');
                                $preferences_update = True;
                        }
-                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'])
 || 
+                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'])
 ||
                                        
!$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'])
                        {
                                $this->add('common','template_set','verdilak');
                                $preferences_update = True;
                        }
-                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) 
|| 
+                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) 
||
                                        
!$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
                        {
                                $this->add('common','dateformat','d-M-Y');
                                $preferences_update = True;
                        }
-                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat']) 
|| 
+                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat']) 
||
                                        
!$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'])
                        {
                                $this->add('common','timeformat',12);
                                $preferences_update = True;
                        }
-                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) || 
+                       if 
(!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) ||
                                        
!$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
                        {
                                
$this->add('common','lang',$GLOBALS['phpgw']->common->getPreferredLanguage());
@@ -779,8 +779,8 @@
                 * mail server of type pop3, pop3s, imap, imaps users value from
                 * 
$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_port'].
                 * if that value is not set, it generates a default port for 
the given $server_type.
-                * Someday, this *MAY* be 
-                * (a) a se4rver wide admin setting, or 
+                * Someday, this *MAY* be
+                * (a) a se4rver wide admin setting, or
                 * (b)user custom preference
                 * Until then, simply set the port number based on the 
mail_server_type, thereof
                 * ONLY call this function AFTER ['email']['mail_server_type'] 
has been set.
@@ -825,7 +825,7 @@
                                                $port_number = 993;
                                                break;
                                        case 'imap':
-                                               // IMAP normal connection, No 
SSL 
+                                               // IMAP normal connection, No 
SSL
                                        default:
                                                // UNKNOWN SERVER in 
Preferences, return a
                                                // default value that is likely 
to work
@@ -852,11 +852,11 @@
                        if 
(isset($GLOBALS['phpgw_info']['server']['mail_login_type']) )
                        {
                                if ( 
$GLOBALS['phpgw_info']['server']['mail_login_type'] == 'vmailmgr' )
-                       {
+                               {
                                        $prefs_email_userid .= 
"@{$GLOBALS['phpgw_info']['server']['mail_suffix']}";
-                       }
+                               }
                                else if ( 
$GLOBALS['phpgw_info']['server']['mail_login_type'] == 'ispman' )
-                       {
+                               {
                                        $prefs_email_userid .= '_' . 
str_replace('.', '_', $GLOBALS['phpgw_info']['server']['mail_suffix']);
                                }
                        }
@@ -866,8 +866,8 @@
                /**
                 * returns the custom email-address (if set) or generates a 
default one
                 *
-                * This will generate the appropriate email address used as the 
"From:" 
-                email address when the user sends email, the localpert * part. 
The "personal" 
+                * This will generate the appropriate email address used as the 
"From:"
+                email address when the user sends email, the localpert * part. 
The "personal"
                 part is generated elsewhere.
                 In the absence of a custom ['email']['address'], this function 
should be used to set it.
                 * @param $accountid - as determined in and/or passed to 
"create_email_preferences"
@@ -903,9 +903,9 @@
                 *      $GLOBALS['phpgw_info']['user']['preferences'] = 
$GLOBALS['phpgw']->preferences->create_email_preferences();
                 * which fills an array based at:
                 *      
$GLOBALS['phpgw_info']['user']['preferences']['email'][prefs_are_elements_here]
-                * Reading the raw preference DB data and comparing to the 
email preference schema defined in 
-                * /email/class.bopreferences.inc.php (see discussion there and 
below) to create default preference values 
-                * for the  in the ['email'][] pref data array in cases where 
the user has not supplied 
+                * Reading the raw preference DB data and comparing to the 
email preference schema defined in
+                * /email/class.bopreferences.inc.php (see discussion there and 
below) to create default preference values
+                * for the  in the ['email'][] pref data array in cases where 
the user has not supplied
                 * a preference value for any particular preference item 
available to the user.
                 * @access Public
                 */
@@ -1034,11 +1034,11 @@
 
                        // --- make the schema-based pref data for this user ---
                        // user defined values and/or user specified custom 
email prefs are read from the
-                       // prefs DB with mininal manipulation of the data. 
Currently the only change to 
+                       // prefs DB with mininal manipulation of the data. 
Currently the only change to
                        // users raw data is related to reversing the encoding 
of "database un-friendly" chars
-                       // which itself may become unnecessary if and when the 
database handlers can reliably 
+                       // which itself may become unnecessary if and when the 
database handlers can reliably
                        // take care of this for us. Of course, password data 
requires special decoding,
-                       // but the password in the array [email][paswd] should 
be left in encrypted form 
+                       // but the password in the array [email][paswd] should 
be left in encrypted form
                        // and only decrypted seperately when used to login in 
to an email server.
 
                        // --- generating a default value if necessary ---
@@ -1069,7 +1069,7 @@
 
                                // --- is there a value in the DB for this 
preference item ---
                                // if the prefs DB has no value for this 
defined available preference, we must make one.
-                               // This occurs if (a) this is user's first 
login, or (b) this is a custom pref which the user 
+                               // This occurs if (a) this is user's first 
login, or (b) this is a custom pref which the user
                                // has not overriden, do a default (non-custom) 
value is needed.
                                if 
(!isset($prefs['email'][$this_avail_pref['id']]))
                                {
@@ -1109,7 +1109,7 @@
                                                }
                                                else
                                                {
-                                                       // opposite of boolean 
not_set  = string "True" which simply sets a 
+                                                       // opposite of boolean 
not_set  = string "True" which simply sets a
                                                        // value it exists in 
the users session [email][] preference array
                                                        
$prefs['email'][$this_avail_pref['id']] = 'True';
                                                }
@@ -1133,7 +1133,7 @@
                                        // INIT_NO_FILL
                                        elseif ($set_proc[0] == 'init_no_fill')
                                        {
-                                               // we have an available 
preference item that we may NOT fill with a default 
+                                               // we have an available 
preference item that we may NOT fill with a default
                                                // value. Only the user may 
supply a value for this pref item.
                                                print_debug('* handle 
"init_no_fill" set_proc:', serialize($set_proc),'api');
                                                // we are FORBADE from filling 
this at this time!
@@ -1141,7 +1141,7 @@
                                        // varEVAL
                                        elseif ($set_proc[0] == 'varEVAL')
                                        {
-                                               // similar to "function" but 
used for array references, the string in $set_proc[1] 
+                                               // similar to "function" but 
used for array references, the string in $set_proc[1]
                                                // represents code which 
typically is an array referencing a system/api property
                                                print_debug('* handle "GLOBALS" 
set_proc:', serialize($set_proc),'api');
                                                $evaled = '';
@@ -1167,8 +1167,8 @@
                                        /// here until the next OFFICIAL submit 
email prefs function, where it
                                        // will again get this preparation 
before being written to the database.
 
-                                       // NOTE: if database de-fanging is 
eventually handled deeper in the 
-                                       // preferences class, then the 
following code would become depreciated 
+                                       // NOTE: if database de-fanging is 
eventually handled deeper in the
+                                       // preferences class, then the 
following code would become depreciated
                                        // and should be removed in that case.
                                        if (($this_avail_pref['type'] == 
'user_string') &&
                                                        
(stristr($this_avail_pref['write_props'], 'no_db_defang') == False))
@@ -1182,7 +1182,7 @@
                        }
                        // users preferences are now established to known 
structured values...
 
-                       // SANITY CHECK 
+                       // SANITY CHECK
                        // ---  [email][use_trash_folder]  ---
                        // ---  [email][use_sent_folder]  ---
                        // is it possible to use Trash and Sent folders - i.e. 
using IMAP server
@@ -1223,7 +1223,7 @@
                {
                $prefs['email']['userid'] = 
$this->sub_default_userid($accountid);
                }
-               // ---  address  --- 
+               // ---  address  ---
                if (!isset($prefs['email']['address']))
                {
                $prefs['email']['address'] = $this->email_address($accountid);
@@ -1313,7 +1313,7 @@
        //      $prefs['email']['font_size_offset'] = 'normal';
        //}
 
-       // SANITY CHECK 
+       // SANITY CHECK
        // ---  use_trash_folder  ---
        // ---  use_sent_folder  ---
        // is it possible to use Trash and Sent folders - i.e. using IMAP server

Modified: people/sigurdne/modules/phpgwapi/trunk/inc/sso/include_login.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/sso/include_login.inc.php        
2010-01-22 09:50:50 UTC (rev 20979)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/sso/include_login.inc.php        
2010-01-22 09:51:24 UTC (rev 20980)
@@ -390,7 +390,7 @@
                        $extra_vars = array();
                        foreach($_GET as $name => $value)
                        {
-                               if (ereg('phpgw_',$name))
+                               if (preg_match('/phpgw_/',$name))
                                {
                                        $extra_vars[$name] = urlencode($value);
                                }





reply via email to

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