web pages
authorx99bachelart <x99bachelart>
Wed, 3 Sep 2003 17:31:44 +0000 (17:31 +0000)
committerx99bachelart <x99bachelart>
Wed, 3 Sep 2003 17:31:44 +0000 (17:31 +0000)
article.php [new file with mode: 0644]
disconnect.php [new file with mode: 0644]
index.php [new file with mode: 0644]
post.php [new file with mode: 0644]
thread.php [new file with mode: 0644]
xface.php [new file with mode: 0644]

diff --git a/article.php b/article.php
new file mode 100644 (file)
index 0000000..0df9eb1
--- /dev/null
@@ -0,0 +1,133 @@
+<?php
+/********************************************************************************
+* article.php : article page
+* -------------
+*
+* This file is part of the banana distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+require("locales/locales.inc.php");
+require("include/session.inc.php");
+require("include/encoding.inc.php");
+require("include/wrapper.inc.php");
+require("include/format.inc.php");
+require("include/config.inc.php");
+require("include/NetNNTP.inc.php");
+require("include/spool.inc.php");
+require("include/post.inc.php");
+require("include/profile.inc.php");
+require("include/password.inc.php");
+
+require("include/header.inc.php");
+
+$profile=getprofile();
+
+$group=strtolower(htmlentities($_REQUEST['group']));
+
+$mynntp = new nntp($news['server']);
+if (!$mynntp) {
+  echo "<p class=\"error\">\n\t".$locale['error']['connect']."\n</p>";
+  require("include/footer.inc.php");
+  exit;
+}
+
+if ($news['user']!="anonymous") {
+  $result = $mynntp->authinfo($news["user"],$news["pass"]);
+  if (!$result) {
+    echo "<p class=\"error\">\n\tYou have provided bad credentials to "
+    ."the server. Good bye !\n</p>";
+    require("include/footer.inc.php");
+    exit;
+  }
+}
+$spool = new spool($mynntp,$group,$profile['display'],$profile['lastnews']);
+if (!$spool) {
+  echo "<p class=\"error\">\n\tError while accessing group.\n</p>";
+  require("include/footer.inc.php");
+  exit;
+}
+$mynntp->group($group);
+
+$post = new post($mynntp,$_REQUEST['id']);
+if (!$post) {
+  if ($mynntp->lasterrorcode == "423") {
+    $spool->delid($_REQUEST['id']);
+  }
+  echo "<p class=\"error\">\n\tError while reading message.\n</p>";
+  require("include/footer.inc.php");
+  exit;
+}
+
+$ndx = $spool->getndx($_REQUEST['id']);
+
+?>
+<div class="title">
+  <?php echo $locale['article']['message'];?>
+</div>
+
+<?php
+if (($_GET['type']=='cancel') && (checkcancel($post->headers))) {
+?>
+<p class="error">
+  <?php echo $locale['article']['cancel'];?>
+  <form action="thread.php" method="post">
+    <input type="hidden" name="group" value="<?php echo $group;?>" />
+    <input type="hidden" name="id" value="<?php 
+      echo $_REQUEST['id'];?>" />
+    <input type="hidden" name="type" value="cancel" />
+    <input type="submit" name="action" value="<?php echo 
+      $locale['article']['okbtn'];?>" />
+  </form>
+</p>
+<?
+}
+
+displayshortcuts();
+?>
+
+<table class="bicol" cellpadding="0" cellspacing="0" 
+summary="<?php echo $locale['article']['summary'];?>">
+  <tr>
+    <th colspan="2">
+      <?php echo $locale['article']['headers'];?>
+    </th>
+  </tr>
+<?php
+foreach ($news['head'] as $real => $nick) {
+  if (isset($post->headers->$nick)) 
+    echo "<tr><td class=\"bicoltitre\">$real</td>"
+    ."<td>".formatdisplayheader($nick,$post->headers->$nick,$spool)
+    ."</td></tr>\n";
+}
+?>
+  <tr>
+    <th colspan="2">
+      <?php echo $locale['article']['body'];?>
+    </th>
+  </tr> 
+  <tr>
+    <td colspan="2">
+      <pre><?php echo formatbody($post->body); ?></pre>
+    </td>
+  </tr>
+  <tr>
+    <th colspan="2">
+      <?php echo $locale['article']['overview'];?>
+    </th>
+  </tr> 
+  <tr>
+    <td class="nopadd" colspan="2">
+      <table class="overview" cellpadding="0" cellspacing="0" summary="overview">
+<?php
+$spool->disp($ndx-$news['threadtop'],$ndx+$news['threadbottom'],$ndx);
+?>
+      </table>
+    </td>
+  </tr>
+</table>
+<?php
+displayshortcuts();
+
+require("include/footer.inc.php");
+?>
diff --git a/disconnect.php b/disconnect.php
new file mode 100644 (file)
index 0000000..516c951
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/********************************************************************************
+* disconnect.php : exit page
+* ----------------
+*
+* This file is part of the banana distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+require("locales/locales.inc.php");
+require("include/session.inc.php");
+$_SESSION=array();
+session_destroy();
+
+require("include/header.inc.php");
+?>
+<div class="title">
+  <?php echo $locale['disconnect']['title'];?>
+</div>
+<p class="normal">
+  <?php echo $locale['disconnect']['back'];?>
+</p>
+<?php
+require("include/footer.inc.php");
+?>
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..47e3ea7
--- /dev/null
+++ b/index.php
@@ -0,0 +1,96 @@
+<?php
+/********************************************************************************
+* index.php : main page (newsgroups list)
+* -----------
+*
+* This file is part of the banana distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+require("locales/locales.inc.php");
+require("include/session.inc.php");
+require("include/password.inc.php");
+require("include/NetNNTP.inc.php");
+require("include/groups.inc.php");
+require("include/format.inc.php");
+require("include/config.inc.php");
+
+require("include/header.inc.php");
+
+$nntp = new nntp($news['server']);
+if ($news['user']!="anonymous") {
+  $result = $nntp->authinfo($news["user"],$news["pass"]);
+  if (!$result) {
+    echo "<p class=\"error\">\n\t".$locale['error']['credentials']
+      ."\n</p>";
+    require("include/footer.inc.php");
+    exit;
+  }
+}
+$groups = new groups($nntp);
+
+?>
+
+<div class="title">
+  <?php echo $locale['index']['title'];?>
+</div>
+
+<?php
+if (!sizeof($groups->overview)) {
+  echo '<p class="normal">';
+  echo "\n".$locale['error']['nogroup']."\n";
+  echo "</p>\n";
+  require("include/footer.inc.php");
+  exit;
+}
+
+displayshortcuts();
+?>
+
+<table class="bicol" cellspacing="0" cellpadding="2" 
+  summary="<?php echo $locale['index']['summary'];?>">
+  <tr>
+    <th>
+      <?php echo $locale['index']['total'];?>
+    </th>
+    <th>
+      <?php echo $locale['index']['unread'];?>
+    </th>
+    <th>
+      <?php echo $locale['index']['name'];?>
+    </th>
+    <th>
+      <?php echo $locale['index']['description'];?>
+    </th>
+  </tr>
+<?php
+$pair = true;
+foreach ($groups->overview as $g => $d) {
+  $pair = !$pair;
+  $groupinfo = $nntp->group($g);
+?>
+  <tr class="<?php echo ($pair?"pair":"impair");?>" >
+    <td class="total">
+      <?php echo $groupinfo[0]; ?>
+    </td>
+    <td class="unread">
+      0
+    </td>
+    <td class="group">
+      <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
+    </td>
+    <td class="description">
+      <?php echo $d[0];?>
+    </td>
+  </tr>
+<?php
+}
+?>
+</table>
+<?php
+
+displayshortcuts();
+
+$nntp->quit();
+require("include/footer.inc.php");
+?>
diff --git a/post.php b/post.php
new file mode 100644 (file)
index 0000000..2fc7410
--- /dev/null
+++ b/post.php
@@ -0,0 +1,149 @@
+<?php
+require("locales/locales.inc.php");
+require("include/session.inc.php");
+require("include/encoding.inc.php");
+require("include/format.inc.php");
+require("include/config.inc.php");
+require("include/NetNNTP.inc.php");
+require("include/post.inc.php");
+require("include/spool.inc.php");
+require("include/password.inc.php");
+require("include/profile.inc.php");
+require("include/wrapper.inc.php");
+
+require("include/header.inc.php");
+$profile = getprofile();
+$group=htmlentities(strtolower($_REQUEST['group']));
+$id=htmlentities(strtolower($_REQUEST['id']));
+
+if (isset($group)) {
+  $target = $group;
+}
+
+$mynntp = new nntp($news['server']);
+if (!$mynntp) {
+  echo "<p class=\"error\">\n\t".$locale['error']['connect']."\n</p>";
+  require("include/footer.inc.php");
+  exit;
+}
+if ($news['user']!="anonymous") {
+  $result = $mynntp->authinfo($news["user"],$news["pass"]);
+  if (!$result) {
+    echo "<p class=\"error\">\n\t".$locale['error']['credentials']
+      ."\n</p>";
+    require("include/footer.inc.php");
+    exit;
+  }
+}
+
+if (isset($group) && isset($id) && isset($_REQUEST['type']) && 
+  ($_REQUEST['type']=='followup')) {
+  $rq=$mynntp->group($group);
+  $post = new post($mynntp,$id);
+  if ($post) {
+    $subject = (preg_match("/^re:/i",$post->headers->subject)?"":"Re: ")
+      .$post->headers->subject;
+    $body = $post->headers->name." wrote :\n".wrap($post->body, ">");
+    if (isset($post->headers->followup))
+      $target=$post->headers->followup;
+    else
+      $target=$post->headers->newsgroups;
+  }
+}
+
+$mynntp->quit();
+?>
+<div class="title">
+  <?php echo $locale['post']['title'];?>
+</div>
+<?php
+
+displayshortcuts();
+
+?>
+
+<form action="thread.php" method="POST">
+<table class="bicol" cellpadding="0" cellspacing="0" border="0">
+  <tr>
+    <th colspan="2">
+      <?php echo $locale['post']['headers'];?>
+    </th>
+  </tr>
+  <tr>
+    <td>
+      <?php echo $locale['post']['name'];?>
+    </td>
+    <td>
+      <?php echo htmlentities($profile['name']); ?>
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <?php echo $locale['post']['subject'];?>
+    </td>
+    <td>
+      <input type="text" name="subject" value="<?php echo 
+        (isset($subject)?$subject:"");?>" />
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <?php echo $locale['post']['newsgroups'];?>
+    </td>
+    <td>
+      <input type="text" name="newsgroups" value="<?php echo
+      (isset($target)?$target:"");?>" />
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <?php echo $locale['post']['fu2'];?>
+    </td>
+    <td>
+      <input type="text" name="followup" value="" />
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <?php echo $locale['post']['organization'];?>
+    </td>
+    <td>
+      <?php echo $profile['org']; ?>
+    </td>
+  </tr>
+  <tr>
+    <th colspan="2">
+      <?php echo $locale['post']['body'];?>
+    </th>
+  </tr>
+  <tr>
+    <td colspan="2">
+      <textarea name="body" cols="90" rows="10"><?php echo 
+      (isset($body)?$body:"").($profile['sig']!=''?"\n\n-- \n"
+      .$profile['sig']:"");?></textarea>
+    </td>
+  </tr>
+  <tr>
+    <td class="bouton" colspan="2">
+<?php
+if (isset($group) && isset($id) && isset($_REQUEST['type']) 
+  && ($_REQUEST['type']=='followup')) {
+?>
+      <input type="hidden" name="type" value="followupok" />
+      <input type="hidden" name="group" value="<?php echo $group;?>" />
+      <input type="hidden" name="id" value="<?php echo $id;?> " />
+<?php
+} else {
+?>
+      <input type="hidden" name="type" value="new" />
+<?php
+}
+?>
+      <input type="submit" name="action" value="OK" />
+    </td>
+</table>
+</form>
+<?php
+displayshortcuts();
+require("include/footer.inc.php");
+?>
diff --git a/thread.php b/thread.php
new file mode 100644 (file)
index 0000000..ee12da4
--- /dev/null
@@ -0,0 +1,177 @@
+<?php
+/********************************************************************************
+* thread.php : group overview
+* ------------
+*
+* This file is part of the banana distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+require("locales/locales.inc.php");
+require("include/session.inc.php");
+require("include/encoding.inc.php");
+require("include/format.inc.php");
+require("include/config.inc.php");
+require("include/NetNNTP.inc.php");
+include("include/post.inc.php");
+require("include/spool.inc.php");
+require("include/password.inc.php");
+require("include/profile.inc.php");
+include("include/wrapper.inc.php");
+
+require("include/header.inc.php");
+
+$profile = getprofile();
+
+if (isset($_REQUEST['group'])) {
+  $group=htmlentities(strtolower($_REQUEST['group']));
+} else {
+  $group=htmlentities(strtolower(strtok(str_replace(" ","",$_REQUEST['newsgroups']),",")));
+}
+$id=htmlentities(strtolower($_REQUEST['id']));
+
+//$mynntp = new nntp($news['server'],120,1);
+$mynntp = new nntp($news['server']);
+if (!$mynntp) {
+  echo "<p class=\"error\">\n\t".$locale['error']['connect']."\n</p>";
+  require("include/footer.inc.php");
+  exit;
+}
+
+if ($news['user']!="anonymous") {
+  $result = $mynntp->authinfo($news["user"],$news["pass"]);
+  if (!$result) {
+    echo "<p class=\"error\">\n\t".$locale['error']['credentials']
+      ."\n</p>";
+    require("include/footer.inc.php");
+    exit;
+  }
+}
+$spool = new spool($mynntp,$group,$profile['display'],
+  $profile['lastnews']);
+if (!$spool) {
+  echo "<p class=\"error\">\n\t".$locale['error']['group']."\n</p>";
+  require("footer.inc.php");
+  exit;
+}
+$max = 50;
+if ($_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']))) {
+  switch ($_REQUEST['type']) {  
+    case 'cancel':
+      $mid = array_search($id,$spool->ids);
+      $mynntp->group($group);
+      $post = new post($mynntp,$id);
+      
+      if (checkcancel($post->headers)) {
+        $message = 'From: '.$profile['name']."\n"
+          ."Newsgroups: $group\n"
+          ."Subject: cmsg $mid\n"
+          .$news['customhdr']
+          ."Control: cancel $mid\n"
+          ."\n"
+          ."Message canceled with Banana";
+        $result = $mynntp->post($message);
+        if ($result) {
+          $spool->delid($id);
+          $text="<p class=\"normal\">".$locale['post']['canceled']
+            ."</p>";
+        } else {
+          $text="<p class=\"error\">".$locale['post']['badcancel']
+            ."</p>";
+        }
+      } else {
+        $text="<p class=\"error\">\n\t".$locale['post']['rghtcancel']
+          ."\n</p>";
+      }
+      break;
+    case 'new':
+      $message = 'From: '.$profile['name']."\n"
+        ."Newsgroups: ".stripslashes(str_replace(" ","",
+          $_REQUEST['newsgroups']))."\n"
+        ."Subject: ".stripslashes($_REQUEST['subject'])."\n"
+        .($_REQUEST['followup']!=''?'Followup-To: '
+        .stripslashes($_REQUEST['followup'])."\n":"")
+        .$news['customhdr']
+        ."\n"
+        .wrap(stripslashes($_REQUEST['body']),"",$news['wrap']);
+      $result = $mynntp->post($message);
+      if ($result) {
+        $text="<p class=\"normal\">".$locale['post']['posted']."</p>";
+      } else {
+        $text="<p class=\"error\">".$locale['post']['badpost']."</p>";
+      }
+      break;
+    case 'followupok':
+      $rq=$mynntp->group($group);
+      $post = new post($mynntp,$id);
+      if ($post) {
+        $refs = $post->headers->references." ".$post->headers->msgid;
+      }
+    
+      $message = 'From: '.$profile['name']."\n"
+        ."Newsgroups: ".stripslashes($_REQUEST['newsgroups'])."\n"
+        ."Subject: ".stripslashes($_REQUEST['subject'])."\n"
+        .($_REQUEST['followup']!=''?'Followup-To: '
+        .stripslashes($_REQUEST['followup'])."\n":"")
+        ."References: $refs\n"
+        .$news['customhdr']
+        ."\n"
+        .wrap(stripslashes($_REQUEST['body']),"",$news['wrap']);
+      $result = $mynntp->post($message);
+      if ($result) {
+        $text="<p class=\"normal\">".$locale['post']['posted']."</p>";
+      } else {
+        $text="<p class=\"error\">".$locale['post']['badpost']."</p>";
+      }
+      break;
+  }
+  $spool = new spool($mynntp,$group,$profile['display'],
+    $profile['lastnews']);
+  if (!$spool) {
+    echo "<p class=\"error\">\n\t".$locale['error']['group']."\n</p>";
+    require("include/footer.inc.php");
+    exit;
+  }
+}
+
+
+?>
+<div class="title">
+  <?php echo $locale['thread']['group_b'].$group
+    .$locale['thread']['group_a'];?>
+</div>
+<?php
+echo $text;
+displayshortcuts();
+
+?>
+
+<table class="bicol" cellpadding="0" cellspacing="0" border="0" 
+  summary="<?php echo $locale['thread']['summary'];?>">
+  <tr>
+    <th class="date">
+      <?php echo $locale['thread']['date'];?>
+    </th>
+    <th class="subject">
+      <?php echo $locale['thread']['subject'];?>
+    </th>
+    <th class="from">
+      <?php echo $locale['thread']['author'];?>
+    </th>
+  </tr>
+<?php
+$spool->disp($first,$last);
+$mynntp->quit();
+echo "</table>";
+
+displayshortcuts();
+
+require("include/footer.inc.php");
+?>
diff --git a/xface.php b/xface.php
new file mode 100644 (file)
index 0000000..4edd725
--- /dev/null
+++ b/xface.php
@@ -0,0 +1,8 @@
+<?php
+
+$face = base64_decode($_REQUEST['face']);
+$face = ereg_replace("'", "'\\''", $face);
+
+header("Content-Type: image/png");
+passthru("echo '$face'|uncompface -X |convert xbm:- png:-");
+?>