Changeset 3609
- Timestamp:
- 12/20/10 15:05:48 (13 years ago)
- Location:
- branches/2.2/mobile
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/mobile/inc/class.common_functions.inc.php
r3573 r3609 63 63 } 64 64 65 /** 66 * Fixes the odd indexing of multiple file uploads from the format: 67 * 68 * $_FILES['field']['key']['index'] 69 * 70 * To the more standard and appropriate: 71 * 72 * $_FILES['field']['index']['key'] 73 * 74 * @param array $files 75 * @author Corey Ballou 76 * @link http://www.jqueryin.com 77 */ 78 function fixFilesArray(&$files) 79 { 80 $names = array( 'name' => 1, 'type' => 1, 'tmp_name' => 1, 'error' => 1, 'size' => 1); 81 82 foreach ($files as $key => $part) { 83 // only deal with valid keys and multiple files 84 $key = (string) $key; 85 if (isset($names[$key]) && is_array($part)) { 86 foreach ($part as $position => $value) { 87 $files[$position][$key] = $value; 88 } 89 // remove old key reference 90 unset($files[$key]); 91 } 92 } 93 } 94 65 95 } //end common class 66 96 -
branches/2.2/mobile/inc/class.ui_mobilemail.inc.php
r3605 r3609 322 322 $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam'] = $current_config['expressoMail_command_for_spam']; 323 323 $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_use_spam_filter'] = $current_config['expressoMail_use_spam_filter']; 324 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size'] = $current_config['expressoMail_Max_attachment_size'] ? $current_config['expressoMail_Max_attachment_size']."M" : ini_get('upload_max_filesize'); 324 325 325 326 // echo '<script> var array_lang = new Array();var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\' </script>'; … … 418 419 { 419 420 420 $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);421 $p = $this->template; 421 422 $p->set_file( 422 423 Array( … … 475 476 { 476 477 477 $functions = CreateObject('mobile.common_functions');478 $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);478 $functions = $this->common; 479 $p = $this->template; 479 480 $p->set_file( 480 481 Array( … … 542 543 } 543 544 return $p->fp('out','rows_mails'); 544 /* 545 // Cria a lista de e-mails 546 $mail_rows = ''; 547 $unread_msg_count = 0; 548 549 if ($this->number_of_messages != 0) 550 { 551 $unread_msg_count = 0; 552 foreach ($messages as $index => $msg) 553 { 554 $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 555 $p->set_file(array('mobilemail_t' => 'mobilemail.tpl')); 556 $p->set_block('mobilemail_t', 'mail_row'); 557 $p->set_block('mobilemail_t', 'end_strong'); 558 $p->set_block('mobilemail_t', 'begin_strong'); 559 $p->set_var('unseen_bkg', "seen_bkg"); 560 $p->set_var('itememail_access_key', "0"); 561 $p->set_var('str_new_message', ""); 562 563 if (is_numeric($index)) 564 { 565 !empty($msg['from']['name']) ? $from = $msg['from']['name'] : $from = $msg['from']['email']; 566 !empty($msg['subject']) ? $subject = $msg['subject'] : $subject = lang('[empty subject]'); 567 if ($msg['Unseen'] == 'U') 568 { //Setando as mensagens nao lidas 569 $p->set_var('strong_unseen_begin', trim($p->fp('mobilemail_t', 'begin_strong'))); 570 $p->set_var('strong_unseen_end', trim($p->fp('mobilemail_t', 'end_strong'))); 571 $p->set_var('unseen_bkg', "unseen_bkg"); 572 $p->set_var('itememail_access_key', "9"); 573 $unread_msg_count = $unread_msg_count + 1; 574 $p->set_var('str_new_message', lang("New message")); 575 } 576 $p->set_var('from', $from); 577 $p->set_var('subject', $subject); 578 $p->set_var('msg_number', $msg['msg_number']); 579 $p->set_var('date', $msg['smalldate']); 580 $p->set_var('msg_folder', $this->folders[$this->current_folder]['folder_id']); 581 $p->set_var('from_label', lang('From')); 582 $mail_rows .= $p->fp('mobilemail_t', 'mail_row'); 583 } 584 } 585 586 // Imprime a lista de e-mails 587 $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 588 $p->set_file(array('mobilemail_t' => 'mobilemail.tpl')); 589 $p->set_block('mobilemail_t', 'mail_list'); 590 $p->set_var('mail_rows', $mail_rows); 591 $p->set_var('messages_total', $this->number_of_messages); 592 $p->set_var('unread_messages_total', $unread_msg_count); 593 if ($unread_msg_count) 594 { 595 $p->set_var('(unread_messages_total)', '('.$unread_msg_count.')'); 596 } 597 598 //$p->pfp('out', 'mail_list'); 599 $GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'mail_list')); 600 } 601 else 602 { 603 // Lista de e-mails vazia 604 $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 605 $p->set_file(array('mobilemail_t' => 'mobilemail.tpl')); 606 $p->set_block('mobilemail_t', 'empty_list'); 607 $p->set_var('empty_message', lang('Empty folder')); 608 //$p->pfp('out', 'empty_list'); 609 $GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'empty_list')); 610 }*/ 545 611 546 } 612 547 … … 753 688 $this->template->set_var('lang_read_confirmation', lang("read confirmation")); 754 689 $this->template->set_var('lang_add_history', lang("add history")); 690 $this->template->set_var("show_forward_attachment","none"); 755 691 756 692 if(isset($params["error_message"])) { … … 772 708 if (isset($params['msg_number'])) $msg = $this->imap_functions->get_info_msg(array('msg_number' => $params['msg_number'], 'msg_folder' => $params['msg_folder'] ) ); 773 709 710 774 711 if($params['type']=="clk") 775 712 { … … 830 767 831 768 $this->template->set_var('msg_number', $_GET['msg_number']); 832 $this->template->set_var('msg_folder', $_GET['msg_folder']); 769 $this->template->set_var('msg_folder', $_GET['msg_folder']); 770 if(count($msg['attachments'])>0) { 771 $this->template->set_var("lang_forward_attachment",lang("forward attachments")); 772 $this->template->set_var("show_forward_attachment","block"); 773 $this->template->set_block("new_msg_t","forward_attach_block"); 774 foreach($msg['attachments'] as $forward_attach) { 775 $value = rawurlencode(serialize(array(0=>$msg['msg_folder'], 776 1=>$msg['msg_number'], 777 3=>$forward_attach['pid'], 778 2=>$forward_attach['name'], 779 4=>$forward_attach['encoding']))); 780 $this->template->set_var("value_forward_attach",$value); 781 $this->template->set_var("label_forward_attach",$forward_attach['name']); 782 $this->template->fp("forwarding_attachments","forward_attach_block",true); 783 } 784 } 785 833 786 } 834 787 else if($params['type']=="use_draft"){ … … 838 791 $this->template->set_var('body_value', strip_tags($msg['body'])); // Usa a função strip_tags() para filtrar 839 792 $this->template->set_var('msg_number', $_GET['msg_number']); 840 $this->template->set_var('msg_folder', $_GET['msg_folder']); 793 $this->template->set_var('msg_folder', $_GET['msg_folder']); 841 794 } 842 795 else{ … … 867 820 { 868 821 $params["folder"] = "INBOX/".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']; 822 $params["FILES"] = $_FILES["FILES"]; 823 $this->common->fixFilesArray($params["FILES"]); 824 $params['forwarding_attachments'] = $params["forward_attachments"]; 869 825 $return = $this->imap_functions->save_msg($params); 870 826 if($return["has_error"]) { … … 885 841 //Chamada da classe phpmailer 886 842 include_once(PHPGW_SERVER_ROOT."/expressoMail1_2/inc/class.phpmailer.php"); 887 843 include_once(PHPGW_SERVER_ROOT."/expressoMail1_2/inc/class.imap_functions.inc.php"); 844 888 845 //Recebe os dados do form (passados pelo POST) 889 846 $toaddress = $_POST['input_to']; 890 847 $ccaddress = $_POST['input_cc']; 891 848 $subject = $_POST['input_subject']; //"Mail Subject"; 892 $body = $_POST['body']; //"Mail body. Any text.";849 $body = nl2br($_POST['body']); //"Mail body. Any text."; 893 850 $isImportant = $_POST['check_important']; 894 851 $addHistory = $_POST['check_add_history']; 895 852 $readConfirmation = $_POST['check_read_confirmation']; 896 853 $msgNumber = $_POST['reply_msg_number']; 854 $attachments = $_FILES['FILES']; 855 $this->common->fixFilesArray($attachments); 856 $forwarding_attachments = $_POST["forward_attachments"]; 857 897 858 898 859 //Cria objeto … … 940 901 if ($readConfirmation) $mail->ConfirmReadingTo = $_SESSION['phpgw_info']['expressomail']['user']['email']; 941 902 903 $imap_functions = new imap_functions(); 904 if (count($attachments)>0) //Attachment 905 { 906 907 $total_uploaded_size = 0; 908 $upload_max_filesize = str_replace("M","",$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size']) * 1024 * 1024; 909 910 foreach ($attachments as $attach) 911 { 912 $mail->AddAttachment($attach['tmp_name'], $attach['name'], "base64", $imap_functions->get_file_type($attach['name'])); // optional name 913 $total_uploaded_size = $total_uploaded_size + $attach['size']; 914 } 915 if( $total_uploaded_size > $upload_max_filesize){ 916 917 return $imap_functions->parse_error("message file too big"); 918 } 919 } 920 if (count($forwarding_attachments) > 0) { //forward attachment 921 foreach($forwarding_attachments as $forwarding_attachment) 922 { 923 $file_description = unserialize(rawurldecode($forwarding_attachment)); 924 $fileContent = $imap_functions->get_forwarding_attachment( 925 $file_description[0], 926 $file_description[1], 927 $file_description[3], 928 $file_description[4]); 929 $fileName = $file_description[2]; 930 $mail->AddStringAttachment($fileContent,html_entity_decode(rawurldecode($fileName)), $file_description[4], $imap_functions->get_file_type($file_description[2])); 931 932 } 933 } 934 942 935 //Se o e-mail nao for enviado por qualquer motivo... 943 936 if(!$mail->Send()) { -
branches/2.2/mobile/setup/phpgw_pt-br.lang
r3602 r3609 55 55 E-mail mobile pt-br Cx Entrada 56 56 E-mails mobile pt-br E-mails 57 forward attachments mobile pt-br Anexos do encaminhamento 57 58 This message have attachment(s) mobile pt-br Este e-mail possui anexo(s) 58 59 This message don't have attachment(s) mobile pt-br Este e-mail não possui anexo(s) … … 143 144 view calendar mobile pt-br Calendário 144 145 view week mobile pt-br Semana 145 -
branches/2.2/mobile/templates/default/new_msg.tpl
r3602 r3609 12 12 } 13 13 14 function add_file() { 15 var divFiles = document.getElementById("div_campos"); 16 var p = document.createElement("p"); 17 p.innerHTML = "<strong><label> </label></strong> "+ 18 "<input name=\"FILES[]\" type=\"file\">"; 19 divFiles.appendChild(p); 20 } 21 14 22 </script> 15 23 … … 18 26 </div> 19 27 20 <form method="POST" action="index.php?menuaction=mobile.ui_mobilemail.send_mail" id="mail_form">28 <form method="POST" action="index.php?menuaction=mobile.ui_mobilemail.send_mail" enctype="multipart/form-data" id="mail_form"> 21 29 <input type="hidden" id="reply_from" name="reply_from" value='{from}' /> 22 30 <input type="hidden" id="reply_msg_number" name="reply_msg_number" value='{msg_number}' /> … … 25 33 <input type="hidden" name="add_to" id="add_to" value='' /> 26 34 27 <div class="campos-correspondencia" >35 <div class="campos-correspondencia" id="div_campos"> 28 36 <p> 29 37 <strong><label>{lang_to}:</label></strong> … … 39 47 <strong><label>{lang_subject}:</label></strong> 40 48 <input id="input_subject" name="input_subject" value='{subject}' /> 41 <!-- <button name="anexo" title="Anexar" class="btn-contexto">{lang_attachment}</button> -->42 49 </p> 50 <p style="display:{show_forward_attachment};"> 51 <strong><label style="float:none;">{lang_forward_attachment}:</label></strong> 52 </p> 53 {forwarding_attachments} 54 <p> 55 <strong><label>{lang_attachment}:</label></strong> 56 <input name="FILES[]" type="file"> 57 <button name="action" type="button" class="btn-contexto" onclick="add_file();">+</button> 58 </p> 59 60 43 61 </div> 62 44 63 45 64 <div id="corpo_mensagem"> … … 58 77 </form> 59 78 <!-- END page --> 79 80 <!-- BEGIN forward_attach_block --> 81 <p><input type="checkbox" name="forward_attachments[]" value="{value_forward_attach}" checked/>{label_forward_attach}</p> 82 <!-- END forward_attach_block -->
Note: See TracChangeset
for help on using the changeset viewer.