fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7383]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7383]
Date: Thu, 16 Jun 2011 06:46:26 +0000

Revision: 7383
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7383
Author:   erikhl
Date:     2011-06-16 06:46:25 +0000 (Thu, 16 Jun 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/activitycalendarfrontend/index.php

Modified: trunk/activitycalendarfrontend/index.php
===================================================================
--- trunk/activitycalendarfrontend/index.php    2011-06-16 06:27:19 UTC (rev 
7382)
+++ trunk/activitycalendarfrontend/index.php    2011-06-16 06:46:25 UTC (rev 
7383)
@@ -6,7 +6,7 @@
     );
     
     $GLOBALS['phpgw_info']['flags']['session_name'] = 
'activitycalendarfrontendsession';
-       //$GLOBALS['phpgw_remote_user_fallback'] = 'sql';
+       $GLOBALS['phpgw_remote_user_fallback'] = 'sql';
        include_once('../header.inc.php');
 
        // Make sure we're always logged in
@@ -31,10 +31,162 @@
                }
        }
        $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'activitycalendarfrontend';
-       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
        
+       
/////////////////////////////////////////////////////////////////////////////
+// BEGIN Stuff copied from functions.inc.php
+/////////////////////////////////////////////////////////////////////////////
+
+               
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] !='en')
+               {
+                       
$GLOBALS['phpgw']->translation->set_userlang($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],
 true);
