function spool(&$_nntp,$_group,$_display=0,$_since=""){
global $news;
+ $prefix_path=(preg_match("/\/scripts\/?$/",getcwd())?"..":".");
$groupinfo = $_nntp->group($_group);
if (!$groupinfo) {
$this = false;
return false;
}
- $spoolfile=realpath("./spool/spool-$_group.dat");
+ $spoolfile=realpath("$prefix_path/spool/spool-$_group.dat");
if (file_exists($spoolfile)) {
$f = fopen($spoolfile,"r");
$this = unserialize(fread($f,filesize($spoolfile)));
$this->overview[$id] = $msg;
}
uasort($this->overview,"spoolcompare");
- $f = fopen("spool/spool-$_group.dat","w");
+ $f = fopen("$prefix_path/spool/spool-$_group.dat","w");
fputs($f,serialize($this));
fclose($f);
}
$ids = array_flip($this->ids);
unset($ids[$_id]);
$this->ids = array_flip($ids);
- $f = fopen("spool/spool-{$this->group}.dat","w");
+ $f = fopen("$prefix_path/spool/spool-{$this->group}.dat","w");
fputs($f,serialize($this));
fclose($f);
}
--- /dev/null
+<?php
+/********************************************************************************
+* spoolgen.php : spool generation
+* --------------
+*
+* This file is part of the banana distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+ini_set('max_execution_time','300');
+ini_set('include_path','.:..:../custom/banana:../../custom/banana:../public/include:../../public/include');
+
+require("include/encoding.inc.php");
+require("include/config.inc.php");
+require("include/NetNNTP.inc.php");
+include("include/post.inc.php");
+include("include/groups.inc.php");
+require("include/spool.inc.php");
+require("include/password.inc.php");
+
+
+$nntp = new nntp($news['server']);
+if (!$nntp) {
+ print "cannot connect to server\n";
+ exit;
+}
+
+if ($news['user']!="anonymous") {
+ $result = $nntp->authinfo($news["user"],$news["pass"]);
+ if (!$result) {
+ print "authentication error\n";
+ exit;
+ }
+}
+unset($result);
+
+$groups = new groups($nntp,2);
+$list = array_keys($groups->overview);
+unset($groups);
+foreach ($list as $g) {
+ print "Generating spool for $g : ";
+ $spool = new spool($nntp,$g);
+ print "done.\n";
+ unset($spool);
+}
+$nntp->quit();
+?>