Do not block access to banana the group list if grp_pattern is set
[banana.git] / banana / banana.inc.php.in
index 0823932..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);