+               }
+
+               /* A few hacker resistant constants that will be used throught 
the program */
+               define('PHPGW_TEMPLATE_DIR', 
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi'));
+               define('PHPGW_IMAGES_DIR', 
ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi'));
+               define('PHPGW_IMAGES_FILEDIR', 
ExecMethod('phpgwapi.phpgw.common.get_image_dir', 'phpgwapi'));
+               define('PHPGW_APP_ROOT', 
ExecMethod('phpgwapi.phpgw.common.get_app_dir'));
+               define('PHPGW_APP_INC', 
ExecMethod('phpgwapi.phpgw.common.get_inc_dir'));
+               define('PHPGW_APP_TPL', 
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir'));
+               define('PHPGW_IMAGES', 
ExecMethod('phpgwapi.phpgw.common.get_image_path'));
+               define('PHPGW_APP_IMAGES_DIR', 
ExecMethod('phpgwapi.phpgw.common.get_image_dir'));
+
+       
/************************************************************************\
+       * Load the menuaction                                                   
 *
+       
\************************************************************************/
+               $GLOBALS['phpgw_info']['menuaction'] = 
phpgw::get_var('menuaction');
+               if(!$GLOBALS['phpgw_info']['menuaction'])
+               {
+                       unset($GLOBALS['phpgw_info']['menuaction']);
+               }
+
+               /********* This sets the user variables *********/
+               $GLOBALS['phpgw_info']['user']['private_dir'] = 
$GLOBALS['phpgw_info']['server']['files_dir']
+                       . '/users/'.$GLOBALS['phpgw_info']['user']['userid'];
+
+               /* This will make sure that a user has the basic default prefs. 
If not it will add them */
+               $GLOBALS['phpgw']->preferences->verify_basic_settings();
+
+               /********* Optional classes, which can be disabled for 
performance increases *********/
+               while ($phpgw_class_name = 
each($GLOBALS['phpgw_info']['flags']))
+               {
+                       if (ereg('enable_', $phpgw_class_name[0]))
+                       {
+                               $enable_class = str_replace('enable_', '', 
$phpgw_class_name[0]);
+                               $enable_class = str_replace('_class', '', 
$enable_class);
+                               $GLOBALS['phpgw']->$enable_class = 
createObject("phpgwapi.{$enable_class}");
+                       }
+               }
+               unset($enable_class);
+               reset($GLOBALS['phpgw_info']['flags']);
+
+               
/*************************************************************************\
+               * These lines load up the templates class                       
          *
+               
\*************************************************************************/
+               if ( 
!isset($GLOBALS['phpgw_info']['flags']['disable_Template_class'])
+                       || 
!$GLOBALS['phpgw_info']['flags']['disable_Template_class'] )
+               {
+                       $GLOBALS['phpgw']->template = 
createObject('phpgwapi.Template',PHPGW_APP_TPL);
+                       $GLOBALS['phpgw']->xslttpl = 
createObject('phpgwapi.xslttemplates',PHPGW_APP_TPL);
+               }
+
+               
/*************************************************************************\
+               * Verify that the users session is still active otherwise kick 
them out   *
+               
\*************************************************************************/
+               if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' && 
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
+               {
+                       if (!$GLOBALS['phpgw']->acl->check('run', 
PHPGW_ACL_READ, $GLOBALS['phpgw_info']['flags']['currentapp']))
+                       {
+                               $GLOBALS['phpgw']->common->phpgw_header(true);
+                               
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access 
%1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
+
+                               $lang_denied = lang('Access not permitted');
+                               echo <<<HTML
+                                       <div class="error">$lang_denied</div>
+
+HTML;
+                               $GLOBALS['phpgw']->common->phpgw_exit(True);
+                       }
+               }
+
+       //  Already called from sessions::verify
+       //      $GLOBALS['phpgw']->applications->read_installed_apps(); // to 
get translated app-titles
+
+               
/*************************************************************************\
+               * Load the header unless the developer turns it off             
          *
+               
\*************************************************************************/
+               if ( !isset($GLOBALS['phpgw_info']['flags']['noheader']) || 
!$GLOBALS['phpgw_info']['flags']['noheader'] )
+               {
+                       $inc_navbar = 
!isset($GLOBALS['phpgw_info']['flags']['nonavbar']) || 
!$GLOBALS['phpgw_info']['flags']['nonavbar'];
+                       $GLOBALS['phpgw']->common->phpgw_header($inc_navbar);
+                       unset($inc_navbar);
+               }
+
+               
/*************************************************************************\
+               * Load the app include files if the exists                      
          *
+               
\*************************************************************************/
+               /* Then the include file */
+               if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) && 
file_exists(PHPGW_APP_INC . '/functions.inc.php') && 
!isset($GLOBALS['phpgw_info']['menuaction']))
+               {
+                       include_once(PHPGW_APP_INC . '/functions.inc.php');
+               }
+               if (address@hidden'phpgw_info']['flags']['noheader'] &&
+                       address@hidden'phpgw_info']['flags']['noappheader'] &&
+                       file_exists(PHPGW_APP_INC . '/header.inc.php') && 
!isset($GLOBALS['phpgw_info']['menuaction']))
+               {
+                       include_once(PHPGW_APP_INC . '/header.inc.php');
+               }
+
+/////////////////////////////////////////////////////////////////////////////
+// END Stuff copied from functions.inc.php
+/////////////////////////////////////////////////////////////////////////////
+
        if (isset($_GET['menuaction']))
        {
+               list($app,$class,$method) = explode('.',$_GET['menuaction']);
+       }
+       else
+       {
+               $app = 'activitycalendarfrontend';
+               $class = 'uiactivity';
+               $method = 'index';
+       }
+
+       $GLOBALS[$class] = CreateObject("{$app}.{$class}");
+
+       $invalid_data = false; //FIXME consider whether this should be computed 
as in the main index.php
+       if ( !$invalid_data 
+               && is_object($GLOBALS[$class])
+               && isset($GLOBALS[$class]->public_functions) 
+               && is_array($GLOBALS[$class]->public_functions) 
+               && isset($GLOBALS[$class]->public_functions[$method])
+               && $GLOBALS[$class]->public_functions[$method] )
+
+       {
+               if ( phpgw::get_var('X-Requested-With', 'string', 'SERVER') == 
'XMLHttpRequest'
+                        // deprecated
+                       || phpgw::get_var('phpgw_return_as', 'string', 'GET') 
== 'json' )
+               {
+                       // comply with RFC 4627
+                       header('Content-Type: application/json'); 
+                       $return_data = $GLOBALS[$class]->$method();
+                       echo json_encode($return_data);
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+               else
+               {
+                       $GLOBALS[$class]->$method();    
+                       $GLOBALS['phpgw']->common->phpgw_footer();
+               }
+       }
+       
+       //$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+       
+/*
+       
+       if (isset($_GET['menuaction']))
+       {
                //list($app,$class,$method) = explode('.',$_GET['menuaction']);
                $GLOBALS['phpgw']->redirect_link('/index.php',$_GET);
        }
@@ -44,7 +196,7 @@
                //$app = 'activitycalendarfrontend';
                //$class = 'uiactivity';
                //$method = 'index';
-       }
+       }*/
        /*
                $GLOBALS[$class] = CreateObject("{$app}.{$class}");
 




reply via email to

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