phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] api/class.phpgw.php, 1.1.1.1.2.43


From: nomail
Subject: [Phpgroupware-cvs] api/class.phpgw.php, 1.1.1.1.2.43
Date: Thu, 20 May 2004 21:51:20 -0000

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

date: 2004/04/16 20:59:48;  author: seek3r;  state: Exp;  lines: +105 -82

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.phpgw.php
diff -u api/class.phpgw.php:1.1.1.1.2.42 api/class.phpgw.php:1.1.1.1.2.43
--- api/class.phpgw.php:1.1.1.1.2.42    Wed Feb 25 18:31:42 2004
+++ api/class.phpgw.php Fri Apr 16 20:59:48 2004
@@ -49,7 +49,7 @@
 
                var $app_menus = array();
 
-               var $base_classes_loaded = False;
+               var $base_classes_loaded = false;
 
                
/**************************************************************************\
                * Core functions                                                
           *
@@ -63,7 +63,7 @@
                or loads up their base classes.
                @param $force bool used to force a login screen.
                */
-               function check_login($force = False)
+               function check_login($force = false)
                {
                        reg_var('phpgw_user', 'any', 'any');
                        reg_var('phpgw_pass', 'any', 'any');
@@ -74,16 +74,15 @@
                                
unset($GLOBALS['phpgw_data']['api']['phpgw_pass']);
                        }
 
-                       if(!isset($GLOBALS['phpgw_session']['nextop']))
+                       if(!isset($_SESSION['phpgw_session']['nextop']))
                        {
-                               $GLOBALS['phpgw_session']['nextop'] = 
$GLOBALS['phpgw_data']['api']['op'];
+                               $_SESSION['phpgw_session']['nextop'] = 
$GLOBALS['phpgw_data']['api']['op'];
                        }
-                       
                        while ($GLOBALS['phpgw_data']['api']['op'] == 
'api.base.login')
                        {
                                
if(isset($GLOBALS['phpgw_data']['api']['phpgw_user']) && 
isset($GLOBALS['phpgw_data']['api']['phpgw_pass']))
                                {
-                                       $this->auth = createobject('api_auth');
+                                       $this->auth = createObject('api_auth');
                                        if 
($this->auth->authenticate($GLOBALS['phpgw_data']['api']['phpgw_user'], 
$GLOBALS['phpgw_data']['api']['phpgw_pass']))
                                        {
                                                $this->accounts      = 
createObject('api_accounts',$GLOBALS['phpgw_data']['api']['phpgw_user']);
@@ -96,11 +95,14 @@
                                                $history->set('api.sessions.' . 
$history->account_id,$new_data,array());
 
                                                
$this->session->create($GLOBALS['phpgw_data']['api']['phpgw_user']);
-                                               
unset($GLOBALS['phpgw_data']['api']['op']);
                                                
unset($GLOBALS['phpgw_data']['api']['phpgw_user']);
                                                
unset($GLOBALS['phpgw_data']['api']['phpgw_pass']);
                                                $this->check_op();
-                                               
unset($GLOBALS['phpgw_session']['serialized_classes']);
+                                               
if($GLOBALS['phpgw_data']['api']['op'] == 'api.base.login')
+                                               {
+                                                       
$GLOBALS['phpgw_data']['api']['op'] = 'api.base.start';
+                                               }
+                                               
unset($_SESSION['phpgw_session']['serialized_classes']);
                                                
$GLOBALS['phpgw']->interface->good_login();
                                        }
                                        else
@@ -127,38 +129,38 @@
                                /* load up the accounts, preferences and 
application classeses */                       
                                /* and also have them send their appropriate 
data to phpgw_data */
                                
$GLOBALS['performance_timer']->start('api_account');
-                               $this->accounts = recoverobject('accounts', 
'api_accounts', $GLOBALS['phpgw_session']['session_lid']);
-                               //$this->accounts = 
createobject('api_accounts',$GLOBALS['phpgw_session']['session_lid']);
+                               $this->accounts = recoverObject('accounts', 
'api_accounts', $_SESSION['phpgw_session']['session_lid']);
+                               //$this->accounts = 
createObject('api_accounts',$_SESSION['phpgw_session']['session_lid']);
                                $this->accounts->fill_phpgw_data();
                                
$GLOBALS['performance_timer']->stop('api_account');
 
                                $GLOBALS['performance_timer']->start('api_acl');
-                               $this->acl = recoverobject('acl', 'api_acl');
-                               //$this->acl      = createobject('api_acl');
+                               $this->acl = recoverObject('acl', 'api_acl');
+                               //$this->acl      = createObject('api_acl');
                                $GLOBALS['performance_timer']->stop('api_acl');
        
                                
$GLOBALS['performance_timer']->start('api_pref');
-                               $this->prefs = recoverobject('prefs', 
'api_prefs');
-                               //$this->prefs = createobject('api_prefs');
+                               $this->prefs = recoverObject('prefs', 
'api_prefs');
+                               //$this->prefs = createObject('api_prefs');
                                $this->prefs->fill_phpgw_data();
                                $GLOBALS['performance_timer']->stop('api_pref');
 
 //$GLOBALS['phpgw_data']['server']['translate_service'] = 'google';
 //$GLOBALS['phpgw_data']['prefs']['api.lang'] = 'es';
                                
$GLOBALS['performance_timer']->start('api_lang');
-                               //$this->lang = recoverobject('lang', 
'api_lang');
-                               $this->lang = createobject('api_lang');
+                               //$this->lang = recoverObject('lang', 
'api_lang');
+                               $this->lang = createObject('api_lang');
                                $this->lang->switchlang();
                                $GLOBALS['performance_timer']->stop('api_lang');
 
                                
