source: sandbox/expresso/novos_templates/expressoMail1_2/index.php @ 773

Revision 773, 14.6 KB checked in by niltonneto, 12 years ago (diff)

Resolve #475

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2
3        /* Begin: Check config needed for expressoMail */
4        /* Config need for expressoMail work */
5        $php_ini['session.auto_start'] = '1';
6        $php_ini['magic_quotes_gpc'] = '';
7        $php_ini['magic_quotes_runtime'] = '';
8        $php_ini['magic_quotes_sybase'] = '';
9       
10        /* Config from php.ini */
11        $php_ini_configs = array("session.auto_start","magic_quotes_gpc","magic_quotes_runtime","magic_quotes_sybase");
12        /* Checking */
13        $error = false;
14        foreach($php_ini_configs as $config)
15        {
16                if ( ($f_phpini=ini_get($config)) != $php_ini[$config])
17                {
18                        $error = true;
19                        echo "Erro: Config <font color=red>$config</font> from php.ini needs to be '" . $php_ini[$config] . "', but is set to '" . $f_phpini . "'.<br>";
20                }
21        }
22        if ($error)
23                exit;
24        /* End: Check config needed for expressoMail */
25               
26        $GLOBALS['phpgw_info']['flags'] = array(
27                'noheader' => False,
28                'nonavbar' => False,
29                'currentapp' => 'expressoMail1_2',
30                'update_version'        => '1.233',
31                'enable_nextmatchs_class' => True
32        );
33       
34        include('../header.inc.php');
35        $update_version = $GLOBALS['phpgw_info']['flags']['update_version'];
36        $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
37        echo '<link rel="stylesheet" type="text/css" href="templates/'.$_SESSION['phpgw_info']['expressoMail1_2']['user']['preferences']['common']['template_set'].'/main.css">';
38        echo '<link rel="stylesheet" type="text/css" href="../phpgwapi/js/dftree/dftree.css">';
39        echo "<script type='text/javascript'>var template = '".$_SESSION['phpgw_info']['expressoMail1_2']['user']['preferences']['common']['template_set']."';</script>";
40        echo "<script src='js/globals.js?".$update_version."' type='text/javascript'></script>";
41        echo "<script src='js/sniff_browser.js?".$update_version."' type='text/javascript'></script>";
42        echo '<script type="text/javascript" src="../phpgwapi/js/wz_dragdrop/wz_dragdrop.js?'.$update_version.'"></script>
43                <script type="text/javascript" src="../phpgwapi/js/dJSWin/dJSWin.js?'.$update_version.'"></script>';
44       
45        //Enable/Disable VoIP Service -> Voip Server Config
46        $voip_enabled = false;
47        $voip_groups = array();
48        if($GLOBALS['phpgw_info']['server']['voip_groups']) {
49                $emailVoip = false;
50                foreach(explode(",",$GLOBALS['phpgw_info']['server']['voip_groups']) as $i => $voip_group){
51                        $a_voip = explode(";",$voip_group);                     
52                        $voip_groups[] = $a_voip[1];
53                }
54                foreach($GLOBALS['phpgw']->accounts->membership() as $idx => $group){                   
55                        if(array_search($group['account_name'],$voip_groups) !== FALSE){                 
56                                $voip_enabled = true;
57                                $emailVoip = $GLOBALS['phpgw_info']['server']['voip_email_redirect'];
58                                break;
59                        }
60                }
61        }
62
63        //Local messages
64        $_SESSION['phpgw_info']['server']['expressomail']['enable_local_messages'] = $current_config['enable_local_messages'];
65
66        // Get Data from ldap_manager and emailadmin.
67        $ldap_manager = CreateObject('contactcenter.bo_ldap_manager');
68        $boemailadmin   = CreateObject('emailadmin.bo');
69        $emailadmin_profile = $boemailadmin->getProfileList();
70    // Loading Admin Config Module
71    $c = CreateObject('phpgwapi.config','expressoMail1_2');
72    $c->read_repository();
73    $current_config = $c->config_data;   
74
75        $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
76//      $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
77        $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server'];
78        $_SESSION['phpgw_info']['expressomail']['ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null;
79        $_SESSION['phpgw_info']['expressomail']['user']['email'] = $GLOBALS['phpgw']->preferences->values['email'];
80       
81        if($current_config['enable_local_messages']!='True')  {
82                $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] = 0;
83        }
84
85        $_SESSION['phpgw_info']['user']['preferences']['expressoMail'] = array(
86                        'voip_enabled'                                          => $voip_enabled,
87                        'voip_email_redirect'                           => $emailVoip,
88                        'outoffice'                                                     => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['outoffice'],
89                        'telephone_number'                                      => $GLOBALS['phpgw_info']['user']['telephonenumber'],
90                        'max_email_per_page'                            => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_email_per_page'],
91                'save_deleted_msg'                                      => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_deleted_msg'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_deleted_msg'] : "0",
92            'delete_trash_messages_after_n_days'=> $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['delete_trash_messages_after_n_days'],
93                'delete_and_show_previous_message'      => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['delete_and_show_previous_message'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['delete_and_show_previous_message'] : "0",
94                'alert_new_msg'                                         => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['alert_new_msg'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['alert_new_msg'] : "0",
95                'mainscreen_showmail'                           => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['mainscreen_showmail'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['mainscreen_showmail'] : "0",
96                'signature'                                             => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['signature'],
97                'type_signature'                                        => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature'],
98                'use_signature'                                         => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature'] : "0",
99                'hide_folders'                                          => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['hide_folders'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['hide_folders'] : "0",                 
100                'save_in_folder'                                        => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] : "-1",
101                'line_height'                                           => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['line_height'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['line_height'] : "30",
102                'font_size'                                             => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['font_size'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['font_size'] : "11",
103                'use_shortcuts'                                         => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts'] : "0",
104                'auto_save_draft'                                       => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_save_draft'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_save_draft'] : "0",
105                'use_dynamic_contacts'                                  => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts'] : "0",
106                'number_of_contacts'                                    => $current_config['expressoMail_Number_of_dynamic_contacts'] ? $current_config['expressoMail_Number_of_dynamic_contacts'] : "0",
107                'use_cache'                                             => $current_config['expressoMail_enable_cache'],
108                'notification_domains'                                  => $current_config['expressoMail_notification_domains'],
109                'remove_attachments_function'                           => $current_config['expressoMail_remove_attachments_function'],
110                'use_important_flag'                                    => $current_config['expressoMail_enable_important_flag'],
111                'use_local_messages'                            => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] : "0",
112                'keep_archived_messages'                        => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] : "0"
113
114
115
116
117        );
118
119
120        $template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
121        $template->set_var("txt_loading",lang("Loading"));
122        $template->set_var("txt_clear_trash",lang("message(s) deleted from your trash folder."));
123    $template->set_var("new_message", lang("New Message"));
124        $template->set_var("lang_inbox", lang("Inbox"));
125    $template->set_var("refresh", lang("Refresh"));
126    $template->set_var("tools", lang("Tools"));
127        $template->set_var("lang_Open_Search_Window", lang("Open search window") . '...');
128        $template->set_var("lang_search_user", lang("Search user") . '...');
129        $template->set_var("upload_max_filesize",ini_get('upload_max_filesize'));
130        $template->set_var("msg_folder",$_GET['msgball']['folder']);
131        $template->set_var("msg_number",$_GET['msgball']['msgnum'] ? $_GET['msgball']['msgnum'] : $_GET['to']);
132        $template->set_var("user_email",$_SESSION['phpgw_info']['expressomail']['user']['email']);
133        $acc = CreateObject('phpgwapi.accounts');
134        $template->set_var("user_organization", $acc->get_organization($GLOBALS['phpgw_info']['user']['account_dn']));
135        $template->set_var("cyrus_delimiter",$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter']);
136        // Fix problem with cyrus delimiter changes in preferences.
137        // Dots in names: enabled/disabled.
138        $save_in_folder = @eregi_replace("INBOX/", "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']);
139        $save_in_folder = @eregi_replace("INBOX.", "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $save_in_folder);
140        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] = $save_in_folder;
141        // End Fix.
142       
143        $template->set_file(Array('expressoMail' => 'index.tpl'));
144        $template->set_block('expressoMail','list');
145        $template->pfp('out','list');
146        $GLOBALS['phpgw']->common->phpgw_footer();
147   
148    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] = $current_config['expressoMail_enable_log_messages'];
149       
150    // Begin Set Anti-Spam options.
151    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_ham'] = $current_config['expressoMail_command_for_ham'];
152    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam'] = $current_config['expressoMail_command_for_spam'];
153    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_use_spam_filter'] = $current_config['expressoMail_use_spam_filter'];   
154    echo '<script> var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\' </script>';
155        // End Set Anti-Spam options.
156
157    // Set Imap Folder names options
158
159    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']   = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']     ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']             : lang("Trash");
160    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']  = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'] ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']       : lang("Drafts");
161    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']    = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']      ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']              : lang("Spam");
162    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']    = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']      ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']              : lang("Sent");
163   
164    echo '<script> var special_folders = new Array(4);
165        special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'].'"] = \'Trash\';
166    special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'].'"] = \'Drafts\';
167    special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'].'"] = \'Spam\';
168    special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'].'"] = \'Sent\';
169    var trashfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'].'";
170    var draftsfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'].'";
171    var sentfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'].'";
172    var spamfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'].'";                 
173    </script>';
174
175    // End Set Imap Folder names options
176        //User info
177        echo "<script language='javascript'> var account_id = ".$GLOBALS['phpgw_info']['user']['account_id'].";</script>";
178
179        $obj = createobject("expressoMail1_2.functions");
180        // este arquivo deve ser carregado antes que
181        // os demais pois nele contem a função get_lang
182        // que é utilizada em diversas partes
183        echo $obj -> getFilesJs("js/common_functions.js");
184        include("inc/load_lang.php");           
185
186        // INCLUDE these JS Files:
187        echo $obj -> getFilesJs("js/abas.js," .
188                                                        "js/doiMenuData.js," .
189                                                        "js/drag_area.js," .
190                                                        "js/draw_api.js," .
191                                                        "js/DropDownContacts.js," .
192                                                        "js/InfoContact.js," .
193                                                        "js/main.js," .
194                                                        "js/gears_init.js," .
195                                                        "js/local_messages.js," .
196                                                        "js/messages_proxy.js," .
197                                                        "js/rich_text_editor.js," .
198                                                        "js/wfolders.js,",
199                                                        $GLOBALS['phpgw_info']['flags']['update_version']);
200
201        if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts'])
202        {
203                echo $obj -> getFilesJs("js/shortcut.js", $GLOBALS['phpgw_info']['flags']['update_version']);
204        }
205
206        // Get Preferences or redirect to preferences page.
207        $GLOBALS['phpgw']->preferences->read_repository();
208        if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail'] == null){
209                echo '<script>alert("' . lang('Dear user,\nthis is your first time in the ExpressoMail, your preferences must be saved.\nPlease, choose your preferences and click on the button Save.') . '")</script>';
210                echo "<script>location.href='./preferences.php'</script>";
211        }       
212
213?>
214
215<html>
216<head>
217<title>ExpressoMail</title>
218<link rel="stylesheet" type="text/css" href="../phpgwapi/js/dftree/dftree.css">
219</head>
220<body scroll="no" style="overflow:hidden">
221</body>
222</html>
223<script src="js/connector.js?<?=$update_version?>" type="text/javascript"></script>
224<script src="../phpgwapi/js/dftree/dftree.js?<?=$update_version?>" type="text/javascript"></script>
225<script language="Javascript">connector.updateVersion = "<?=$update_version?>";init();</script>
226<!-----Expresso Mail - Version Updated:<?=$update_version?>-------->
Note: See TracBrowser for help on using the repository browser.