Reduce row height tu 20px ==> should force tree to be correctly drawn
[banana.git] / banana / post.inc.php
index bc7f37e..1da8783 100644 (file)
@@ -59,7 +59,9 @@ class BananaPost
         if ($this->_split_multipart($this->headers, $this->body)) {
             $this->set_body_to_part(0);
         } else {
-            $this->_split_multipart($mpart_type[1], $mpart_boundary[1]);
+            if(isset($mpart_type)) {
+                $this->_split_multipart($mpart_type[1], $mpart_boundary[1]);
+            }
             $this->_find_uuencode();
             $this->_fix_charset();
         }
@@ -90,7 +92,8 @@ class BananaPost
      */
     function _split_multipart($headers, $body)
     {
-        if (!preg_match("@multipart/([^;]+);@", $headers['content-type'], $type)) {
+        if (!isset($headers['content-type'])
+                || !preg_match("@multipart/([^;]+);@", $headers['content-type'], $type)) {
             return false;
         }
             
@@ -138,6 +141,7 @@ class BananaPost
     {
         global $banana;
 
+        $local_headers = Array();
         $lines = split("\n", $part);
         while (count($lines)) {
             $line = array_shift($lines);
@@ -156,7 +160,8 @@ class BananaPost
             }
         }
         $local_body = join("\n", $lines);
-        if (preg_match("/quoted-printable/", $local_headers['content-transfer-encoding'])) {
+        if (isset($local_headers['content-transfer-encoding'])
+                && preg_match("/quoted-printable/", $local_headers['content-transfer-encoding'])) {
             $local_body = quoted_printable_decode($local_body);
         }
         return Array('headers' => $local_headers, 'body' => $local_body); 
@@ -174,7 +179,7 @@ class BananaPost
             $filename = $filename[1];
         }           
         if (!isset($filename)) {
-            $filename = "attachment".count($pj);
+            $filename = "attachment" . count($this->pj);
         }
 
         if (isset($local_header['content-type'])
@@ -204,7 +209,8 @@ class BananaPost
      */
     function _fix_charset()
     {
-        if (preg_match('!charset="?([^;"]*)"?\s*(;|$)?!', $this->headers['content-type'], $matches)) {
+        if (isset($this->headers['content-type'])
+                && preg_match('!charset="?([^;"]*)"?\s*(;|$)?!', $this->headers['content-type'], $matches)) {
             $body = iconv($matches[1], 'utf-8', $this->body);
             if (strlen($body) == 0) {
                 return false;
@@ -409,14 +415,15 @@ class BananaPost
              . makeImgLink(Array('group'  => $banana->state['group'],
                                  'action' => 'new'),
                            'post.gif',
-                           _b_('Nouveau message'))
+                           _b_('Nouveau message')) . ' '
              . makeImgLink(Array('group'  => $banana->state['group'],
                                  'artid'  => $this->id,
                                  'action' => 'new'),
                            'reply.gif',
                            _b_('RĂ©pondre'));
         if ($this->checkCancel()) {
-            $res .= makeImgLink(Array('group'  => $banana->state['group'],
+            $res .= ' '
+                  . makeImgLink(Array('group'  => $banana->state['group'],
                                       'artid'  => $this->id,
                                       'action' => 'cancel'),
                                 'cancel.gif',
@@ -427,6 +434,7 @@ class BananaPost
              . '</th></tr>'
              . '<tr class="pair"><td class="headers"><table cellpadding="0" cellspacing="0">';
 
+        $xface = null;
         foreach ($banana->show_hdr as $hdr) {
             if (isset($this->headers[$hdr])) {
                 $res2 = formatdisplayheader($hdr, $this->headers[$hdr]);
@@ -464,8 +472,12 @@ class BananaPost
             $res .= '</th></tr>';
         }
  
-        preg_match("@text/([^;]+);@", $this->headers['content-type'], $format);
-        $format = $format[1];
+        if (isset($this->headers['content-type'])
+                && preg_match("@text/([^;]+);@", $this->headers['content-type'], $format)) {
+            $format = $format[1];
+        } else {
+            $format = 'plain';
+        }
         $res .= '<tr class="impair"><td colspan="2" class="body"';
         if ($format == 'html') {
             if (preg_match('@<body[^>]*bgcolor="?([#0-9a-f]+)"?[^>]*>@i', $this->body, $bgcolor)) {