fixed the attachment problem
[squirrelmail.git] / src / compose.php
index ab43ce5f7018b8df2350a54b92265bb63edf3d5c..666326ad02952f664f9ab22db9ad27156baf1bbf 100644 (file)
       $subject = sqStripSlashes(decodeHeader($subject));
       $reply_subj = decodeHeader($reply_subj);
       $forward_subj = decodeHeader($forward_subj);
+      $body = sqStripSlashes($body);
 
       if ($use_javascript_addr_book) {
          echo "\n<SCRIPT LANGUAGE=JavaScript><!--\n";
       echo "      <TD BGCOLOR=\"$color[4]\" COLSPAN=2>\n";
       echo "         &nbsp;&nbsp;<TEXTAREA NAME=body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>";
       if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) {
-         echo sqStripSlashes(htmlspecialchars($body)) . "\n\n-- \n" . htmlspecialchars($signature);
+         echo (htmlspecialchars($body)) . "\n\n-- \n" . htmlspecialchars($signature);
       } else {
-         echo sqStripSlashes(htmlspecialchars($body));
+         echo (htmlspecialchars($body));
       }
       echo "</TEXTAREA><BR>\n";
       echo "      </TD>\n";
       echo "     </td>\n";
       echo "   </tr>\n";
       if (isset($attachments) && count($attachments)>0) {
-         echo "</tr><tr><td bgcolor=\"$color[1]\" align=right>\n";
+         echo "<tr><td bgcolor=\"$color[0]\" align=right>\n";
          echo "&nbsp;";
          echo "</td><td align=left bgcolor=\"$color[0]\">";
          while (list($localname, $remotename) = each($attachments)) {
       $localfilename = $localfilename;
       
       // Put the file in a better place
-      error_reporting(0); // Rename will produce error output if it fails
-      if (!rename($attachfile, $attachment_dir.$localfilename)) {
-         if (!copy($attachfile, $attachment_dir.$localfilename)) {
+      // This shouldn't be here... Ondrej Sury <ondrej@sury.cz>
+      //$tmp=explode('/',$attachfile);
+      //$attachfile=$tmp[count($tmp)-1];
+      //$attachfile=ereg_replace('\.{2,}','',$attachfile);
+
+      //error_reporting(0); // Rename will produce error output if it fails
+      //if (!rename($attachfile, $attachment_dir.$localfilename)) {
+      //   if (!copy($attachfile, $attachment_dir.$localfilename)) {
+      if (!@rename($attachfile, $attachment_dir.$localfilename)) {
+         if (!@copy($attachfile, $attachment_dir.$localfilename)) {
             plain_error_message(_("Could not move/copy file. File not attached"), $color);
             $failed = true;
          }