source: trunk/index.php @ 2674

Revision 2674, 3.9 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1009 - Criando persistência da última requisicao a ser recuperada no reload.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * phpGroupWare                                                             *
4        * http://www.phpgroupware.org                                              *
5        * --------------------------------------------                             *
6        *  This program is free software; you can redistribute it and/or modify it *
7        *  under the terms of the GNU General Public License as published by the   *
8        *  Free Software Foundation; either version 2 of the License, or (at your  *
9        *  option) any later version.                                              *
10        \**************************************************************************/
11
12
13        $phpgw_info = array();
14        if(!file_exists('header.inc.php'))
15        {
16                Header('Location: setup/index.php');
17                exit;
18        }
19
20        $GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
21        if(!$GLOBALS['sessionid'])
22        {
23                Header('Location: login.php'.
24                (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ?
25                '?phpgw_forward='.urlencode('/index.php?'.$_SERVER['QUERY_STRING']):''));
26                exit;
27        }
28
29        /*
30                This is the menuaction driver for the multi-layered design
31        */
32        if(isset($_GET['menuaction']))
33        {
34                list($app,$class,$method) = explode('.',@$_GET['menuaction']);
35                if(! $app || ! $class || ! $method)
36                {
37                        $invalid_data = True;
38                }
39        }
40        else
41        {
42        //$phpgw->log->message('W-BadmenuactionVariable, menuaction missing or corrupt: %1',$menuaction);
43        //$phpgw->log->commit();
44
45                $app = 'home';
46                $invalid_data = True;
47        }
48
49        if($app == 'phpgwapi')
50        {
51                $app = 'home';
52                $api_requested = True;
53        }
54
55        $GLOBALS['phpgw_info']['flags'] = array(
56                'currentapp' => $app
57        );
58        include('./header.inc.php');
59
60        if (($GLOBALS['phpgw_info']['server']['use_https'] == 2) && ($_SERVER['HTTPS'] != 'on'))
61        {
62                Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
63                exit;
64        }
65
66        if ( $app == 'home' && ! $api_requested )
67        {
68                $target = 'home.php';
69                if ( $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] && $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app']])
70                        $target = $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] . '/index.php';
71
72                echo '<script>XEvents.add( window, "onload", function( ) { var target = window.location.hash; target = ( ( target && target.length > 1 ) ? URL_SERVER + target.substr( 1 ) : "'
73                        . $GLOBALS[ 'phpgw' ] -> link( $target ). '" );XLink( target ); } );</script>';
74
75                exit;
76        }
77
78        if($api_requested)
79        {
80                $app = 'phpgwapi';
81        }
82
83        $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class));
84        if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data)
85        {
86                execmethod($_GET['menuaction']);
87                unset($app);
88                unset($class);
89                unset($method);
90                unset($invalid_data);
91                unset($api_requested);
92        }
93        else
94        {
95                if(!$app || !$class || !$method)
96                {
97                        if(@is_object($GLOBALS['phpgw']->log))
98                        {
99                                if($menuaction)
100                {                       
101                                        $GLOBALS['phpgw']->log->message(array(
102                                                'text' => "W-BadmenuactionVariable, menuaction missing or corrupt: $menuaction",
103                                                'p1'   => $menuaction,
104                                                'line' => __LINE__,
105                                                'file' => __FILE__
106                                        ));
107                }
108                        }
109                }
110
111                if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method)
112                {
113                        if(@is_object($GLOBALS['phpgw']->log))
114                        {                               
115                                if($menuaction)
116                {                       
117                                        $GLOBALS['phpgw']->log->message(array(
118                                                'text' => "W-BadmenuactionVariable, attempted to access private method: $method",
119                                                'p1'   => $method,
120                                                'line' => __LINE__,
121                                                'file' => __FILE__
122                                        ));
123                }
124                        }
125                }
126                if(@is_object($GLOBALS['phpgw']->log))
127                {
128                        $GLOBALS['phpgw']->log->commit();
129                }
130
131                echo '<script>XLink( "' . $GLOBALS[ 'phpgw' ] -> link( '/home.php' ) . '", true );</script>';
132                exit;
133        }
134?>
Note: See TracBrowser for help on using the repository browser.