$GLOBALS['performance_timer']->start('api_apps');
-                               $this->apps = recoverobject('apps', 'api_apps');
-                               //$this->apps = createobject('api_apps');
+                               $this->apps = recoverObject('apps', 'api_apps');
+                               //$this->apps = createObject('api_apps');
                                $this->apps->fill_phpgw_data();
                                $GLOBALS['performance_timer']->stop('api_apps');
 
-                               $this->statecache = recoverobject('statecache', 
'api_statecache');
-                               $this->base_classes_loaded = True;
+                               $this->statecache = recoverObject('statecache', 
'api_statecache');
+                               $this->base_classes_loaded = true;
                        }
                }       
                
@@ -167,14 +169,16 @@
                @abstract Adds another xsl file to the list of those required 
by the current operation.
                @param $xsl
                */
-               function add_xsl($xsl)
+               function add_xsl()
                {
                        $args = new safe_args();
-                       $args->set('xsl', '##REQUIRED##', 'string');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+                       $args->set('xsl', REQUIRED, 'string');
+                       $args = $args->get(func_get_args());
 
-                       $this->xsl_files[] = $args['xsl'];
-                       $this->xsl_files   = array_unique($this->xsl_files);
+                       if (!in_array($args['xsl'],$this->xsl_files))
+                       {
+                               $this->xsl_files[] = $args['xsl'];
+                       }
                }
 
                /*!
@@ -182,14 +186,16 @@
                @abstract Adds another css file to the list of those required 
by the current operation.
                @param $css
                */
-               function add_css($css)
+               function add_css()
                {
                        $args = new safe_args();
-                       $args->set('css', '##REQUIRED##', 'string');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+                       $args->set('css', REQUIRED, 'string');
+                       $args = $args->get(func_get_args());
 
-                       $this->css_files[] = $args['css'];
-                       $this->css_files   = array_unique($this->css_files);
+                       if (!in_array($args['css'],$this->css_files))
+                       {
+                               $this->css_files[] = $args['css'];
+                       }
                }
 
                /*!
@@ -197,19 +203,21 @@
                @abstract Adds another javascript file to the list of those 
required by the current operation.
                @param $js
                */
