source: trunk/phpgwapi/inc/functions.inc.php @ 5281

Revision 5281, 21.9 KB checked in by wmerlotto, 12 years ago (diff)

Ticket #2398 - Compatibilizando codigo do Expresso, em geral, com PHP >= 5.3

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2         /**************************************************************************\
3         * eGroupWare API - phpgwapi loader                                         *
4         * This file written by Dan Kuykendall <seek3r@phpgroupware.org>            *
5         * and Joseph Engo <jengo@phpgroupware.org>                                 *
6         * Has a few functions, but primary role is to load the phpgwapi            *
7         * Copyright (C) 2000, 2001 Dan Kuykendall                                  *
8         * -------------------------------------------------------------------------*
9         * This library is part of the eGroupWare API                               *
10         * http://www.egroupware.org/api                                            *
11         * ------------------------------------------------------------------------ *
12         * This library is free software; you can redistribute it and/or modify it  *
13         * under the terms of the GNU Lesser General Public License as published by *
14         * the Free Software Foundation; either version 2.1 of the License,         *
15         * or any later version.                                                    *
16         * This library is distributed in the hope that it will be useful, but      *
17         * WITHOUT ANY WARRANTY; without even the implied warranty of               *
18         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
19         * See the GNU Lesser General Public License for more details.              *
20         * You should have received a copy of the GNU Lesser General Public License *
21         * along with this library; if not, write to the Free Software Foundation,  *
22         * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
23         \**************************************************************************/
24       
25       
26        /***************************************************************************\
27        * If running in PHP3, then force admin to upgrade                           *
28        \***************************************************************************/
29
30        error_reporting(error_reporting() & ~E_NOTICE);
31       
32        include(PHPGW_API_INC.'/common_functions.inc.php');
33       
34        /*!
35         @function lang
36         @abstract function to handle multilanguage support
37        */
38        function lang($key,$m1='',$m2='',$m3='',$m4='',$m5='',$m6='',$m7='',$m8='',$m9='',$m10='')
39        {
40                if(is_array($m1))
41                {
42                        $vars = $m1;
43                }
44                else
45                {
46                        $vars = array($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10);
47                }
48                // Get the translation from Lang File, if the database is down.
49                if(!$GLOBALS['phpgw']->translation){
50                        $fn = PHPGW_SERVER_ROOT.'/phpgwapi/setup/phpgw_'.$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE'].'.lang';
51                        if (file_exists($fn)){
52                                $fp = fopen($fn,'r');
53                                while ($data = fgets($fp,16000)){
54                                        list($message_id,$app_name,$null,$content) = explode("\t",substr($data,0,-1));
55                                        $GLOBALS['phpgw_info']['phpgwapi']['lang'][$message_id] =  $content;
56                                }
57                                fclose($fp);
58                        }
59                        $return = str_replace('%1',$vars[0],$GLOBALS['phpgw_info']['phpgwapi']['lang'][$key]);                 
60                        return $return; 
61                }
62                $value = $GLOBALS['phpgw']->translation->translate("$key",$vars);
63                return $value;
64        }
65
66        function get_theme()
67        {
68
69            $test_cookie = get_var('THEME', 'COOKIE');
70
71            // se o cookie foi definido coloca tema na sessão
72            if (!empty($test_cookie))
73            {
74                $_SESSION['THEME'] = $test_cookie;
75            }
76
77            // se tema não estiver definido na sessão retorna $GLOBALS['phpgw_info']['user']['preferences']['common']['theme']
78            if (!$_SESSION['THEME'])
79            {
80                return $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'];
81            }
82           
83            // senão retorna o tema definido na sessão
84            return $_SESSION['THEME'];
85        }
86
87        /* Make sure the header.inc.php is current. */
88        if ($GLOBALS['phpgw_info']['server']['versions']['header'] < $GLOBALS['phpgw_info']['server']['versions']['current_header'])
89        {
90                header("location:setup/manageheader.php");
91        }
92
93        /* Make sure the developer is following the rules. */
94        if (!isset($GLOBALS['phpgw_info']['flags']['currentapp']))
95        {
96                /* This object does not exist yet. */
97        /*      $GLOBALS['phpgw']->log->write(array('text'=>'W-MissingFlags, currentapp flag not set'));*/
98
99                echo '<b>!!! YOU DO NOT HAVE YOUR $GLOBALS[\'phpgw_info\'][\'flags\'][\'currentapp\'] SET !!!';
100                echo '<br>!!! PLEASE CORRECT THIS SITUATION !!!</b>';
101        }
102
103        print_debug('sane environment','messageonly','api');
104
105        /****************************************************************************\
106        * Multi-Domain support                                                       *
107        \****************************************************************************/
108       
109        /* make them fix their header */
110        if (!isset($GLOBALS['phpgw_domain']))
111        {
112                echo '<center><b>The administrator must upgrade the header.inc.php file before you can continue.</b></center>';
113                exit;
114        }
115        if (!isset($GLOBALS['phpgw_info']['server']['default_domain']) ||       // allow to overwrite the default domain
116                !isset($GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]))
117        {
118                reset($GLOBALS['phpgw_domain']);
119                list($GLOBALS['phpgw_info']['server']['default_domain']) = each($GLOBALS['phpgw_domain']);
120        }
121        if (isset($_POST['login']))     // on login
122        {
123                $GLOBALS['login'] = $_POST['login'];
124                if (strstr($GLOBALS['login'],'@') === False || count($GLOBALS['phpgw_domain']) == 1)
125                {
126                        $GLOBALS['login'] .= '@' . get_var('logindomain',array('POST'),$GLOBALS['phpgw_info']['server']['default_domain']);
127                }
128                $parts = explode('@',$GLOBALS['login']);
129                $GLOBALS['phpgw_info']['user']['domain'] = array_pop($parts);
130        }
131        else    // on "normal" pageview
132        {
133                $GLOBALS['phpgw_info']['user']['domain'] = get_var('domain', array('GET', 'COOKIE'), FALSE);
134        }
135
136        if (@isset($GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]))
137        {
138                $GLOBALS['phpgw_info']['server']['db_host'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_host'];
139                $GLOBALS['phpgw_info']['server']['db_port'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_port'];
140                $GLOBALS['phpgw_info']['server']['db_name'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_name'];
141                $GLOBALS['phpgw_info']['server']['db_user'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_user'];
142                $GLOBALS['phpgw_info']['server']['db_pass'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_pass'];
143                $GLOBALS['phpgw_info']['server']['db_type'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_type'];
144        }
145        else
146        {
147                $GLOBALS['phpgw_info']['server']['db_host'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_host'];
148                $GLOBALS['phpgw_info']['server']['db_port'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_port'];
149                $GLOBALS['phpgw_info']['server']['db_name'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_name'];
150                $GLOBALS['phpgw_info']['server']['db_user'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_user'];
151                $GLOBALS['phpgw_info']['server']['db_pass'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_pass'];
152                $GLOBALS['phpgw_info']['server']['db_type'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_type'];
153        }
154
155        if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'login' && ! $GLOBALS['phpgw_info']['server']['show_domain_selectbox'])
156        {
157                unset ($GLOBALS['phpgw_domain']); // we kill this for security reasons
158        }
159
160        print_debug('domain',@$GLOBALS['phpgw_info']['user']['domain'],'api');
161
162         /****************************************************************************\
163         * These lines load up the API, fill up the $phpgw_info array, etc            *
164         \****************************************************************************/
165         /* Load main class */
166        $GLOBALS['phpgw'] = CreateObject('phpgwapi.phpgw');
167         /************************************************************************\
168         * Load up the main instance of the db class.                             *
169         \************************************************************************/
170        $GLOBALS['phpgw']->db           = CreateObject('phpgwapi.db');
171        if ($GLOBALS['phpgw']->debug)
172        {
173                $GLOBALS['phpgw']->db->Debug = 1;
174        }
175        $GLOBALS['phpgw']->db->Halt_On_Error = 'no';
176        /* jakjr: ExpressoLivre: We do not count the config table. */
177        if (!
178        $GLOBALS['phpgw']->db->connect(
179                $GLOBALS['phpgw_info']['server']['db_name'],
180                $GLOBALS['phpgw_info']['server']['db_host'],
181                $GLOBALS['phpgw_info']['server']['db_port'],
182                $GLOBALS['phpgw_info']['server']['db_user'],
183                $GLOBALS['phpgw_info']['server']['db_pass'],
184                $GLOBALS['phpgw_info']['server']['db_type']
185        ) )
186        //@$GLOBALS['phpgw']->db->query("SELECT COUNT(config_name) FROM phpgw_config");
187        //if(!@$GLOBALS['phpgw']->db->next_record())
188        {
189               
190                /* BEGIN - CELEPAR - jakjr - 05/06/2006 */
191                /* $setup_dir = str_replace($_SERVER['PHP_SELF'],'index.php','setup/'); */
192                /*echo '<center><b>Fatal Error:</b> It appears that you have not created the database tables for '
193                        .'eGroupWare.  Click <a href="' . $setup_dir . '">here</a> to run setup.</center>';*/
194                echo '<center><b>'.lang("ExpressoLivre is unavailable at this moment. Code %1<br>Please, try later.","001").'</b></center>';
195                /* END - CELEPAR - jakjr - 05/06/2006 */
196                exit;
197        }
198        $GLOBALS['phpgw']->db->Halt_On_Error = 'yes';
199
200        /* Fill phpgw_info["server"] array */
201        // An Attempt to speed things up using cache premise
202        /* jakjr: ExpressoLivre does not use cache. */
203        /*
204        $GLOBALS['phpgw']->db->query("select config_value from phpgw_config WHERE config_app='phpgwapi' and config_name='cache_phpgw_info'",__LINE__,__FILE__);
205        if ($GLOBALS['phpgw']->db->num_rows())
206        {
207                $GLOBALS['phpgw']->db->next_record();
208                $GLOBALS['phpgw_info']['server']['cache_phpgw_info'] = stripslashes($GLOBALS['phpgw']->db->f('config_value'));
209        }*/
210
211        /* jakjr: ExpressoLivre does not use cache. */
212        /*     
213        $cache_query = "select content from phpgw_app_sessions where"
214                ." sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'";
215
216        $GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);
217        $server_info_cache = $GLOBALS['phpgw']->db->num_rows();
218        */
219        /*
220        if(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info'] && $server_info_cache)
221        {
222                $GLOBALS['phpgw']->db->next_record();
223                $GLOBALS['phpgw_info']['server'] = unserialize(stripslashes($GLOBALS['phpgw']->db->f('content')));
224        }
225        else
226        {*/
227                $GLOBALS['phpgw']->db->query("SELECT * from phpgw_config WHERE config_app='phpgwapi'",__LINE__,__FILE__);
228                while ($GLOBALS['phpgw']->db->next_record())
229                {
230                        $GLOBALS['phpgw_info']['server'][$GLOBALS['phpgw']->db->f('config_name')] = stripslashes($GLOBALS['phpgw']->db->f('config_value'));
231                }
232
233                /*
234                if(@isset($GLOBALS['phpgw_info']['server']['cache_phpgw_info']))
235                {
236                        if($server_info_cache)
237                        {
238                                $cache_query = "DELETE FROM phpgw_app_sessions WHERE sessionid='0' and loginid='0' and app='phpgwapi' and location='config'";
239                                $GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);
240                        }
241                        $cache_query = 'INSERT INTO phpgw_app_sessions(sessionid,loginid,app,location,content) VALUES('
242                                . "'0','0','phpgwapi','config','".addslashes(serialize($GLOBALS['phpgw_info']['server']))."')";
243                        $GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);
244                }*/
245        //}
246        unset($cache_query);
247        unset($server_info_cache);
248        if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) && !$_SERVER['HTTPS'])
249        {
250                Header('Location: https://' . $GLOBALS['phpgw_info']['server']['hostname'] . $GLOBALS['phpgw_info']['server']['webserver_url'] . $_SERVER['REQUEST_URI']);
251                exit;
252        }
253
254        /****************************************************************************\
255        * This is a global constant that should be used                              *
256        * instead of / or \ in file paths                                            *
257        \****************************************************************************/
258        define('SEP',filesystem_separator());
259
260        /************************************************************************\
261        * Required classes                                                       *
262        \************************************************************************/
263        $GLOBALS['phpgw']->log          = CreateObject('phpgwapi.errorlog');
264        $GLOBALS['phpgw']->translation  = CreateObject('phpgwapi.translation');
265        $GLOBALS['phpgw']->common       = CreateObject('phpgwapi.common');
266        $GLOBALS['phpgw']->hooks        = CreateObject('phpgwapi.hooks');
267        $GLOBALS['phpgw']->auth         = CreateObject('phpgwapi.auth');
268        $GLOBALS['phpgw']->accounts     = CreateObject('phpgwapi.accounts');
269        $GLOBALS['phpgw']->acl          = CreateObject('phpgwapi.acl');
270        $GLOBALS['phpgw']->session      = CreateObject('phpgwapi.sessions');
271        $GLOBALS['phpgw']->preferences  = CreateObject('phpgwapi.preferences');
272        $GLOBALS['phpgw']->applications = CreateObject('phpgwapi.applications');
273        $GLOBALS['phpgw']->css          = CreateObject('phpgwapi.css');
274        print_debug('main class loaded', 'messageonly','api');
275        if (! isset($GLOBALS['phpgw_info']['flags']['included_classes']['error']) ||
276                ! $GLOBALS['phpgw_info']['flags']['included_classes']['error'])
277        {
278                include_once(PHPGW_INCLUDE_ROOT.'/phpgwapi/inc/class.error.inc.php');
279                $GLOBALS['phpgw_info']['flags']['included_classes']['error'] = True;
280        }
281
282        /*****************************************************************************\
283        * ACL defines - moved here to work for xml-rpc/soap, also                     *
284        \*****************************************************************************/
285        define('PHPGW_ACL_READ',1);
286        define('PHPGW_ACL_ADD',2);
287        define('PHPGW_ACL_EDIT',4);
288        define('PHPGW_ACL_DELETE',8);
289        define('PHPGW_ACL_PRIVATE',16);
290        define('PHPGW_ACL_GROUP_MANAGERS',32);
291        define('PHPGW_ACL_CUSTOM_1',64);
292        define('PHPGW_ACL_CUSTOM_2',128);
293        define('PHPGW_ACL_CUSTOM_3',256);
294
295        /****************************************************************************\
296        * Forcing the footer to run when the rest of the script is done.             *
297        \****************************************************************************/
298        register_shutdown_function(array($GLOBALS['phpgw']->common, 'phpgw_final'));
299
300        /****************************************************************************\
301        * Stuff to use if logging in or logging out                                  *
302        \****************************************************************************/
303        if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'login' || $GLOBALS['phpgw_info']['flags']['currentapp'] == 'logout')
304        {
305                if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'login')
306                {
307                        if (@$_POST['login'] != '')
308                        {
309                                if (count($GLOBALS['phpgw_domain']) > 1)
310                                {
311                                        list($login) = explode('@',$_POST['login']);
312                                }
313                                else
314                                {
315                                        $login = $_POST['login'];
316                                }
317                                print_debug('LID',$login,'app');
318                                $login_id = $GLOBALS['phpgw']->accounts->name2id($login);
319                                print_debug('User ID',$login_id,'app');
320                                $GLOBALS['phpgw']->accounts->accounts($login_id);
321                                $GLOBALS['phpgw']->preferences->preferences($login_id);
322                                $GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.date_time');
323                        }
324                }
325        /**************************************************************************\
326        * Everything from this point on will ONLY happen if                        *
327        * the currentapp is not login or logout                                    *
328        \**************************************************************************/
329        }
330        else
331        {
332                if (! $GLOBALS['phpgw']->session->verify())
333                {
334                        // we forward to the same place after the re-login
335                        if ($GLOBALS['phpgw_info']['server']['webserver_url'] && $GLOBALS['phpgw_info']['server']['webserver_url'] != '/')
336                        {
337                                list(,$relpath) = explode($GLOBALS['phpgw_info']['server']['webserver_url'],$_SERVER['PHP_SELF'],2);
338                        }
339                        else    // the webserver-url is empty or just a slash '/' (eGW is installed in the docroot and no domain given)
340                        {
341                                if (preg_match('/^https?:\/\/[^\/]*\/(.*)$/',$relpath=$_SERVER['PHP_SELF'],$matches))
342                                {
343                                        $relpath = $matches[1];
344                                }
345                        }
346
347                        $ifMobile = false;
348                        $browser = CreateObject('phpgwapi.browser');
349                        switch ( $browser->get_platform() )
350                        {
351                                case browser::PLATFORM_IPHONE:
352                                case browser::PLATFORM_IPOD:
353                                case browser::PLATFORM_IPAD:
354                                case browser::PLATFORM_BLACKBERRY:
355                                case browser::PLATFORM_NOKIA:
356                                case browser::PLATFORM_ANDROID:
357                                        $ifMobile = true;
358                                        break;
359                        }
360                       
361                        if( $ifMobile )
362                        {
363                                Header('Location: '.$GLOBALS['phpgw_info']['server']['webserver_url'].'/login.php?cd=66');
364                                exit;
365                        }
366                        else
367                        {
368                                // this removes the sessiondata if its saved in the URL
369                                $query = preg_replace('/[&]?sessionid(=|%3D)[^&]+&kp3(=|%3D)[^&]+&domain=.*$/','',$_SERVER['QUERY_STRING']);
370                                Header('Location: '.$GLOBALS['phpgw_info']['server']['webserver_url'].'/login.php?cd=10&phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : '')));
371                                exit;
372                        }
373                }
374
375                $GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.date_time');
376
377                /* A few hacker resistant constants that will be used throught the program */
378                define('PHPGW_TEMPLATE_DIR', ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi'));
379                define('PHPGW_IMAGES_DIR', ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi'));
380                define('PHPGW_IMAGES_FILEDIR', ExecMethod('phpgwapi.phpgw.common.get_image_dir', 'phpgwapi'));
381                define('PHPGW_APP_ROOT', ExecMethod('phpgwapi.phpgw.common.get_app_dir'));
382                define('PHPGW_APP_INC', ExecMethod('phpgwapi.phpgw.common.get_inc_dir'));
383                define('PHPGW_APP_TPL', ExecMethod('phpgwapi.phpgw.common.get_tpl_dir'));
384                define('PHPGW_IMAGES', ExecMethod('phpgwapi.phpgw.common.get_image_path'));
385                define('PHPGW_APP_IMAGES_DIR', ExecMethod('phpgwapi.phpgw.common.get_image_dir'));
386
387                /*      define('PHPGW_APP_IMAGES_DIR', $GLOBALS['phpgw']->common->get_image_dir()); */
388
389                /* Moved outside of this logic
390                define('PHPGW_ACL_READ',1);
391                define('PHPGW_ACL_ADD',2);
392                define('PHPGW_ACL_EDIT',4);
393                define('PHPGW_ACL_DELETE',8);
394                define('PHPGW_ACL_PRIVATE',16);
395                */
396
397                /********* This sets the user variables *********/
398                $GLOBALS['phpgw_info']['user']['private_dir'] = $GLOBALS['phpgw_info']['server']['files_dir']
399                        . '/users/'.$GLOBALS['phpgw_info']['user']['userid'];
400
401                /* This will make sure that a user has the basic default prefs. If not it will add them */
402                $GLOBALS['phpgw']->preferences->verify_basic_settings();
403
404                /********* Optional classes, which can be disabled for performance increases *********/
405                while ($phpgw_class_name = each($GLOBALS['phpgw_info']['flags']))
406                {
407                        if (preg_match('/enable_/',$phpgw_class_name[0]))
408                        {
409                                $enable_class = str_replace('enable_','',$phpgw_class_name[0]);
410                                $enable_class = str_replace('_class','',$enable_class);
411                                eval('$GLOBALS["phpgw"]->' . $enable_class . ' = createobject(\'phpgwapi.' . $enable_class . '\');');
412                        }
413                }
414                unset($enable_class);
415                reset($GLOBALS['phpgw_info']['flags']);
416
417
418                if (!include(PHPGW_SERVER_ROOT . '/phpgwapi/themes/' . get_theme() . '.theme'))
419                {
420                        if(!include(PHPGW_SERVER_ROOT . '/phpgwapi/themes/default.theme'))
421                        {
422                                /* Hope we don't get to this point.  Better then the user seeing a */
423                                /* complety back screen and not know whats going on                */
424                                echo '<body bgcolor="FFFFFF">';
425                                $GLOBALS['phpgw']->log->write(array('text'=>'F-Abort, No themes found'));
426
427                                exit;
428                        }
429                }
430
431                /*************************************************************************\
432                * These lines load up the templates class                                 *
433                \*************************************************************************/
434                if(!@$GLOBALS['phpgw_info']['flags']['disable_Template_class'])
435                {
436                        $GLOBALS['phpgw']->template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
437                        preg_match('/(.*)\/(.*)/', PHPGW_APP_TPL, $matches);
438
439                        if ( $GLOBALS['phpgw_info']['flags']['currentapp'] != "jabberit_messenger" )
440                                $_SESSION['phpgw_info'][$GLOBALS['phpgw_info']['flags']['currentapp']]['user']['preferences']['common']['template_set'] = $matches[2];
441                }
442
443
444                /*************************************************************************\
445                * If they are using frames, we need to set some variables                 *
446                \*************************************************************************/
447                if (((isset($GLOBALS['phpgw_info']['user']['preferences']['common']['useframes']) &&
448                        $GLOBALS['phpgw_info']['user']['preferences']['common']['useframes']) &&
449                        $GLOBALS['phpgw_info']['server']['useframes'] == 'allowed') ||
450                        ($GLOBALS['phpgw_info']['server']['useframes'] == 'always'))
451                {
452                        $GLOBALS['phpgw_info']['flags']['navbar_target'] = 'phpgw_body';
453                }
454
455                /*************************************************************************\
456                * Verify that the users session is still active otherwise kick them out   *
457                \*************************************************************************/
458                if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
459                        $GLOBALS['phpgw_info']['flags']['currentapp'] != 'about' &&
460                        $GLOBALS['phpgw_info']['flags']['currentapp'] != 'mobile')
461                {
462                        // This will need to use ACL in the future
463                        if (! $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']] ||
464                                (@$GLOBALS['phpgw_info']['flags']['admin_only'] &&
465                                ! $GLOBALS['phpgw_info']['user']['apps']['admin']))
466                        {
467                                $GLOBALS['phpgw']->common->phpgw_header();
468                                if ($GLOBALS['phpgw_info']['flags']['noheader'])
469                                {
470                                        echo parse_navbar();
471                                }
472
473                                $GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access %1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
474
475                                echo '<p><center><b>'.lang('Access not permitted').'</b></center>';
476                                $GLOBALS['phpgw']->common->phpgw_exit(True);
477                        }
478                }
479
480                if(!is_object($GLOBALS['phpgw']->datetime))
481                {
482                        $GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.date_time');
483                }
484                $GLOBALS['phpgw']->applications->read_installed_apps(); // to get translated app-titles
485               
486                /*************************************************************************\
487                * Load the header unless the developer turns it off                       *
488                \*************************************************************************/
489                if (!@$GLOBALS['phpgw_info']['flags']['noheader'])
490                {
491                        $GLOBALS['phpgw']->common->phpgw_header();
492                }
493
494        }
Note: See TracBrowser for help on using the repository browser.