X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fpost.inc.php;h=b85f23d0174e92594698a2797e166c5a8c636fb5;hb=261210bc9c416cca0d9b79ab215526d4c93b098a;hp=c94b1fd6f00996bee0a104ed0a1974abc10a2b00;hpb=218e9ec8a45fa38c2265814fa2bae09d88f81730;p=banana.git diff --git a/banana/post.inc.php b/banana/post.inc.php index c94b1fd..b85f23d 100644 --- a/banana/post.inc.php +++ b/banana/post.inc.php @@ -23,6 +23,8 @@ class BananaPost var $pj; /** poster name */ var $name; + /** test validity */ + var $valid = true; /** constructor * @param $_id STRING MSGNUM or MSGID (a group should be selected in this case) @@ -33,12 +35,17 @@ class BananaPost $this->id = $_id; $this->pj = array(); $this->messages = array(); - $this->_header(); + if (!$this->_header()) { + $this->valid = false; + return null; + } + if ($body = $banana->nntp->body($_id)) { $this->body = join("\n", $body); } else { - return ($this = null); + $this->valid = false; + return null; } if (isset($this->headers['content-transfer-encoding'])) { @@ -263,7 +270,6 @@ class BananaPost global $banana; $hdrs = $banana->nntp->head($this->id); if (!$hdrs) { - $this = null; return false; } @@ -292,6 +298,7 @@ class BananaPost $this->name = $this->headers['from']; $this->name = preg_replace('/<[^ ]*>/', '', $this->name); $this->name = trim($this->name); + return true; } function checkcancel() @@ -366,7 +373,10 @@ class BananaPost preg_match("@text/([^;]+);@", $this->messages[$i]['headers']['content-type'], $format); $format = textFormat_translate($format[1]); if ($i != $partid) { - $res .= ''.$format.''; + $res .= makeHREF(Array('group' => $banana->state['group'], + 'artid' => $this->id, + 'part' => $i), + $format); } else { $res .= $format; } @@ -393,8 +403,16 @@ class BananaPost $i = 0; foreach ($this->pj as $file) { $res .= $file['filename'].' ('.$file['MIME'].') : '; - $res .= 'télécharger'; - $res .= ' . aperçu'; + $res .= makeHREF(Array('group' => $banana->state['group'], + 'artid' => $this->id, + 'pj' => $i), + _b_('télécharger')); + $res .= ' . '; + $res .= makeHREF(Array('group' => $banana->state['group'], + 'artid' => $this->id, + 'pj' => $i, + 'action'=> 'view'), + _b_('aperçu')); $res .= '
'; $i++; } @@ -409,4 +427,5 @@ class BananaPost } } +// vim:set et sw=4 sts=4 ts=4 ?>