-               function add_js($js)
+               function add_js()
                {
                        $args = new safe_args();
-                       $args->set('js', '##REQUIRED##', 'string');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+                       $args->set('js', REQUIRED, 'string');
+                       $args = $args->get(func_get_args());
 
-                       $this->js_files[] = $args['js'];
-                       $this->js_files   = array_unique($this->js_files);
+                       if (!in_array($args['js'],$this->js_files))
+                       {
+                               $this->js_files[] = $args['js'];
+                       }
                }
 
                function form_lock()
                {
-                       
$GLOBALS['phpgw_xml_apinode']->add_node(True,'form_lock');
+                       
$GLOBALS['phpgw_xml_apinode']->add_node(true,'form_lock');
                }
 
                /*!
@@ -221,7 +229,7 @@
                        if ($this->acl->check('api.base.start', 1))
                        {
                                $menu[] = array(
-                                       'title' => lang('Home', '##NOTSET##' , 
'api'),
+                                       'title' => lang('Home', NOTSET , 'api'),
                                        'op'    => 'api.base.start',
                                );
                        }
@@ -229,7 +237,7 @@
                        if ($this->acl->check('api.admin.start', 1))
                        {
                                $menu[] = array(
-                                       'title' => lang('Admin', '##NOTSET##', 
'api'),
+                                       'title' => lang('Admin', NOTSET, 'api'),
                                        'op'    => 'api.admin.start',
                                );
                        }
@@ -237,7 +245,7 @@
                        if ($this->acl->check('api.base.prefs', 1))
                        {
                                $menu[] = array(
-                                       'title'     => lang('Preferences', 
'##NOTSET##', 'api'),
+                                       'title'     => lang('Preferences', 
NOTSET, 'api'),
                                        'op'        => 
'api.base.prefs&appname=api'
                                );
                        }
@@ -245,7 +253,7 @@
                        if ($this->acl->check('api.base.profile', 1))
                        {
                                $menu[] = array(
-                                       'title'     => lang('Your Profile', 
'##NOTSET##', 'api'),
+                                       'title'     => lang('Your Profile', 
NOTSET, 'api'),
                                        'op'        => 'api.base.profile'
                                );
                        }
@@ -253,13 +261,13 @@
                        if ($this->acl->check('api.base.about', 1))
                        {
                                $menu[] = array(
-                                       'title' => lang('About', '##NOTSET##', 
'api'),
+                                       'title' => lang('About', NOTSET, 'api'),
                                        'op'    => 'api.base.about',
                                );
                        }
 
                        $menu[] = array(
-                               'title' => lang('Logout', '##NOTSET##', 'api'),
+                               'title' => lang('Logout', NOTSET, 'api'),
                                'op'    => 'api.base.logout',
                        );
 
@@ -269,12 +277,11 @@
                function add_appmenu()
                {
                        $args = new safe_args();
-                       // Yes, I know its spelled wrong, but its like that due 
to bug in safe_args (jengo)
-                       $args->set('title', '##REQUIRED##', 'string');
-                       $args->set('item_title','##REQUIRED##', 'string');
-                       $args->set('item_op','##REQUIRED##', 'string');
-                       $args->set('dont_add_current_op',False,'bool');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+                       $args->set('title', REQUIRED, 'string');
+                       $args->set('item_title',REQUIRED, 'string');
+                       $args->set('item_op',REQUIRED, 'string');
+                       $args->set('dont_add_current_op',false,'bool');
+                       $args = $args->get(func_get_args());
 
                        if ($args['dont_add_current_op'])
                        {
@@ -282,14 +289,14 @@
                                {
                                        if (substr($args['item_op'],0,$pos) == 
$GLOBALS['phpgw_data']['api']['op'])
                                        {
-                                               return False;
+                                               return false;
                                        }
                                }
                                else
                                {
                                        if ($GLOBALS['phpgw_data']['api']['op'] 
== $args['item_op'])
                                        {
-                                               return False;
+                                               return false;
                                        }
                                }
                        }
@@ -299,14 +306,14 @@
                                'op'    => $args['item_op']
                        );
 
-                       return True;
+                       return true;
                }
 
                function finish_appmenus()
                {
                        foreach ($this->app_menus as $key => $values)
                        {
-                               unset($r);
+                               $r = array();
 
                                foreach ($values as $value)
                                {
@@ -334,11 +341,13 @@
                function finish()
                {
                        $args = new safe_args();
-                       $args->set('loadmainxsl', True, 'bool');
-                       $args->set('loadmaincss', True, 'bool');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+                       $args->set('loadmainxsl', true, 'bool');
+                       $args->set('loadmaincss', true, 'bool');
+                       $args->set('sendoutput', true, 'bool');
+                       $args = $args->get(func_get_args());
 
-                       if(!$GLOBALS['missing_critical'])
+                       define('PHPGW_FINISHED', true);
+                       if(!$GLOBALS['force_setup'])
                        {
                                /* Make sure the base classes are loaded. */
                                $this->load_base_classes();
