⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compose.inc

📁 开源邮件管理系统
💻 INC
📖 第 1 页 / 共 2 页
字号:
    rcube_add_label('checking');    }   $out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;border:none;visibility:hidden;"></iframe>';  return $out;}function rcmail_create_reply_body($body, $bodyIsHtml){  global $IMAP, $MESSAGE;  if (! $bodyIsHtml)  {    // soft-wrap message first    $body = wordwrap($body, 75);      // split body into single lines    $a_lines = preg_split('/\r?\n/', $body);      // add > to each line    for($n=0; $n<sizeof($a_lines); $n++)    {      if (strpos($a_lines[$n], '>')===0)        $a_lines[$n] = '>'.$a_lines[$n];      else        $a_lines[$n] = '> '.$a_lines[$n];    }     $body = join("\n", $a_lines);    // add title line    $prefix = sprintf("\n\n\nOn %s, %s wrote:\n",      $MESSAGE->headers->date,      $MESSAGE->get_header('from'));    // try to remove the signature    if ($sp = strrpos($body, '-- '))      {      if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r")        $body = substr($body, 0, $sp-1);      }    $suffix = '';  }  else  {    $prefix = sprintf("<br /><br />On %s, %s wrote:<br />\n",      $MESSAGE->headers->date,      Q($MESSAGE->get_header('from')));    $prefix .= '<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">';    $suffix = "</blockquote>";  }  return $prefix.$body.$suffix;}function rcmail_create_forward_body($body, $bodyIsHtml){  global $IMAP, $MESSAGE;  if (!$bodyIsHtml)  {    // soft-wrap message first    $body = wordwrap($body, 80);      $prefix = sprintf("\n\n\n-------- Original Message --------\nSubject: %s\nDate: %s\nFrom: %s\nTo: %s\n\n",      $MESSAGE->subject,      $MESSAGE->headers->date,      $MESSAGE->get_header('from'),      $MESSAGE->get_header('to'));  }  else  {    $prefix = sprintf(      "<br><br>-------- Original Message --------" .        "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody>" .        "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">Subject: </th><td>%s</td></tr>" .        "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">Date: </th><td>%s</td></tr>" .        "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">From: </th><td>%s</td></tr>" .        "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">To: </th><td>%s</td></tr>" .        "</tbody></table><br>",      Q($MESSAGE->subject),      Q($MESSAGE->headers->date),      Q($MESSAGE->get_header('from')),      Q($MESSAGE->get_header('to')));  }  // add attachments  if (!isset($_SESSION['compose']['forward_attachments']) && is_array($MESSAGE->mime_parts))    rcmail_write_compose_attachments($MESSAGE);      return $prefix.$body;}function rcmail_create_draft_body($body, $bodyIsHtml){  global $MESSAGE;    /**   * add attachments   * sizeof($MESSAGE->mime_parts can be 1 - e.g. attachment, but no text!   */  if (!isset($_SESSION['compose']['forward_attachments'])      && is_array($MESSAGE->mime_parts)      && count($MESSAGE->mime_parts) > 0)    rcmail_write_compose_attachments($MESSAGE);  return $body;}    function rcmail_write_compose_attachments(&$message){  global $RCMAIL, $IMAP;  $temp_dir = unslashify($RCMAIL->config->get('temp_dir'));  if (!is_array($_SESSION['compose']['attachments']))    $_SESSION['compose']['attachments'] = array();    foreach ((array)$message->mime_parts as $pid => $part)  {    if ($part->ctype_primary != 'message' &&        ($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] ||         (empty($part->disposition) && $part->filename)))    {      $tmp_path = tempnam($temp_dir, 'rcmAttmnt');      if ($fp = fopen($tmp_path, 'w'))      {        fwrite($fp, $message->get_part_content($pid));        fclose($fp);                $_SESSION['compose']['attachments'][] = array(          'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary,          'name' => $part->filename,          'path' => $tmp_path          );      }    }  }	  $_SESSION['compose']['forward_attachments'] = true;}function rcmail_compose_subject($attrib){  global $MESSAGE, $compose_mode;    list($form_start, $form_end) = get_form_tags($attrib);  unset($attrib['form']);    $attrib['name'] = '_subject';  $textfield = new html_inputfield($attrib);  $subject = '';  // use subject from post  if (isset($_POST['_subject']))    $subject = get_input_value('_subject', RCUBE_INPUT_POST, TRUE);      // create a reply-subject  else if ($compose_mode == RCUBE_COMPOSE_REPLY)  {    if (eregi('^re:', $MESSAGE->subject))      $subject = $MESSAGE->subject;    else      $subject = 'Re: '.$MESSAGE->subject;  }  // create a forward-subject  else if ($compose_mode == RCUBE_COMPOSE_FORWARD)  {    if (eregi('^fwd:', $MESSAGE->subject))      $subject = $MESSAGE->subject;    else      $subject = 'Fwd: '.$MESSAGE->subject;  }  // creeate a draft-subject  else if ($compose_mode == RCUBE_COMPOSE_DRAFT)    $subject = $MESSAGE->subject;    $out = $form_start ? "$form_start\n" : '';  $out .= $textfield->show($subject);  $out .= $form_end ? "\n$form_end" : '';           return $out;}function rcmail_compose_attachment_list($attrib){  global $OUTPUT, $CONFIG;    // add ID if not given  if (!$attrib['id'])    $attrib['id'] = 'rcmAttachmentList';    $out = "\n";    if (is_array($_SESSION['compose']['attachments']))  {    if ($attrib['deleteicon'])      $button = html::img(array(        'src' => $CONFIG['skin_path'] . $attrib['deleteicon'],        'alt' => rcube_label('delete'),        'style' => "border:0;padding-right:2px;vertical-align:middle"));    else      $button = Q(rcube_label('delete'));    foreach ($_SESSION['compose']['attachments'] as $id => $a_prop)      $out .= html::tag('li', array('id' => "rcmfile".$id),        html::a(array(            'href' => "#delete",            'title' => rcube_label('delete'),              'onclick' => sprintf("return %s.command(\'remove-attachment\',\'rcmfile%d\', this)", JS_OBJECT_NAME, $id)),          $button) . Q($a_prop['name']));  }  $OUTPUT->add_gui_object('attachmentlist', $attrib['id']);      return html::tag('ul', $attrib, $out, html::$common_attrib);}function rcmail_compose_attachment_form($attrib){  global $OUTPUT;  // add ID if not given  if (!$attrib['id'])    $attrib['id'] = 'rcmUploadbox';    $button = new html_inputfield(array('type' => 'button', 'class' => 'button'));    $out = html::div($attrib,    $OUTPUT->form_tag(array('name' => 'form', 'method' => 'post', 'enctype' => 'multipart/form-data')) .    rcmail_compose_attachment_field(array()) . html::br() .    $button->show(rcube_label('close'), array('onclick' => "document.getElementById('$attrib[id]').style.visibility='hidden'")) .    $button->show(rcube_label('upload'), array('onclick' => JS_OBJECT_NAME . ".command('send-attachment', this.form)"))  );      $OUTPUT->add_gui_object('uploadbox', $attrib['id']);  return $out;}function rcmail_compose_attachment_field($attrib){  // allow the following attributes to be added to the <input> tag  $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'size'));   $out = '<input type="file" name="_attachments[]"'. $attrib_str . " />";  return $out;}function rcmail_priority_selector($attrib){  global $MESSAGE;    list($form_start, $form_end) = get_form_tags($attrib);  unset($attrib['form']);    $attrib['name'] = '_priority';  $selector = new html_select($attrib);  $selector->add(array(rcube_label('lowest'),                       rcube_label('low'),                       rcube_label('normal'),                       rcube_label('high'),                       rcube_label('highest')),                 array(5, 4, 0, 2, 1));                   $sel = isset($_POST['_priority']) ? $_POST['_priority'] : intval($MESSAGE->headers->priority);  $out = $form_start ? "$form_start\n" : '';  $out .= $selector->show($sel);  $out .= $form_end ? "\n$form_end" : '';           return $out;}function rcmail_receipt_checkbox($attrib){  global $MESSAGE, $compose_mode;    list($form_start, $form_end) = get_form_tags($attrib);  unset($attrib['form']);    if (!isset($attrib['id']))    $attrib['id'] = 'receipt';    $attrib['name'] = '_receipt';  $attrib['value'] = '1';  $checkbox = new html_checkbox($attrib);  $out = $form_start ? "$form_start\n" : '';  $out .= $checkbox->show(    $compose_mode == RCUBE_COMPOSE_DRAFT && $MESSAGE->headers->mdn_to ? 1 : 0);  $out .= $form_end ? "\n$form_end" : '';  return $out;}function rcmail_editor_selector($attrib){  global $CONFIG, $MESSAGE, $compose_mode;  $choices = array(    'html'  => 'htmltoggle',    'plain' => 'plaintoggle'  );  // determine whether HTML or plain text should be checked  $useHtml = $CONFIG['htmleditor'] ? true : false;  if ($compose_mode)    $useHtml = ($useHtml && $MESSAGE->has_html_part());  $selector = '';  $chosenvalue = $useHtml ? 'html' : 'plain';  $radio = new html_radiobutton(array('name' => '_editorSelect', 'onclick' => 'return rcmail_toggle_editor(this)'));  foreach ($choices as $value => $text)  {    $attrib['id'] = '_' . $value;    $attrib['value'] = $value;    $selector .= $radio->show($chosenvalue, $attrib) . html::label($attrib['id'], Q(rcube_label($text)));  }  return $selector;}function get_form_tags($attrib){  global $RCMAIL, $MESSAGE_FORM;  $form_start = '';  if (!strlen($MESSAGE_FORM))  {    $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task));    $hiddenfields->add(array('name' => '_action', 'value' => 'send'));    $form_start = empty($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : '';    $form_start .= $hiddenfields->show();  }      $form_end = (strlen($MESSAGE_FORM) && !strlen($attrib['form'])) ? '</form>' : '';  $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';    if (!strlen($MESSAGE_FORM))    $RCMAIL->output->add_gui_object('messageform', $form_name);    $MESSAGE_FORM = $form_name;  return array($form_start, $form_end);}// register UI objects$OUTPUT->add_handlers(array(  'composeheaders' => 'rcmail_compose_headers',  'composesubject' => 'rcmail_compose_subject',  'composebody' => 'rcmail_compose_body',  'composeattachmentlist' => 'rcmail_compose_attachment_list',  'composeattachmentform' => 'rcmail_compose_attachment_form',  'composeattachment' => 'rcmail_compose_attachment_field',  'priorityselector' => 'rcmail_priority_selector',  'editorselector' => 'rcmail_editor_selector',  'receiptcheckbox' => 'rcmail_receipt_checkbox',));/****** get contacts for this user and add them to client scripts ********/$CONTACTS = new rcube_contacts($DB, $USER->ID);$CONTACTS->set_pagesize(1000);$a_contacts = array();                                    if ($result = $CONTACTS->list_records())  {  while ($sql_arr = $result->iterate())    if ($sql_arr['email'])      $a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);  }if (isset($CONFIG['ldap_public']))  {  /* LDAP autocompletion */   foreach ($CONFIG['ldap_public'] as $ldapserv_config)     {     if ($ldapserv_config['fuzzy_search'] != 1 ||         $ldapserv_config['global_search'] != 1)      {       continue;       }	     $LDAP = new rcube_ldap($ldapserv_config);     $LDAP->connect();     $LDAP->set_pagesize(1000);      $results = $LDAP->search($ldapserv_config['mail_field'], "");      for ($i = 0; $i < $results->count; $i++)  	  {  	  if ($results->records[$i]['email'] != '')  	    {  	    $email = $results->records[$i]['email'];  	    $name = $results->records[$i]['name'];  		  	    $a_contacts[] = format_email_recipient($email, $name); 	    }  	  }    $LDAP->close();     }  }if ($a_contacts)   {  	$OUTPUT->set_env('contacts', $a_contacts);   }$OUTPUT->send('compose');?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -