source: trunk/expressoMail1_2/index.php @ 689

Revision 689, 14.0 KB checked in by eduardoalex, 12 years ago (diff)

Ticket #413

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