Some fixes
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Sun, 16 Jul 2006 15:13:19 +0000 (15:13 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:35:03 +0000 (00:35 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@116 9869982d-c50d-0410-be91-f2a2ec7c7c7b

banana/banana.inc.php.in
banana/misc.inc.php
banana/spool.inc.php

index 0166d80..362dbc4 100644 (file)
@@ -335,11 +335,16 @@ class Banana
             $body     = $_POST['body'];
             $target   = $_POST['newsgroups'];
             $followup = $_POST['followup'];
-            $this->state['page'] = 'message';
+            $this->state['page']   = 'action';
+            $this->state['group']  = $group;
+            $this->state['action'] = 'new';
+            if ($id != -1) {
+                $this->state['artid'] = $id;
+            }
         } elseif ($id > 0) {
             $this->nntp->group($group);
             if ($this->_newPost($id)) {
-                $subject  = preg_replace("/^re\s*:\s*/i", '', 'Re: '.$this->post->headers['subject']);
+                $subject  = 'Re: ' . preg_replace("/^re\s*:\s*/i", '', $this->post->headers['subject']);
                 $body     = utf8_encode($this->post->name." "._b_("a écrit"))." :\n"
                                         . wrap($this->post->get_body(), "> ")
                           . $this->profile['sig'] ? "\n\n-- \n". $this->profile['sig'] : '';
@@ -376,8 +381,8 @@ class Banana
                   . '<input type="file" name="newpj" size="40"/></td></tr>';
         }
         $html .= '<tr><th colspan="2">';
-        if ($id > 0) {
-            $html .= '<input type="hidden" name="artid" value="'.$id.'" />';
+        if ($id != -1) {
+            $html .= '<input type="hidden" name="artid" value="' . $id . '" />';
         }
         $html .= '<input type="hidden" name="action" value="new" />'
               . '<input type="submit" value="' . _b_('Envoyer le message') . '" /></th></tr>'
index c91dba9..66fe305 100644 (file)
@@ -426,7 +426,7 @@ function displayTabs()
     }
     $ret = '<ul id="onglet">';
     foreach ($res as $name=>$onglet) {
-        if ($name != $page) {
+        if ($name != @$page) {
             $ret .= '<li>' . $onglet[0] . '</li>';
         } else {
             $ret .= '<li class="actif">' . $onglet[1] . '</li>';
index b2e04f6..2a6be2e 100644 (file)
@@ -178,7 +178,7 @@ class BananaSpool
         $msgids   = $banana->nntp->xhdr('Message-ID', $arg);
         $refs     = $banana->nntp->xhdr('References', $arg);
 
-        if (is_array($this->ids)) {
+        if (is_array(@$this->ids)) {
             $this->ids = array_merge($this->ids, array_flip($msgids));
         } else {
             $this->ids = array_flip($msgids);
@@ -186,16 +186,11 @@ class BananaSpool
 
         foreach ($msgids as $id=>$msgid) {
             $msg                = new BananaSpoolHead($dates[$id], $subjects[$id], $froms[$id]);
-            if (isset($ref[$id])) {
-                $refs[$id]          = str_replace('><', '> <', $refs[$id]);
-                $msgrefs            = preg_split("/[ \t]/", strtr($refs[$id], $this->ids));
-                $parents            = preg_grep('/^\d+$/', $msgrefs);
-                $msg->parent        = array_pop($parents);
-                $msg->parent_direct = preg_match('/^\d+$/', array_pop($msgrefs));
-            } else {
-                $msg->parent        = null;
-                $msg->parent_direct = null;
-            }
+            $refs[$id]          = str_replace('><', '> <', @$refs[$id]);
+            $msgrefs            = preg_split("/[ \t]/", strtr($refs[$id], $this->ids));
+            $parents            = preg_grep('/^\d+$/', $msgrefs);
+            $msg->parent        = array_pop($parents);
+            $msg->parent_direct = preg_match('/^\d+$/', array_pop($msgrefs));
 
             if (isset($this->overview[$id])) {
                 $msg->desc     = $this->overview[$id]->desc;