source: trunk/expressoMail1_2/index.php @ 905

Revision 905, 11.5 KB checked in by amuller, 12 years ago (diff)

Ticket #485 - Re-colocando código que foi removido quando implementado preferências

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