source: branches/2.4/index.php @ 7444

Revision 7444, 6.2 KB checked in by eduardow, 11 years ago (diff)

Ticket #3167 - Melhoria na performance nas pesquisas de contatos dinamicos.

  • 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       
66                Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
67                exit;
68        }
69
70        if($app == 'home' && !$api_requested)
71        {
72                if( $_GET['dont_redirect_if_moble'] == 1 )
73                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php?dont_redirect_if_moble=1'));
74                else
75                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php'));
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                if( $_GET['dont_redirect_if_moble'] == 1 )
132                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php?dont_redirect_if_moble=1'));
133                else
134                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php'));
135                               
136                //$GLOBALS['phpgw']->redirect_link('/home.php');
137        }
138
139        /*if(!isset($GLOBALS['phpgw_info']['nofooter']))
140        {
141                $GLOBALS['phpgw']->common->phpgw_footer();
142        }*/
143               
144                if($_GET['menuaction']){
145                        $modulo = explode('.', $_GET['menuaction']);
146                       
147                        if($modulo[0] == 'expressoAdmin1_2' || $modulo[0] == 'calendar'){
148                    echo '<script type="text/javascript" src="prototype/plugins/jquery/jquery.min.js"></script>
149                              <script type="text/javascript" src="prototype/plugins/jquery/jquery-ui.min.js"></script>
150                              <link rel="stylesheet" href="prototype/plugins/jqgrid/themes/prognusone/jquery-ui-1.8.2.custom.css" type="text/css" />
151                              <script src="prototype/plugins/json2/json2.js" language="javascript"></script>
152                              <script src="prototype/plugins/ejs/ejs.js" language="javascript"></script>
153                              <script src="prototype/plugins/store/jquery.store.js" language="javascript"></script>
154                              <script type="text/javascript" src="prototype/api/rest.js"></script>
155                          <script src="prototype/api/datalayer.js" language="javascript"></script>
156                              <script type="text/javascript">DataLayer.dispatchPath = "/"; REST.dispatchPath = "prototype/";REST.load("")</script>
157                              <link rel="stylesheet" type="text/css" href="prototype/plugins/zebradialog/css/zebra_dialog.css"></link>
158                              <script type="text/javascript" src="prototype/plugins/zebradialog/javascript/zebra_dialog.js"></script>       
159                              <script type="text/javascript" src="calendar/templates/default/js/quickSearch.js"></script>
160                             <script src="expressoMail1_2/js/ccQuickAdd.js" type="text/javascript"></script>
161                            ';
162                    if($modulo[0] == 'calendar'){
163                            echo '<link rel="stylesheet" href="prototype/plugins/jquery.jrating/jRating.jquery.css" type="text/css" />
164                            <script type="text/javascript" src="prototype/plugins/jquery.jrating/jRating.jquery.js"></script>
165                            <script src="expressoMail1_2/js/common_functions.js" type="text/javascript"></script>
166                            <script type="text/javascript">userContacts = false; currentTypeContact = ""; REST.get("/usercontacts", false, updateDynamicContact);</script>';
167                        }
168                        }
169                }
170?>
Note: See TracBrowser for help on using the repository browser.