source: sandbox/2.4.1-3/home.php @ 6352

Revision 6352, 8.6 KB checked in by gustavo, 12 years ago (diff)

Ticket #2768 - Melhorias na inserção de destinatários na criacao de mensagem

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare                                                               *
4        * http://www.egroupware.org                                                *
5        * The file written by Joseph Engo <jengo@phpgroupware.org>                 *
6        * This file modified by Greg Haygood <shrykedude@bellsouth.net>            *
7        * --------------------------------------------                             *
8        *  This program is free software; you can redistribute it and/or modify it *
9        *  under the terms of the GNU General Public License as published by the   *
10        *  Free Software Foundation; either version 2 of the License, or (at your  *
11        *  option) any later version.                                              *
12        \**************************************************************************/
13        $phpgw_info = array();
14        $current_url = substr($_SERVER["SCRIPT_NAME"], 0, strpos($_SERVER["SCRIPT_NAME"],'home.php'));
15
16        if (!is_file('header.inc.php'))
17        {
18                Header('Location: '.$current_url.'setup/index.php');
19                exit;
20        }
21
22        $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
23        if (!isset($GLOBALS['sessionid']) || !$GLOBALS['sessionid'])
24        {
25                Header('Location: '.$current_url.'login.php?cd=10');
26                exit;
27        }
28
29        $GLOBALS['phpgw_info']['flags'] = array(
30                'noheader'                => True,
31                'nonavbar'                => True,
32                'currentapp'              => 'home',
33                'enable_network_class'    => True,
34                'enable_contacts_class'   => True,
35                'enable_nextmatchs_class' => True
36        );
37        include('header.inc.php');
38       
39        //detect browser
40        require_once('phpgwapi/inc/class.browser.inc.php');
41       
42        $ifMobile       = false;
43        $browser        = new browser();
44       
45       
46        switch( $browser->get_platform() )
47        {
48                case browser::PLATFORM_IPHONE:
49                case browser::PLATFORM_IPOD:
50                case browser::PLATFORM_IPAD:
51                case browser::PLATFORM_BLACKBERRY:
52                case browser::PLATFORM_ANDROID:                                         
53                        $ifMobile = false;
54                        break;                 
55        }
56       
57        if( $ifMobile )
58        {
59                if( $_GET['dont_redirect_if_moble'] != 1 )
60                {
61                        $GLOBALS['phpgw']->redirect('/mobile/index.php');
62                        exit;                   
63                }
64        }
65       
66       
67        $GLOBALS['phpgw_info']['flags']['app_header']=lang('home');
68
69        // Commented by alpeb: The following prevented anonymous users to get a home page. Perhaps it was done with anonymous users such as the ones
70        // used by  wiki and sitemgr in mind. However, if you mark a normal user as anonymous just to avoid being shown in sessions and access log (like you would for an admin that doesn't want to be noticed), the user won't be able to login anymore. That's why I commented the code.
71        /*if ($GLOBALS['phpgw']->session->session_flags == 'A')
72        {
73                if ($_SERVER['HTTP_REFERER'] && strstr($_SERVER['HTTP_REFERER'],'home.php') === False)
74                {
75                        $GLOBALS['phpgw']->redirect($_SERVER['HTTP_REFERER']);
76                }
77                else
78                {
79                        // redirect to the login-page, better then giving an empty page
80                        $GLOBALS['phpgw']->redirect('login.php');
81                }
82                exit;
83        }*/
84
85        if ($GLOBALS['phpgw_info']['server']['force_default_app'] && $GLOBALS['phpgw_info']['server']['force_default_app'] != 'user_choice')
86        {
87                $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] = $GLOBALS['phpgw_info']['server']['force_default_app'];
88        }
89
90        if ($_GET['cd']=='yes' && $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] &&
91                $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app']])
92        {
93                $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/' . $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] . '/' . 'index.php'));
94        }
95        else
96        {
97                $GLOBALS['phpgw']->common->phpgw_header();
98                echo parse_navbar();
99        }
100
101/*
102//ESSE TRECHO DE CÓDIGO DEVE SER INSERIDO NOVAMENTE POSTERIORMENTE !!!!!!!!!!!
103
104        // Default Applications (Home Page)
105        $default_apps = Array(                 
106                        'workflow',                     
107                        'expressoMail1_2',
108                        'calendar',
109                        'news_admin'
110                );
111        $sorted_apps = array();
112        $user_apps = $GLOBALS['phpgw_info']['user']['apps'];
113        @reset($user_apps);     
114        for($i = 0; $i < count($default_apps);$i++) {
115                if(array_key_exists($default_apps[$i], $user_apps)){
116                        $sorted_apps[] = $default_apps[$i];
117                }               
118        }
119       
120        foreach($GLOBALS['phpgw_info']['user']['apps'] as $i => $p) {
121                $sorted_apps[] = $p['name'];
122        }
123
124        $portal_oldvarnames = array('mainscreen_showevents', 'homeShowEvents','homeShowLatest','mainscreen_showmail','mainscreen_showbirthdays','mainscreen_show_new_updated');
125        $done = array();
126        // Display elements, within appropriate table cells     
127        @reset($sorted_apps);
128        $idx = 1;
129        echo "<table width='100%' cellpadding=5>";
130        foreach($sorted_apps as $appname)
131        {
132                if((int)$done[$appname] == 1 || empty($appname)){
133                        continue;
134                }
135                $varnames = $portal_oldvarnames;
136                $varnames[] = 'homepage_display';
137                $thisd = 0;
138                $tmp = '';
139
140                foreach($varnames as $varcheck)
141                {
142
143                        /*if($appname == 'expressoMail1_2') {
144                                $tmp = $appname;
145                                $appname = 'expressoMail';
146                        }*/
147/*
148                        if(array_search($appname, $default_apps) !== False){
149                                $thisd = 1;
150                                break;
151                        }
152                        if($GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]=='True') {
153                                $thisd = 1;
154                                break;
155                        }
156                        else  {
157                                $_thisd = (int)$GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck];
158                                if($_thisd > 0) {
159                                        $thisd = $_thisd;
160                                        break;
161                                }
162                        }
163                }
164
165               if($thisd > 0)
166                {
167                        if($tmp) {
168                $appname = $tmp;
169                                $tmp = '';
170                        }
171                        if($idx == 0) {
172                                print '<tr>';
173                        }
174                        print '<td style="vertical-align:top;" width="45%">';
175                        $GLOBALS['phpgw']->hooks->single('home',$appname);
176                        print '</td>';
177
178                        if($idx == 2){
179                                $idx = 0;
180                                print '</tr>';
181                        }
182                        $idx++;
183                        $neworder[] = $appname;
184                }
185                $done[$appname] = 1;
186        }
187        print '</table>';
188*/
189
190
191
192//Inicio       
193        echo '
194            <link rel="Stylesheet" type="text/css" href="prototype/plugins/jquery/jquery-ui.css" />                                     
195   
196            <script type="text/javascript" src="prototype/plugins/jquery/jquery.min.js"></script>
197       
198            <script type="text/javascript" src="prototype/plugins/jquery/jquery-ui.min.js"></script>
199            <script type="text/javascript" src="prototype/plugins/jquery/jquery-ui.custom.min.js"></script>
200            <script src="prototype/plugins/json2/json2.js" language="javascript"></script>
201            <script src="prototype/plugins/ejs/ejs.js" language="javascript"></script>
202            <script src="prototype/plugins/store/jquery.store.js" language="javascript"></script>
203           
204            <script src="prototype/api/datalayer.js" language="javascript"></script>   
205           
206            <script type="text/javascript" src="prototype/plugins/datejs/date-pt-BR.js"></script>
207            <script type="text/javascript" src="prototype/plugins/datejs/sugarpak.js"></script>
208            <script type="text/javascript" src="prototype/plugins/datejs/parser.js"></script>
209
210            <script type="text/javascript" src="prototype/plugins/countdown/jquery.countdown.min.js"></script>
211            <script type="text/javascript" src="prototype/plugins/countdown/jquery.countdown-pt-BR.js"></script>
212
213            <script type="text/javascript" src="prototype/modules/home/js/home.js"></script>
214            <link rel="Stylesheet" type="text/css" href="prototype/modules/home/css/home.css" />       
215        ';
216
217        echo'
218            <tr>
219                <td>
220                    <div class="portlets" style="width: 100%;"></div>
221                <td>
222            </tr>';
223
224//Fim   
225        $GLOBALS['phpgw']->common->phpgw_footer();
226?>
Note: See TracBrowser for help on using the repository browser.