phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.preferences.inc.php


From: Bettina Gille
Subject: [Phpgroupware-cvs] phpgwapi/inc class.preferences.inc.php
Date: Wed, 11 Jan 2006 23:26:58 +0000

CVSROOT:        /cvsroot/phpgwapi
Module name:    phpgwapi
Branch:         
Changes by:     Bettina Gille <address@hidden>  06/01/11 23:26:57

Modified files:
        inc            : class.preferences.inc.php 

Log message:
        added acl demo mode patch

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/phpgwapi/inc/class.preferences.inc.php.diff?tr1=1.57&tr2=1.58&r1=text&r2=text

Patches:
Index: phpgwapi/inc/class.preferences.inc.php
diff -u phpgwapi/inc/class.preferences.inc.php:1.57 
phpgwapi/inc/class.preferences.inc.php:1.58
--- phpgwapi/inc/class.preferences.inc.php:1.57 Mon May  2 16:38:57 2005
+++ phpgwapi/inc/class.preferences.inc.php      Wed Jan 11 23:26:57 2006
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.preferences.inc.php,v 1.57 2005/05/02 16:38:57 
fipsfuchs Exp $
+       * @version $Id: class.preferences.inc.php,v 1.58 2006/01/11 23:26:57 
ceb Exp $
        */
 
        /**
@@ -201,31 +201,60 @@
                */
                function read_repository()
                {
-                       $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())
+                       
if($GLOBALS['phpgw']->acl->check('session_only_preferences',1,'preferences') && 
strlen($GLOBALS['phpgw']->session->appsession('session_prefs','initiated')))
                        {
-                               // 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->user             = 
$GLOBALS['phpgw']->session->appsession('session_prefs','user');
+                               $this->default  = 
$GLOBALS['phpgw']->session->appsession('session_prefs','default');
+                               $this->forced   = 
$GLOBALS['phpgw']->session->appsession('session_prefs','forced');
+
+                               if(!is_array($this->user))
                                {
-                                       continue;
+                                       $this->user = array();
                                }
-                               switch($this->db->f('preference_owner'))
+                               if(!is_array($this->forced))
                                {
-                                       case -1:        // forced
-                                               $this->forced[$app] = $value;
-                                               break;
-                                       case -2:        // default
-                                               $this->default[$app] = $value;
-                                               break;
-                                       default:        // user
-                                               $this->user[$app] = $value;
-                                               break;
+                                       $this->forced = array();
+                               }
+                               if(!is_array($this->default))
+                               {
+                                       $this->default = array();
+                               }
+                       }
+                       else
+                       {
+                               $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))
+                                       {
+                                               continue;
+                                       }
+                                       switch($this->db->f('preference_owner'))
+                                       {
+                                               case -1:        // forced
+                                                       $this->forced[$app] = 
$value;
+                                                       break;
+                                               case -2:        // default
+                                                       $this->default[$app] = 
$value;
+                                                       break;
+                                               default:        // user
+                                                       $this->user[$app] = 
$value;
+                                                       break;
+                                       }
+                               }
+                               
+                               if 
($GLOBALS['phpgw']->acl->check('session_only_preferences',1,'preferences'))
+                               {
+                                       
$GLOBALS['phpgw']->session->appsession('session_prefs', 'initiated', 'yes');
+                                       
$GLOBALS['phpgw']->session->appsession('session_prefs', 'forced', 
$this->forced);
+                                       
$GLOBALS['phpgw']->session->appsession('session_prefs', 'default', 
$this->default);
+                                       
$GLOBALS['phpgw']->session->appsession('session_prefs', 'user', $this->user);
                                }
                        }
                        $this->data = $this->user;
@@ -528,6 +557,19 @@
                        }
                        else
                        {
+                               switch($type)
+                               {
+                                       case 'forced':
+                                               
$GLOBALS['phpgw']->session->appsession('session_prefs', 'forced', 
$this->forced);
+                                               break;
+                                       case 'default':
+                                               
$GLOBALS['phpgw']->session->appsession('session_prefs', 'default', 
$this->default);
+                                               break;
+                                       default:
+                                               
$GLOBALS['phpgw']->session->appsession('session_prefs', 'user', $this->user);
+                                               break;
+                               }
+                               
                                $GLOBALS['phpgw_info']['user']['preferences'] = 
$this->data;
                                $GLOBALS['phpgw']->session->save_repositories();
                        }




reply via email to

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