phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] api/class.statecache.php, 1.1.2.7


From: nomail
Subject: [Phpgroupware-cvs] api/class.statecache.php, 1.1.2.7
Date: Thu, 20 May 2004 15:50:04 -0000

Update of /api
Modified Files:
        Branch: proposal-branch
          class.statecache.php

date: 2004/04/16 20:59:49;  author: seek3r;  state: Exp;  lines: +40 -35

Log Message:
bringing savannah cvs back up to date with what we were doing on our private 
cvs server. We will not be doing dev from this cvs tree
=====================================================================
No syntax errors detected in -
=====================================================================
Index: api/class.statecache.php
diff -u api/class.statecache.php:1.1.2.6 api/class.statecache.php:1.1.2.7
--- api/class.statecache.php:1.1.2.6    Wed Jan  7 08:57:32 2004
+++ api/class.statecache.php    Fri Apr 16 20:59:49 2004
@@ -35,19 +35,19 @@
                // (This is mainly for PHP sessions) (jengo)
                var $history_size = 30;
 
-               function pre_serialize()
+               function __sleep()
                {
                        // stub so its gets cache'd. No cleanup needed.
                }
                
-               function post_serialize()
+               function __wakeup()
                {
                        // stub. No restore needed.
                }
 
                function api_statecache()
                {
-                       $this->data = 
$GLOBALS['phpgw_session']['phpgw_data']['op_history'];
+                       $this->data = 
$_SESSION['phpgw_session']['phpgw_data']['op_history'];
                        if ($this->history_size < 10)
                        {
                                $this->history_size = 10;
@@ -81,9 +81,9 @@
                                        {
                                                foreach 
($GLOBALS['docs'][$appname]['classes'][$appname . '_' . 
$classname]['functions'][$methodname]['params'] as $key => $params)
                                                {
-                                                       // For some odd reason, 
when you call this passing ##REQUIRED## it causes PHP to run out of memory
+                                                       // For some odd reason, 
when you call this passing REQUIRED it causes PHP to run out of memory
                                                        // This appears to be a 
better temp work around then disabling this line. (jengo)
-                                                       $data[$key] = 
get_var($key,array('GET','POST'),$params['type'],'##NOTSET##');
+                                                       $data[$key] = 
get_var($key,array('GET','POST'),$params['type'],NOTSET);
                                                }
                                        }
 
@@ -91,10 +91,10 @@
                                        {
                                                // If they refresh the current 
page, we lose the current position, so we are going to store it
                                                // This is only done durring 
new page loads
-                                               
$GLOBALS['phpgw_session']['phpgw_data']['current_history_position'] = 
md5(rand(1,RAND_MAX) . time());
+                                               
$_SESSION['phpgw_session']['phpgw_data']['current_history_position'] = 
md5(mt_rand(1,mt_getrandmax()) . time());
 
-                                               
$this->data[$GLOBALS['phpgw_session']['phpgw_data']['current_history_position']]
 = array(
-                                                       'position' => 
$GLOBALS['phpgw_session']['phpgw_data']['current_history_position'],
+                                               
$this->data[$_SESSION['phpgw_session']['phpgw_data']['current_history_position']]
 = array(
+                                                       'position' => 
$_SESSION['phpgw_session']['phpgw_data']['current_history_position'],
                                                        'title'    => $_title,
                                                        'op'       => 
$GLOBALS['phpgw_data']['api']['op'],
                                                        'data'     => $data
@@ -105,7 +105,7 @@
                                        {
                                                array_shift($this->data);
                                        }
-                                       
$GLOBALS['phpgw_session']['phpgw_data']['op_history'] = $this->data;
+                                       
$_SESSION['phpgw_session']['phpgw_data']['op_history'] = $this->data;
                                }
 
                        }
@@ -113,9 +113,9 @@
                        $this->handle_xml_return();
                }
 
-               function minimize($inputs = '##NOTSET##',$position_id)
+               function minimize($inputs = NOTSET,$position_id)
                {
-                       $current_op = 
$GLOBALS['phpgw_session']['phpgw_data']['op_history'][$position_id]['op'];
+                       $current_op = 
$_SESSION['phpgw_session']['phpgw_data']['op_history'][$position_id]['op'];
                        list($appname,$classname,$methodname) = 
explode('.',$current_op);
 
                        // If it doesn't exist, don't spit out any errors or 
PHP warnings, the API handles that later on
@@ -136,14 +136,14 @@
                                {
                                        foreach 
($GLOBALS['docs'][$appname]['classes'][$appname . '_' . 
$classname]['functions'][$methodname]['params'] as $key => $params)
                                        {
-                                               // For some odd reason, when 
you call this passing ##REQUIRED## it causes PHP to run out of memory
+                                               // For some odd reason, when 
you call this passing REQUIRED it causes PHP to run out of memory
                                                // This appears to be a better 
temp work around then disabling this line. (jengo)
-                                               $data[$key] = 
get_var($key,array('GET','POST'),$params['type'],'##NOTSET##');
+                                               $data[$key] = 
get_var($key,array('GET','POST'),$params['type'],NOTSET);
                                        }
                                }
                        }
 
-                       
$GLOBALS['phpgw_session']['phpgw_data']['statecache'][$current_op] = $data;
+                       
$_SESSION['phpgw_session']['phpgw_data']['statecache'][$current_op] = $data;
 
                        end($this->data);
                        $prev = prev($this->data);
@@ -187,20 +187,20 @@
 
                        
$GLOBALS['phpgw_xml_apinode']->add_node($xml_history,'op_history');
                        // This is for the "close" button
-                       
$GLOBALS['phpgw_xml_apinode']->add_node($GLOBALS['phpgw_session']['phpgw_data']['current_history_position'],'current_history_position');
+                       
$GLOBALS['phpgw_xml_apinode']->add_node($_SESSION['phpgw_session']['phpgw_data']['current_history_position'],'current_history_position');
                }
 
-               function close($inputs = '##NOTSET##',$position_id)
+               function close($inputs = NOTSET,$position_id)
                {
                        $o_op = $this->data[$position_id]['op'];
-                       
unset($GLOBALS['phpgw_session']['phpgw_data']['statecache'][$o_op]);
+                       
unset($_SESSION['phpgw_session']['phpgw_data']['statecache'][$o_op]);
 
                        foreach ($this->data as $key => $null)
                        {
                                if ($key == $position_id)
                                {
                                        $n_key = $p_key;
-                                       $not_found = False;
+                                       $not_found = false;
                                        $p = prev($this->data);
                                        break;
                                }
@@ -215,13 +215,13 @@
                                $n_key = key($this->data);
                        }
 
-                       $GLOBALS['phpgw_session']['phpgw_data']['op_history'] = 
$this->data;
+                       $_SESSION['phpgw_session']['phpgw_data']['op_history'] 
= $this->data;
 
-                       
$GLOBALS['phpgw_session']['phpgw_data']['current_history_position'] = 
$this->data[$n_key]['position'];
+                       
$_SESSION['phpgw_session']['phpgw_data']['current_history_position'] = 
$this->data[$n_key]['position'];
                        $op               = $this->data[$n_key]['op'];
-                       $statecache_data  = 
$GLOBALS['phpgw_session']['phpgw_data']['statecache'][$this->data[$n_key]['op']];
+                       $statecache_data  = 
$_SESSION['phpgw_session']['phpgw_data']['statecache'][$this->data[$n_key]['op']];
 
-                       $GLOBALS['phpgw_session']['phpgw_data']['op_history'] = 
$this->data;
+                       $_SESSION['phpgw_session']['phpgw_data']['op_history'] 
= $this->data;
                        $this->handle_xml_return();
 
                        return 
array_merge($inputs,$this->data[$n_key]['data'],$statecache_data,array('op' => 
$this->data[$n_key]['op']));
@@ -231,25 +231,25 @@
                {
                        $op = $this->data[$position_id]['op'];
 
-                       foreach 
($GLOBALS['phpgw_session']['phpgw_data']['statecache'][$op] as $key => $values)
+                       foreach 
($_SESSION['phpgw_session']['phpgw_data']['statecache'][$op] as $key => $values)
                        {
                                unset($inputs[$key]);
                        }
-                       
unset($GLOBALS['phpgw_session']['phpgw_data']['statecache'][$op]);
+                       
unset($_SESSION['phpgw_session']['phpgw_data']['statecache'][$op]);
 
-                       return array_merge($inputs,array('form_submit' => 
'False'),array('op' => $op));
+                       return array_merge($inputs,array('form_submit' => 
'false'),array('op' => $op));
                }
 
                function restore_op($inputs,$op)
                {
-                       return 
array_merge($GLOBALS['phpgw_session']['phpgw_data']['statecache'][$op],$inputs);
+                       return 
array_merge($_SESSION['phpgw_session']['phpgw_data']['statecache'][$op],$inputs);
                }
 
-               function restore($inputs = '##NOTSET##',$position_id)
+               function restore($inputs = NOTSET,$position_id)
                {
-                       
$GLOBALS['phpgw_session']['phpgw_data']['current_history_position'] = 
$position_id;
-                       $op                                   = 
$this->data[$position_id]['op'];
-                       $statecache_data                      = 
$GLOBALS['phpgw_session']['phpgw_data']['statecache'][$op];
+                       
$_SESSION['phpgw_session']['phpgw_data']['current_history_position'] = 
$position_id;
+                       $op              = $this->data[$position_id]['op'];
+                       $statecache_data = 
$_SESSION['phpgw_session']['phpgw_data']['statecache'][$op];
                        $this->handle_xml_return();
 
                        list($app,$class,$method) = explode('.',$op);
@@ -262,23 +262,28 @@
                // Don't add login, or if the last op is a duplicate
                function allow_set()
                {
-                       $result = True;
+                       $result = true;
 
                        if ($GLOBALS['phpgw_data']['api']['op'] == 
'api.base.login')
                        {
-                               $result = False;
+                               $result = false;
                        }
 
                        if 
(ereg('api.statecache.',$GLOBALS['phpgw_data']['api']['op']))
                        {
-                               $result = False;
+                               $result = false;
+                       }
+
+                       if(!is_array($this->data))
+                       {
+                               return true;
                        }
 
                        $last = end($this->data);
 
                        if ($last['op'] == $GLOBALS['phpgw_data']['api']['op'])
                        {
-                               $result = False;
+                               $result = false;
                        }
 
                        return $result;




reply via email to

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