source: trunk/expressoMail1_2/index.php @ 1035

Revision 1035, 13.3 KB checked in by rafaelraymundo, 11 years ago (diff)

Ticket #558 - Adicionada funcionalidade de assinatura e criptografia de e-mails.

  • 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.334',
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        $preferences = $GLOBALS['phpgw']->preferences->read();
85        $_SESSION['phpgw_info']['user']['preferences']['expressoMail'] = $preferences['expressoMail'];
86        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_cache'] = $current_config['expressoMail_enable_cache'];
87        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts'] = $current_config['expressoMail_Number_of_dynamic_contacts'] ? $current_config['expressoMail_Number_of_dynamic_contacts'] : "0";
88        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['notification_domains'] = $current_config['expressoMail_notification_domains'];
89        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['remove_attachments_function'] = $current_config['expressoMail_remove_attachments_function'];
90        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag'] = $current_config['expressoMail_enable_important_flag'];
91        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] : "0";
92        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] : "0";
93    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_assinar_criptografar'] = $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] ?  $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] : "0";
94    $_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";
95    $_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";
96    $_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";
97    $_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";
98
99        $template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
100        $template->set_var("txt_loading",lang("Loading"));
101        $template->set_var("txt_clear_trash",lang("message(s) deleted from your trash folder."));
102    $template->set_var("new_message", lang("New Message"));
103        $template->set_var("lang_inbox", lang("Inbox"));
104    $template->set_var("refresh", lang("Refresh"));
105    $template->set_var("tools", lang("Tools"));
106        $template->set_var("lang_Open_Search_Window", lang("Open search window") . '...');
107        $template->set_var("lang_search_user", lang("Search user") . '...');
108        $template->set_var("upload_max_filesize",ini_get('upload_max_filesize'));
109        $template->set_var("msg_folder",$_GET['msgball']['folder']);
110        $template->set_var("msg_number",$_GET['msgball']['msgnum'] ? $_GET['msgball']['msgnum'] : $_GET['to']);
111        $template->set_var("user_email",$_SESSION['phpgw_info']['expressomail']['user']['email']);
112        $acc = CreateObject('phpgwapi.accounts');
113        $template->set_var("user_organization", $acc->get_organization($GLOBALS['phpgw_info']['user']['account_dn']));
114        $template->set_var("cyrus_delimiter",$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter']);
115        // Fix problem with cyrus delimiter changes in preferences.
116        // Dots in names: enabled/disabled.
117        $save_in_folder = @eregi_replace("INBOX/", "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']);
118        $save_in_folder = @eregi_replace("INBOX.", "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $save_in_folder);
119        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] = $save_in_folder;
120        // End Fix.
121       
122        $template->set_file(Array('expressoMail' => 'index.tpl'));
123        $template->set_block('expressoMail','list');
124        $template->pfp('out','list');
125        $GLOBALS['phpgw']->common->phpgw_footer();
126   
127    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] = $current_config['expressoMail_enable_log_messages'];
128       
129    // Begin Set Anti-Spam options.
130    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_ham'] = $current_config['expressoMail_command_for_ham'];
131    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam'] = $current_config['expressoMail_command_for_spam'];
132    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_use_spam_filter'] = $current_config['expressoMail_use_spam_filter'];   
133    echo '<script> var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\' </script>';
134        // End Set Anti-Spam options.
135
136    // Set Imap Folder names options
137
138    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']   = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']     ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']             : lang("Trash");
139    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']  = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'] ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']       : lang("Drafts");
140    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']    = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']      ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']              : lang("Spam");
141    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']    = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']      ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']              : lang("Sent");
142
143    // gera paramero com tokens suportados ....
144    $var_tokens = '';
145    for($ii = 1; $ii < 11; $ii++)
146    {
147        if($GLOBALS['phpgw_info']['server']['test_token' . $ii . '1'])
148            $var_tokens .= $GLOBALS['phpgw_info']['server']['test_token' . $ii . '1'] . ',';
149    }
150
151    if(!$var_tokens)
152    {
153        $var_tokens = 'ePass2000Lx;/usr/lib/libepsng_p11.so,ePass2000Win;c:/windows/system32/ngp11v211.dll';
154    }
155
156    echo '<script> var special_folders = new Array(4);
157        special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'].'"] = \'Trash\';
158    special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'].'"] = \'Drafts\';
159    special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'].'"] = \'Spam\';
160    special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'].'"] = \'Sent\';
161    var trashfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'].'";
162    var draftsfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'].'";
163    var sentfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'].'";
164    var spamfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'].'";
165    var token_param = "'.$var_tokens.'";
166    var locale = "'.$GLOBALS['phpgw']->common->getPreferredLanguage().'";
167    </script>';
168
169    // End Set Imap Folder names options
170        //User info
171        echo "<script language='javascript'> var account_id = ".$GLOBALS['phpgw_info']['user']['account_id'].";</script>";
172
173        $obj = createobject("expressoMail1_2.functions");
174        // este arquivo deve ser carregado antes que
175        // os demais pois nele contem a função get_lang
176        // que é utilizada em diversas partes
177        echo $obj -> getFilesJs("js/common_functions.js");
178        include("inc/load_lang.php");           
179
180        // INCLUDE these JS Files:
181        echo $obj -> getFilesJs("js/abas.js," .
182                                                        "js/doiMenuData.js," .
183                                                        "js/drag_area.js," .
184                                                        "js/draw_api.js," .
185                                                        "js/DropDownContacts.js," .
186                                                        "js/InfoContact.js," .
187                                                        "js/main.js," .
188                                                        "js/gears_init.js," .
189                                                        "js/local_messages.js," .
190                                                        "js/messages_proxy.js," .
191                                                        "js/rich_text_editor.js," .
192                                                        "js/wfolders.js,",
193                                                        $GLOBALS['phpgw_info']['flags']['update_version']);
194
195        if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts'])
196        {
197                echo $obj -> getFilesJs("js/shortcut.js", $GLOBALS['phpgw_info']['flags']['update_version']);
198        }
199
200        // Get Preferences or redirect to preferences page.
201        $GLOBALS['phpgw']->preferences->read_repository();
202?>
203
204<html>
205<head>
206<title>ExpressoMail</title>
207<link rel="stylesheet" type="text/css" href="../phpgwapi/js/dftree/dftree.css">
208</head>
209<body scroll="no" style="overflow:hidden">
210</body>
211</html>
212<script src="js/connector.js?<?=$update_version?>" type="text/javascript"></script>
213<script src="../phpgwapi/js/dftree/dftree.js?<?=$update_version?>" type="text/javascript"></script>
214<script language="Javascript">connector.updateVersion = "<?=$update_version?>";init();</script>
215<!-----Expresso Mail - Version Updated:<?=$update_version?>-------->
Note: See TracBrowser for help on using the repository browser.