source: trunk/index.php @ 2707

Revision 2707, 4.3 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1058 - Corrigindo problemas no expressoAdmin1_2.

  • 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                $target = '( function( ){ var target = window.location.hash; target = ('
73                        . '( arguments.length && ( target && target.length > 1 ) ) ?'
74                        . 'URL_SERVER + target.substr( 1 ) : "' . $GLOBALS[ 'phpgw' ] -> link( $target ). '" ); ExpressoLivre.link( target ); } )';
75
76                if ( array_key_exists( 'HTTP_BACKGROUNDREQUEST', $_SERVER ) || array_key_exists( 'BackgroundRequest', $_GET ) )
77                        $target = "{$target}( );";
78                else
79                        $target = "XEvents.add( window, 'onload', {$target} );";
80
81                echo "<script>{$target}</script>";
82
83                exit;
84        }
85
86        if($api_requested)
87        {
88                $app = 'phpgwapi';
89        }
90
91        $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class));
92        if ( is_object( $GLOBALS[ $class ] ) && ( ( ! property_exists( $class, 'public_functions' ) ) || (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data ) )
93        {
94                $menuaction = $_GET[ 'menuaction' ];
95                unset( $_GET[ 'menuaction' ] );
96                echo execmethod( $menuaction, $_GET );
97                unset($app);
98                unset($class);
99                unset($method);
100                unset($invalid_data);
101                unset($api_requested);
102        }
103        else
104        {
105                if(!$app || !$class || !$method)
106                {
107                        if(@is_object($GLOBALS['phpgw']->log))
108                        {
109                                if($menuaction)
110                {                       
111                                        $GLOBALS['phpgw']->log->message(array(
112                                                'text' => "W-BadmenuactionVariable, menuaction missing or corrupt: $menuaction",
113                                                'p1'   => $menuaction,
114                                                'line' => __LINE__,
115                                                'file' => __FILE__
116                                        ));
117                }
118                        }
119                }
120
121                if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method)
122                {
123                        if(@is_object($GLOBALS['phpgw']->log))
124                        {                               
125                                if($menuaction)
126                {                       
127                                        $GLOBALS['phpgw']->log->message(array(
128                                                'text' => "W-BadmenuactionVariable, attempted to access private method: $method",
129                                                'p1'   => $method,
130                                                'line' => __LINE__,
131                                                'file' => __FILE__
132                                        ));
133                }
134                        }
135                }
136                if(@is_object($GLOBALS['phpgw']->log))
137                {
138                        $GLOBALS['phpgw']->log->commit();
139                }
140
141                echo '<script>ExpressoLivre.link( "' . $GLOBALS[ 'phpgw' ] -> link( '/home.php' ) . '", true );/* ??? */</script>';
142                exit;
143        }
144?>
Note: See TracBrowser for help on using the repository browser.