=?utf-8?q?Permet=20le=20formatage=20des=20x-face=20diff=C3=83=C2=A9remment=20du=20res...
[banana.git] / banana / banana.inc.php.in
index 4bc8826..ab4e6da 100644 (file)
@@ -24,7 +24,10 @@ class Banana
     var $can_attach  = true;
     /** Maximum allowed file size for attachment
      */
-    var $maxfilesize = 100000;  
+    var $maxfilesize = 100000;
+    /** Indicate wether x-face should be skinned as specials data or not
+     */
+    var $formatxface = true;
 
     /** Regexp for selecting newsgroups to show (if empty, match all newsgroups)
      * ex : '^xorg\..*' for xorg.*
@@ -36,7 +39,20 @@ class Banana
     var $tmax        = 50;
 
     var $wrap        = 74;
+    /** Match an url
+     * Should be included in a regexp delimited using ! (eg: "!$url_regexp!i")
+     * If it matches, return 3 main parts :
+     *  \\1 and \\3 are delimiters
+     *  \\2 is the url
+     *
+     * eg : preg_match("!$url_regexp!i", "[http://www.polytechnique.org]", $matches);
+     *   $matches[1] = "["
+     *   $matches[2] = "http://www.polytechnique.org"
+     *   $matches[3] = "]"
+     */
+    var $url_regexp  = '(["\[])?((?:https?|ftp|news)://(?:&|[a-z@0-9.~%$£µ&i#\-+=_/\?])*)(["\]])?';
 
+    
     /** Boundary for multipart messages
      */
     var $boundary    = 'bananaBoundary42';
@@ -90,7 +106,6 @@ class Banana
         $banana->state = Array ('group' => $group, 'artid' => $artid);
 
         if (is_null($group)) {
-
             if (isset($_GET['subscribe'])) {
                 return $banana->action_listSubs();
             } elseif (isset($_POST['subscribe'])) {
@@ -108,7 +123,6 @@ class Banana
             }
 
         } else {
-
             if (isset($_POST['action']) && $_POST['action']=='cancel') {
                 $res = $banana->action_cancelArticle($group, $artid);
             } else {
@@ -302,9 +316,11 @@ class Banana
         $html .= '<tr><th colspan="2">'._b_('Corps').'</th></tr>';
         $html .= '<tr><td colspan="2"><textarea name="body" cols="74" rows="16">'
               .  to_entities($body).($this->profile['sig'] ? "\n\n-- \n".htmlentities($this->profile['sig']) : '').'</textarea></td></tr>';
-       $html .= '<tr><th colspan="2">'._b_('Pièces jointes').'</th></tr>';
-        $html .= '<tr><td colspan="2"><input type="hidden" name="MAX_FILE_SIZE" value="'.$this->maxfilesize.'" />';
-        $html .= '<input type="file" name="newpj" size="40"/></td></tr>';
+        if ($this->can_attach) {
+               $html .= '<tr><th colspan="2">'._b_('Pièce jointe').'</th></tr>';
+            $html .= '<tr><td colspan="2"><input type="hidden" name="MAX_FILE_SIZE" value="'.$this->maxfilesize.'" />';
+            $html .= '<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.'" />';
@@ -342,7 +358,7 @@ class Banana
         }
 
         $body_headers  = $this->custom_plain;
-        $body          = wrap($body, "", $this->wrap);
+        $body          = wrap($body, "");
 
         // include attachment in the body
         $uploaded = $this->_upload('newpj');