Файл: htdocs/newmess.php
Строк: 66
<?php
  include ("includes/header.php");
  //create message
  
  //fetch data for reply or forward
  if (intval($_REQUEST["m"])) $message = $SmartMail->showmess();
  $to = strtolower($_REQUEST["to"]);
  if ($action == "send") {
    $from = trim($_REQUEST["from"]);
    $body = $_REQUEST["body"];
    $subject = trim($_REQUEST["subject"]);
  
    $SmartMail->sendmail();
  }
  
  if (!$from) {
    $from = $SmartMail->user;
    if (!preg_match('/@/',$from)) $from .= "@" . ($maildomain ? $maildomain : $SmartMail->server);
  }
  
  if (!$action && $message) {
    $to = $message["header"]["frommail"];
    $from = $message["header"]["toaddress"];
    $subject = $message["header"]["subject"]; 
    $body = sprintf(lang("body_waswritingon"), $message["header"]["fromaddress"], $message["header"]["date"]) . ":n" . 
      preg_replace('/A|n/',"n> ",strip_tags($message["body"]));
    if ($mode == "reply") {
      if (!preg_match('/^(re:|aw:)/i',$subject)) $subject = "Re: $subject";
    }
    if ($mode == "forward") {
      if (!preg_match('/^(fwd:|wg:)/i',$subject)) $subject = "Fwd: $subject";
    }
  }
  
  if (!$subject) $subject = "No Subject";
  
  echo "<div class='header'>" . cutstr($subject,30) . "</div>";
  
  echo "<div id='createmess'>";
  
  if ($SmartMail->error) echo display_error($SmartMail->error);
  
  if (!$SmartMail->success) {
    echo "<form method='post' action='newmess.php'>
        <input type='hidden' name='action' value='send'>
        <input type='hidden' name='m' value='" . $SmartMail->m . "'>
        <input type='hidden' name='f' value='" . $SmartMail->basefolder . "'>
        <input type='hidden' name='mode' value='$mode'>
        <p><label>" . lang("descr_from") . ":</label>
          <input type='text' name='from' value='" . he($from) . "'></p>
        <p><label>" . lang("descr_to") . ":</label>
          <input type='text' name='to' value='" . he($to) . "'></p>
        <p>
        <p><label>" . lang("descr_subject") . ":</label>
          <input type='text' name='subject' value='" . he($subject) . "'></p>
          <textarea name='body' cols='70' rows='15'>" . he($body) . "</textarea>";
    
    echo "<span id='sendtools'>";
    echo "<!--<input type='image' src='images/icons/save.png' alt='Save' name='save'>-->
          <input type='image' src='images/icons/send.png' alt='Send' name='send'></span>
      </form>";
  } else {
    echo display_success($SmartMail->success);
  }
  echo "</div>";
  echo "<p class='clear'></p>";
  echo "<div id='footer'>
    <div class='home'><a href='index.php'><img src='images/icons/home.png' alt=''></a>
      <a href='index.php?f=" . $SmartMail->basefolder . "'><img src='images/icons/back.png' alt='back'></a></div>
    <div class='logout'><a href='?action=logout'><img src='images/icons/logout.png' alt=''></a></div>
    </div>";
  
  
?>
  </body>
</html>