X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=thread.php;h=abade8576fb1080a7cbfbf3e173c23b54c2f0a08;hb=25d27cb73ea48a9cd75316fd96b125d8e0446835;hp=ca57ef650aef02426f27faede4fa127af9764205;hpb=e2625e7277ea0769529e4eaf3f28412dea90399b;p=banana.git diff --git a/thread.php b/thread.php index ca57ef6..abade85 100644 --- a/thread.php +++ b/thread.php @@ -28,7 +28,10 @@ if (isset($_REQUEST['group'])) { } else { $group=htmlentities(strtolower(strtok(str_replace(" ","",$_REQUEST['newsgroups']),","))); } -$id=htmlentities(strtolower($_REQUEST['id'])); + +if (isset($_REQUEST['id'])) { + $id=htmlentities(strtolower($_REQUEST['id'])); +} //$mynntp = new nntp($news['server'],120,1); $mynntp = new nntp($news['server']); @@ -55,14 +58,15 @@ if (!$spool) { exit; } $max = 50; -if ($_REQUEST['first']>sizeof($spool->overview)) +if (isset($_REQUEST['first']) && ($_REQUEST['first']>sizeof($spool->overview))) $_REQUEST['first']=sizeof($spool->overview); $first = (isset($_REQUEST['first'])? (floor($_REQUEST['first']/$max)*$max+1):1); $last = (isset($_REQUEST['first'])? (floor($_REQUEST['first']/$max+1)*$max):$max); -if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))) { +if (isset($_REQUEST['action']) && (isset($_REQUEST['type'])) && +(isset($_SESSION['bananapostok'])) && ($_SESSION['bananapostok'])) { switch ($_REQUEST['type']) { case 'cancel': $mid = array_search($id,$spool->ids); @@ -92,15 +96,17 @@ if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))) { } break; case 'new': + $body = preg_replace("/\n\.[ \t\r]*\n/m","\n..\n",stripslashes($_REQUEST['body'])); $message = 'From: '.$profile['name']."\n" ."Newsgroups: ".stripslashes(str_replace(" ","", $_REQUEST['newsgroups']))."\n" ."Subject: ".stripslashes($_REQUEST['subject'])."\n" + .(isset($profile['org'])?"Organization: ".$profile['org']."\n":"") .($_REQUEST['followup']!=''?'Followup-To: ' .stripslashes($_REQUEST['followup'])."\n":"") .$news['customhdr'] ."\n" - .wrap(stripslashes($_REQUEST['body']),"",$news['wrap']); + .wrap($body,"",$news['wrap']); $result = $mynntp->post($message); if ($result) { $text="

".$locale['post']['posted']."

"; @@ -112,18 +118,21 @@ if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))) { $rq=$mynntp->group($group); $post = new post($mynntp,$id); if ($post) { - $refs = $post->headers->references." ".$post->headers->msgid; + $refs = (isset($post->headers->references)? + $post->headers->references." ":"").$post->headers->msgid; } + $body = preg_replace("/\n\.[ \t\r]*\n/m","\n..\n",stripslashes($_REQUEST['body'])); $message = 'From: '.$profile['name']."\n" ."Newsgroups: ".stripslashes($_REQUEST['newsgroups'])."\n" ."Subject: ".stripslashes($_REQUEST['subject'])."\n" + .(isset($profile['org'])?"Organization: ".$profile['org']."\n":"") .($_REQUEST['followup']!=''?'Followup-To: ' .stripslashes($_REQUEST['followup'])."\n":"") ."References: $refs\n" .$news['customhdr'] ."\n" - .wrap(stripslashes($_REQUEST['body']),"",$news['wrap']); + .wrap($body,"",$news['wrap']); $result = $mynntp->post($message); if ($result) { $text="

".$locale['post']['posted']."

"; @@ -132,6 +141,7 @@ if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))) { } break; } + $_SESSION['bananapostok']=false; $spool = new spool($mynntp,$group,$profile['display'], $profile['lastnews']); if (!$spool) { @@ -143,26 +153,28 @@ if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))) { ?> -
+
- - - -
+ + +