source: branches/1.2/expressoMail1_2/index.php @ 1342

Revision 1342, 13.1 KB checked in by niltonneto, 11 years ago (diff)

Ticket #561 - Correção das diferenças entre versão publicada e branch 1.2

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