'expressoMail1_2', 'nonavbar' => true, 'noheader' => true ); } require_once '../header.inc.php'; /**************************************************************************\ * eGroupWare - ExpressoMail Preferences * * http://www.expressolivre.org * * Modified by Alexandre Felipe Muller de Souza * * -------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ $type = isset($_GET['type']) ? $_GET['type']:$GLOBALS['type']; // FIX ME //if ($type == 'user' || $type == ''){ create_script('function exibir_ocultar() { var type = ("'.$type.'" == "") ? "user" : "'.$type.'"; var use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0]; var default_signature_digital_cripto = "'.$GLOBALS['phpgw_info']['default']['preferences']['expressoMail']['use_signature_digital_cripto'].'"; if (use_signature_digital_cripto) { var element_signature_digital = document.getElementById(type+"[use_signature_digital]"); var element_signature_cripto = document.getElementById(type+"[use_signature_cripto]"); switch (use_signature_digital_cripto[use_signature_digital_cripto.selectedIndex].value){ case "1": element_signature_digital.style.display=""; element_signature_cripto.style.display=""; break; case "0": element_signature_digital.style.display="none"; element_signature_cripto.style.display="none"; break; case "": if (default_signature_digital_cripto){ element_signature_digital.style.display=""; element_signature_cripto.style.display=""; } else { element_signature_digital.style.display="none"; element_signature_cripto.style.display="none"; } } } } function validateSignature() { var sigs_len = parseInt( document.getElementById("counter").value ); var signatures = {}, types = {}, noSig = true; var default_signature = "", errors = false; for( var i = 0; i < sigs_len; i++ ) { if( !document.getElementById( "_signature" + i ) ) continue; var key = document.getElementById( "title_signature" + i ).value; var edit = !!document.getElementById( "edit_signature" + i ).checked; var value = edit ? tinyMCE.get( "user_signature" + i ).getContent() : document.getElementById( "user_signature" + i ).value; if( !value ) continue; if( !key ) { alert( "Titulo da assinatura nao pode ser em branco." ); return( false ); } var openTags = value.match(/<[a-z][^&>]*>/g); var closedTags = value.match(/<[/][^&>]*>/g); var oclosedTags = value.match(/[a-z]*[^&<>]* [/]>/g); if( ( openTags || [] ).length !== (( closedTags || [] ).length + ( oclosedTags || [] ).length )) { errors = errors || []; errors.push( key ); } if( errors ) continue; if( document.getElementById( "default_signature" + i ).checked ) default_signature = key; signatures[key] = value; if( edit ) types[key] = edit; if( noSig ) noSig = false; } if( errors ){ alert( "Há erros de html na(s) assinatura(s) \'" + errors.join("\',\'") + "\'.\\nRevise a informação inserida (somente no modo Texto Simples ou visulização do Código-Fonte, no modo Texto Rico).\\nPossivelmente você copiou e colou sua assinatura de outro software. Para evitar erros, recomendamos utilizar apenas o editor Texto Rico do Expresso." ); return( false ); } if( !default_signature ){ if( !noSig ) { alert( "Favor selecionar uma assinatura padrao." ); return( false ); } document.getElementById( "signature_default" ).value = ""; document.getElementById( "signature" ).value = ""; } else { document.getElementById( "signature_default" ).value = default_signature; document.getElementById( "signature" ).value = types[key] ? signatures[default_signature] : signatures[default_signature].replace( /\\n/g, "
" ); } document.getElementById( "signatures" ).value = toJSON( signatures ); document.getElementById( "signature_types" ).value = toJSON( types ); return( true ); } function fromJSON( value ) { return (new Function( "return " + decode64( value )))(); } function toJSON( value ) { var json = []; for( var key in value ) json.push( \'"\' + key + \'":"\' + escape( value[key] ) + \'"\' ); return encode64( "{" + json.join( "," ) + "}" ); } // This code was written by Tyler Akins and has been placed in the // public domain. It would be nice if you left this header intact. // Base64 code from Tyler Akins -- http://rumkin.com var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function encode64(input) { var output = new StringMaker(); var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4)); } return output.toString(); } var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf(" chrome/") >= 0 || ua.indexOf(" firefox/") >= 0 || ua.indexOf(" gecko/") >= 0) { var StringMaker = function () { this.str = ""; this.length = 0; this.append = function (s) { this.str += s; this.length += s.length; } this.prepend = function (s) { this.str = s + this.str; this.length += s.length; } this.toString = function () { return this.str; } } } else { var StringMaker = function () { this.parts = []; this.length = 0; this.append = function (s) { this.parts.push(s); this.length += s.length; } this.prepend = function (s) { this.parts.unshift(s); this.length += s.length; } this.toString = function () { return this.parts.join(""); } } } function decode64(input) { var output = new StringMaker(); var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; // remove all characters that are not A-Z, a-z, 0-9, +, /, or = input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = keyStr.indexOf(input.charAt(i++)); enc2 = keyStr.indexOf(input.charAt(i++)); enc3 = keyStr.indexOf(input.charAt(i++)); enc4 = keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output.append(String.fromCharCode(chr1)); if (enc3 != 64) { output.append(String.fromCharCode(chr2)); } if (enc4 != 64) { output.append(String.fromCharCode(chr3)); } } return output.toString(); } function loadSignature() { var types = fromJSON( document.getElementById( "signature_types" ).value ); var signatures = fromJSON( document.getElementById( "signatures" ).value ); var old_signature = document.getElementById( "signature" ).value; var def = document.getElementById( "signature_default" ).value; var counter = 0, ids = [], def_signature = "", noSig = true; for( key in signatures ) { addSignature( !types || !types[key] ); var value = unescape( signatures[key] ); document.getElementById( "title_signature" + counter ).value = key; document.getElementById( "user_signature" + counter ).value = value; if( def === key ) def_signature = counter; if( noSig ) noSig = false; counter++; } if( def_signature !== "" ) document.getElementById( "default_signature" + def_signature ).checked = true; else if( noSig && old_signature ) { addSignature( document.getElementById("type_signature").value !== "html" ); document.getElementById( "user_signature" + counter ).value = old_signature; } }'); //} $default = array( '25' => '25', '50' => '50', '75' => '75', '100' => '100' ); // Cria nova opção nas preferências do ExpressoMail create_check_box('View the user name in the header of the messages printed?', 'show_name_print_messages', 'Displays the user name in the header print email'); create_select_box('What is the maximum number of messages per page?','max_email_per_page',$default,'This is the number of messages shown in your mailbox per page'); create_check_box('Save deleted messages in trash folder?','save_deleted_msg','When delete message, send it automatically to trash folder'); $default = array( '1' => lang('1 day'), '2' => lang('2 days'), '3' => lang('3 days'), '4' => lang('4 days'), '5' => lang('5 days') ); create_select_box('Delete trash messages after how many days?','delete_trash_messages_after_n_days',$default,'Delete automatically the messages in trash folder in how many days'); create_check_box('Would you like to use local messages?','use_local_messages','Enabling this options you will be able to store messages in your local computer'); create_check_box('Would you like to keep archived messages?','keep_archived_messages','After store email in your local computer delete it from server'); create_check_box('Show previous message, after delete actual message?','delete_and_show_previous_message','Enable this option if you want to read the next message everytime you delete a message'); create_check_box('Do you wanna receive an alert for new messages?','alert_new_msg','Everytime you receive new messages you will be informed'); create_check_box('Show default view on main screen?','mainscreen_showmail','Show unread messages in your home page'); create_check_box('Do you want to use remove attachments function?','remove_attachments_function','It allow you to remove attachments from messages'); create_check_box('Do you want to use important flag in email editor?','use_important_flag','It allow you to send emails with important flag, but you can receive unwanted messages with important flag'); //Use user folders from email if ($type != "" && $type != "user"){ $trash = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']; $drafts = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']; $spam = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']; $sent = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']; $delimiter = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter']; $default = Array( 'INBOX' => lang('INBOX'), 'INBOX'.$delimiter.$trash => $trash, 'INBOX'.$delimiter.$drafts => $drafts, 'INBOX'.$delimiter.$spam => $spam, 'INBOX'.$delimiter.$sent => $sent ); } else { require_once('class.imap_functions.inc.php'); $boemailadmin = CreateObject('emailadmin.bo'); $emailadmin_profile = $boemailadmin->getProfileList(); $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']); $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user']; $e_server = $_SESSION['phpgw_info']['expressomail']['email_server']; $imap = CreateObject('expressoMail1_2.imap_functions'); $save_in_folder_selected = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']; // Load Special Folders (Sent, Trash, Draft, Spam) from EmailAdmin (if exists, else get_lang) $specialFolders = array ("Trash" => lang("Trash"), "Drafts" => lang("Drafts"), "Spam" => lang("Spam"), "Sent" => lang("Sent")); foreach ($specialFolders as $key => $value){ if($e_server['imapDefault'.$key.'Folder']) $specialFolders[$key] = $e_server['imapDefault'.$key.'Folder']; } unset($default); $default[-1] = lang('Select on send'); foreach($imap -> get_folders_list(array('noSharedFolders' => true)) as $id => $folder){ if(!is_numeric($id)) continue; else{ // Translate INBOX (root folder) if (strtolower($folder['folder_name']) == "inbox") $folder['folder_name'] = lang("Inbox"); // Translate Special Folders elseif (($keyFolder = array_search($folder['folder_name'], $specialFolders)) !== false) $folder['folder_name'] = lang($keyFolder); // Identation for subfolders $folder_id = explode($e_server['imapDelimiter'],$folder['folder_id']); $level = count($folder_id); $ident = ''; for($i = 2; $level > 2 && $i < $level;$i++) $ident .= ' - '; $default[$folder['folder_id']] = $ident.$folder['folder_name']; } } } create_select_box('Save sent messages in folder','save_in_folder',$default,'Save automatically sent messages in selected folder'); create_check_box('Hide menu folders?','hide_folders','You can use it if your screen does not have good resolution'); $default = array( '1' => lang('unlimited'), '2' => '2', '3' => '3', '4' => '4', '5' => '5' ); create_select_box('What is the minimum number of characters in searching contacts?','search_characters_number',$default,'what is the minimum number of characters in searching contacts'); $default = array( '20' => lang('normal'), '30' => lang('medium'), '40' => lang('big') ); create_select_box('What is the height of the lines in the list of messages?','line_height',$default,''); create_check_box('Use dynamic contacts?','use_dynamic_contacts','Store your\'s most used contacts'); create_check_box('Use shortcuts?','use_shortcuts',''); create_check_box('Auto save draft','auto_save_draft','When you are away from computer it saves automatically the message you are writing'); $default = array( '65536' => lang('unlimited'), '640' => '640', '768' => '768', '800' => '800', '1024' => '1024', '1080' => '1080' ); create_select_box('What is the maximum size of embedded images?','image_size',$default,'When user send an email with image in body message, it changes the size'); if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar']) { create_check_box('Enable digitally sign/cipher the message?','use_signature_digital_cripto','','',True,'onchange="javascript:exibir_ocultar();"'); if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto']) { create_check_box('Always sign message digitally?','use_signature_digital',''); create_check_box('Always cipher message digitally?','use_signature_cripto',''); } else { create_check_box('Always sign message digitally?','use_signature_digital','','',True,'',False); create_check_box('Always cipher message digitally?','use_signature_cripto','','',True,'',False); } } $default = array( 'text' => lang('simple text'), 'html' => lang('rich text') ); create_check_box('Insert signature automatically in new messages?','use_signature',''); if ($type == 'user' || $type == ''){ global $prefs; // create_select_box('Signature Type','type_signature',$default,'','','','onchange="javascript:changeType(this.value);"'); $vars = $GLOBALS['phpgw']->preferences->user['expressoMail']; create_html_code("signature"," "); }else{ create_select_box('Signature Type','type_signature',$default,'','','',''); } ?>