source: trunk/expressoMail1_2/index.php @ 7870

Revision 7870, 28.5 KB checked in by angelo, 9 years ago (diff)

Ticket #3342 - Configurar Imap automaticamente ao instalar o Expresso pelo instalador automatico

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2                /***************************************************************************
3                * Expresso Livre                                                           *
4                * http://www.expressolivre.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        $GLOBALS['phpgw_info']['flags'] = array(
13                'noheader' => False,
14                'nonavbar' => false,
15                'currentapp' => 'expressoMail1_2',
16                'enable_nextmatchs_class' => True
17        );
18       
19        require_once('../header.inc.php');
20        include_once dirname(__FILE__) . '/../header.inc.php';
21        require_once dirname(__FILE__) . '/../services/class.servicelocator.php';
22        $template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
23        $alternativeMailService = ServiceLocator::getService('ldap');
24        $AlternateEmailExpresso = Array();
25        $AlternateEmailExpresso = $alternativeMailService->getMailAlternateByUidNumber($_SESSION['phpgw_info']['expressomail']['user']['account_id']);
26        $template->set_var("user_email_alternative", implode(",", $AlternateEmailExpresso));   
27       
28        if (execmethod('emailadmin.ui.countProfiles') == 0){
29        execmethod('emailadmin.ui.addDefaultProfile');
30    }
31
32        $update_version = $GLOBALS['phpgw_info']['apps']['expressoMail1_2']['version'];
33        $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
34        echo "<script type='text/javascript'>var template = '".$_SESSION['phpgw_info']['expressoMail1_2']['user']['preferences']['common']['template_set']."';</script>";
35
36        //jquery and Editor
37        echo '<link rel="stylesheet" type="text/css" href="assetic_css.php"></link>';
38        echo '
39                <link rel="stylesheet" type="text/css" href="../prototype/plugins/jquery/jquery-ui.css"/>
40                <link rel="stylesheet" type="text/css" href="../prototype/modules/filters/filters.css"/>
41                <link rel="stylesheet" type="text/css" href="../prototype/plugins/jqgrid/css/ui.jqgrid.css"/>
42                <link rel="stylesheet" type="text/css" href="../prototype/plugins/contextmenu/jquery.contextMenu.css"/>
43                <link rel="stylesheet" type="text/css" href="../prototype/plugins/zebradialog/css/zebra_dialog.css"/>
44                <link rel="stylesheet" type="text/css" href="../prototype/plugins/fileupload/jquery.fileupload-ui.css"/>
45                <link rel="stylesheet" type="text/css" href="../prototype/plugins/freeow/style/freeow/freeow.css"/>
46                <link rel="stylesheet" type="text/css" href="../prototype/modules/mail/css/followupflag.css"/>
47                <link rel="stylesheet" type="text/css" href="../prototype/plugins/farbtastic/farbtastic.css"/>
48                <link rel="stylesheet" type="text/css" href="templates/default/main.css"/>
49                <link rel="stylesheet" type="text/css" href="../prototype/plugins/treeview/jquery.treeview.css"/>
50                <link rel="stylesheet" type="text/css" href="../prototype/modules/attach_message/attach_message.css"/>
51                <link rel="stylesheet" type="text/css" href="../prototype/plugins/jquery.jrating/jRating.jquery.css"/>
52               
53                <script src="../prototype/plugins/jquery/jquery.min.js" language="javascript" charset="utf-8"></script>
54                <script src="../library/ckeditor/ckeditor.js" language="javascript" charset="utf-8"></script>
55                <script src="../library/ckeditor/adapters/jquery.js" language="javascript" charset="utf-8"></script>
56                <script src="../prototype/plugins/jquery/jquery-ui.min.js" language="javascript" charset="utf-8"></script>
57                <script type="text/javascript" src="../prototype/plugins/farbtastic/farbtastic.js"></script>
58                <script src="../prototype/plugins/countdown/jquery.countdown.min.js" language="javascript" charset="utf-8"></script>
59                <script src="../prototype/plugins/countdown/jquery.countdown-pt-BR.js" language="javascript" charset="utf-8"></script>
60                <script src="../prototype/plugins/fileupload/jquery.fileupload.js" language="javascript" charset="utf-8"></script>
61                <script type="text/javascript" src="../prototype/plugins/contextmenu/jquery.contextMenu.js"></script>
62                <script type="text/javascript" src="../prototype/plugins/mask/jquery.maskedinput.js"></script>
63                <script type="text/javascript" src="../prototype/plugins/lazy/jquery.lazy.js"></script>
64                <script type="text/javascript" src="../prototype/plugins/jquery.autoscroll/jquery.aautoscroll.min.2.41.js"></script>
65                ';     
66
67        echo "<script src='js/globals.js?".$update_version."' type='text/javascript'></script>";
68        echo "<script src='js/sniff_browser.js?".$update_version."' type='text/javascript'></script>";
69        //echo "<script src='js/QuickCatalogSearch.js' type='text/javascript'></script>";
70        //echo "<style type='text/css'>@import url(../phpgwapi/js/jscalendar/calendar-win2k-1.css);</style>";
71        //echo "<script src='../phpgwapi/js/jscalendar/calendar.js?".$update_version."' type='text/javascript'></script>";
72        //echo "<script src='../phpgwapi/js/jscalendar/calendar-setup.js?".$update_version."' type='text/javascript'></script>";
73        //echo "<script src='../phpgwapi/js/jscalendar/lang/calendar-br.js?".$update_version."' type='text/javascript'></script>";
74        echo '<script type="text/javascript" src="../phpgwapi/js/wz_dragdrop/wz_dragdrop.js?'.$update_version.'"></script>
75                  <script type="text/javascript" src="../phpgwapi/js/dJSWin/dJSWin.js?'.$update_version.'"></script>
76                  <script type="text/javascript" src="js/connector.js"></script>
77                  <script type="text/javascript" src="../phpgwapi/js/x_tools/xtools.js?'.$update_version.'"></script>
78                  <script type="text/javascript" src="js/DropDownContacts.js"></script>
79                  ';
80       
81        /*
82         * TODO: implementar o controle como preferência do usuário
83         *
84         */
85        $jcarousel = false;
86        if ($jcarousel) {
87                //jcarousel
88                echo "\n".'<link rel="stylesheet" type="text/css" href="../library/jcarousel/skins/default/skin.css" />';
89                echo "\n".'<script src="../library/jcarousel/lib/jquery.jcarousel.min.js" type="text/javascript"></script>';
90                //fancybox
91                echo "\n".'<link rel="stylesheet" type="text/css" href="../library/fancybox/jquery.fancybox-1.3.4.css" />';             
92                echo "\n".'<script src="../library/fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>';
93        }
94
95        echo "<div id='overlay' style='background-color: #AAAAAAA; opacity: .50; filter:Alpha(Opacity=50); height: 100%; width: 100%; position: absolute; top: 0; left: 0; visibility: hidden; z-index: 30000000000000000000000'></div>";
96
97       
98        //Enable/Disable VoIP Service -> Voip Server Config
99        $voip_enabled = false;
100        $voip_groups = array();
101        if($GLOBALS['phpgw_info']['server']['voip_groups']) {
102                $emailVoip = false;
103                foreach(explode(",",$GLOBALS['phpgw_info']['server']['voip_groups']) as $i => $voip_group){
104                        $a_voip = explode(";",$voip_group);                     
105                        $voip_groups[] = $a_voip[1];
106                }
107                foreach($GLOBALS['phpgw']->accounts->membership() as $idx => $group){                   
108                        if(array_search($group['account_name'],$voip_groups) !== FALSE){                 
109                                $voip_enabled = true;
110                                $emailVoip = $GLOBALS['phpgw_info']['server']['voip_email_redirect'];
111                                break;
112                        }
113                }
114        }
115
116        //Local messages
117        $_SESSION['phpgw_info']['server']['expressomail']['enable_local_messages'] = $current_config['enable_local_messages'];
118
119        // Get Data from ldap_manager and emailadmin.
120        $ldap_manager = CreateObject('contactcenter.bo_ldap_manager');
121        $boemailadmin   = CreateObject('emailadmin.bo');
122        $emailadmin_profile = $boemailadmin->getProfileList();
123    // Loading Admin Config Module
124    $c = CreateObject('phpgwapi.config','expressoMail1_2');
125    $c->read_repository();
126    $current_config = $c->config_data;
127   
128    // Loading Config Module
129    $conf = CreateObject('phpgwapi.config','phpgwapi');
130    $conf->read_repository();
131    $config = $conf->config_data;   
132
133    //Carrega Configuração global do expressoMail
134        $_SESSION['phpgw_info']['expresso']['expressoMail'] =  $current_config;
135   
136        $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
137        //$_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
138        $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server'];
139        $_SESSION['phpgw_info']['expressomail']['ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null;
140        $_SESSION['phpgw_info']['expressomail']['user']['email'] = $GLOBALS['phpgw']->preferences->values['email'];
141        $_SESSION['phpgw_info']['server']['temp_dir'] = $GLOBALS['phpgw_info']['server']['temp_dir'];
142       
143        $preferences = $GLOBALS['phpgw']->preferences->read();
144        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['gears_firefox_windows'] = $current_config['expressoMail_gears_firefox_windows'] ? $current_config['expressoMail_gears_firefox_windows'] : "";
145        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['gears_firefox_linux'] = $current_config['expressoMail_gears_firefox_linux'] ? $current_config['expressoMail_gears_firefox_linux'] : "";
146        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['gears_ie'] = $current_config['expressoMail_gears_ie'] ? $current_config['expressoMail_gears_ie'] : "";
147        $_SESSION['phpgw_info']['user']['preferences']['expressoMail'] = $preferences['enable_local_messages'];
148        $_SESSION['phpgw_info']['user']['preferences']['expressoMail'] = $preferences['expressoMail'];
149        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['voip_enabled'] = $voip_enabled;
150        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['voip_email_redirect'] = $emailVoip;
151        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['outoffice'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['outoffice'];
152        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['telephone_number'] = $GLOBALS['phpgw_info']['user']['telephonenumber'];
153        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_cache'] = $current_config['expressoMail_enable_cache'];
154        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['expressoMail_ldap_identifier_recipient'] = $current_config['expressoMail_ldap_identifier_recipient'];
155        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_x_origin'] = $current_config['expressoMail_use_x_origin'];
156        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts'] = $current_config['expressoMail_Number_of_dynamic_contacts'] ? $current_config['expressoMail_Number_of_dynamic_contacts'] : "0";
157        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['notification_domains'] = $current_config['expressoMail_notification_domains'];
158        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['googlegears_url'] = $current_config['expressoMail_googlegears_url'];
159    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_assinar_criptografar'] = $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] ?  $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] : "0";
160    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] : "0";
161    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital'] : "0";
162    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['search_result_number'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['search_result_number'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['search_result_number'] : "50";
163    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['search_characters_number'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['search_characters_number'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['search_characters_number'] : "4";
164    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['num_max_certs_to_cipher'] = $GLOBALS['phpgw_info']['server']['num_max_certs_to_cipher'] ?  $GLOBALS['phpgw_info']['server']['num_max_certs_to_cipher'] : "10";
165    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto'] : "0";
166        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['keep_after_auto_archiving'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_after_auto_archiving'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_after_auto_archiving'] : "0";
167
168        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size'] = $current_config['expressoMail_Max_attachment_size'] ? $current_config['expressoMail_Max_attachment_size']."M" : '';
169        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_msg_size'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_msg_size'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_msg_size'] : "0";
170        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['imap_max_folders'] = $current_config['expressoMail_imap_max_folders'];
171        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_email_per_page'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_email_per_page'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_email_per_page'] : "50";
172        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['extended_info'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['extended_info']?$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['extended_info'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['extended_info']:'0';
173        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['from_to_sent'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['from_to_sent'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['from_to_sent'] : "0";
174        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['auto_create_local'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_create_local'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_create_local'] : "0";
175        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['return_recipient_deafault'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['return_recipient_deafault'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['return_recipient_deafault'] : "0";
176        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['quick_search_default'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['quick_search_default'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['quick_search_default'] : 1;
177        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['confirm_read_message'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['confirm_read_message'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['confirm_read_message'] : 0;
178        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['alert_message_attachment'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['alert_message_attachment'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['alert_message_attachment'] : 0;
179        //      ACL for block edit Personal Data.
180        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['enable_quickadd_telephonenumber'] = $current_config['expressoMail_enable_quickadd_telephonenumber'] == 'true' ? $current_config['expressoMail_enable_quickadd_telephonenumber'] : "";
181        if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['enable_quickadd_telephonenumber']){
182                $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['blockpersonaldata'] = $GLOBALS['phpgw']->acl->check('blockpersonaldata',1,'preferences');               
183        }
184
185        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['auto_close_first_tab'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_close_first_tab'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_close_first_tab'] : "0";
186        $template->set_var("txt_loading",lang("Loading"));
187        $template->set_var("txt_clear_trash",lang("message(s) deleted from your trash folder."));
188    $template->set_var("new_message", lang("New Message"));
189        $template->set_var("lang_inbox", lang("Inbox"));
190    $template->set_var("refresh", lang("Refresh"));
191    $template->set_var("tools", lang("Tools"));
192        $template->set_var("lang_Open_Search_Window", lang("Open search window") . '...');
193        $template->set_var("lang_search_user", lang("Search user") . '...');
194        $template->set_var("upload_max_filesize",ini_get('upload_max_filesize'));
195        $template->set_var("msg_folder",$_GET['msgball']['folder']);
196        $template->set_var("msg_number",$_GET['msgball']['msgnum'] ? $_GET['msgball']['msgnum'] : $_GET['to']);
197        $template->set_var("user_email",$_SESSION['phpgw_info']['expressomail']['user']['email']);
198
199        $acc = CreateObject('phpgwapi.accounts');
200        $template->set_var("user_organization", $acc->get_organization($GLOBALS['phpgw_info']['user']['account_dn']));
201        $template->set_var("cyrus_delimiter",$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter']);
202        $template->set_var("lang_contact_details", lang("Contact Details"));
203        $template->set_var("lang_catalog", lang("catalog"));
204        $template->set_var("lang_search", lang("search"));
205        $template->set_var("lang_page", lang("page"));
206        $template->set_var("lang_quick_search_users_dialog_title", lang("Quick Search Contacts"));
207        $template->set_var("lang_global_catalog", lang("Global Catalog"));
208        $template->set_var("lang_personal_catalog", lang("Personal Catalog"));
209        $template->set_var("lang_all_catalogs", lang("All Catalogs"));
210        // Fix problem with cyrus delimiter changes in preferences.
211        // Dots in names: enabled/disabled.
212        $save_in_folder = @preg_replace('/INBOX\//i', "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']);
213        $save_in_folder = @preg_replace('/INBOX./i', "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $save_in_folder);
214        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] = $save_in_folder;
215        // End Fix.
216
217        $template->set_file(Array('expressoMail' => 'index.tpl'));
218        $template->set_block('expressoMail','list');
219        $template->pfp('out','list');
220        $GLOBALS['phpgw']->common->phpgw_footer();
221   
222    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] = $current_config['expressoMail_enable_log_messages'];
223       
224    // Begin Set Anti-Spam options.
225    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_ham'] = $current_config['expressoMail_command_for_ham'];
226    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam'] = $current_config['expressoMail_command_for_spam'];
227    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_use_spam_filter'] = $current_config['expressoMail_use_spam_filter'];   
228    echo '<script> var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\'
229           var sieve_forward_domains = \''.$current_config['expressoMail_sieve_forward_domains'].'\'
230                  </script>';
231        // End Set Anti-Spam options.
232
233        // Begin Set Hidden Copy options.
234        $_SESSION['phpgw_info']['server']['expressomail']['allow_hidden_copy'] = $current_config['allow_hidden_copy'];
235        echo '<script> var allow_hidden_copy = \''.$current_config['allow_hidden_copy'].'\' </script>';
236        // End Set Hidden Copy options.
237       
238    // Set Imap Folder names options
239    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']   = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']     ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']             : lang("Trash");
240    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']  = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'] ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']       : lang("Drafts");
241    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']    = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']      ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']              : lang("Spam");
242    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']    = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']      ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']              : lang("Sent");
243
244    // gera paramero com tokens suportados ....
245    $var_tokens = '';
246    for($ii = 1; $ii < 11; ++$ii)
247    {
248        if($GLOBALS['phpgw_info']['server']['test_token' . $ii . '1'])
249            $var_tokens .= $GLOBALS['phpgw_info']['server']['test_token' . $ii . '1'] . ',';
250    }
251
252    if(!$var_tokens)
253    {
254        $var_tokens = 'ePass2000Lx;/usr/lib/libepsng_p11.so,ePass2000Win;c:/windows/system32/ngp11v211.dll';
255    }
256
257    echo '
258        <script> var special_folders = new Array(4);
259                special_folders[\'Trash\'] = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'].'";
260                special_folders[\'Drafts\'] = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'].'";
261                special_folders[\'Spam\'] = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'].'";
262                special_folders[\'Sent\'] = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'].'";
263        special_folders[\'Outbox\'] = "Outbox";
264                var trashfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'].'";
265                var draftsfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'].'";
266                var sentfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'].'";
267                var spamfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'].'";
268        var outboxfolder = "Outbox";
269
270                var token_param = "'.$var_tokens.'";
271                var locale = "'.$GLOBALS['phpgw']->common->getPreferredLanguage().'";
272                var language = "'.$_SESSION['phpgw_info']['expressomail']['user']['preferences']['common']['lang'].'";
273                var defaultCalendar = "'.  (isset($config['defaultCalendar']) ?  $config['defaultCalendar']  :  "calendar" )    .'";
274                $("#sideboxdragarea").hide();
275                $("#menu2Container").hide();
276    </script>
277
278                <script type="text/javascript" src="../prototype/plugins/store/jquery.store.js"></script>
279                <script type="text/javascript" src="../prototype/api/datalayer.js"</script>
280               
281                <script type="text/javascript" src="../prototype/modules/mail/js/label.js"></script>
282                <script type="text/javascript" src="../prototype/api/rest.js"></script>
283               
284       
285        ';
286    // End Set Imap Folder names options
287        //User info
288    echo "<script language='javascript'> var account_id = ".$GLOBALS['phpgw_info']['user']['account_id'].";var expresso_offline = false; var mail_archive_host = '127.0.0.1';</script>\n";
289       
290    //MAILARCHIVER-02
291    //todo: remover a linha abaixo e implementar a configuração
292    //$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] = true;
293        if ( $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] == true ) {
294        $mail_archiver_host = '127.0.0.1';
295        //Check protocol in use (https or http)
296        if($_SERVER['HTTPS'] != 'on'){
297            $mail_archiver_protocol = "http";
298            $mail_archiver_port = "4333";
299        }
300        else{
301            $mail_archiver_protocol = "https";
302            $mail_archiver_port = "4334";
303        }
304   
305        //JS Variables (to add on jscripts variables, needed by dependence scripts following)
306        echo '<script type="text/javascript">var mail_archive_protocol="'.$mail_archiver_protocol.'"; var mail_archive_port="'.$mail_archiver_port.'";</script>';
307   
308        //CXF custom js files, from MailArchiver ArcServUtil JS files repository, intended to be running already: CORS support and custom TRANSPORT object
309        echo '<script type="text/javascript" src="'.$mail_archiver_protocol.'://'.$mail_archiver_host.':'.$mail_archiver_port.'/arcservutil/cxf-addon-xdr-adapter.js"></script>';
310        echo '<script type="text/javascript" src="'.$mail_archiver_protocol.'://'.$mail_archiver_host.':'.$mail_archiver_port.'/arcservutil/cxf-addon-cors-request-object.js"></script>';
311        echo '<script type="text/javascript" src="'.$mail_archiver_protocol.'://'.$mail_archiver_host.':'.$mail_archiver_port.'/arcservutil/cxf-addon-cors-utils.js"></script>';
312
313        //CXF UTILS MAIN FILE
314        echo '<script type="text/javascript" src="'.$mail_archiver_protocol.'://'.$mail_archiver_host.':'.$mail_archiver_port.'/arcserv/ArchiveServices?js&nojsutils"></script>';
315   
316        //QueryConfig add on
317        echo '<script src="js/MAQueryConfig.js?'.$update_version.'"></script>';       
318        //Expresso serialized format add on
319        echo '<script src="js/MAExpressoPattern.js?'.$update_version.'"></script>';       
320   
321        //echo $obj -> getFilesJs("js/mail_archiver.js," . $GLOBALS['phpgw_info']['flags']['update_version']);
322        echo '<script src="js/mail_archiver.js?'.$update_version.'"></script>';
323   
324    }
325        //echo "<script language='javascript'> var account_id = ".$GLOBALS['phpgw_info']['user']['account_id'].";var expresso_offline = false;</script>";
326
327        $obj = createobject("expressoMail1_2.functions");
328
329        // setting timezone preference
330        $zones = $obj->getTimezones();
331        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['timezone'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] : sprintf("%s", array_search("America/Sao_Paulo", $zones));
332
333        // este arquivo deve ser carregado antes que
334        // os demais pois nele contem a função get_lang
335        // que é utilizada em diversas partes
336        //echo $obj -> getFilesJs("js/common_functions.js",$update_version);
337        include("inc/load_lang.php");
338   
339    // INCLUDE these JS Files:
340        if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'])
341                echo "<script src='js/gears_init.js?".$update_version."'></script>";
342        echo '<script src="../phpgwapi/js/dftree/dftree.js?'.$update_version.'"></script>';
343   
344        $scripts = "";
345       
346        if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts'])
347        {
348                //echo $obj -> getFilesJs("js/shortcut.js", $update_version);
349                $scripts .= "js/shortcut.js,";
350        }
351        echo "<script> use_local_messages = ".$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages']."</script>";         
352        if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'])
353                $scripts .= "js/local_messages.js";     
354               
355        echo '
356                <!--<script type="text/javascript" src="../prototype/modules/mail/js/followupflag.js"></script>-->
357                <script language="javascript">
358                        DataLayer.dispatchPath = "../prototype/";
359                        REST.dispatchPath = "../prototype/";
360                        REST.load("");
361                </script>
362        ';
363
364        echo
365            '<script src="../prototype/plugins/datejs/date-pt-BR.js" language="javascript" ></script>
366                <script src="../prototype/modules/calendar/js/timezone.js" language="javascript" ></script>
367                <script src="../prototype/modules/calendar/js/calendar.codecs.js" language="javascript" ></script>
368                <script src="../prototype/modules/calendar/js/calendar.alarms.js" language="javascript" ></script>
369                <script src="../prototype/modules/calendar/js/helpers.js" language="javascript" ></script>';
370
371        echo $obj -> getFilesJs($scripts, $update_version);
372        echo '<script type="text/javascript">connector.updateVersion = "'.$update_version.'";</script>';
373               
374        echo '<script type="text/javascript" src="assetic.php"></script>';
375       
376
377        // Get Preferences or redirect to preferences page.
378        $GLOBALS['phpgw']->preferences->read_repository();
379        //print_r($_SESSION['phpgw_info']['user']['preferences']['expressoMail']);
380        unset($_SESSION['phpgw_info']['expressomail']['user']['preferences']);
381        unset($_SESSION['phpgw_info']['expressomail']['user']['acl']);
382        unset($_SESSION['phpgw_info']['expressomail']['user']['apps']);
383        unset($_SESSION['phpgw_info']['expressomail']['server']['global_denied_users']);
384        unset($_SESSION['phpgw_info']['expressomail']['server']['global_denied_groups']);
385?>
386<!-----Expresso Mail - Version Updated:<?=$update_version?>-------->
Note: See TracBrowser for help on using the repository browser.