source: companies/serpro/mobile/index.php @ 903

Revision 903, 3.5 KB checked in by niltonneto, 15 years ago (diff)

Importacao inicial do Expresso do Serpro

Line 
1<?php
2        //TODO: Aplicar o conceito de subapp (mobileapp)
3
4        $phpgw_info = array();
5        $GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
6        //Testa a expiracao de sessao
7        $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
8        if (!isset($GLOBALS['sessionid']) || !$GLOBALS['sessionid']) {
9                Header('Location: ./login.php?cd=10');
10                exit;
11        }
12        /*if(!$GLOBALS['sessionid'])
13        {
14                /*if (($GLOBALS['phpgw_info']['server']['use_https'] == 2) && ($_SERVER['HTTPS'] != 'on'))
15                {
16
17                        Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
18                        exit;
19                }
20                else
21                {*/
22        /*      $location = 'Location: ' . $_SERVER['SCRIPT_URL'].'login.php';
23                Header('Location: ' . $_SERVER['SCRIPT_URL'].'login.php');
24                //Header('Location: ' . $_SERVER['SCRIPT_URL'].'login.php' .
25                //      (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ?
26                //      '?phpgw_forward='.urlencode('/index.php?'.$_SERVER['QUERY_STRING']):''));
27                exit;
28                //      Header('Location: login.php'.
29                //      (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ?
30                //      '?phpgw_forward='.urlencode('/mobile/index.php?'.$_SERVER['QUERY_STRING']):''));
31                //      exit;
32                //}
33        }*/
34
35        if ($GLOBALS['phpgw_info']['server']['use_https'] > 0)  {
36                if ($_SERVER['HTTPS'] != 'on') {
37                        Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
38                        exit;
39                }
40        }
41
42        /*
43                This is the menuaction driver for the multi-layered design
44        */
45        if(isset($_GET['menuaction']))
46        {
47                list($mobileapp,$class,$method) = explode('.',@$_GET['menuaction']);
48                if(! $mobileapp || ! $class || ! $method)
49                {
50                        $invalid_data = True;
51                }
52        }
53        else
54        {
55        //$phpgw->log->message('W-BadmenuactionVariable, menuaction missing or corrupt: %1',$menuaction);
56        //$phpgw->log->commit();
57                $mobileapp = 'home';
58                $invalid_data = True;
59        }
60
61        $GLOBALS['phpgw_info']['flags'] = array(
62                'noheader'   => True,
63                'nonavbar'   => True,
64                'currentapp' => 'mobile',
65                'mobileapp'  => $mobileapp,
66        );
67
68        include('../header.inc.php');
69        include('./mobile_header.inc.php');
70
71        if($mobileapp == 'home')
72        {
73                Header('Location: ' . $GLOBALS['phpgw']->link('/mobile/home.php'));
74        }
75
76        $GLOBALS[$class] = CreateObject(sprintf('%s.%s','mobile',$class));
77        $public_functions = $GLOBALS[$class]->public_functions;
78        if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data)
79        //if((is_array($public_functions) && $public_functions[$method]) && ! $invalid_data)
80        {
81                execmethod($_GET['menuaction']);
82                print_header();
83                print_footer();
84                unset($mobileapp);
85                unset($class);
86                unset($method);
87                unset($invalid_data);
88        }
89        else
90        {
91                if(!$mobileapp || !$class || !$method)
92                {
93                        if(@is_object($GLOBALS['phpgw']->log))
94                        {
95                                $GLOBALS['phpgw']->log->message(array(
96                                        'text' => 'W-BadmenuactionVariable, menuaction missing or corrupt: %1',
97                                        'p1'   => $menuaction,
98                                        'line' => __LINE__,
99                                        'file' => __FILE__
100                                ));
101                        }
102                }
103
104                if(!is_array($GLOBALS[$class]->public_functions) || ! $GLOBALS[$class]->public_functions[$method] && $method)
105                {
106                        if(@is_object($GLOBALS['phpgw']->log))
107                        {
108                                $GLOBALS['phpgw']->log->message(array(
109                                        'text' => 'W-BadmenuactionVariable, attempted to access private method: %1',
110                                        'p1'   => $method,
111                                        'line' => __LINE__,
112                                        'file' => __FILE__
113                                ));
114                        }
115                }
116                if(@is_object($GLOBALS['phpgw']->log))
117                {
118                        $GLOBALS['phpgw']->log->commit();
119                }
120                $GLOBALS['phpgw']->redirect_link('/mobile/home.php');
121        }
122
123?>
Note: See TracBrowser for help on using the repository browser.