source: sandbox/3.0/index.php @ 2991

Revision 2991, 4.3 KB checked in by amuller, 14 years ago (diff)

Ticket #1124 - Configurando a página a validação w3c

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