@@ -358,26 +367,33 @@
 
                        /* Check to see there are any errors. */
                        /* If so include them in XML and load the xsl for it */
-                       if(count($GLOBALS['msgbox']->out()) > 0)
+                       $messages = $GLOBALS['msgbox']->out();
+                       if(!empty($messages))
                        {
                                $GLOBALS['phpgw']->add_xsl('api.msgbox');
-                               
$GLOBALS['phpgw_xml_apinode']->add_node($GLOBALS['msgbox']->out(),'msgbox');
+                               
$GLOBALS['phpgw_xml_apinode']->add_node($messages,'msgbox');
                        }
 
-                       // If the app developer doesn't specify a title for 
there method, this will attempt
+                       // If the app developer doesn't specify a title for 
their method, this will attempt
                        // to detect the title in the "doc array".  If it 
can't, it will fall back to the application name.
                        // FIXME: It appears that the xmltool search sections 
aren't complete, once they are, recode this section (jengo)
-                       $found_title = False;
+                       $found_title = false;
                        foreach ($GLOBALS['phpgw_xml_apinode']->data as $node)
                        {
                                if ($node['name'] == 'title' && 
strlen($node['data']))
                                {
-                                       $found_title = True;
+                                       $found_title = true;
                                }
                        }
 
-                       if (! $found_title)
+                       $this->check_op();
+                       if (!$found_title)
                        {
+                               // This if shouldnt need to be here. I need to 
find out why the flags are not set.
+                               //if(!is_array($GLOBALS['phpgw_data']['flags']))
+                               //{
+                               //      
list($GLOBALS['phpgw_data']['flags']['req_app'],$GLOBALS['phpgw_data']['flags']['req_class'],$GLOBALS['phpgw_data']['flags']['req_method'])
 = explode('.',$GLOBALS['phpgw_data']['api']['op']);
+                               //}
                                $app    = 
$GLOBALS['phpgw_data']['flags']['req_app'];
                                $class  = 
$GLOBALS['phpgw_data']['flags']['req_class'];
                                $method = 
$GLOBALS['phpgw_data']['flags']['req_method'];
@@ -392,7 +408,13 @@
                                }
                        }
 
