source: sandbox/expressoAgenda/index.php @ 5042

Revision 5042, 3.9 KB checked in by alexandrecorreia, 13 years ago (diff)

Ticket #2260 - Sincronismo do branch2.2(versão 2.2.8) para 2.4 ajustes

  • 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        $current_url = substr($_SERVER["SCRIPT_NAME"], 0, strpos($_SERVER["SCRIPT_NAME"],'index.php'));
13
14        $phpgw_info = array();
15        if(!file_exists('header.inc.php'))
16        {
17                Header('Location: '.$current_url.'setup/index.php');
18                exit;
19        }
20
21        $GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
22        if(!$GLOBALS['sessionid'])
23        {
24                Header('Location: '.$current_url.'login.php'.
25                (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ?
26                '?phpgw_forward='.urlencode('/index.php?'.$_SERVER['QUERY_STRING']):''));
27                exit;
28        }
29
30        /*
31                This is the menuaction driver for the multi-layered design
32        */
33        if(isset($_GET['menuaction']))
34        {
35                list($app,$class,$method) = explode('.',@$_GET['menuaction']);
36                if(! $app || ! $class || ! $method)
37                {
38                        $invalid_data = True;
39                }
40        }
41        else
42        {
43        //$phpgw->log->message('W-BadmenuactionVariable, menuaction missing or corrupt: %1',$menuaction);
44        //$phpgw->log->commit();
45
46                $app = 'home';
47                $invalid_data = True;
48        }
49
50        if($app == 'phpgwapi')
51        {
52                $app = 'home';
53                $api_requested = True;
54        }
55
56        $GLOBALS['phpgw_info']['flags'] = array(
57                'noheader'   => True,
58                'nonavbar'   => True,
59                'currentapp' => $app
60        );
61        include('./header.inc.php');
62
63        if (($GLOBALS['phpgw_info']['server']['use_https'] == 2) && ($_SERVER['HTTPS'] != 'on'))
64        {
65                Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
66                exit;
67        }
68
69        if($app == 'home' && !$api_requested)
70        {
71                if( $_GET['dont_redirect_if_moble'] == 1 )
72                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php?dont_redirect_if_moble=1'));
73                else
74                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php'));
75        }
76
77        if($api_requested)
78        {
79                $app = 'phpgwapi';
80        }
81
82        $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class));
83        if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data)
84        {
85                execmethod($_GET['menuaction']);
86                unset($app);
87                unset($class);
88                unset($method);
89                unset($invalid_data);
90                unset($api_requested);
91        }
92        else
93        {
94                if(!$app || !$class || !$method)
95                {
96                        if(@is_object($GLOBALS['phpgw']->log))
97                        {
98                                if($menuaction)
99                {                       
100                                        $GLOBALS['phpgw']->log->message(array(
101                                                'text' => "W-BadmenuactionVariable, menuaction missing or corrupt: $menuaction",
102                                                'p1'   => $menuaction,
103                                                'line' => __LINE__,
104                                                'file' => __FILE__
105                                        ));
106                }
107                        }
108                }
109
110                if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method)
111                {
112                        if(@is_object($GLOBALS['phpgw']->log))
113                        {                               
114                                if($menuaction)
115                {                       
116                                        $GLOBALS['phpgw']->log->message(array(
117                                                'text' => "W-BadmenuactionVariable, attempted to access private method: $method",
118                                                'p1'   => $method,
119                                                'line' => __LINE__,
120                                                'file' => __FILE__
121                                        ));
122                }
123                        }
124                }
125                if(@is_object($GLOBALS['phpgw']->log))
126                {
127                        $GLOBALS['phpgw']->log->commit();
128                }
129
130                if( $_GET['dont_redirect_if_moble'] == 1 )
131                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php?dont_redirect_if_moble=1'));
132                else
133                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php'));
134                               
135                //$GLOBALS['phpgw']->redirect_link('/home.php');
136        }
137
138        /*if(!isset($GLOBALS['phpgw_info']['nofooter']))
139        {
140                $GLOBALS['phpgw']->common->phpgw_footer();
141        }*/
142?>
Note: See TracBrowser for help on using the repository browser.