source: sandbox/3.0/home.php @ 2674

Revision 2674, 4.7 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1009 - Criando persistência da última requisicao a ser recuperada no reload.

  • 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        if (!is_file('header.inc.php'))
15        {
16                Header('Location: setup/index.php');
17                exit;
18        }
19
20        $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
21        if (!isset($GLOBALS['sessionid']) || !$GLOBALS['sessionid'])
22        {
23                Header('Location: login.php?cd=10');
24                exit;
25        }
26
27        $GLOBALS['phpgw_info']['flags'] = array(
28                'currentapp'              => 'home',
29                //'noheader'                => ( ( array_key_exists( 'HTTP_BACKGROUNDREQUEST', $_SERVER ) ) ? true : false ),
30                //'nonavbar'                => ( ( array_key_exists( 'HTTP_BACKGROUNDREQUEST', $_SERVER ) ) ? true : false ),
31                'enable_network_class'    => True,
32                'enable_contacts_class'   => True,
33                'enable_nextmatchs_class' => True
34        );
35
36        include('header.inc.php');
37        $GLOBALS['phpgw_info']['flags']['app_header']=lang('home');
38
39        // Commented by alpeb: The following prevented anonymous users to get a home page. Perhaps it was done with anonymous users such as the ones
40        // 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.
41        /*if ($GLOBALS['phpgw']->session->session_flags == 'A')
42        {
43                if ($_SERVER['HTTP_REFERER'] && strstr($_SERVER['HTTP_REFERER'],'home.php') === False)
44                {
45                        $GLOBALS['phpgw']->redirect($_SERVER['HTTP_REFERER']);
46                }
47                else
48                {
49                        // redirect to the login-page, better then giving an empty page
50                        $GLOBALS['phpgw']->redirect('login.php');
51                }
52                exit;
53        }*/
54
55        if ($GLOBALS['phpgw_info']['server']['force_default_app'] && $GLOBALS['phpgw_info']['server']['force_default_app'] != 'user_choice')
56        {
57                $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] = $GLOBALS['phpgw_info']['server']['force_default_app'];
58        }
59
60        // Default Applications (Home Page)
61        $default_apps = Array(                 
62                        'workflow',                     
63                        'expressoMail1_2',
64                        'calendar',
65                        'news_admin'
66                );
67        $sorted_apps = array();
68        $user_apps = $GLOBALS['phpgw_info']['user']['apps'];
69        @reset($user_apps);     
70        for($i = 0; $i < count($default_apps);$i++) {
71                if(array_key_exists($default_apps[$i], $user_apps)){
72                        $sorted_apps[] = $default_apps[$i];
73                }               
74        }
75       
76        foreach($GLOBALS['phpgw_info']['user']['apps'] as $i => $p) {
77                $sorted_apps[] = $p['name'];
78        }
79       
80        $portal_oldvarnames = array('mainscreen_showevents', 'homeShowEvents','homeShowLatest','mainscreen_showmail','mainscreen_showbirthdays','mainscreen_show_new_updated');
81        $done = array();
82        // Display elements, within appropriate table cells     
83        @reset($sorted_apps);
84        $idx = 1;
85        echo "<table width='100%' cellpadding=5>";
86        foreach($sorted_apps as $appname)
87        {
88                if((int)$done[$appname] == 1 || empty($appname)){
89                        continue;
90                }               
91                $varnames = $portal_oldvarnames;
92                $varnames[] = 'homepage_display';
93                $thisd = 0;
94                $tmp = '';
95               
96                foreach($varnames as $varcheck)
97                {
98                                                                       
99                        /*if($appname == 'expressoMail1_2') {
100                                $tmp = $appname;
101                                $appname = 'expressoMail';
102                        }*/                             
103
104                        if(array_search($appname, $default_apps) !== False){
105                                $thisd = 1;
106                                break;
107                        }
108                        if($GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]=='True') {
109                                $thisd = 1;
110                                break;
111                        }
112                        else  {
113                                $_thisd = (int)$GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck];
114                                if($_thisd > 0) {
115                                        $thisd = $_thisd;
116                                        break;
117                                }
118                        }
119                }
120
121                if($thisd > 0)
122                {
123                        if($tmp) {
124                $appname = $tmp;
125                                $tmp = '';
126                        }
127                        if($idx == 0) {                         
128                                print '<tr>';
129                        }
130                        print '<td style="vertical-align:top;" width="45%">';
131                        $GLOBALS['phpgw']->hooks->single('home',$appname);                     
132                        print '</td>';
133                       
134                        if($idx == 2){
135                                $idx = 0;
136                                print '</tr>';
137                        }                       
138                        $idx++;
139                        $neworder[] = $appname;
140                }
141                $done[$appname] = 1;
142        }
143        print '</table>';
144        $GLOBALS[ 'phpgw' ] -> common -> phpgw_footer( );
145        $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'currentapp' ] = 'home';
146?>
Note: See TracBrowser for help on using the repository browser.