-                       if (! $GLOBALS['missing_critical'])
+                       if ($GLOBALS['phpgw_data']['flags']['req_app'] != 'api')
+                       {
+                               $title = 
$GLOBALS['phpgw']->apps->allapps[$GLOBALS['phpgw_data']['flags']['req_app']]['title'];
+                               $GLOBALS['phpgw']->add_appmenu($title . ' 
menu','About ' . $title,'api.base.about&location=' . 
$GLOBALS['phpgw_data']['flags']['req_app']);
+                       }
+
+                       if (! $GLOBALS['force_setup'])
                        {
                                /* If any, add the hooks to the API XML node */
                                if(count($this->hooks->data) > 0)
@@ -427,18 +449,20 @@
 
                        /* Pack up any classes that want to be serialized */
                        $GLOBALS['performance_timer']->start('cache_classes');
-                       saveobject($this->accounts, 'accounts');
-                       saveobject($this->acl, 'acl');
-                       saveobject($this->prefs, 'prefs');
-                       saveobject($this->apps, 'apps');
-                       saveobject($this->statecache, 'statecache');
+                       saveObject(&$this->accounts, 'accounts');
+                       saveObject(&$this->acl, 'acl');
+                       saveObject(&$this->prefs, 'prefs');
+                       saveObject(&$this->apps, 'apps');
+                       saveObject(&$this->statecache, 'statecache');
                        $GLOBALS['performance_timer']->stop('cache_classes');
-                       /* Before we send output, save the session data */
-                       $GLOBALS['phpgw']->session->save_data();
                        
-                       /* Now pass back to the interface for final packaging. 
*/
-                       $this->interface->sendtoclient();
-
+                       if(!$args['sendoutput'])
+                       {
+                               $GLOBALS['performance_timer']->stop('phpgw');
+                               $GLOBALS['performance_timer']->save();
+                               return $this->interface->sendtoclient();
+                       }
+                       echo $this->interface->sendtoclient();
                        $GLOBALS['performance_timer']->stop('phpgw');
                        $GLOBALS['performance_timer']->save();
                        exit;
@@ -486,11 +510,11 @@
 
                        
list($GLOBALS['phpgw_data']['flags']['req_app'],$GLOBALS['phpgw_data']['flags']['req_class'],$GLOBALS['phpgw_data']['flags']['req_method'])
 = explode('.',$GLOBALS['phpgw_data']['api']['op']);
 
-                       if (! 
sanitize($GLOBALS['phpgw_data']['flags']['req_app'],'string')
-                               || ! 
sanitize($GLOBALS['phpgw_data']['flags']['req_class'],'string')
-                               || ! 
sanitize($GLOBALS['phpgw_data']['flags']['req_method'],'string'))
+                       if (! 
validate($GLOBALS['phpgw_data']['flags']['req_app'],'string')
+                               || ! 
validate($GLOBALS['phpgw_data']['flags']['req_class'],'string')
+                               || ! 
validate($GLOBALS['phpgw_data']['flags']['req_method'],'string'))
                        {
-                               $GLOBALS['msgbox']->add('illegal op 
name',__LINE__,__FILE__, 'fatal');
+                               $GLOBALS['msgbox']->add('illegal op name', 
'fatal');
 
                                
unset($GLOBALS['phpgw_data']['flags']['req_app'],$GLOBALS['phpgw_data']['flags']['req_class'],$GLOBALS['phpgw_data']['flags']['req_method']);
                        }
@@ -506,8 +530,8 @@
                        }
 
                        $GLOBALS['phpgw_data']['api']['req_app'] = 
$GLOBALS['phpgw_data']['flags']['req_app'];
-                       $GLOBALS['phpgw_data']['api']['prevop']  = 
$GLOBALS['phpgw_session']['prevop'];
-                       $GLOBALS['phpgw_session']['prevop']      = 
$GLOBALS['phpgw_data']['api']['op'];
+                       $GLOBALS['phpgw_data']['api']['prevop']  = 
$_SESSION['phpgw_session']['prevop'];
+                       $_SESSION['phpgw_session']['prevop']      = 
$GLOBALS['phpgw_data']['api']['op'];
                }
 
                function load_docs()
@@ -542,4 +566,3 @@
                        }
                }
        }
-       //register_shutdown_function(array($GLOBALS['phpgw'], 'phpgw_final'));




reply via email to

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