Replace all '-- ' as signature delimiter and not only the last one.
[banana.git] / banana / banana.inc.php.in
index b1ec2b2..cdf43dd 100644 (file)
@@ -14,7 +14,7 @@ class Banana
     var $hdecode     = array('from','name','organization','subject');
     var $parse_hdr   = array('content-disposition', 'content-transfer-encoding', 'content-type', 'date', 'followup-to', 'from',
             'message-id', 'newsgroups', 'organization', 'references', 'subject', 'x-face');
-    var $show_hdr    = array('from', 'subject', 'newsgroups', 'followup', 'date', 'organization', 'references', 'x-face');
+    var $show_hdr    = array('from', 'newsgroups', 'followup', 'date', 'organization', 'references', 'x-face');
 
     /** Favorites MIMEtypes to use, by order for reading multipart messages
      */
@@ -117,6 +117,12 @@ class Banana
         }
 
         $group  = empty($banana->get['group']) ? null : $banana->get['group'];
+        if (!is_null($group)
+                &&  isset($banana->grp_pattern) && !preg_match('/' . $banana->grp_pattern . '/', $group)) {
+            return '<p class="error">'
+                    . $group . _b_(' : ce newsgroup n\'existe pas ou vous n\'avez pas l\'autorisation d\'y accĂ©der')
+                    . '</p>';
+        }
         $artid  = empty($banana->get['artid']) ? null : strtolower($banana->get['artid']);
         $partid = !isset($banana->get['part']) ? -1 : $banana->get['part'];
         $banana->state = Array ('group' => $group, 'artid' => $artid);
@@ -450,7 +456,8 @@ class Banana
             }
             redirectInBanana($dir);
         } else {
-            return "<p class=\"error\">"._b_('Impossible de poster le message')."</p>".$this->action_showThread($group, $artid);
+            return '<p class="error">' . _b_('Impossible de poster le message') . '</p>'
+                   . $this->action_showThread($group, $artid);
         }
     }
 
@@ -467,6 +474,9 @@ class Banana
                 return false;
             }
         }
+        if (count($this->profile['subscribe']) > 0) {
+            $this->_newGroup(false);
+        }
         return true;
     }
 
@@ -481,11 +491,11 @@ class Banana
         return true;
     }
 
-    function _newGroup()
+    function _newGroup($showNew = true)
     {
         $this->_require('groups');
         $this->groups = new BananaGroups(BANANA_GROUP_SUB);
-        if ($this->groups->type == BANANA_GROUP_SUB) {
+        if ($showNew && $this->groups->type == BANANA_GROUP_SUB) {
             $this->newgroups = new BananaGroups(BANANA_GROUP_NEW);
         }
     }