Clean up, update phpdoc.

This commit is contained in:
DariusIII
2014-04-15 23:48:50 +02:00
parent fd08b91807
commit dd7c2ad178
32 changed files with 4337 additions and 3988 deletions
+27 -31
View File
@@ -1,47 +1,43 @@
<?php
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/backfill.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/backfill.php");
$time = TIME();
if (isset($argv[1]))
$groupName = $argv[1];
$groupName = $argv[1];
else
$groupName = '';
$groupName = '';
$backfill = new Backfill();
$backfill->backfillAllGroups($groupName);
function relativeTime($_time) {
$d[0] = array(1,"sec");
$d[1] = array(60,"min");
$d[2] = array(3600,"hr");
$d[3] = array(86400,"day");
$d[4] = array(31104000,"yr");
function relativeTime($_time)
{
$d[0] = array(1, "sec");
$d[1] = array(60, "min");
$d[2] = array(3600, "hr");
$d[3] = array(86400, "day");
$d[4] = array(31104000, "yr");
$w = array();
$w = array();
$return = "";
$now = TIME();
$diff = ($now-$_time);
$secondsLeft = $diff;
$return = "";
$now = TIME();
$diff = ($now - $_time);
$secondsLeft = $diff;
for($i=4;$i>-1;$i--)
{
$w[$i] = intval($secondsLeft/$d[$i][0]);
$secondsLeft -= ($w[$i]*$d[$i][0]);
if($w[$i]!=0)
{
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
}
}
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= ($w[$i] * $d[$i][0]);
if ($w[$i] != 0) {
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
//$return .= ($diff>0)?"ago":"left";
return $return;
}
echo "\n\033[1;33mStock backfill process completed in: " .relativeTime($time). "\n";
?>
echo "\n\033[1;33mStock backfill process completed in: " . relativeTime($time) . "\n";
+47 -56
View File
@@ -1,13 +1,13 @@
<?php
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/backfill.php");
require_once(WWW_DIR."/lib/framework/db.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/backfill.php");
require_once(WWW_DIR . "/lib/framework/db.php");
$time = TIME();
//get variables from defaults.sh
$path = dirname(__FILE__);
$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = explode("\n", $varnames);
$vardata = explode("\n", $vardata);
$array = array_combine($varnames, $vardata);
@@ -16,62 +16,53 @@ unset($array['']);
$_date = $array['KEVIN_DATE'];
$_parts = $array['KEVIN_PARTS'];
$groupPost = $_parts;
if (isset($argv[1]))
{
$groupName = $argv[1];
echo "\n\n===>Starting kevin123's backfill process for ".$groupName."<===\n\n";
$groupPost = $_parts;
if (isset($argv[1])) {
$groupName = $argv[1];
echo "\n\n===>Starting kevin123's backfill process for " . $groupName . "<===\n\n";
$db = new DB;
$query = $db->queryOneRow(sprintf("select name from groups WHERE (first_record_postdate BETWEEN '${_date}' and now()) and (name = '$groupName')")) or die(mysql_error());
if (isset($query))
{
$backfill = new Backfill();
$backfill->backfillPostAllGroups($groupName, $groupPost);
echo "\n===>Backfilling completed for ".$groupName."\n";
}
else
{
echo "\nAlready have the target post, skipping the ".$groupName."\n";
}
}
else
{
$groupName = '';
$db = new DB;
$query = $db->queryOneRow(sprintf("select name from groups WHERE (first_record_postdate BETWEEN '${_date}' and now()) and (name = '$groupName')")) or die(mysql_error());
if (isset($query)) {
$backfill = new Backfill();
$backfill->backfillPostAllGroups($groupName, $groupPost);
echo "\n===>Backfilling completed for " . $groupName . "\n";
} else {
echo "\nAlready have the target post, skipping the " . $groupName . "\n";
}
function relativeTime($_time) {
$d[0] = array(1,"sec");
$d[1] = array(60,"min");
$d[2] = array(3600,"hr");
$d[3] = array(86400,"day");
$d[4] = array(31104000,"yr");
$w = array();
$return = "";
$now = TIME();
$diff = ($now-$_time);
$secondsLeft = $diff;
for($i=4;$i>-1;$i--)
{
$w[$i] = intval($secondsLeft/$d[$i][0]);
$secondsLeft -= ($w[$i]*$d[$i][0]);
if($w[$i]!=0)
{
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
} else {
$groupName = '';
$backfill = new Backfill();
$backfill->backfillPostAllGroups($groupName, $groupPost);
}
echo "\nKevin123's backfill parts process completed in: " .relativeTime($time);
function relativeTime($_time)
{
$d[0] = array(1, "sec");
$d[1] = array(60, "min");
$d[2] = array(3600, "hr");
$d[3] = array(86400, "day");
$d[4] = array(31104000, "yr");
?>
$w = array();
$return = "";
$now = TIME();
$diff = ($now - $_time);
$secondsLeft = $diff;
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= ($w[$i] * $d[$i][0]);
if ($w[$i] != 0) {
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
}
echo "\nKevin123's backfill parts process completed in: " . relativeTime($time);
+39 -51
View File
@@ -1,59 +1,51 @@
<?php
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/groups.php");
require_once(WWW_DIR."/lib/binaries.php");
require_once(WWW_DIR."/lib/powerprocess.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/groups.php");
require_once(WWW_DIR . "/lib/binaries.php");
require_once(WWW_DIR . "/lib/powerprocess.php");
$time = TIME();
$groups = new Groups;
$groupList = $groups->getActive();
unset($groups);
$ps = new PowerProcess(5,0,false);
$ps = new PowerProcess(5, 0, false);
$ps->RegisterCallback('psUpdateComplete');
$ps->maxThreads = 5;
$ps->tickCount = 500000; // value in usecs. change this to 1000000 (one second) to reduce cpu use
$ps->threadTimeLimit = 0; // Disable child timeout
$ps->tickCount = 500000; // value in usecs. change this to 1000000 (one second) to reduce cpu use
$ps->threadTimeLimit = 0; // Disable child timeout
echo "Starting kevin123's threaded backfill process\n\n";
while ($ps->RunControlCode())
{
while ($ps->RunControlCode()) {
// Start the parent loop
if (count($groupList))
{
if (count($groupList)) {
// We still have groups to process
if ($ps->SpawnReady())
{
if ($ps->SpawnReady()) {
// Spawn another thread
$ps->threadData = array_pop($groupList);
echo "\n[Thread-MASTER] Spawning new thread. Still have " . count($groupList) ." group(s) to update after this\n";
echo "\n[Thread-MASTER] Spawning new thread. Still have " . count($groupList) . " group(s) to update after this\n";
$ps->spawnThread();
}
else
{
} else {
// There are no more slots available to run
//$ps->tick();
//echo "No threads avaialble.\n";
}
}
else
{
} else {
// No more groups to process
echo "\nNo more groups to process - Initiating shutdown\n";
$ps->Shutdown();
echo "\nShutdown complete\n";
echo "\n\033[1;33m[Thread-MASTER] Kevin123's threaded backfill parts process completed in: " .relativeTime($time). "\n";
echo "\n\033[1;33m[Thread-MASTER] Kevin123's threaded backfill parts process completed in: " . relativeTime($time) . "\n";
}
}
unset($groupList);
if ($ps->RunThreadCode())
{
if ($ps->RunThreadCode()) {
$group = $ps->threadData;
$thread = sprintf("%05d",$ps->GetPID());
$thread = sprintf("%05d", $ps->GetPID());
echo "\n[Thread-{$thread}] Begining backfill processing for group {$group['name']}\n";
@@ -68,33 +60,32 @@ if ($ps->RunThreadCode())
echo "\n[Thread-{$thread}] Completed update for group {$group['name']}\n";
}
function relativeTime($_time) {
$d[0] = array(1,"sec");
$d[1] = array(60,"min");
$d[2] = array(3600,"hr");
$d[3] = array(86400,"day");
$d[4] = array(31104000,"yr");
function relativeTime($_time)
{
$d[0] = array(1, "sec");
$d[1] = array(60, "min");
$d[2] = array(3600, "hr");
$d[3] = array(86400, "day");
$d[4] = array(31104000, "yr");
$w = array();
$w = array();
$return = "";
$now = TIME();
$diff = ($now-$_time);
$secondsLeft = $diff;
$return = "";
$now = TIME();
$diff = ($now - $_time);
$secondsLeft = $diff;
for($i=4;$i>-1;$i--)
{
$w[$i] = intval($secondsLeft/$d[$i][0]);
$secondsLeft -= ($w[$i]*$d[$i][0]);
if($w[$i]!=0)
{
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
}
}
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= ($w[$i] * $d[$i][0]);
if ($w[$i] != 0) {
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
//$return .= ($diff>0)?"ago":"left";
return $return;
}
// Exit to call back to parent - Let know that child has completed
@@ -103,9 +94,6 @@ exit(0);
// Create callback function
function psUpdateComplete()
{
echo "\n\033[1;33mKevin123's threaded backfill parts process completed in: " .relativeTime($time). "\n";
echo "\n\033[1;33mKevin123's threaded backfill parts process completed in: " . relativeTime($time) . "\n";
}
?>
+51 -64
View File
@@ -1,12 +1,12 @@
<?php
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/groups.php");
require_once(WWW_DIR."/lib/binaries.php");
require_once(WWW_DIR."/lib/powerprocess.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/groups.php");
require_once(WWW_DIR . "/lib/binaries.php");
require_once(WWW_DIR . "/lib/powerprocess.php");
$time = TIME();
//Include AlienX's NewzDash Comms Class.
require_once(dirname(__FILE__)."/../alienx/ndComms.php");
require_once(dirname(__FILE__) . "/../alienx/ndComms.php");
$groups = new Groups;
$groupList = $groups->getActive();
@@ -16,75 +16,65 @@ $ps = new PowerProcess();
$ps->RegisterCallback('psUpdateComplete');
$ps->maxThreads = 5;
$ps->tickCount = 500000;
$ps->threadTimeLimit = 0; // Disable child timeout
$ps->threadTimeLimit = 0; // Disable child timeout
echo "Starting threaded backfill process\n";
while ($ps->RunControlCode())
{
while ($ps->RunControlCode()) {
// Start the parent loop
if (count($groupList))
{
if (count($groupList)) {
// We still have groups to process
if ($ps->SpawnReady())
{
if ($ps->SpawnReady()) {
// Spawn another thread
$ps->threadData = array_pop($groupList);
echo "[Thread-MASTER] Spawning new thread. Still have " . count($groupList) ." group(s) to update after this\n";
echo "[Thread-MASTER] Spawning new thread. Still have " . count($groupList) . " group(s) to update after this\n";
$ps->spawnThread();
}
else
{
} else {
// There are no more slots available to run
//$ps->tick();
//echo ".\n";
}
}
else
{
} else {
// No more groups to process
echo "No more groups to process - Initiating shutdown\n";
$ps->Shutdown();
echo "Shutdown complete\n";
echo "\n\033[1;33m[Thread-MASTER] Threaded stock backfill process completed in: " .relativeTime($time). "\n";
echo "\n\033[1;33m[Thread-MASTER] Threaded stock backfill process completed in: " . relativeTime($time) . "\n";
}
}
unset($groupList);
if ($ps->RunThreadCode())
{
if ($ps->RunThreadCode()) {
$group = $ps->threadData;
$thread = sprintf("%05d",$ps->GetPID());
$thread = sprintf("%05d", $ps->GetPID());
echo "[Thread-{$thread}] Begining backfill processing for group {$group['name']}\n";
$param = $group['name'];
$dir = WWW_DIR.'/../misc/update_scripts/';
$dir = WWW_DIR . '/../misc/update_scripts/';
$file = 'backfill.php';
//NewzDash
$ndComm = new newzdashComms;
$ndCommAllowed = false;
if ( $ndComm->init() )
if ($ndComm->init())
$ndCommAllowed = true;
if ( $ndCommAllowed )
{
if ($ndCommAllowed) {
$args[] = null;
$args[] = "backfill on " . $group['name'];
$args[] = "started";
$ndComm->broadcast($args);
}
//End Newzdash
$output = passthru("cd {$dir}/ && php {$file} {$param}");
//Newzdash
if ( $ndCommAllowed )
{
if ($ndCommAllowed) {
unset($args);
$args[] = null;
$args[] = "backfill on " . $group['name'];
@@ -92,37 +82,36 @@ if ($ps->RunThreadCode())
$ndComm->broadcast($args);
}
//End Newzdash
echo "[Thread-{$thread}] Completed update for group {$group['name']}\n";
}
function relativeTime($_time) {
$d[0] = array(1,"sec");
$d[1] = array(60,"min");
$d[2] = array(3600,"hr");
$d[3] = array(86400,"day");
$d[4] = array(31104000,"yr");
function relativeTime($_time)
{
$d[0] = array(1, "sec");
$d[1] = array(60, "min");
$d[2] = array(3600, "hr");
$d[3] = array(86400, "day");
$d[4] = array(31104000, "yr");
$w = array();
$w = array();
$return = "";
$now = TIME();
$diff = ($now-$_time);
$secondsLeft = $diff;
$return = "";
$now = TIME();
$diff = ($now - $_time);
$secondsLeft = $diff;
for($i=4;$i>-1;$i--)
{
$w[$i] = intval($secondsLeft/$d[$i][0]);
$secondsLeft -= ($w[$i]*$d[$i][0]);
if($w[$i]!=0)
{
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
}
}
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= ($w[$i] * $d[$i][0]);
if ($w[$i] != 0) {
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
//$return .= ($diff>0)?"ago":"left";
return $return;
}
// Exit to call back to parent - Let know that child has completed
@@ -131,7 +120,5 @@ exit(0);
// Create callback function
function psUpdateComplete()
{
echo "\n\033[1;33mThreaded stock backfill process completed in: " .relativeTime($time). "\n";
echo "\n\033[1;33mThreaded stock backfill process completed in: " . relativeTime($time) . "\n";
}
?>
+1 -3
View File
@@ -1,6 +1,4 @@
<?php
require(dirname(__FILE__)."/../../../../../www/config.php");
?>
require(dirname(__FILE__) . "/../../../../../www/config.php");
+109 -107
View File
@@ -6,192 +6,194 @@ class DB
function DB()
{
if (DB::$initialized === false)
{
if (DB::$initialized === false) {
// initialize db connection
mysql_pconnect(DB_HOST, DB_USER, DB_PASSWORD)
or die("fatal error: could not connect to database! Check your config.");
mysql_select_db(DB_NAME)
or die("fatal error: could not select database! Check your config.");
mysql_set_charset('utf8');
DB::$initialized = true;
}
$this->mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
}
$this->mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
}
public function escapeString($str)
{
return "'".mysql_real_escape_string($str)."'";
}
return "'" . mysql_real_escape_string($str) . "'";
}
public function makeLookupTable($rows, $keycol)
{
$arr = array();
foreach($rows as $row)
$arr[$row[$keycol]] = $row;
foreach ($rows as $row)
$arr[$row[$keycol]] = $row;
return $arr;
}
public function queryInsert($query, $returnlastid=true)
}
public function queryInsert($query, $returnlastid = true)
{
$result = mysql_query($query);
return ($returnlastid) ? mysql_insert_id() : $result;
}
public function queryOneRow($query)
{
$rows = $this->query($query);
if (!$rows)
return false;
if ($rows)
return $rows[0];
else
return $rows;
}
return $rows;
}
public function query($query)
{
$result = mysql_query($query);
if ($result === false || $result === true)
return array();
$rows = array();
while ($row = mysql_fetch_assoc($result))
$rows[] = $row;
while ($row = mysql_fetch_assoc($result))
$rows[] = $row;
mysql_free_result($result);
return $rows;
}
}
public function queryDirect($query)
{
$result = mysql_query($query);
return $result;
}
}
public function optimize($force = false)
public function optimize($force = false)
{
$ret = array();
if ($force)
$alltables = $this->query("show table status where `Engine` = 'MyISAM'");
$alltables = $this->query("show table status where `Engine` = 'MyISAM'");
else
$alltables = $this->query("show table status where `Engine` = 'MyISAM' and Data_free != 0");
$alltables = $this->query("show table status where `Engine` = 'MyISAM' and Data_free != 0");
foreach ($alltables as $tablename)
{
foreach ($alltables as $tablename) {
$ret[] = $tablename['Name'];
$this->queryDirect("REPAIR TABLE `".$tablename['Name']."`");
$this->queryDirect("OPTIMIZE TABLE `".$tablename['Name']."`");
$this->queryDirect("ANALYZE TABLE `".$tablename['Name']."`");
$this->queryDirect("REPAIR TABLE `" . $tablename['Name'] . "`");
$this->queryDirect("OPTIMIZE TABLE `" . $tablename['Name'] . "`");
$this->queryDirect("ANALYZE TABLE `" . $tablename['Name'] . "`");
}
return $ret;
}
public function optimizeinnodb($iforce = false)
public function optimizeinnodb($iforce = false)
{
$iret = array();
if ($iforce)
$ialltables = $this->query("show table status where `Engine` = 'InnoDB'");
$ialltables = $this->query("show table status where `Engine` = 'InnoDB'");
else
$ialltables = $this->query("show table status where `Engine` = 'InnoDB' and Data_free != 0");
$ialltables = $this->query("show table status where `Engine` = 'InnoDB' and Data_free != 0");
foreach ($ialltables as $itablename)
{
foreach ($ialltables as $itablename) {
$iret[] = $itablename['Name'];
$this->queryDirect("OPTIMIZE TABLE `".$itablename['Name']."`");
$this->queryDirect("OPTIMIZE TABLE `" . $itablename['Name'] . "`");
}
return $iret;
}
/* Mysqli Functions */
public function multiQueryTransaction($query)
{
$this->mysqli->autocommit(FALSE);
$this->mysqli->multi_query($query);
/* Mysqli Functions */
public function multiQueryTransaction($query)
{
$this->mysqli->autocommit(false);
$this->mysqli->multi_query($query);
while($this->mysqli->next_result()) {
$result = $this->mysqli->use_result();
if($result instanceof mysqli_result)
$result->free();
}
while ($this->mysqli->next_result()) {
$result = $this->mysqli->use_result();
if ($result instanceof mysqli_result)
$result->free();
}
$this->mysqli->commit();
}
$this->mysqli->commit();
}
public function disableAutoCommit()
{
$this->mysqli->autocommit(FALSE);
}
public function disableAutoCommit()
{
$this->mysqli->autocommit(false);
}
public function mysqliQuery($sql)
{
$result = $this->mysqli->query($sql);
if ($result === false || $result === true)
return array();
public function mysqliQuery($sql)
{
$result = $this->mysqli->query($sql);
if ($result === false || $result === true)
return array();
$rows = array();
$rows = array();
while ($row = mysqli_fetch_assoc($result))
$rows[] = $row;
while ($row = mysqli_fetch_assoc($result))
$rows[] = $row;
mysqli_free_result($result);
return $rows;
}
mysqli_free_result($result);
public function mysqliQueryOneRow($query)
{
$rows = $this->mysqliQuery($query);
return $rows;
}
if (!$rows)
return false;
public function mysqliQueryOneRow($query)
{
$rows = $this->mysqliQuery($query);
if ($rows)
return $rows[0];
else
return $rows;
}
if (!$rows)
return false;
public function mysqliQueryInsert($query, $returnlastid=true)
{
$result = $this->mysqli->query($query);
return ($returnlastid) ? $this->mysqli->insert_id : $result;
}
if ($rows)
return $rows[0];
else
return $rows;
}
public function commit()
{
$this->mysqli->commit();
}
public function mysqliQueryInsert($query, $returnlastid = true)
{
$result = $this->mysqli->query($query);
public function rollback()
{
$this->mysqli->rollback();
}
return ($returnlastid) ? $this->mysqli->insert_id : $result;
}
public function mysqliQueryDirect($query)
{
return $this->mysqli->query($query);
}
public function commit()
{
$this->mysqli->commit();
}
public function rollback()
{
$this->mysqli->rollback();
}
public function mysqliQueryDirect($query)
{
return $this->mysqli->query($query);
}
public function enableAutoCommit()
{
$this->mysqli->autocommit(TRUE);
}
public function enableAutoCommit()
{
$this->mysqli->autocommit(true);
}
}
?>
+18 -27
View File
@@ -1,27 +1,27 @@
<?php
require(dirname(__FILE__)."/config.php");
require(WWW_DIR."/lib/powerprocess.php");
require(dirname(__FILE__) . "/config.php");
require(WWW_DIR . "/lib/powerprocess.php");
$dirroot = $argv[1];
$subdirs = array_filter(glob($dirroot."/*", GLOB_ONLYDIR|GLOB_NOSORT));
$subdirs = array_filter(glob($dirroot . "/*", GLOB_ONLYDIR | GLOB_NOSORT));
$subdir_count = 0;
foreach($subdirs AS $subdir){
foreach ($subdirs AS $subdir) {
//$filecount = count(glob($subdir."/*.nzb"));
//if($filecount > 0){
//echo "Directory {$subdir} contains {$filecount} nzb's.\n";
$subdir_count++;
//echo "Directory {$subdir} contains {$filecount} nzb's.\n";
$subdir_count++;
//}
}
if($subdir_count == 0){
if ($subdir_count == 0) {
echo "Nothing to import, sub-directories are empty or there are no sub-directories to process.\n";
die();
}
//get variables from defaults.sh
$path = dirname(__FILE__);
$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = explode("\n", $varnames);
$vardata = explode("\n", $vardata);
$array = array_combine($varnames, $vardata);
@@ -36,27 +36,21 @@ $selected = $subdir_count - 1;
echo "Starting threaded import process, {$array['NZBCOUNT']} per thread\n";
while ($ps->RunControlCode())
{
if ($selected >= 0)
{
if ($ps->SpawnReady())
{
$ps->threadData = $subdirs[$selected]."/";
while ($ps->RunControlCode()) {
if ($selected >= 0) {
if ($ps->SpawnReady()) {
$ps->threadData = $subdirs[$selected] . "/";
$ps->spawnThread();
}
}
else
{
}
} else {
$ps->Shutdown();
}
$selected--;
$selected--;
}
if ($ps->RunThreadCode())
{
if ($ps->RunThreadCode()) {
$subdir = $ps->threadData;
$thread = sprintf("%05d",$ps->GetPID());
$thread = sprintf("%05d", $ps->GetPID());
$dir = dirname(__FILE__);
$file = 'nzb-importonenzb.php';
@@ -72,6 +66,3 @@ function psUpdateComplete()
echo "[Thread-MASTER] The threaded import process has completed.\n";
}
?>
+4 -5
View File
@@ -1,18 +1,17 @@
<?php
require(dirname(__FILE__)."/config.php");
require(WWW_DIR.'/lib/postprocess.php');
require(dirname(__FILE__) . "/config.php");
require(WWW_DIR . '/lib/postprocess.php');
$postprocess = new PostProcess(true);
$postprocess->processSpotnab();
//get variables from defaults.sh
$path = dirname(__FILE__);
$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = explode("\n", $varnames);
$vardata = explode("\n", $vardata);
$array = array_combine($varnames, $vardata);
unset($array['']);
?>
+5 -1
View File
@@ -103,6 +103,8 @@ function getReleaseNameFromRequestID($tmux, $requestID, $groupName)
if (isset($request)) {
return array('title' => $request['name'], 'ID' => 'NULL');
}
return true;
}
function localLookup($requestID, $groupName, $oldname)
@@ -133,4 +135,6 @@ function localLookup($requestID, $groupName, $oldname)
if (isset($run1['title'])) {
return array('title' => $run['title'], 'ID' => $run['ID']);
}
}
return true;
}
+47 -50
View File
@@ -2,64 +2,64 @@
/*
This scripts backfills 100k parts, on ONE group from your active groups, reverse alphabetically, to a maximum of 2012-06-24. When that group is at 2012-06-24 it will move on to the next group.
*/
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/backfill.php");
require_once(WWW_DIR."/lib/framework/db.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/backfill.php");
require_once(WWW_DIR . "/lib/framework/db.php");
$time = TIME();
//get variables from defaults.sh
$path = dirname(__FILE__);
$varnames = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = explode("\n", $varnames);
$vardata = explode("\n", $vardata);
$array = array_combine($varnames, $vardata);
unset($array['']);
function relativeTime($_time) {
$d[0] = array(1,"sec");
$d[1] = array(60,"min");
$d[2] = array(3600,"hr");
$d[3] = array(86400,"day");
$d[4] = array(31104000,"yr");
function relativeTime($_time)
{
$d[0] = array(1, "sec");
$d[1] = array(60, "min");
$d[2] = array(3600, "hr");
$d[3] = array(86400, "day");
$d[4] = array(31104000, "yr");
$w = array();
$w = array();
$return = "";
$now = TIME();
$diff = ($now-$_time);
$secondsLeft = $diff;
$return = "";
$now = TIME();
$diff = ($now - $_time);
$secondsLeft = $diff;
for($i=4;$i>-1;$i--)
{
$w[$i] = intval($secondsLeft/$d[$i][0]);
$secondsLeft -= ($w[$i]*$d[$i][0]);
if($w[$i]!=0)
{
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
}
}
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= ($w[$i] * $d[$i][0]);
if ($w[$i] != 0) {
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
//$return .= ($diff>0)?"ago":"left";
return $return;
}
function get_color()
{
$from = 1;
$to = 231;
$exceptions = array( 4, 8, 16, 17, 18, 19, 52, 53, 59, 60, 67 );
sort($exceptions); // lets us use break; in the foreach reliably
$number = mt_rand($from, $to - count($exceptions)); // or mt_rand()
foreach ($exceptions as $exception) {
if ($number >= $exception) {
$number++; // make up for the gap
} else /*if ($number < $exception)*/ {
break;
}
}
return $number;
$from = 1;
$to = 231;
$exceptions = array(4, 8, 16, 17, 18, 19, 52, 53, 59, 60, 67);
sort($exceptions); // lets us use break; in the foreach reliably
$number = mt_rand($from, $to - count($exceptions)); // or mt_rand()
foreach ($exceptions as $exception) {
if ($number >= $exception) {
$number++; // make up for the gap
} else /*if ($number < $exception)*/ {
break;
}
}
return $number;
}
$_date = $array['KEVIN_DATE'];
@@ -73,24 +73,21 @@ $query1 = $db->queryOneRow("select name from groups WHERE (first_record_postdate
$query2 = $db->queryOneRow("select first_record_postdate from groups WHERE (first_record_postdate BETWEEN '$_date' and now()) and (active = 1) order by name ASC limit 1");
$groups = $db->query("select name from groups WHERE (first_record_postdate NOT BETWEEN '$_date' and now()) and (active = 1) order by name ASC");
foreach($groups as $row)
{
$tbl = $row['name'];
echo "\033[1;33m$tbl Completed\n\033[0m";
}
foreach ($groups as $row) {
$tbl = $row['name'];
echo "\033[1;33m$tbl Completed\n\033[0m";
}
$groupPost = $_parts;
$groupName = $query1['name'];
$groupDate = $query2['first_record_postdate'];
if($query1){
if ($query1) {
echo "\n\033[1;33mStarting kevin123's safer backfill process on $groupName ==> $_date ==> $groupDate\n\033[38;5;${color}m\n\n";
sleep(3);
$backfill = new Backfill();
$backfill->backfillPostAllGroups($groupName, $groupPost);
}
echo "\n\033[1;33mKevin123's safer backfill process completed in: " .relativeTime($time). "\n\033[0m\n";
?>
echo "\n\033[1;33mKevin123's safer backfill process completed in: " . relativeTime($time) . "\n\033[0m\n";
+3 -5
View File
@@ -1,13 +1,11 @@
<?php
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/releases.php");
require_once(WWW_DIR."/lib/sphinx.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/releases.php");
require_once(WWW_DIR . "/lib/sphinx.php");
//$releases = new Releases;
$sphinx = new Sphinx();
//$releases->processReleases();
$sphinx->update();
?>
+42 -48
View File
@@ -1,59 +1,53 @@
<?php
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/groups.php");
require_once(WWW_DIR."/lib/binaries.php");
require_once(dirname(__FILE__)."/../lib/ColorCLI.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/groups.php");
require_once(WWW_DIR . "/lib/binaries.php");
require_once(dirname(__FILE__) . "/../lib/ColorCLI.php");
$time = TIME();
$c = new ColorCLI();
if (isset($argv[1]))
if (isset($argv[1])) {
$group = $argv[1];
echo $c->header("Updating group {$group}");
$g = new Groups;
$group = $g->getByName($group);
$bin = new Binaries;
$bin->updateGroup(null, $group);
} else {
$binaries = new Binaries;
$binaries->updateAllGroups();
}
function relativeTime($_time)
{
$group = $argv[1];
echo $c->header("Updating group {$group}");
$d[0] = array(1, "sec");
$d[1] = array(60, "min");
$d[2] = array(3600, "hr");
$d[3] = array(86400, "day");
$d[4] = array(31104000, "yr");
$g = new Groups;
$group = $g->getByName($group);
$w = array();
$bin = new Binaries;
$bin->updateGroup(null, $group);
}
else
{
$binaries = new Binaries;
$binaries->updateAllGroups();
$return = "";
$now = TIME();
$diff = ($now - $_time);
$secondsLeft = $diff;
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= ($w[$i] * $d[$i][0]);
if ($w[$i] != 0) {
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
}
function relativeTime($_time) {
$d[0] = array(1,"sec");
$d[1] = array(60,"min");
$d[2] = array(3600,"hr");
$d[3] = array(86400,"day");
$d[4] = array(31104000,"yr");
$w = array();
$return = "";
$now = TIME();
$diff = ($now-$_time);
$secondsLeft = $diff;
for($i=4;$i>-1;$i--)
{
$w[$i] = intval($secondsLeft/$d[$i][0]);
$secondsLeft -= ($w[$i]*$d[$i][0]);
if($w[$i]!=0)
{
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
}
echo $c->header("Group update process completed in: " .relativeTime($time). "\n");
?>
echo $c->header("Group update process completed in: " . relativeTime($time) . "\n");
+53 -67
View File
@@ -1,12 +1,12 @@
<?php
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/groups.php");
require_once(WWW_DIR."/lib/binaries.php");
require_once(WWW_DIR."/lib/powerprocess.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/groups.php");
require_once(WWW_DIR . "/lib/binaries.php");
require_once(WWW_DIR . "/lib/powerprocess.php");
$time = TIME();
//Include AlienX's NewzDash Comms Class.
require_once(dirname(__FILE__)."/../alienx/ndComms.php");
require_once(dirname(__FILE__) . "/../alienx/ndComms.php");
$groups = new Groups;
$groupList = $groups->getActive();
@@ -16,81 +16,71 @@ $ps = new PowerProcess();
$ps->RegisterCallback('psUpdateComplete');
$ps->maxThreads = 5;
$ps->tickCount = 500000;
$ps->threadTimeLimit = 0; // Disable child timeout
$ps->threadTimeLimit = 0; // Disable child timeout
echo "Starting threaded binary update process\n";
//while ($ps->runParentCode())
while ($ps->RunControlCode())
{
//while ($ps->runParentCode())
while ($ps->RunControlCode()) {
// Start the parent loop
if (count($groupList))
{
if (count($groupList)) {
// We still have groups to process
if ($ps->SpawnReady())
{
if ($ps->SpawnReady()) {
// Spawn another thread
$ps->threadData = array_pop($groupList);
echo "[Thread-MASTER] Spawning new thread. Still have " . count($groupList) ." group(s) to update after this\n";
echo "[Thread-MASTER] Spawning new thread. Still have " . count($groupList) . " group(s) to update after this\n";
$ps->spawnThread();
}
else
{
} else {
// There are no more slots available to run
//$ps->tick();
//echo "- \n";
}
}
else
{
} else {
// No more groups to process
echo "No more groups to process - Initiating shutdown\n";
$ps->Shutdown();
echo "Shutdown complete\n";
echo "\n\033[1;33m[Thread-MASTER] Threaded stock binaries update completed in: " .relativeTime($time). "\n";
echo "\n\033[1;33m[Thread-MASTER] Threaded stock binaries update completed in: " . relativeTime($time) . "\n";
}
}
unset($groupList);
if ($ps->RunThreadCode())
{
if ($ps->RunThreadCode()) {
$group = $ps->threadData;
$thread = sprintf("%05d",$ps->GetPID());
$thread = sprintf("%05d", $ps->GetPID());
echo "[Thread-{$thread}] Begining processing for group {$group['name']}\n";
//NewzDash
$ndComm = new newzdashComms;
$ndCommAllowed = false;
if ( $ndComm->init() )
if ($ndComm->init())
$ndCommAllowed = true;
if ( $ndCommAllowed )
{
if ($ndCommAllowed) {
$args[] = null;
$args[] = "update_binaries on " . $group['name'];
$args[] = "started";
$ndComm->broadcast($args);
}
//End Newzdash
$param = $group['name'];
$dir = WWW_DIR.'/../misc/update_scripts/';
$dir = WWW_DIR . '/../misc/update_scripts/';
$file = 'update_binaries.php';
//$output = shell_exec("php {$dir}/{$file} {$param}");
$output = passthru("cd {$dir}/ && php {$file} {$param}");
//$output = shell_exec("/usr/bin/php -c /etc/php5/cli/php.ini {$dir}/{$file} {$param}");
echo "[Thread-{$thread}] Completed update for group {$group['name']}\n";
//Newzdash
if ( $ndCommAllowed )
{
if ($ndCommAllowed) {
unset($args);
$args[] = null;
$args[] = "update_binaries on " . $group['name'];
@@ -100,33 +90,32 @@ if ($ps->RunThreadCode())
//End Newzdash
}
function relativeTime($_time) {
$d[0] = array(1,"sec");
$d[1] = array(60,"min");
$d[2] = array(3600,"hr");
$d[3] = array(86400,"day");
$d[4] = array(31104000,"yr");
function relativeTime($_time)
{
$d[0] = array(1, "sec");
$d[1] = array(60, "min");
$d[2] = array(3600, "hr");
$d[3] = array(86400, "day");
$d[4] = array(31104000, "yr");
$w = array();
$w = array();
$return = "";
$now = TIME();
$diff = ($now-$_time);
$secondsLeft = $diff;
$return = "";
$now = TIME();
$diff = ($now - $_time);
$secondsLeft = $diff;
for($i=4;$i>-1;$i--)
{
$w[$i] = intval($secondsLeft/$d[$i][0]);
$secondsLeft -= ($w[$i]*$d[$i][0]);
if($w[$i]!=0)
{
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
}
}
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= ($w[$i] * $d[$i][0]);
if ($w[$i] != 0) {
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
//$return .= ($diff>0)?"ago":"left";
return $return;
}
// Exit to call back to parent - Let know that child has completed
@@ -135,8 +124,5 @@ exit(0);
// Create callback function
function psUpdateComplete()
{
echo "Threaded stock binaries update completed in: " .relativeTime($time). "\n";
echo "Threaded stock binaries update completed in: " . relativeTime($time) . "\n";
}
?>
+25 -27
View File
@@ -1,7 +1,7 @@
<?php
$time = TIME();
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/releases.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/releases.php");
//require_once(WWW_DIR."/lib/sphinx.php");
$releases = new Releases;
@@ -9,34 +9,32 @@ $releases = new Releases;
$releases->processReleases();
//$sphinx->update();
function relativeTime($_time) {
$d[0] = array(1,"\033[1;33msec");
$d[1] = array(60,"\033[1;33mmin");
$d[2] = array(3600,"\033[1;33mhr");
$d[3] = array(86400,"\033[1;33mday");
$d[4] = array(31104000,"\033[1;33myr");
function relativeTime($_time)
{
$d[0] = array(1, "\033[1;33msec");
$d[1] = array(60, "\033[1;33mmin");
$d[2] = array(3600, "\033[1;33mhr");
$d[3] = array(86400, "\033[1;33mday");
$d[4] = array(31104000, "\033[1;33myr");
$w = array();
$w = array();
$return = "";
$now = TIME();
$diff = ($now-$_time);
$secondsLeft = $diff;
$return = "";
$now = TIME();
$diff = ($now - $_time);
$secondsLeft = $diff;
for($i=4;$i>-1;$i--)
{
$w[$i] = intval($secondsLeft/$d[$i][0]);
$secondsLeft -= ($w[$i]*$d[$i][0]);
if($w[$i]!=0)
{
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
}
}
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= ($w[$i] * $d[$i][0]);
if ($w[$i] != 0) {
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
//$return .= ($diff>0)?"ago":"left";
return $return;
}
echo "\033[1;33mThis loop completed in: " .relativeTime($time). "\n";
?>
echo "\033[1;33mThis loop completed in: " . relativeTime($time) . "\n";
+26 -28
View File
@@ -1,9 +1,9 @@
<?php
$time = TIME();
require(dirname(__FILE__)."/config.php");
require_once(WWW_DIR."/lib/releases.php");
require(dirname(__FILE__) . "/config.php");
require_once(WWW_DIR . "/lib/releases.php");
//require_once(WWW_DIR."/lib/sphinx.php");
require_once(dirname(__FILE__).'/../lib/ColorCLI.php');
require_once(dirname(__FILE__) . '/../lib/ColorCLI.php');
$c = new ColorCLI();
if (!isset($argv[1])) {
@@ -17,34 +17,32 @@ $releases = new Releases;
$releases->processReleases();
//$sphinx->update();
function relativeTime($_time) {
$d[0] = array(1,"\033[1;33msec");
$d[1] = array(60,"\033[1;33mmin");
$d[2] = array(3600,"\033[1;33mhr");
$d[3] = array(86400,"\033[1;33mday");
$d[4] = array(31104000,"\033[1;33myr");
function relativeTime($_time)
{
$d[0] = array(1, "\033[1;33msec");
$d[1] = array(60, "\033[1;33mmin");
$d[2] = array(3600, "\033[1;33mhr");
$d[3] = array(86400, "\033[1;33mday");
$d[4] = array(31104000, "\033[1;33myr");
$w = array();
$w = array();
$return = "";
$now = TIME();
$diff = ($now-$_time);
$secondsLeft = $diff;
$return = "";
$now = TIME();
$diff = ($now - $_time);
$secondsLeft = $diff;
for($i=4;$i>-1;$i--)
{
$w[$i] = intval($secondsLeft/$d[$i][0]);
$secondsLeft -= ($w[$i]*$d[$i][0]);
if($w[$i]!=0)
{
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
}
}
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= ($w[$i] * $d[$i][0]);
if ($w[$i] != 0) {
//$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." ";
$return .= $w[$i] . " " . $d[$i][1] . (($w[$i] > 1) ? 's' : '') . " ";
}
}
//$return .= ($diff>0)?"ago":"left";
return $return;
//$return .= ($diff>0)?"ago":"left";
return $return;
}
echo "\033[1;33mThis loop completed in: " .relativeTime($time). "\n";
?>
echo "\033[1;33mThis loop completed in: " . relativeTime($time) . "\n";
+200 -202
View File
@@ -25,213 +25,211 @@
*/
// don't change this! unless you know what you do
define('SMARTIRC_CRLF', "\r\n");
define('SMARTIRC_UNUSED', '*');
define('SMARTIRC_STDOUT', 0);
define('SMARTIRC_FILE', 1);
define('SMARTIRC_SYSLOG', 2);
define('SMARTIRC_BROWSEROUT', 3);
define('SMARTIRC_NONE', 4);
define('SMARTIRC_LOW', 0);
define('SMARTIRC_MEDIUM', 1);
define('SMARTIRC_HIGH', 2);
define('SMARTIRC_CRITICAL', 3);
define('SMARTIRC_STATE_DISCONNECTED', 0);
define('SMARTIRC_STATE_CONNECTING', 1);
define('SMARTIRC_STATE_CONNECTED', 2);
define('SMARTIRC_DEBUG_NONE', 0);
define('SMARTIRC_DEBUG_NOTICE', 1);
define('SMARTIRC_DEBUG_CONNECTION', 2);
define('SMARTIRC_DEBUG_SOCKET', 4);
define('SMARTIRC_DEBUG_IRCMESSAGES', 8);
define('SMARTIRC_DEBUG_MESSAGETYPES', 16);
define('SMARTIRC_DEBUG_ACTIONHANDLER', 32);
define('SMARTIRC_DEBUG_TIMEHANDLER', 64);
define('SMARTIRC_DEBUG_MESSAGEHANDLER', 128);
define('SMARTIRC_DEBUG_CHANNELSYNCING', 256);
define('SMARTIRC_DEBUG_MODULES', 512);
define('SMARTIRC_DEBUG_USERSYNCING', 1024);
define('SMARTIRC_DEBUG_MESSAGEPARSER', 2048);
define('SMARTIRC_DEBUG_DCC', 4096);
define('SMARTIRC_DEBUG_ALL', 8191);
define('SMARTIRC_TYPE_UNKNOWN', 1);
define('SMARTIRC_TYPE_CHANNEL', 2);
define('SMARTIRC_TYPE_QUERY', 4);
define('SMARTIRC_TYPE_CTCP', 8);
define('SMARTIRC_TYPE_NOTICE', 16);
define('SMARTIRC_TYPE_WHO', 32);
define('SMARTIRC_TYPE_JOIN', 64);
define('SMARTIRC_TYPE_INVITE', 128);
define('SMARTIRC_TYPE_ACTION', 256);
define('SMARTIRC_TYPE_TOPICCHANGE', 512);
define('SMARTIRC_TYPE_NICKCHANGE', 1024);
define('SMARTIRC_TYPE_KICK', 2048);
define('SMARTIRC_TYPE_QUIT', 4096);
define('SMARTIRC_TYPE_LOGIN', 8192);
define('SMARTIRC_TYPE_INFO', 16384);
define('SMARTIRC_TYPE_LIST', 32768);
define('SMARTIRC_TYPE_NAME', 65536);
define('SMARTIRC_TYPE_MOTD', 131072);
define('SMARTIRC_TYPE_MODECHANGE', 262144);
define('SMARTIRC_TYPE_PART', 524288);
define('SMARTIRC_TYPE_ERROR', 1048576);
define('SMARTIRC_TYPE_BANLIST', 2097152);
define('SMARTIRC_TYPE_TOPIC', 4194304);
define('SMARTIRC_TYPE_NONRELEVANT', 8388608);
define('SMARTIRC_TYPE_WHOIS', 16777216);
define('SMARTIRC_TYPE_WHOWAS', 33554432);
define('SMARTIRC_TYPE_USERMODE', 67108864);
define('SMARTIRC_TYPE_CHANNELMODE', 134217728);
define('SMARTIRC_TYPE_CTCP_REQUEST', 268435456);
define('SMARTIRC_TYPE_CTCP_REPLY', 536870912);
define('SMARTIRC_CRLF', "\r\n");
define('SMARTIRC_UNUSED', '*');
define('SMARTIRC_STDOUT', 0);
define('SMARTIRC_FILE', 1);
define('SMARTIRC_SYSLOG', 2);
define('SMARTIRC_BROWSEROUT', 3);
define('SMARTIRC_NONE', 4);
define('SMARTIRC_LOW', 0);
define('SMARTIRC_MEDIUM', 1);
define('SMARTIRC_HIGH', 2);
define('SMARTIRC_CRITICAL', 3);
define('SMARTIRC_STATE_DISCONNECTED', 0);
define('SMARTIRC_STATE_CONNECTING', 1);
define('SMARTIRC_STATE_CONNECTED', 2);
define('SMARTIRC_DEBUG_NONE', 0);
define('SMARTIRC_DEBUG_NOTICE', 1);
define('SMARTIRC_DEBUG_CONNECTION', 2);
define('SMARTIRC_DEBUG_SOCKET', 4);
define('SMARTIRC_DEBUG_IRCMESSAGES', 8);
define('SMARTIRC_DEBUG_MESSAGETYPES', 16);
define('SMARTIRC_DEBUG_ACTIONHANDLER', 32);
define('SMARTIRC_DEBUG_TIMEHANDLER', 64);
define('SMARTIRC_DEBUG_MESSAGEHANDLER', 128);
define('SMARTIRC_DEBUG_CHANNELSYNCING', 256);
define('SMARTIRC_DEBUG_MODULES', 512);
define('SMARTIRC_DEBUG_USERSYNCING', 1024);
define('SMARTIRC_DEBUG_MESSAGEPARSER', 2048);
define('SMARTIRC_DEBUG_DCC', 4096);
define('SMARTIRC_DEBUG_ALL', 8191);
define('SMARTIRC_TYPE_UNKNOWN', 1);
define('SMARTIRC_TYPE_CHANNEL', 2);
define('SMARTIRC_TYPE_QUERY', 4);
define('SMARTIRC_TYPE_CTCP', 8);
define('SMARTIRC_TYPE_NOTICE', 16);
define('SMARTIRC_TYPE_WHO', 32);
define('SMARTIRC_TYPE_JOIN', 64);
define('SMARTIRC_TYPE_INVITE', 128);
define('SMARTIRC_TYPE_ACTION', 256);
define('SMARTIRC_TYPE_TOPICCHANGE', 512);
define('SMARTIRC_TYPE_NICKCHANGE', 1024);
define('SMARTIRC_TYPE_KICK', 2048);
define('SMARTIRC_TYPE_QUIT', 4096);
define('SMARTIRC_TYPE_LOGIN', 8192);
define('SMARTIRC_TYPE_INFO', 16384);
define('SMARTIRC_TYPE_LIST', 32768);
define('SMARTIRC_TYPE_NAME', 65536);
define('SMARTIRC_TYPE_MOTD', 131072);
define('SMARTIRC_TYPE_MODECHANGE', 262144);
define('SMARTIRC_TYPE_PART', 524288);
define('SMARTIRC_TYPE_ERROR', 1048576);
define('SMARTIRC_TYPE_BANLIST', 2097152);
define('SMARTIRC_TYPE_TOPIC', 4194304);
define('SMARTIRC_TYPE_NONRELEVANT', 8388608);
define('SMARTIRC_TYPE_WHOIS', 16777216);
define('SMARTIRC_TYPE_WHOWAS', 33554432);
define('SMARTIRC_TYPE_USERMODE', 67108864);
define('SMARTIRC_TYPE_CHANNELMODE', 134217728);
define('SMARTIRC_TYPE_CTCP_REQUEST', 268435456);
define('SMARTIRC_TYPE_CTCP_REPLY', 536870912);
//define('SMARTIRC_TYPE_DCC', 536870912);
define('SMARTIRC_TYPE_ALL', 1073741823);
define('SMARTIRC_TYPE_ALL', 1073741823);
$SMARTIRC_replycodes = array(
'RPL_WELCOME' => '001',
'RPL_YOURHOST' => '002',
'RPL_CREATED' => '003',
'RPL_MYINFO' => '004',
'RPL_BOUNCE' => '005',
'RPL_TRACELINK' => '200',
'RPL_TRACECONNECTING' => '201',
'RPL_TRACEHANDSHAKE' => '202',
'RPL_TRACEUNKNOWN' => '203',
'RPL_TRACEOPERATOR' => '204',
'RPL_TRACEUSER' => '205',
'RPL_TRACESERVER' => '206',
'RPL_TRACESERVICE' => '207',
'RPL_TRACENEWTYPE' => '208',
'RPL_TRACECLASS' => '209',
'RPL_TRACERECONNECT' => '210',
'RPL_STATSLINKINFO' => '211',
'RPL_STATSCOMMANDS' => '212',
'RPL_ENDOFSTATS' => '219',
'RPL_UMODEIS' => '221',
'RPL_SERVLIST' => '234',
'RPL_SERVLISTEND' => '235',
'RPL_STATSUPTIME' => '242',
'RPL_STATSOLINE' => '243',
'RPL_LUSERCLIENT' => '251',
'RPL_LUSEROP' => '252',
'RPL_LUSERUNKNOWN' => '253',
'RPL_LUSERCHANNELS' => '254',
'RPL_LUSERME' => '255',
'RPL_ADMINME' => '256',
'RPL_ADMINLOC1' => '257',
'RPL_ADMINLOC2' => '258',
'RPL_ADMINEMAIL' => '259',
'RPL_TRACELOG' => '261',
'RPL_TRACEEND' => '262',
'RPL_TRYAGAIN' => '263',
'RPL_AWAY' => '301',
'RPL_USERHOST' => '302',
'RPL_ISON' => '303',
'RPL_UNAWAY' => '305',
'RPL_NOWAWAY' => '306',
'RPL_WHOISUSER' => '311',
'RPL_WHOISSERVER' => '312',
'RPL_WHOISOPERATOR' => '313',
'RPL_WHOWASUSER' => '314',
'RPL_ENDOFWHO' => '315',
'RPL_WHOISIDLE' => '317',
'RPL_ENDOFWHOIS' => '318',
'RPL_WHOISCHANNELS' => '319',
'RPL_LISTSTART' => '321',
'RPL_LIST' => '322',
'RPL_LISTEND' => '323',
'RPL_CHANNELMODEIS' => '324',
'RPL_UNIQOPIS' => '325',
'RPL_NOTOPIC' => '331',
'RPL_TOPIC' => '332',
'RPL_INVITING' => '341',
'RPL_SUMMONING' => '342',
'RPL_INVITELIST' => '346',
'RPL_ENDOFINVITELIST' => '347',
'RPL_EXCEPTLIST' => '348',
'RPL_ENDOFEXCEPTLIST' => '349',
'RPL_VERSION' => '351',
'RPL_WHOREPLY' => '352',
'RPL_NAMREPLY' => '353',
'RPL_LINKS' => '364',
'RPL_ENDOFLINKS' => '365',
'RPL_ENDOFNAMES' => '366',
'RPL_BANLIST' => '367',
'RPL_ENDOFBANLIST' => '368',
'RPL_ENDOFWHOWAS' => '369',
'RPL_INFO' => '371',
'RPL_MOTD' => '372',
'RPL_ENDOFINFO' => '374',
'RPL_MOTDSTART' => '375',
'RPL_ENDOFMOTD' => '376',
'RPL_YOUREOPER' => '381',
'RPL_REHASHING' => '382',
'RPL_YOURESERVICE' => '383',
'RPL_TIME' => '391',
'RPL_USERSSTART' => '392',
'RPL_USERS' => '393',
'RPL_ENDOFUSERS' => '394',
'RPL_NOUSERS' => '395',
'ERR_NOSUCHNICK' => '401',
'ERR_NOSUCHSERVER' => '402',
'ERR_NOSUCHCHANNEL' => '403',
'ERR_CANNOTSENDTOCHAN' => '404',
'ERR_TOOMANYCHANNELS' => '405',
'ERR_WASNOSUCHNICK' => '406',
'ERR_TOOMANYTARGETS' => '407',
'ERR_NOSUCHSERVICE' => '408',
'ERR_NOORIGIN' => '409',
'ERR_NORECIPIENT' => '411',
'ERR_NOTEXTTOSEND' => '412',
'ERR_NOTOPLEVEL' => '413',
'ERR_WILDTOPLEVEL' => '414',
'ERR_BADMASK' => '415',
'ERR_UNKNOWNCOMMAND' => '421',
'ERR_NOMOTD' => '422',
'ERR_NOADMININFO' => '423',
'ERR_FILEERROR' => '424',
'ERR_NONICKNAMEGIVEN' => '431',
'ERR_ERRONEUSNICKNAME' => '432',
'ERR_NICKNAMEINUSE' => '433',
'ERR_NICKCOLLISION' => '436',
'ERR_UNAVAILRESOURCE' => '437',
'ERR_USERNOTINCHANNEL' => '441',
'ERR_NOTONCHANNEL' => '442',
'ERR_USERONCHANNEL' => '443',
'ERR_NOLOGIN' => '444',
'ERR_SUMMONDISABLED' => '445',
'ERR_USERSDISABLED' => '446',
'ERR_NOTREGISTERED' => '451',
'ERR_NEEDMOREPARAMS' => '461',
'ERR_ALREADYREGISTRED' => '462',
'ERR_NOPERMFORHOST' => '463',
'ERR_PASSWDMISMATCH' => '464',
'ERR_YOUREBANNEDCREEP' => '465',
'ERR_YOUWILLBEBANNED' => '466',
'ERR_KEYSET' => '467',
'ERR_CHANNELISFULL' => '471',
'ERR_UNKNOWNMODE' => '472',
'ERR_INVITEONLYCHAN' => '473',
'ERR_BANNEDFROMCHAN' => '474',
'ERR_BADCHANNELKEY' => '475',
'ERR_BADCHANMASK' => '476',
'ERR_NOCHANMODES' => '477',
'ERR_BANLISTFULL' => '478',
'ERR_NOPRIVILEGES' => '481',
'ERR_CHANOPRIVSNEEDED' => '482',
'ERR_CANTKILLSERVER' => '483',
'ERR_RESTRICTED' => '484',
'ERR_UNIQOPPRIVSNEEDED' => '485',
'ERR_NOOPERHOST' => '491',
'ERR_UMODEUNKNOWNFLAG' => '501',
'ERR_USERSDONTMATCH' => '502',
'RPL_WELCOME' => '001',
'RPL_YOURHOST' => '002',
'RPL_CREATED' => '003',
'RPL_MYINFO' => '004',
'RPL_BOUNCE' => '005',
'RPL_TRACELINK' => '200',
'RPL_TRACECONNECTING' => '201',
'RPL_TRACEHANDSHAKE' => '202',
'RPL_TRACEUNKNOWN' => '203',
'RPL_TRACEOPERATOR' => '204',
'RPL_TRACEUSER' => '205',
'RPL_TRACESERVER' => '206',
'RPL_TRACESERVICE' => '207',
'RPL_TRACENEWTYPE' => '208',
'RPL_TRACECLASS' => '209',
'RPL_TRACERECONNECT' => '210',
'RPL_STATSLINKINFO' => '211',
'RPL_STATSCOMMANDS' => '212',
'RPL_ENDOFSTATS' => '219',
'RPL_UMODEIS' => '221',
'RPL_SERVLIST' => '234',
'RPL_SERVLISTEND' => '235',
'RPL_STATSUPTIME' => '242',
'RPL_STATSOLINE' => '243',
'RPL_LUSERCLIENT' => '251',
'RPL_LUSEROP' => '252',
'RPL_LUSERUNKNOWN' => '253',
'RPL_LUSERCHANNELS' => '254',
'RPL_LUSERME' => '255',
'RPL_ADMINME' => '256',
'RPL_ADMINLOC1' => '257',
'RPL_ADMINLOC2' => '258',
'RPL_ADMINEMAIL' => '259',
'RPL_TRACELOG' => '261',
'RPL_TRACEEND' => '262',
'RPL_TRYAGAIN' => '263',
'RPL_AWAY' => '301',
'RPL_USERHOST' => '302',
'RPL_ISON' => '303',
'RPL_UNAWAY' => '305',
'RPL_NOWAWAY' => '306',
'RPL_WHOISUSER' => '311',
'RPL_WHOISSERVER' => '312',
'RPL_WHOISOPERATOR' => '313',
'RPL_WHOWASUSER' => '314',
'RPL_ENDOFWHO' => '315',
'RPL_WHOISIDLE' => '317',
'RPL_ENDOFWHOIS' => '318',
'RPL_WHOISCHANNELS' => '319',
'RPL_LISTSTART' => '321',
'RPL_LIST' => '322',
'RPL_LISTEND' => '323',
'RPL_CHANNELMODEIS' => '324',
'RPL_UNIQOPIS' => '325',
'RPL_NOTOPIC' => '331',
'RPL_TOPIC' => '332',
'RPL_INVITING' => '341',
'RPL_SUMMONING' => '342',
'RPL_INVITELIST' => '346',
'RPL_ENDOFINVITELIST' => '347',
'RPL_EXCEPTLIST' => '348',
'RPL_ENDOFEXCEPTLIST' => '349',
'RPL_VERSION' => '351',
'RPL_WHOREPLY' => '352',
'RPL_NAMREPLY' => '353',
'RPL_LINKS' => '364',
'RPL_ENDOFLINKS' => '365',
'RPL_ENDOFNAMES' => '366',
'RPL_BANLIST' => '367',
'RPL_ENDOFBANLIST' => '368',
'RPL_ENDOFWHOWAS' => '369',
'RPL_INFO' => '371',
'RPL_MOTD' => '372',
'RPL_ENDOFINFO' => '374',
'RPL_MOTDSTART' => '375',
'RPL_ENDOFMOTD' => '376',
'RPL_YOUREOPER' => '381',
'RPL_REHASHING' => '382',
'RPL_YOURESERVICE' => '383',
'RPL_TIME' => '391',
'RPL_USERSSTART' => '392',
'RPL_USERS' => '393',
'RPL_ENDOFUSERS' => '394',
'RPL_NOUSERS' => '395',
'ERR_NOSUCHNICK' => '401',
'ERR_NOSUCHSERVER' => '402',
'ERR_NOSUCHCHANNEL' => '403',
'ERR_CANNOTSENDTOCHAN' => '404',
'ERR_TOOMANYCHANNELS' => '405',
'ERR_WASNOSUCHNICK' => '406',
'ERR_TOOMANYTARGETS' => '407',
'ERR_NOSUCHSERVICE' => '408',
'ERR_NOORIGIN' => '409',
'ERR_NORECIPIENT' => '411',
'ERR_NOTEXTTOSEND' => '412',
'ERR_NOTOPLEVEL' => '413',
'ERR_WILDTOPLEVEL' => '414',
'ERR_BADMASK' => '415',
'ERR_UNKNOWNCOMMAND' => '421',
'ERR_NOMOTD' => '422',
'ERR_NOADMININFO' => '423',
'ERR_FILEERROR' => '424',
'ERR_NONICKNAMEGIVEN' => '431',
'ERR_ERRONEUSNICKNAME' => '432',
'ERR_NICKNAMEINUSE' => '433',
'ERR_NICKCOLLISION' => '436',
'ERR_UNAVAILRESOURCE' => '437',
'ERR_USERNOTINCHANNEL' => '441',
'ERR_NOTONCHANNEL' => '442',
'ERR_USERONCHANNEL' => '443',
'ERR_NOLOGIN' => '444',
'ERR_SUMMONDISABLED' => '445',
'ERR_USERSDISABLED' => '446',
'ERR_NOTREGISTERED' => '451',
'ERR_NEEDMOREPARAMS' => '461',
'ERR_ALREADYREGISTRED' => '462',
'ERR_NOPERMFORHOST' => '463',
'ERR_PASSWDMISMATCH' => '464',
'ERR_YOUREBANNEDCREEP' => '465',
'ERR_YOUWILLBEBANNED' => '466',
'ERR_KEYSET' => '467',
'ERR_CHANNELISFULL' => '471',
'ERR_UNKNOWNMODE' => '472',
'ERR_INVITEONLYCHAN' => '473',
'ERR_BANNEDFROMCHAN' => '474',
'ERR_BADCHANNELKEY' => '475',
'ERR_BADCHANMASK' => '476',
'ERR_NOCHANMODES' => '477',
'ERR_BANLISTFULL' => '478',
'ERR_NOPRIVILEGES' => '481',
'ERR_CHANOPRIVSNEEDED' => '482',
'ERR_CANTKILLSERVER' => '483',
'ERR_RESTRICTED' => '484',
'ERR_UNIQOPPRIVSNEEDED' => '485',
'ERR_NOOPERHOST' => '491',
'ERR_UMODEUNKNOWNFLAG' => '501',
'ERR_USERSDONTMATCH' => '502',
);
$SMARTIRC_nreplycodes = array();
foreach ($SMARTIRC_replycodes as $key => $value) {
define('SMARTIRC_'.$key, $value);
$SMARTIRC_nreplycodes[$value] = $key;
}
?>
define('SMARTIRC_' . $key, $value);
$SMARTIRC_nreplycodes[$value] = $key;
}
+18 -14
View File
@@ -26,20 +26,24 @@
class Net_SmartIRC_irccommands extends Net_SmartIRC_base
{
/**
* sends a new message
*
* Sends a message to a channel or user.
*
* @see DOCUMENTATION
* @param integer $type specifies the type, like QUERY/ACTION or CTCP see 'Message Types'
* @param string $destination can be a user or channel
* @param mixed $message the message
* @return boolean
* @access public
*/
function message($type, $destination, $messagearray, $priority = SMARTIRC_MEDIUM)
{
/**
* sends a new message
*
* Sends a message to a channel or user.
*
* @see DOCUMENTATION
*
* @param integer $type specifies the type, like QUERY/ACTION or CTCP see 'Message Types'
* @param string $destination can be a user or channel
* @param $messagearray
* @param int $priority
*
* @internal param mixed $message the message
* @return boolean
* @access public
*/
function message($type, $destination, $messagearray, $priority = SMARTIRC_MEDIUM)
{
if (!is_array($messagearray)) {
$messagearray = array($messagearray);
}
+27 -25
View File
@@ -2,33 +2,35 @@
class Net_SmartIRC_module_PingFix
{
public $name = 'PingFix';
public $version = '1.0';
public $description = 'An active-pinging system to keep the bot from dropping the connection';
public $author = 'Garrett W.';
public $license = 'LGPL';
public $name = 'PingFix';
public $version = '1.0';
public $description = 'An active-pinging system to keep the bot from dropping the connection';
public $author = 'Garrett W.';
public $license = 'LGPL';
private $irc;
private $thid;
private $irc;
private $thid;
function __construct (&$irc) {
$this->irc = $irc;
$this->thid = $this->irc->registerTimehandler(
$this->irc->_rxtimeout/8*1000, $this, 'pingCheck'
);
}
function __construct(&$irc)
{
$this->irc = $irc;
$this->thid = $this->irc->registerTimehandler(
$this->irc->_rxtimeout / 8 * 1000, $this, 'pingCheck'
);
}
function __destruct () {
$this->irc->unregisterTimeid($this->thid);
}
function __destruct()
{
$this->irc->unregisterTimeid($this->thid);
}
function pingCheck () {
if (time() - $this->irc->_lastrx > $this->irc->_rxtimeout) {
$this->irc->reconnect();
$this->irc->_lastrx = time();
} elseif (time() - $this->irc->_lastrx > $this->irc->_rxtimeout/3) {
$this->irc->_send('PING '.$this->irc->_address, SMARTIRC_CRITICAL);
}
}
function pingCheck()
{
if (time() - $this->irc->_lastrx > $this->irc->_rxtimeout) {
$this->irc->reconnect();
$this->irc->_lastrx = time();
} elseif (time() - $this->irc->_lastrx > $this->irc->_rxtimeout / 3) {
$this->irc->_send('PING ' . $this->irc->_address, SMARTIRC_CRITICAL);
}
}
}
?>
+189 -179
View File
@@ -104,7 +104,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
*
* @var array
* @access private
* @since 1.3.0
* @since 1.3.0
*/
var $_overviewFormatCache = null;
@@ -135,17 +135,17 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/connect.php}
*
* @param string $host (optional) The hostname og IP-address of the NNTP-server to connect to, defaults to localhost.
* @param mixed $encryption (optional) false|'tls'|'ssl', defaults to false.
* @param int $port (optional) The port number to connect to, defaults to 119 or 563 dependng on $encryption.
* @param int $timeout (optional)
* @param string $host (optional) The hostname og IP-address of the NNTP-server to connect to, defaults to localhost.
* @param mixed $encryption (optional) false|'tls'|'ssl', defaults to false.
* @param int $port (optional) The port number to connect to, defaults to 119 or 563 dependng on $encryption.
* @param int $timeout (optional)
*
* @return mixed <br>
* - (bool) True when posting allowed, otherwise false
* - (object) Pear_Error on failure
* - (bool) True when posting allowed, otherwise false
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::disconnect()
* @see Net_NNTP_Client::authenticate()
* @see Net_NNTP_Client::disconnect()
* @see Net_NNTP_Client::authenticate()
*/
function connect($host = null, $encryption = null, $port = null, $timeout = 15)
{
@@ -176,13 +176,14 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
*
* @return mixed <br>
* - (bool)
* - (object) Pear_Error on failure
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::connect()
* @see Net_NNTP_Client::connect()
*/
function disconnect()
{
$this->resetProperties();
return parent::disconnect();
}
@@ -201,14 +202,14 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/authenticate.php}
*
* @param string $user The username
* @param string $pass The password
* @param string $user The username
* @param string $pass The password
*
* @return mixed <br>
* - (bool) True on successful authentification, otherwise false
* - (object) Pear_Error on failure
* - (bool) True on successful authentification, otherwise false
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::connect()
* @see Net_NNTP_Client::connect()
*/
function authenticate($user, $pass)
{
@@ -237,18 +238,18 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/selectGroup.php}
*
* @param string $group Name of the group to select
* @param mixed $articles (optional) experimental! When true the article numbers is returned in 'articles'
* @param string $group Name of the group to select
* @param mixed $articles (optional) experimental! When true the article numbers is returned in 'articles'
*
* @return mixed <br>
* - (array) Summary about the selected group
* - (object) Pear_Error on failure
* - (array) Summary about the selected group
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getGroups()
* @see Net_NNTP_Client::group()
* @see Net_NNTP_Client::first()
* @see Net_NNTP_Client::last()
* @see Net_NNTP_Client::count()
* @see Net_NNTP_Client::getGroups()
* @see Net_NNTP_Client::group()
* @see Net_NNTP_Client::first()
* @see Net_NNTP_Client::last()
* @see Net_NNTP_Client::count()
*/
function selectGroup($group, $articles = false)
{
@@ -292,17 +293,17 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/selectPreviousArticle.php}
*
* @param int $_ret (optional) Experimental
* @param int $_ret (optional) Experimental
*
* @return mixed <br>
* - (integer) Article number, if $ret=0 (default)
* - (string) Message-id, if $ret=1
* - (array) Both article number and message-id, if $ret=-1
* - (bool) False if no prevoius article exists
* - (object) Pear_Error on failure
* - (integer) Article number, if $ret=0 (default)
* - (string) Message-id, if $ret=1
* - (array) Both article number and message-id, if $ret=-1
* - (bool) False if no prevoius article exists
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::selectArticle()
* @see Net_NNTP_Client::selectNextArticle()
* @see Net_NNTP_Client::selectArticle()
* @see Net_NNTP_Client::selectNextArticle()
*/
function selectPreviousArticle($_ret = 0)
{
@@ -314,13 +315,13 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
switch ($_ret) {
case -1:
return array('Number' => (int) $response[0], 'Message-ID' => (string) $response[1]);
return array('Number' => (int)$response[0], 'Message-ID' => (string)$response[1]);
break;
case 0:
return (int) $response[0];
return (int)$response[0];
break;
case 1:
return (string) $response[1];
return (string)$response[1];
break;
default:
error(); // ...
@@ -338,17 +339,17 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/selectNextArticle.php}
*
* @param int $_ret (optional) Experimental
* @param int $_ret (optional) Experimental
*
* @return mixed <br>
* - (integer) Article number, if $ret=0 (default)
* - (string) Message-id, if $ret=1
* - (array) Both article number and message-id, if $ret=-1
* - (bool) False if no further articles exist
* - (object) Pear_Error on unexpected failure
* - (integer) Article number, if $ret=0 (default)
* - (string) Message-id, if $ret=1
* - (array) Both article number and message-id, if $ret=-1
* - (bool) False if no further articles exist
* - (object) Pear_Error on unexpected failure
* @access public
* @see Net_NNTP_Client::selectArticle()
* @see Net_NNTP_Client::selectPreviousArticle()
* @see Net_NNTP_Client::selectArticle()
* @see Net_NNTP_Client::selectPreviousArticle()
*/
function selectNextArticle($_ret = 0)
{
@@ -360,13 +361,13 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
switch ($_ret) {
case -1:
return array('Number' => (int) $response[0], 'Message-ID' => (string) $response[1]);
return array('Number' => (int)$response[0], 'Message-ID' => (string)$response[1]);
break;
case 0:
return (int) $response[0];
return (int)$response[0];
break;
case 1:
return (string) $response[1];
return (string)$response[1];
break;
default:
error(); // ...
@@ -384,17 +385,17 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/selectArticle.php}
*
* @param mixed $article The message-number (on the server) of
* @param mixed $article The message-number (on the server) of
* the article to select as current article.
* @param int $_ret (optional) Experimental
* @param int $_ret (optional) Experimental
*
* @return mixed <br>
* - (integer) Article number
* - (bool) False if article doesn't exists
* - (object) Pear_Error on failure
* - (integer) Article number
* - (bool) False if article doesn't exists
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::selectNextArticle()
* @see Net_NNTP_Client::selectPreviousArticle()
* @see Net_NNTP_Client::selectNextArticle()
* @see Net_NNTP_Client::selectPreviousArticle()
*/
function selectArticle($article = null, $_ret = 0)
{
@@ -406,13 +407,13 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
switch ($_ret) {
case -1:
return array('Number' => (int) $response[0], 'Message-ID' => (string) $response[1]);
return array('Number' => (int)$response[0], 'Message-ID' => (string)$response[1]);
break;
case 0:
return (int) $response[0];
return (int)$response[0];
break;
case 1:
return (string) $response[1];
return (string)$response[1];
break;
default:
error(); // ...
@@ -431,20 +432,20 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getArticle.php}
*
* @param mixed $article (optional) Either the message-id or the
* @param mixed $article (optional) Either the message-id or the
* message-number on the server of the
* article to fetch.
* @param bool $implode (optional) When true the result array
* @param bool $implode (optional) When true the result array
* is imploded to a string, defaults to
* false.
*
* @return mixed <br>
* - (array) Complete article (when $implode is false)
* - (string) Complete article (when $implode is true)
* - (object) Pear_Error on failure
* - (array) Complete article (when $implode is false)
* - (string) Complete article (when $implode is true)
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getHeader()
* @see Net_NNTP_Client::getBody()
* @see Net_NNTP_Client::getHeader()
* @see Net_NNTP_Client::getBody()
*/
function getArticle($article = null, $implode = false)
{
@@ -490,20 +491,20 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getHeader.php}
*
* @param mixed $article (optional) Either message-id or message
* @param mixed $article (optional) Either message-id or message
* number of the article to fetch.
* @param bool $implode (optional) When true the result array
* @param bool $implode (optional) When true the result array
* is imploded to a string, defaults to
* false.
*
* @return mixed <br>
* - (bool) False if article does not exist
* - (array) Header fields (when $implode is false)
* - (string) Header fields (when $implode is true)
* - (object) Pear_Error on failure
* - (bool) False if article does not exist
* - (array) Header fields (when $implode is false)
* - (string) Header fields (when $implode is true)
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getArticle()
* @see Net_NNTP_Client::getBody()
* @see Net_NNTP_Client::getArticle()
* @see Net_NNTP_Client::getBody()
*/
function getHeader($article = null, $implode = false)
{
@@ -549,20 +550,20 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getBody.php}
*
* @param mixed $article (optional) Either the message-id or the
* @param mixed $article (optional) Either the message-id or the
* message-number on the server of the
* article to fetch.
* @param bool $implode (optional) When true the result array
* @param bool $implode (optional) When true the result array
* is imploded to a string, defaults to
* false.
*
* @return mixed <br>
* - (array) Message body (when $implode is false)
* - (string) Message body (when $implode is true)
* - (object) Pear_Error on failure
* - (array) Message body (when $implode is false)
* - (string) Message body (when $implode is true)
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getHeader()
* @see Net_NNTP_Client::getArticle()
* @see Net_NNTP_Client::getHeader()
* @see Net_NNTP_Client::getArticle()
*/
function getBody($article = null, $implode = false)
{
@@ -605,14 +606,14 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/post.php}
*
* @param mixed $article <br>
* - (string) Complete article in a ready to send format (lines terminated by LFCR etc.)
* - (array) First key is the article header, second key is article body - any further keys are ignored !!!
* - (mixed) Something 'callable' (which must return otherwise acceptable data as replacement)
* @param mixed $article <br>
* - (string) Complete article in a ready to send format (lines terminated by LFCR etc.)
* - (array) First key is the article header, second key is article body - any further keys are ignored !!!
* - (mixed) Something 'callable' (which must return otherwise acceptable data as replacement)
*
* @return mixed <br>
* - (string) Server response
* - (object) Pear_Error on failure
* - (string) Server response
* - (object) Pear_Error on failure
* @access public
* @ignore
*/
@@ -671,14 +672,14 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/mail.php}
*
* @param string $groups The groups to post to.
* @param string $subject The subject of the article.
* @param string $body The body of the article.
* @param string $additional (optional) Additional header fields to send.
* @param string $groups The groups to post to.
* @param string $subject The subject of the article.
* @param string $body The body of the article.
* @param string $additional (optional) Additional header fields to send.
*
* @return mixed <br>
* - (string) Server response
* - (object) Pear_Error on failure
* - (string) Server response
* - (object) Pear_Error on failure
* @access public
*/
function mail($groups, $subject, $body, $additional = null)
@@ -715,14 +716,14 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getDate.php}
*
* @param int $format (optional) Determines the format of returned date:
* @param int $format (optional) Determines the format of returned date:
* - 0: return string
* - 1: return integer/timestamp
* - 2: return an array('y'=>year, 'm'=>month,'d'=>day)
*
* @return mixed <br>
* - (mixed)
* - (object) Pear_Error on failure
* - (object) Pear_Error on failure
* @access public
*/
function getDate($format = 1)
@@ -741,8 +742,9 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
break;
case 2:
return array('y' => substr($date, 0, 4),
'm' => substr($date, 4, 2),
'd' => substr($date, 6, 2));
'm' => substr($date, 4, 2),
'd' => substr($date, 6, 2)
);
break;
default:
error();
@@ -761,14 +763,14 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getNewGroups.php}
*
* @param mixed $time <br>
* - (integer) A timestamp
* - (string) Somthing parseable by strtotime() like '-1 week'
* @param string $distributions (optional)
* @param mixed $time <br>
* - (integer) A timestamp
* - (string) Somthing parseable by strtotime() like '-1 week'
* @param string $distributions (optional)
*
* @return mixed <br>
* - (array)
* - (object) Pear_Error on failure
* - (object) Pear_Error on failure
* @access public
*/
function getNewGroups($time, $distributions = null)
@@ -801,17 +803,17 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getNewArticles.php}
*
* @param mixed $time <br>
* - (integer) A timestamp
* - (string) Somthing parseable by strtotime() like '-1 week'
* @param string $groups (optional)
* @param string $distributions (optional)
* @param mixed $time <br>
* - (integer) A timestamp
* - (string) Somthing parseable by strtotime() like '-1 week'
* @param string $groups (optional)
* @param string $distributions (optional)
*
* @return mixed <br>
* - (array)
* - (object) Pear_Error on failure
* - (object) Pear_Error on failure
* @access public
* @since 1.3.0
* @since 1.3.0
*/
function getNewArticles($time, $groups = '*', $distribution = null)
{
@@ -844,11 +846,11 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* {@example docs/examples/phpdoc/getGroups.php}
*
* @return mixed <br>
* - (array) Nested array with information about every valid group
* - (object) Pear_Error on failure
* - (array) Nested array with information about every valid group
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getDescriptions()
* @see Net_NNTP_Client::selectGroup()
* @see Net_NNTP_Client::getDescriptions()
* @see Net_NNTP_Client::selectGroup()
*/
function getGroups($wildmat = null)
{
@@ -907,13 +909,13 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getDescriptions.php}
*
* @param mixed $wildmat (optional)
* @param mixed $wildmat (optional)
*
* @return mixed <br>
* - (array) Associated array with descriptions of known groups
* - (object) Pear_Error on failure
* - (array) Associated array with descriptions of known groups
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getGroups()
* @see Net_NNTP_Client::getGroups()
*/
function getDescriptions($wildmat = null)
{
@@ -961,20 +963,20 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getOverview.php}
*
* @param mixed $range (optional)
* - '<message number>'
* - '<message number>-<message number>'
* - '<message number>-'
* - '<message-id>'
* @param boolean $_names (optional) experimental parameter! Use field names as array kays
* @param boolean $_forceNames (optional) experimental parameter!
* @param mixed $range (optional)
* - '<message number>'
* - '<message number>-<message number>'
* - '<message number>-'
* - '<message-id>'
* @param boolean $_names (optional) experimental parameter! Use field names as array kays
* @param boolean $_forceNames (optional) experimental parameter!
*
* @return mixed <br>
* - (array) Nested array of article overview data
* - (object) Pear_Error on failure
* - (array) Nested array of article overview data
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getHeaderField()
* @see Net_NNTP_Client::getOverviewFormat()
* @see Net_NNTP_Client::getHeaderField()
* @see Net_NNTP_Client::getOverviewFormat()
*/
function getOverview($range = null, $_names = true, $_forceNames = true)
{
@@ -1010,6 +1012,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
// Use 'Message-ID' field as key
$articles[$article['Message-ID']] = $article;
}
return $articles;
}
@@ -1107,10 +1110,10 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* {@example docs/examples/phpdoc/getOveriewFormat.php}
*
* @return mixed <br>
* - (array) Overview field names
* - (object) Pear_Error on failure
* - (array) Overview field names
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getOverview()
* @see Net_NNTP_Client::getOverview()
*/
function getOverviewFormat($_forceNames = true, $_full = false)
{
@@ -1122,13 +1125,15 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
// Force name of first seven fields
if ($_forceNames) {
array_splice($format, 0, 7);
$format = array_merge(array('Subject' => false,
'From' => false,
'Date' => false,
'Message-ID' => false,
'References' => false,
':bytes' => false,
':lines' => false), $format);
$format = array_merge(array('Subject' => false,
'From' => false,
'Date' => false,
'Message-ID' => false,
'References' => false,
':bytes' => false,
':lines' => false
), $format
);
}
if ($_full) {
@@ -1153,19 +1158,19 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getHeaderField.php}
*
* @param string $field The name of the header field to retreive
* @param mixed $range (optional)
* @param string $field The name of the header field to retreive
* @param mixed $range (optional)
* '<message number>'
* '<message number>-<message number>'
* '<message number>-'
* '<message-id>'
*
* @return mixed <br>
* - (array) Nested array of
* - (object) Pear_Error on failure
* - (array) Nested array of
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getOverview()
* @see Net_NNTP_Client::getReferences()
* @see Net_NNTP_Client::getOverview()
* @see Net_NNTP_Client::getReferences()
*/
function getHeaderField($field, $range = null)
{
@@ -1211,13 +1216,13 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getGroupArticles.php}
*
* @param mixed $range (optional) Experimental!
* @param mixed $range (optional) Experimental!
*
* @return mixed <br>
* - (array)
* - (object) Pear_Error on failure
* - (object) Pear_Error on failure
* @access public
* @since 1.3.0
* @since 1.3.0
*/
function getGroupArticles($range = null)
{
@@ -1253,17 +1258,17 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* <b>Usage example:</b>
* {@example docs/examples/phpdoc/getReferences.php}
*
* @param mixed $range (optional)
* @param mixed $range (optional)
* '<message number>'
* '<message number>-<message number>'
* '<message number>-'
* '<message-id>'
*
* @return mixed <br>
* - (array) Nested array of references
* - (object) Pear_Error on failure
* - (array) Nested array of references
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::getHeaderField()
* @see Net_NNTP_Client::getHeaderField()
*/
function getReferences($range = null)
{
@@ -1340,13 +1345,13 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* {@example docs/examples/phpdoc/count.php}
*
* @return mixed <br>
* - (string) the number of article in group
* - (object) Pear_Error on failure
* - (string) the number of article in group
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::group()
* @see Net_NNTP_Client::first()
* @see Net_NNTP_Client::last()
* @see Net_NNTP_Client::selectGroup()
* @see Net_NNTP_Client::group()
* @see Net_NNTP_Client::first()
* @see Net_NNTP_Client::last()
* @see Net_NNTP_Client::selectGroup()
* @ignore
*/
function count()
@@ -1364,13 +1369,13 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* {@example docs/examples/phpdoc/last.php}
*
* @return mixed <br>
* - (string) the last article's number
* - (object) Pear_Error on failure
* - (string) the last article's number
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::first()
* @see Net_NNTP_Client::group()
* @see Net_NNTP_Client::count()
* @see Net_NNTP_Client::selectGroup()
* @see Net_NNTP_Client::first()
* @see Net_NNTP_Client::group()
* @see Net_NNTP_Client::count()
* @see Net_NNTP_Client::selectGroup()
* @ignore
*/
function last()
@@ -1388,13 +1393,13 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* {@example docs/examples/phpdoc/first.php}
*
* @return mixed <br>
* - (string) the first article's number
* - (object) Pear_Error on failure
* - (string) the first article's number
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::last()
* @see Net_NNTP_Client::group()
* @see Net_NNTP_Client::count()
* @see Net_NNTP_Client::selectGroup()
* @see Net_NNTP_Client::last()
* @see Net_NNTP_Client::group()
* @see Net_NNTP_Client::count()
* @see Net_NNTP_Client::selectGroup()
* @ignore
*/
function first()
@@ -1412,13 +1417,13 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
* {@example docs/examples/phpdoc/group.php}
*
* @return mixed <br>
* - (string) group name
* - (object) Pear_Error on failure
* - (string) group name
* - (object) Pear_Error on failure
* @access public
* @see Net_NNTP_Client::first()
* @see Net_NNTP_Client::last()
* @see Net_NNTP_Client::count()
* @see Net_NNTP_Client::selectGroup()
* @see Net_NNTP_Client::first()
* @see Net_NNTP_Client::last()
* @see Net_NNTP_Client::count()
* @see Net_NNTP_Client::selectGroup()
* @ignore
*/
function group()
@@ -1432,16 +1437,17 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
/**
* Test whether a connection is currently open or closed.
*
* @return bool True if connected, otherwise false
* @access public
* @see Net_NNTP_Client::connect()
* @see Net_NNTP_Client::quit()
* @deprecated since v1.3.0 due to use of protected method: Net_NNTP_Protocol_Client::isConnected()
* @return bool True if connected, otherwise false
* @access public
* @see Net_NNTP_Client::connect()
* @see Net_NNTP_Client::quit()
* @deprecated since v1.3.0 due to use of protected method: Net_NNTP_Protocol_Client::isConnected()
* @ignore
*/
function isConnected()
{
trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: isConnected() !', E_USER_NOTICE);
return parent::_isConnected();
}
@@ -1457,6 +1463,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
function getArticleRaw($article, $implode = false)
{
trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: getArticleRaw() !', E_USER_NOTICE);
return $this->getArticle($article, $implode);
}
@@ -1472,6 +1479,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
function getHeaderRaw($article = null, $implode = false)
{
trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: getHeaderRaw() !', E_USER_NOTICE);
return $this->getHeader($article, $implode);
}
@@ -1487,6 +1495,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
function getBodyRaw($article = null, $implode = false)
{
trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: getBodyRaw() !', E_USER_NOTICE);
return $this->getBody($article, $implode);
}
@@ -1502,6 +1511,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
function getNewNews($time, $groups = '*', $distribution = null)
{
trigger_error('You are using deprecated API v1.1 in Net_NNTP_Client: getNewNews() !', E_USER_NOTICE);
return $this->getNewArticles($time, $groups, $distribution);
}
@@ -1517,6 +1527,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
function getReferencesOverview($first, $last)
{
trigger_error('You are using deprecated API v1.0 in Net_NNTP_Client: getReferencesOverview() !', E_USER_NOTICE);
return $this->getReferences($first . '-' . $last);
}
@@ -1524,4 +1535,3 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client
}
// }}}
?>
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -1,6 +1,6 @@
<?php
require_once(WWW_DIR."/lib/framework/db.php");
require_once(WWW_DIR."/lib/site.php");
require_once(WWW_DIR . "/lib/framework/db.php");
require_once(WWW_DIR . "/lib/site.php");
class Tmux
{
@@ -13,6 +13,7 @@ class Tmux
{
$s = new Sites();
$site = $s->get();
return $site->version;
}
@@ -55,6 +56,7 @@ class Tmux
}
$obj->{'version'} = $this->version();
return $obj;
}
@@ -73,7 +75,7 @@ class Tmux
{
$db = $this->db;
$sql = sprintf("UPDATE tmux SET value = %s WHERE setting = %s", $db->escapeString($value), $db->escapeString($setting));
return $db->exec($sql);
}
}
?>
}
+19 -14
View File
@@ -433,7 +433,7 @@ class NNTP extends Net_NNTP_Client
*
* @param string $groupName The name of the group the articles are in.
* @param array|string|int $identifiers Message-ID(string) or article number(int), or array containing M-ID's or A-Numbers.
*
*
*
* @return string On success : The article bodies.
* @return object On failure : Pear error.
@@ -981,15 +981,17 @@ class NNTP extends Net_NNTP_Client
/**
* Decode a string of text encoded with yEnc.
*
* @note For usage outside of this class, please use the YEnc library.
* @note For usage outside of this class, please use the YEnc library.
*
* @param string $string The encoded text to decode.
* @param $data
*
* @internal param string $string The encoded text to decode.
*
* @return string The decoded yEnc string, or the input, if it's not yEnc.
*
* @access protected
* @access protected
*
* @TODO: ? Maybe this function should be merged into the YEnc class?
* @TODO : ? Maybe this function should be merged into the YEnc class?
*/
protected function _decodeYEnc($data)
{
@@ -1325,15 +1327,18 @@ class NNTP extends Net_NNTP_Client
}
/**
* Fetch message header from message number $first until $last
* The format of the returned array is:
* $messages[message_id][header_name]
* @param optional string $range articles to fetch
* @return mixed (array) nested array of message and there headers on success or (object) pear_error on failure
* @access protected
*/
function cmdXZver($range = null)
{
* Fetch message header from message number $first until $last
* The format of the returned array is:
* $messages[message_id][header_name]
*
* @param null $range
*
* @internal param string $optional $range articles to fetch
* @return mixed (array) nested array of message and there headers on success or (object) pear_error on failure
* @access protected
*/
function cmdXZver($range = null)
{
if (is_null($range))
$command = 'XZVER';
else
File diff suppressed because it is too large Load Diff
@@ -1,99 +1,136 @@
{$rsshead}
<newznab:response offset="{$offset}" total="{if $releases|@count > 0}{$releases[0]._totalrows}{else}0{/if}" />
<newznab:response offset="{$offset}" total="{if $releases|@count > 0}{$releases[0]._totalrows}{else}0{/if}"/>
{foreach from=$releases item=release}
<item>
<title>{$release.searchname|escape:html}</title>
<guid isPermaLink="true">{$serverroot}details/{$release.guid}</guid>
<link>{$serverroot}getnzb/{$release.guid}.nzb&amp;i={$uid}&amp;r={$rsstoken}</link>
<comments>{$serverroot}details/{$release.guid}#comments</comments>
<pubDate>{$release.adddate|phpdate_format:"DATE_RSS"}</pubDate>
<category>{$release.category_name|escape:html}</category>
<description>{$release.searchname|escape:html}</description>
<enclosure url="{$serverroot}getnzb/{$release.guid}.nzb&amp;i={$uid}&amp;r={$rsstoken}" length="{$release.size}" type="application/x-nzb" />
<item>
<title>{$release.searchname|escape:html}</title>
<guid isPermaLink="true">{$serverroot}details/{$release.guid}</guid>
<link>{$serverroot}getnzb/{$release.guid}.nzb&amp;i={$uid}&amp;r={$rsstoken}</link>
<comments>{$serverroot}details/{$release.guid}#comments</comments>
<pubDate>{$release.adddate|phpdate_format:"DATE_RSS"}</pubDate>
<category>{$release.category_name|escape:html}</category>
<description>{$release.searchname|escape:html}</description>
<enclosure url="{$serverroot}getnzb/{$release.guid}.nzb&amp;i={$uid}&amp;r={$rsstoken}" length="{$release.size}"
type="application/x-nzb"/>
{foreach from=$release.category_ids|parray:"," item=cat}
<newznab:attr name="category" value="{$cat}" />
{/foreach}
<newznab:attr name="size" value="{$release.size}" />
<newznab:attr name="guid" value="{$release.guid}" />
{if $extended=="1" || isset($attrs.files)} <newznab:attr name="files" value="{$release.totalpart}" />
{/if}
{if $extended=="1" || isset($attrs.poster)} <newznab:attr name="poster" value="{$release.fromname|escape:html}" />
{/if}
{if $release.season != "" && ($extended=="1" || isset($attrs.season))} <newznab:attr name="season" value="{$release.season}" />
{/if}
{if $release.episode != "" && ($extended=="1" || isset($attrs.episode))} <newznab:attr name="episode" value="{$release.episode}" />
{/if}
{if $release.rageID != "-1" && $release.rageID != "-2" && ($extended=="1" || isset($attrs.rageid))} <newznab:attr name="rageid" value="{$release.rageID}" />
{/if}
{if $release.tvtitle != "" && ($extended=="1" || isset($attrs.tvtitle))} <newznab:attr name="tvtitle" value="{$release.tvtitle|escape:html}" />
{/if}
{if $release.tvairdate != "" && ($extended=="1" || isset($attrs.tvairdate))} <newznab:attr name="tvairdate" value="{$release.tvairdate|phpdate_format:"DATE_RSS"}" />
{/if}
{if $release.imdbID != "" && ($extended=="1" || isset($attrs.imdb))} <newznab:attr name="imdb" value="{$release.imdbID}" />
{/if}
{if $release.moi_title != "" && ($extended=="1" || isset($attrs.imdbtitle))} <newznab:attr name="imdbtitle" value="{$release.moi_title|escape:html}" />
{/if}
{if $release.moi_tagline != "" && ($extended=="1" || isset($attrs.imdbtagline))} <newznab:attr name="imdbtagline" value="{$release.moi_tagline|escape:html}" />
{/if}
{if $release.moi_plot != "" && ($extended=="1" || isset($attrs.imdbplot))} <newznab:attr name="imdbplot" value="{$release.moi_plot|escape:html}" />
{/if}
{if $release.moi_rating != "" && ($extended=="1" || isset($attrs.imdbscore))} <newznab:attr name="imdbscore" value="{$release.moi_rating}" />
{/if}
{if $release.moi_genre != "" && ($extended=="1" || isset($attrs.genre))} <newznab:attr name="genre" value="{$release.moi_genre|escape:html}" />
{/if}
{if $release.moi_year != "" && ($extended=="1" || isset($attrs.imdbyear))} <newznab:attr name="imdbyear" value="{$release.moi_year}" />
{/if}
{if $release.moi_director != "" && ($extended=="1" || isset($attrs.imdbdirector))} <newznab:attr name="imdbdirector" value="{$release.moi_director|escape:html}" />
{/if}
{if $release.moi_actors != "" && ($extended=="1" || isset($attrs.imdbactors))} <newznab:attr name="imdbactors" value="{$release.moi_actors|escape:html}" />
{/if}
{if $release.moi_cover == 1 && ($extended=="1" || isset($attrs.coverurl))} <newznab:attr name="coverurl" value="{$serverroot}covers/movies/{$release.imdbID}-cover.jpg" />
{/if}
{if $release.moi_backdrop == 1 && ($extended=="1" || isset($attrs.backdropurl))} <newznab:attr name="backdropurl" value="{$serverroot}covers/movies/{$release.imdbID}-backdrop.jpg" />
{/if}
{if $release.musicinfoID != "" && $release.mi_title != "" && ($extended=="1" || isset($attrs.album))} <newznab:attr name="album" value="{$release.mi_title|escape:html}" />
{/if}
{if $release.musicinfoID != "" && $release.mi_artist != "" && ($extended=="1" || isset($attrs.artist))} <newznab:attr name="artist" value="{$release.mi_artist|escape:html}" />
{/if}
{if $release.musicinfoID != "" && $release.mi_publisher != "" && ($extended=="1" || isset($attrs.label))} <newznab:attr name="label" value="{$release.mi_publisher|escape:html}" />
{/if}
{if $release.musicinfoID != "" && $release.mi_tracks != "" && ($extended=="1" || isset($attrs.tracks))} <newznab:attr name="tracks" value="{$release.mi_tracks|escape:html}" />
{/if}
{if $release.musicinfoID != "" && $release.mi_review != "" && ($extended=="1" || isset($attrs.review))} <newznab:attr name="review" value="{$release.mi_review|escape:html}" />
{/if}
{if $release.musicinfoID != "" && $release.mi_cover == "1" && ($extended=="1" || isset($attrs.coverurl))} <newznab:attr name="coverurl" value="{$serverroot}covers/music/{$release.musicinfoID}.jpg" />
{/if}
{if $release.musicinfoID != "" && $release.music_genrename != "" && ($extended=="1" || isset($attrs.genre))} <newznab:attr name="genre" value="{$release.music_genrename|escape:html}" />
{/if}
{if $release.bookinfoID != "" && $release.bi_author != "" && ($extended=="1" || isset($attrs.author))} <newznab:attr name="author" value="{$release.bi_author|escape:html}" />
{/if}
{if $release.bookinfoID != "" && $release.bi_title != "" && ($extended=="1" || isset($attrs.booktitle))} <newznab:attr name="booktitle" value="{$release.bi_title|escape:html}" />
{/if}
{if $release.bookinfoID != "" && $release.bi_cover == "1" && ($extended=="1" || isset($attrs.coverurl))} <newznab:attr name="coverurl" value="{$serverroot}covers/book/{$release.bookinfoID}.jpg" />
{/if}
{if $release.bookinfoID != "" && $release.bi_review != "" && ($extended=="1" || isset($attrs.review))} <newznab:attr name="review" value="{$release.bi_review|escape:html}" />
{/if}
{if $release.bookinfoID != "" && $release.bi_publishdate != "" && ($extended=="1" || isset($attrs.publishdate))} <newznab:attr name="publishdate" value="{$release.bi_publishdate|phpdate_format:"DATE_RSS"}" />
{/if}
{if $release.bookinfoID != "" && $release.bi_publisher != "" && ($extended=="1" || isset($attrs.publisher))} <newznab:attr name="publisher" value="{$release.bi_publisher|escape:html}" />
{/if}
{if $release.bookinfoID != "" && $release.bi_pages != "" && ($extended=="1" || isset($attrs.pages))} <newznab:attr name="pages" value="{$release.bi_pages|escape:html}" />
{/if}
{foreach from=$release.category_ids|parray:"," item=cat}
<newznab:attr name="category" value="{$cat}"/>
{/foreach}
<newznab:attr name="size" value="{$release.size}"/>
<newznab:attr name="guid" value="{$release.guid}"/>
{if $extended=="1" || isset($attrs.files)}
<newznab:attr name="files" value="{$release.totalpart}"/>
{/if}
{if $extended=="1" || isset($attrs.poster)}
<newznab:attr name="poster" value="{$release.fromname|escape:html}"/>
{/if}
{if $release.season != "" && ($extended=="1" || isset($attrs.season))}
<newznab:attr name="season" value="{$release.season}"/>
{/if}
{if $release.episode != "" && ($extended=="1" || isset($attrs.episode))}
<newznab:attr name="episode" value="{$release.episode}"/>
{/if}
{if $release.rageID != "-1" && $release.rageID != "-2" && ($extended=="1" || isset($attrs.rageid))}
<newznab:attr name="rageid" value="{$release.rageID}"/>
{/if}
{if $release.tvtitle != "" && ($extended=="1" || isset($attrs.tvtitle))}
<newznab:attr name="tvtitle" value="{$release.tvtitle|escape:html}"/>
{/if}
{if $release.tvairdate != "" && ($extended=="1" || isset($attrs.tvairdate))}
<newznab:attr name="tvairdate" value="{$release.tvairdate|phpdate_format:"DATE_RSS"}"/>
{/if}
{if $release.imdbID != "" && ($extended=="1" || isset($attrs.imdb))}
<newznab:attr name="imdb" value="{$release.imdbID}"/>
{/if}
{if $release.moi_title != "" && ($extended=="1" || isset($attrs.imdbtitle))}
<newznab:attr name="imdbtitle" value="{$release.moi_title|escape:html}"/>
{/if}
{if $release.moi_tagline != "" && ($extended=="1" || isset($attrs.imdbtagline))}
<newznab:attr name="imdbtagline" value="{$release.moi_tagline|escape:html}"/>
{/if}
{if $release.moi_plot != "" && ($extended=="1" || isset($attrs.imdbplot))}
<newznab:attr name="imdbplot" value="{$release.moi_plot|escape:html}"/>
{/if}
{if $release.moi_rating != "" && ($extended=="1" || isset($attrs.imdbscore))}
<newznab:attr name="imdbscore" value="{$release.moi_rating}"/>
{/if}
{if $release.moi_genre != "" && ($extended=="1" || isset($attrs.genre))}
<newznab:attr name="genre" value="{$release.moi_genre|escape:html}"/>
{/if}
{if $release.moi_year != "" && ($extended=="1" || isset($attrs.imdbyear))}
<newznab:attr name="imdbyear" value="{$release.moi_year}"/>
{/if}
{if $release.moi_director != "" && ($extended=="1" || isset($attrs.imdbdirector))}
<newznab:attr name="imdbdirector" value="{$release.moi_director|escape:html}"/>
{/if}
{if $release.moi_actors != "" && ($extended=="1" || isset($attrs.imdbactors))}
<newznab:attr name="imdbactors" value="{$release.moi_actors|escape:html}"/>
{/if}
{if $release.moi_cover == 1 && ($extended=="1" || isset($attrs.coverurl))}
<newznab:attr name="coverurl" value="{$serverroot}covers/movies/{$release.imdbID}-cover.jpg"/>
{/if}
{if $release.moi_backdrop == 1 && ($extended=="1" || isset($attrs.backdropurl))}
<newznab:attr name="backdropurl" value="{$serverroot}covers/movies/{$release.imdbID}-backdrop.jpg"/>
{/if}
{if $release.musicinfoID != "" && $release.mi_title != "" && ($extended=="1" || isset($attrs.album))}
<newznab:attr name="album" value="{$release.mi_title|escape:html}"/>
{/if}
{if $release.musicinfoID != "" && $release.mi_artist != "" && ($extended=="1" || isset($attrs.artist))}
<newznab:attr name="artist" value="{$release.mi_artist|escape:html}"/>
{/if}
{if $release.musicinfoID != "" && $release.mi_publisher != "" && ($extended=="1" || isset($attrs.label))}
<newznab:attr name="label" value="{$release.mi_publisher|escape:html}"/>
{/if}
{if $release.musicinfoID != "" && $release.mi_tracks != "" && ($extended=="1" || isset($attrs.tracks))}
<newznab:attr name="tracks" value="{$release.mi_tracks|escape:html}"/>
{/if}
{if $release.musicinfoID != "" && $release.mi_review != "" && ($extended=="1" || isset($attrs.review))}
<newznab:attr name="review" value="{$release.mi_review|escape:html}"/>
{/if}
{if $release.musicinfoID != "" && $release.mi_cover == "1" && ($extended=="1" || isset($attrs.coverurl))}
<newznab:attr name="coverurl" value="{$serverroot}covers/music/{$release.musicinfoID}.jpg"/>
{/if}
{if $release.musicinfoID != "" && $release.music_genrename != "" && ($extended=="1" || isset($attrs.genre))}
<newznab:attr name="genre" value="{$release.music_genrename|escape:html}"/>
{/if}
{if $release.bookinfoID != "" && $release.bi_author != "" && ($extended=="1" || isset($attrs.author))}
<newznab:attr name="author" value="{$release.bi_author|escape:html}"/>
{/if}
{if $release.bookinfoID != "" && $release.bi_title != "" && ($extended=="1" || isset($attrs.booktitle))}
<newznab:attr name="booktitle" value="{$release.bi_title|escape:html}"/>
{/if}
{if $release.bookinfoID != "" && $release.bi_cover == "1" && ($extended=="1" || isset($attrs.coverurl))}
<newznab:attr name="coverurl" value="{$serverroot}covers/book/{$release.bookinfoID}.jpg"/>
{/if}
{if $release.bookinfoID != "" && $release.bi_review != "" && ($extended=="1" || isset($attrs.review))}
<newznab:attr name="review" value="{$release.bi_review|escape:html}"/>
{/if}
{if $release.bookinfoID != "" && $release.bi_publishdate != "" && ($extended=="1" || isset($attrs.publishdate))}
<newznab:attr name="publishdate" value="{$release.bi_publishdate|phpdate_format:"DATE_RSS"}"/>
{/if}
{if $release.bookinfoID != "" && $release.bi_publisher != "" && ($extended=="1" || isset($attrs.publisher))}
<newznab:attr name="publisher" value="{$release.bi_publisher|escape:html}"/>
{/if}
{if $release.bookinfoID != "" && $release.bi_pages != "" && ($extended=="1" || isset($attrs.pages))}
<newznab:attr name="pages" value="{$release.bi_pages|escape:html}"/>
{/if}
{if $extended=="1" || isset($attrs.grabs)} <newznab:attr name="grabs" value="{$release.grabs}" />
{/if}
{if $extended=="1" || isset($attrs.comments)} <newznab:attr name="comments" value="{$release.comments}" />
{/if}
{if $extended=="1" || isset($attrs.password)} <newznab:attr name="password" value="{$release.passwordstatus}" />
{/if}
{if $extended=="1" || isset($attrs.usenetdate)} <newznab:attr name="usenetdate" value="{$release.postdate|phpdate_format:"DATE_RSS"}" />
{/if}
{if $extended=="1" || isset($attrs.group)} {$attrs.group}<newznab:attr name="group" value="{$release.group_name|escape:html}" />
{/if}
{if $extended=="1" || isset($attrs.grabs)}
<newznab:attr name="grabs" value="{$release.grabs}"/>
{/if}
{if $extended=="1" || isset($attrs.comments)}
<newznab:attr name="comments" value="{$release.comments}"/>
{/if}
{if $extended=="1" || isset($attrs.password)}
<newznab:attr name="password" value="{$release.passwordstatus}"/>
{/if}
{if $extended=="1" || isset($attrs.usenetdate)}
<newznab:attr name="usenetdate" value="{$release.postdate|phpdate_format:"DATE_RSS"}"/>
{/if}
{if $extended=="1" || isset($attrs.group)} {$attrs.group}
<newznab:attr name="group" value="{$release.group_name|escape:html}"/>
{/if}
</item>
</item>
{/foreach}
</channel>
@@ -1,4 +1,3 @@
<h1>Edit your profile</h1>
{if $error != ''}
@@ -9,125 +8,174 @@
<form action="profileedit?action=submit" method="post">
<fieldset>
<legend>User Details</legend>
<table class="input">
<tr><th width="100">Username:</th><td>{$user.username|escape:"htmlall"}</td></tr>
<tr><th>Email:</th><td><input id="email" class="long" name="email" type="text" value="{$user.email|escape:"htmlall"}"></input></td></tr>
<tr><th>Password:</th>
<td>
<input autocomplete="off" id="password" name="password" type="password" value=""></input>
<div class="hint">Only enter your password if you want to change it.</div>
</td>
</tr>
<tr><th>Confirm Password:</th><td><input autocomplete="off" id="confirmpassword" name="confirmpassword" type="password" value=""></input>
</td></tr>
<tr><th>Site Api/Rss Key:</th><td>{$user.rsstoken}<br/><a class="confirm_action" href="?action=newapikey">Generate</a></td></tr>
</table>
</fieldset>
<fieldset>
<legend>Site Preferences</legend>
<table class="input">
<tr><th>View Movie Page:</th>
<td>
<input id="movieview" name="movieview" value="1" type="checkbox" {if $user.movieview=="1"}checked="checked"{/if}></input>
<div class="hint">Browse movie covers. Only shows movies with known IMDB info.</div>
</td>
</tr>
<tr><th>View Music Page:</th>
<td>
<input id="musicview" name="musicview" value="1" type="checkbox" {if $user.musicview=="1"}checked="checked"{/if}></input>
<div class="hint">Browse music covers. Only shows music with known lookup info.</div>
</td>
</tr>
<tr><th>View Console Page:</th>
<td>
<input id="consoleview" name="consoleview" value="1" type="checkbox" {if $user.consoleview=="1"}checked="checked"{/if}></input>
<div class="hint">Browse console covers. Only shows games with known lookup info.</div>
</td>
</tr>
<tr><th>View Book Page:</th>
<td>
<input id="bookview" name="bookview" value="1" type="checkbox" {if $user.bookview=="1"}checked="checked"{/if}></input>
<div class="hint">Browse book covers. Only shows books with known lookup info.</div>
</td>
</tr>
<tr><th>Excluded Categories:</th>
<td>
{html_options style="height:105px;" multiple=multiple name="exccat[]" options=$catlist selected=$userexccat}
<div class="hint">Use Ctrl and click to exclude multiple categories.</div>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>User Details</legend>
<table class="input">
<tr>
<th width="100">Username:</th>
<td>{$user.username|escape:"htmlall"}</td>
</tr>
<tr>
<th>Email:</th>
<td><input id="email" class="long" name="email" type="text" value="{$user.email|escape:"htmlall"}"/>
</td>
</tr>
<tr>
<th>Password:</th>
<td>
<input autocomplete="off" id="password" name="password" type="password" value=""/>
{if $page->site->sabintegrationtype == 2}
<fieldset>
<legend>SABnzbd Integration</legend>
<table class="input">
<tr>
<th width="100"><label for="saburl">SABnzbd Url</label>:</th>
<td>
<input id="saburl" class="long" name="saburl" type="text" value="{$saburl_selected}" />
<div class="hint">The url of the SAB installation, for example: http://localhost:8080/sabnzbd/</div>
</td>
</tr>
<tr>
<th><label for="sabapikey">SABnzbd Api Key</label>:</th>
<td>
<input id="sabapikey" class="long" name="sabapikey" type="text" value="{$sabapikey_selected}" />
<div class="hint">The api key of the SAB installation. Can be the full api key or the nzb api key (as of SAB 0.6)</div>
</td>
</tr>
<tr>
<th><label for="sabapikeytype">Api Key Type</label>:</th>
<td>
{html_radios id="sabapikeytype" name='sabapikeytype' values=$sabapikeytype_ids output=$sabapikeytype_names selected=$sabapikeytype_selected separator='<br />'}
<div class="hint">Select the type of api key you entered in the above setting. Using your full SAB api key will allow you access to the SAB queue from within this site.</div>
</td>
</tr>
<tr>
<th><label for="sabpriority">Priority Level</label>:</th>
<td>
{html_options id="sabpriority" name='sabpriority' values=$sabpriority_ids output=$sabpriority_names selected=$sabpriority_selected}
<div class="hint">Set the priority level for NZBs that are added to your queue</div>
</td>
</tr>
<tr>
<th><label for="sabsetting">Setting Storage</label>:</th>
<td>
{html_radios id="sabsetting" name='sabsetting' values=$sabsetting_ids output=$sabsetting_names selected=$sabsetting_selected separator='&nbsp;&nbsp;'}{if $sabsetting_selected == 2}&nbsp;&nbsp;[<a class="confirm_action" href="?action=clearcookies">Clear Cookies</a>]{/if}
<div class="hint">Where to store the SAB setting.<br />&bull; <b>Cookie</b> will store the setting in your browsers coookies and will only work when using your current browser.<br/>&bull; <b>Site</b> will store the setting in your user account enabling it to work no matter where you are logged in from.<br /><span class="warning"><b>Please Note:</b></span> You should only store your full SAB api key with sites you trust.</div>
</td>
</tr>
</table>
</fieldset>
{/if}
<fieldset>
<legend>NZBVortex Integration</legend>
<table class="input">
<tr>
<th width="100"><label for="nzbvortex_server_url">Server URL</label>:</th>
<td>
<input id="nzbvortex_server_url" class="long" name="nzbvortex_server_url" maxlength="255" type="text" value="{$user.nzbvortex_server_url}" />
<div class="hint">Server URL for NZBVortex found in <strong>Preferences -> Remote</strong>. Do not put a / at the end!
<br />
Example: http://123.123.123.123:8080</div>
</td>
</tr>
<tr>
<th width="100"><label for="nzbvortex_remote_api_key">Remote API Key</label>:</th>
<td>
<input id="nzbvortex_api_key" class="medium" name="nzbvortex_api_key" maxlength="10" type="text" value="{$user.nzbvortex_api_key}" />
<div class="hint">Remote API key for NZBVortex found in <strong>Preferences -> Remote</strong>.
<br />
Example: 52FE-5ABD</div>
</td>
</tr>
</table>
</fieldset>
<input type="submit" value="Save Profile" />
<div class="hint">Only enter your password if you want to change it.</div>
</td>
</tr>
<tr>
<th>Confirm Password:</th>
<td><input autocomplete="off" id="confirmpassword" name="confirmpassword" type="password" value=""/>
</td>
</tr>
<tr>
<th>Site Api/Rss Key:</th>
<td>{$user.rsstoken}<br/><a class="confirm_action" href="?action=newapikey">Generate</a></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>Site Preferences</legend>
<table class="input">
<tr>
<th>View Movie Page:</th>
<td>
<input id="movieview" name="movieview" value="1" type="checkbox"
{if $user.movieview=="1"}checked="checked"{/if}/>
<div class="hint">Browse movie covers. Only shows movies with known IMDB info.</div>
</td>
</tr>
<tr>
<th>View Music Page:</th>
<td>
<input id="musicview" name="musicview" value="1" type="checkbox"
{if $user.musicview=="1"}checked="checked"{/if}/>
<div class="hint">Browse music covers. Only shows music with known lookup info.</div>
</td>
</tr>
<tr>
<th>View Console Page:</th>
<td>
<input id="consoleview" name="consoleview" value="1" type="checkbox"
{if $user.consoleview=="1"}checked="checked"{/if}/>
<div class="hint">Browse console covers. Only shows games with known lookup info.</div>
</td>
</tr>
<tr>
<th>View Book Page:</th>
<td>
<input id="bookview" name="bookview" value="1" type="checkbox"
{if $user.bookview=="1"}checked="checked"{/if}/>
<div class="hint">Browse book covers. Only shows books with known lookup info.</div>
</td>
</tr>
<tr>
<th>Excluded Categories:</th>
<td>
{html_options style="height:105px;" multiple=multiple name="exccat[]" options=$catlist selected=$userexccat}
<div class="hint">Use Ctrl and click to exclude multiple categories.</div>
</td>
</tr>
</table>
</fieldset>
{if $page->site->sabintegrationtype == 2}
<fieldset>
<legend>SABnzbd Integration</legend>
<table class="input">
<tr>
<th width="100"><label for="saburl">SABnzbd Url</label>:</th>
<td>
<input id="saburl" class="long" name="saburl" type="text" value="{$saburl_selected}"/>
<div class="hint">The url of the SAB installation, for example: http://localhost:8080/sabnzbd/
</div>
</td>
</tr>
<tr>
<th><label for="sabapikey">SABnzbd Api Key</label>:</th>
<td>
<input id="sabapikey" class="long" name="sabapikey" type="text" value="{$sabapikey_selected}"/>
<div class="hint">The api key of the SAB installation. Can be the full api key or the nzb api
key (as of SAB 0.6)
</div>
</td>
</tr>
<tr>
<th><label for="sabapikeytype">Api Key Type</label>:</th>
<td>
{html_radios id="sabapikeytype" name='sabapikeytype' values=$sabapikeytype_ids output=$sabapikeytype_names selected=$sabapikeytype_selected separator='<br />'}
<div class="hint">Select the type of api key you entered in the above setting. Using your full
SAB api key will allow you access to the SAB queue from within this site.
</div>
</td>
</tr>
<tr>
<th><label for="sabpriority">Priority Level</label>:</th>
<td>
{html_options id="sabpriority" name='sabpriority' values=$sabpriority_ids output=$sabpriority_names selected=$sabpriority_selected}
<div class="hint">Set the priority level for NZBs that are added to your queue</div>
</td>
</tr>
<tr>
<th><label for="sabsetting">Setting Storage</label>:</th>
<td>
{html_radios id="sabsetting" name='sabsetting' values=$sabsetting_ids output=$sabsetting_names selected=$sabsetting_selected separator='&nbsp;&nbsp;'}{if $sabsetting_selected == 2}&nbsp;&nbsp;[
<a class="confirm_action" href="?action=clearcookies">Clear Cookies</a>
]{/if}
<div class="hint">Where to store the SAB setting.<br/>&bull; <b>Cookie</b> will store the
setting in your browsers coookies and will only work when using your current browser.<br/>&bull;
<b>Site</b> will store the setting in your user account enabling it to work no matter where
you are logged in from.<br/><span class="warning"><b>Please Note:</b></span> You should only
store your full SAB api key with sites you trust.
</div>
</td>
</tr>
</table>
</fieldset>
{/if}
<fieldset>
<legend>NZBVortex Integration</legend>
<table class="input">
<tr>
<th width="100"><label for="nzbvortex_server_url">Server URL</label>:</th>
<td>
<input id="nzbvortex_server_url" class="long" name="nzbvortex_server_url" maxlength="255"
type="text" value="{$user.nzbvortex_server_url}"/>
<div class="hint">Server URL for NZBVortex found in <strong>Preferences -> Remote</strong>. Do not
put a / at the end!
<br/>
Example: http://123.123.123.123:8080
</div>
</td>
</tr>
<tr>
<th width="100"><label for="nzbvortex_remote_api_key">Remote API Key</label>:</th>
<td>
<input id="nzbvortex_api_key" class="medium" name="nzbvortex_api_key" maxlength="10" type="text"
value="{$user.nzbvortex_api_key}"/>
<div class="hint">Remote API key for NZBVortex found in <strong>Preferences -> Remote</strong>.
<br/>
Example: 52FE-5ABD
</div>
</td>
</tr>
</table>
</fieldset>
<input type="submit" value="Save Profile"/>
</form>
@@ -1,16 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:newznab="http://www.newznab.com/DTD/2010/feeds/attributes/">
<channel>
<atom:link href="{$serverroot}{$smarty.server.REQUEST_URI|escape:"htmlall"|substr:1}" rel="self" type="application/rss+xml" />
<title>{$site->title|escape}{if $rsstitle!=""} {$rsstitle|escape:"htmlall"}{/if}</title>
<description>{if $rssdesc==""}{$site->title|escape} Feed{else}{$rssdesc|escape:"htmlall"}{/if}</description>
<link>{$serverroot}</link>
<language>en-gb</language>
<webMaster>{$site->email} ({$site->title|escape})</webMaster>
<category>{$site->meta_keywords}</category>
<image>
<url>{$serverroot}templates/nntmux/images/banner.jpg</url>
<title>{$site->title|escape}</title>
<link>{$serverroot}</link>
<description>Visit {$site->title|escape} - {$site->strapline|escape}</description>
</image>
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="{$serverroot}{$smarty.server.REQUEST_URI|escape:"htmlall"|substr:1}" rel="self"
type="application/rss+xml"/>
<title>{$site->title|escape}{if $rsstitle!=""} {$rsstitle|escape:"htmlall"}{/if}</title>
<description>{if $rssdesc==""}{$site->title|escape} Feed{else}{$rssdesc|escape:"htmlall"}{/if}</description>
<link>{$serverroot}</link>
<language>en-gb</language>
<webMaster>{$site->email} ({$site->title|escape})</webMaster>
<category>{$site->meta_keywords}</category>
<image>
<url>{$serverroot}templates/nntmux/images/banner.jpg</url>
<title>{$site->title|escape}</title>
<link>{$serverroot}</link>
<description>Visit {$site->title|escape} - {$site->strapline|escape}</description>
</image>
+13 -12
View File
@@ -1,6 +1,6 @@
<?php
require_once(dirname(__FILE__)."/../bin/config.php");
require_once(WWW_DIR."/lib/framework/db.php");
require_once(dirname(__FILE__) . "/../bin/config.php");
require_once(WWW_DIR . "/lib/framework/db.php");
require_once("ColorCLI.php");
$db = new DB();
@@ -16,7 +16,7 @@ if (isset($argv[2])) {
if (isset($argv[1]) && $argv[1] == 'export' && isset($argv[2])) {
if (!preg_match('/\.csv$/', $path)) {
$path = dirname($path) . '/' . basename($path) . '/prebd_dump.csv';
$path = dirname($path) . '/' . basename($path) . '/predb_dump.csv';
} else {
$path = $path;
}
@@ -49,12 +49,12 @@ if (isset($argv[1]) && $argv[1] == 'export' && isset($argv[2])) {
$db->query('CREATE TABLE tmp_pre LIKE prehash');
// Drop indexes on tmp_pre
echo $c->info("Dropping indexes from temporary table.");
echo $c->info("Dropping indexes from temporary table.");
$db->query('ALTER TABLE tmp_pre DROP INDEX `ix_prehash_md5`, DROP INDEX `ix_prehash_nfo`, DROP INDEX `ix_prehash_predate`, DROP INDEX `ix_prehash_source`, DROP INDEX `ix_prehash_title`, DROP INDEX `ix_prehash_requestid`');
$db->query('ALTER TABLE tmp_pre ADD COLUMN groupname VARCHAR (255)');
// Import file into tmp_pre
echo $c->info("Importing data into temporary table.");
echo $c->info("Importing data into temporary table.");
if ($argv[1] == 'remote') {
$db->queryDirect("LOAD DATA LOCAL INFILE '" . $path . "' IGNORE INTO TABLE tmp_pre FIELDS TERMINATED BY '\t\t' ENCLOSED BY \"'\" LINES TERMINATED BY '\r\n' (title, nfo, size, files, nuked, nukereason, category, predate, source, md5, requestID, groupname)");
} else {
@@ -62,17 +62,18 @@ if (isset($argv[1]) && $argv[1] == 'export' && isset($argv[2])) {
}
// Insert and update table
echo $c->info("Inserting data into" . $table. "table.");
echo $c->info("Inserting data into" . $table . "table.");
$db->queryDirect('INSERT INTO ' . $table . ' (title, nfo, size, files, nuked, nukereason, category, predate, source, md5, requestID, groupID) SELECT t.title, t.nfo, t.size, t.category, t.predate, t.source, t.md5, t.requestID, IF(g.ID IS NOT NULL, g.ID, 0) FROM tmp_pre t LEFT OUTER JOIN groups g ON t.groupname = g.name ON DUPLICATE KEY UPDATE prehash.nfo = IF(prehash.nfo is null, t.nfo, prehash.nfo), prehash.size = IF(prehash.size is null, t.size, prehash.size), prehash.files = IF(prehash.files is null, t.files, prehash.files), prehash.nuked = IF(prehash.nuked is null, t.nuked, prehash.nuked), prehash.nukereason = IF(prehash.nukereason is null, t.nukereason, prehash.nukereason), prehash.category = IF(prehash.category is null, t.category, prehash.category), prehash.requestID = IF(prehash.requestID = 0, t.requestID, prehash.requestID), prehash.groupID = IF(g.ID IS NOT NULL, g.ID, 0)');
// Drop tmp_pre table
echo $c->info("Dropping temporary table");
echo $c->info("Dropping temporary table");
$db->query('DROP TABLE IF EXISTS tmp_pre');
echo $c->info("Import complete");
echo $c->info("Import complete");
} else {
exit($c->error("\nThis script can export or import a prehash dump file. You may use the full path, or a relative path.\n"
. "For importing, the script insert new rows and update existing matched rows. For databases not on the local system, use remote, else use local.\n"
. "For exporting, the path must be writeable by mysql, any existing file[prebd_dump.csv] will be overwritten.\n\n"
. "php $argv[0] export /path/to/write/to ...: To export.\n"
. "php $argv[0] [remote | local] /path/to/filename ...: To import.\n"));
. "For importing, the script insert new rows and update existing matched rows. For databases not on the local system, use remote, else use local.\n"
. "For exporting, the path must be writeable by mysql, any existing file[prebd_dump.csv] will be overwritten.\n\n"
. "php $argv[0] export /path/to/write/to ...: To export.\n"
. "php $argv[0] [remote | local] /path/to/filename ...: To import.\n"
));
}
+117 -129
View File
@@ -1,8 +1,8 @@
<?php
require_once(dirname(__FILE__)."/../bin/config.php");
require_once(WWW_DIR. "lib/framework/db.php");
require_once(WWW_DIR. "lib/category.php");
require_once(WWW_DIR. "lib/groups.php");
require_once(dirname(__FILE__) . "/../bin/config.php");
require_once(WWW_DIR . "lib/framework/db.php");
require_once(WWW_DIR . "lib/category.php");
require_once(WWW_DIR . "lib/groups.php");
require_once("functions.php");
require_once("ColorCLI.php");
require_once("consoletools.php");
@@ -11,12 +11,13 @@ require_once("namefixer.php");
//This script is adapted from nZEDB requestID.php
$c = new ColorCLI;
if (!isset($argv[1]) || ( $argv[1] != "all" && $argv[1] != "full" && !is_numeric($argv[1]))){
if (!isset($argv[1]) || ($argv[1] != "all" && $argv[1] != "full" && !is_numeric($argv[1]))) {
exit($c->error("\nThis script tries to match an MD5 of the releases.name or releases.searchname to predb.md5 doing local lookup only.\n"
. "php requestid.php 1000 true ...: to limit to 1000 sorted by newest postdate and show renaming.\n"
. "php requestid.php full true ...: to run on full database and show renaming.\n"
. "php requestid.php all true ...: to run on all hashed releases(including previously renamed) and show renaiming."
. "In addition an optional final argument is time, in minutes, to check releases that have previously been checked.\n"));
. "php requestid.php 1000 true ...: to limit to 1000 sorted by newest postdate and show renaming.\n"
. "php requestid.php full true ...: to run on full database and show renaming.\n"
. "php requestid.php all true ...: to run on all hashed releases(including previously renamed) and show renaiming."
. "In addition an optional final argument is time, in minutes, to check releases that have previously been checked.\n"
));
}
$db = new DB();
@@ -48,135 +49,122 @@ if (isset($argv[1]) && $argv[1] === "all") {
$res = $db->queryDirect("SELECT r.ID, r.searchname, r.categoryID, g.name AS groupname FROM releases r LEFT JOIN groups g ON r.groupID = g.ID WHERE (isrenamed = 0 AND isrequestid = 1 " . $time . " AND reqidstatus in (0, -1) ORDER BY postdate DESC LIMIT " . $argv[1]);
}
$total = $res->rowCount();
if ($total > 0)
{
$precount = $db->queryOneRow("SELECT COUNT(*) AS count FROM prehash WHERE requestID > 0");
echo $c->header("\nComparing ".number_format($total).' releases against '.number_format($precount['count'])." Local requestID's.");
$total = $res->rowCount();
if ($total > 0) {
$precount = $db->queryOneRow("SELECT COUNT(*) AS count FROM prehash WHERE requestID > 0");
echo $c->header("\nComparing " . number_format($total) . ' releases against ' . number_format($precount['count']) . " Local requestID's.");
sleep(2);
foreach ($res as $row)
{
if (!preg_match('/^\[\d+\]/', $row["searchname"]) && !preg_match('/^\[ \d+ \]/', $row["searchname"]))
{
$db->query(sprintf("UPDATE releases SET reqidstatus = -2 WHERE reqidstatus != 1 AND ID = %d", $row["ID"]));
continue;
}
foreach ($res as $row) {
if (!preg_match('/^\[\d+\]/', $row["searchname"]) && !preg_match('/^\[ \d+ \]/', $row["searchname"])) {
$db->query(sprintf("UPDATE releases SET reqidstatus = -2 WHERE reqidstatus != 1 AND ID = %d", $row["ID"]));
continue;
}
$requestIDtmp = explode(']', substr($row["searchname"], 1));
$bFound = false;
$newTitle = '';
$requestIDtmp = explode(']', substr($row["searchname"], 1));
$bFound = false;
$newTitle = '';
if (count($requestIDtmp) >= 1)
{
$requestID = (int) trim($requestIDtmp[0]);
if ($requestID != 0 and $requestID != '')
{
// Do a local lookup
$newTitle = localLookup($requestID, $row["groupname"], $row["searchname"]);
if (is_array($newTitle) && $newTitle['title'] != ''){
$bFound = true;
}
}
}
if (count($requestIDtmp) >= 1) {
$requestID = (int)trim($requestIDtmp[0]);
if ($requestID != 0 and $requestID != '') {
// Do a local lookup
$newTitle = localLookup($requestID, $row["groupname"], $row["searchname"]);
if (is_array($newTitle) && $newTitle['title'] != '') {
$bFound = true;
}
}
}
if ($bFound === true)
{
$title = $newTitle['title'];
$prehashID = $newTitle['ID'];
$groupname = $functions->getByNameByID($row["groupname"]);
$determinedcat = $category->determineCategory($groupname, $title );
$run = $db->queryDirect(sprintf('UPDATE releases SET rageID = NULL, seriesfull = NULL, season = NULL, episode = NULL, tvtitle = NULL, tvairdate = NULL, imdbID = NULL, musicinfoID = NULL, consoleinfoID = NULL, bookinfoID = NULL, "
. "anidbID = NULL, prehashID = %d, reqidstatus = 1, isrenamed = 1, iscategorized = 1, searchname = %s, categoryID = %d WHERE ID = %d', $prehashID, $db->escapeString($title), $determinedcat, $row['ID']));
if ($row['searchname'] !== $newTitle)
{
$counter++;
if (isset($argv[2]) && $argv[2] === 'true')
{
$newcatname = $functions->getNameByID($determinedcat);
$oldcatname = $functions->getNameByID($row['categoryID']);
if ($bFound === true) {
$title = $newTitle['title'];
$prehashID = $newTitle['ID'];
$groupname = $functions->getByNameByID($row["groupname"]);
$determinedcat = $category->determineCategory($groupname, $title);
$run = $db->queryDirect(sprintf('UPDATE releases SET rageID = NULL, seriesfull = NULL, season = NULL, episode = NULL, tvtitle = NULL, tvairdate = NULL, imdbID = NULL, musicinfoID = NULL, consoleinfoID = NULL, bookinfoID = NULL, "
. "anidbID = NULL, prehashID = %d, reqidstatus = 1, isrenamed = 1, iscategorized = 1, searchname = %s, categoryID = %d WHERE ID = %d', $prehashID, $db->escapeString($title), $determinedcat, $row['ID']
)
);
if ($row['searchname'] !== $newTitle) {
$counter++;
if (isset($argv[2]) && $argv[2] === 'true') {
$newcatname = $functions->getNameByID($determinedcat);
$oldcatname = $functions->getNameByID($row['categoryID']);
echo $c->headerOver($n.$n.'New name: ').$c->primary($title).
$c->headerOver('Old name: ').$c->primary($row["searchname"]).
$c->headerOver('New cat: ').$c->primary($newcatname).
$c->headerOver('Old cat: ').$c->primary($oldcatname).
$c->headerOver('Group: ').$c->primary($row["groupname"]).
$c->headerOver('Method: ').$c->primary('requestID local').
$c->headerOver('ReleaseID: ').$c->primary($row["ID"]);
}
else
{
if ($counter % 100 == 0)
{
echo ".";
}
}
}
}
else
{
$db->exec("UPDATE releases SET reqidstatus = -3 WHERE reqidstatus != 1 AND ID = " . $row["ID"]);
echo '.';
}
}
if ($total > 0) {
echo $c->header("\nRenamed " . number_format($counter) . " releases in " . $consoletools->convertTime(TIME() - $timestart) . ".");
} else {
echo $c->info("\nNothing to do.");
}
echo $c->headerOver($n . $n . 'New name: ') . $c->primary($title) .
$c->headerOver('Old name: ') . $c->primary($row["searchname"]) .
$c->headerOver('New cat: ') . $c->primary($newcatname) .
$c->headerOver('Old cat: ') . $c->primary($oldcatname) .
$c->headerOver('Group: ') . $c->primary($row["groupname"]) .
$c->headerOver('Method: ') . $c->primary('requestID local') .
$c->headerOver('ReleaseID: ') . $c->primary($row["ID"]);
} else {
if ($counter % 100 == 0) {
echo ".";
}
}
}
} else {
$db->exec("UPDATE releases SET reqidstatus = -3 WHERE reqidstatus != 1 AND ID = " . $row["ID"]);
echo '.';
}
}
if ($total > 0) {
echo $c->header("\nRenamed " . number_format($counter) . " releases in " . $consoletools->convertTime(TIME() - $timestart) . ".");
} else {
echo $c->info("\nNothing to do.");
}
} else {
echo $c->info("No work to process\n");
echo $c->info("No work to process\n");
}
function localLookup($requestID, $groupName, $oldname)
{
$db = new DB();
$groups = new Groups();
$functions = new Functions();
$groupID = $functions->getIDByName($groupName);
$run = $db->queryOneRow(sprintf("SELECT ID, title FROM prehash WHERE requestID = %d AND groupID = %d", $requestID, $groupID));
if (isset($run["title"]) && preg_match('/s\d+/i', $run["title"]) && !preg_match('/s\d+e\d+/i', $run["title"])) {
return false;
}
if (isset($run["title"]))
return array('title' => $run['title'], 'ID' => $run['ID']);
if (preg_match('/\[#?a\.b\.teevee\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if (preg_match('/\[#?a\.b\.moovee\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.moovee');
else if (preg_match('/\[#?a\.b\.erotica\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.erotica');
else if (preg_match('/\[#?a\.b\.foreign\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.mom');
else if ($groupName == 'alt.binaries.etc')
$groupID = $functions->getIDByName('alt.binaries.teevee');
//groups below are added for testing purposes
else if (preg_match('/\[#?a\.b\.mom\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.mom');
else if ($groupName == 'alt.binaries.mom')
$groupID = $functions->getIDByName('alt.binaries.mom');
else if ($groupName == 'alt.binaries.town.xxx')
$groupID = $functions->getIDByName('alt.binaries.erotica');
else if (preg_match('/\[#?a\.b\.town\.xxx\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.erotica');
else if ($groupName == 'alt.binaries.tvseries')
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if (preg_match('/\[#?a\.b\.tvseries\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if ($groupName == 'alt.binaries.x264')
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if (preg_match('/\[#?a\.b\.x264\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if ($groupName == 'alt.binaries.town')
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if (preg_match('/\[#?a\.b\.town\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.teevee');
function localLookup($requestID, $groupName, $oldname)
{
$db = new DB();
$groups = new Groups();
$functions = new Functions();
$groupID = $functions->getIDByName($groupName);
$run = $db->queryOneRow(sprintf("SELECT ID, title FROM prehash WHERE requestID = %d AND groupID = %d", $requestID, $groupID));
if (isset($run["title"]) && preg_match('/s\d+/i', $run["title"]) && !preg_match('/s\d+e\d+/i', $run["title"])) {
return false;
}
if (isset($run["title"]))
return array('title' => $run['title'], 'ID' => $run['ID']);
if (preg_match('/\[#?a\.b\.teevee\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if (preg_match('/\[#?a\.b\.moovee\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.moovee');
else if (preg_match('/\[#?a\.b\.erotica\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.erotica');
else if (preg_match('/\[#?a\.b\.foreign\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.mom');
else if ($groupName == 'alt.binaries.etc')
$groupID = $functions->getIDByName('alt.binaries.teevee');
//groups below are added for testing purposes
else if (preg_match('/\[#?a\.b\.mom\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.mom');
else if ($groupName == 'alt.binaries.mom')
$groupID = $functions->getIDByName('alt.binaries.mom');
else if ($groupName == 'alt.binaries.town.xxx')
$groupID = $functions->getIDByName('alt.binaries.erotica');
else if (preg_match('/\[#?a\.b\.town\.xxx\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.erotica');
else if ($groupName == 'alt.binaries.tvseries')
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if (preg_match('/\[#?a\.b\.tvseries\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if ($groupName == 'alt.binaries.x264')
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if (preg_match('/\[#?a\.b\.x264\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if ($groupName == 'alt.binaries.town')
$groupID = $functions->getIDByName('alt.binaries.teevee');
else if (preg_match('/\[#?a\.b\.town\]/', $oldname))
$groupID = $functions->getIDByName('alt.binaries.teevee');
$run = $db->queryOneRow(sprintf("SELECT ID, title FROM prehash WHERE requestID = %d AND groupID = %d", $requestID, $groupID));
if (isset($run['title']))
return array('title' => $run['title'], 'ID' => $run['ID']);
}
?>
$run = $db->queryOneRow(sprintf("SELECT ID, title FROM prehash WHERE requestID = %d AND groupID = %d", $requestID, $groupID));
if (isset($run['title']))
return array('title' => $run['title'], 'ID' => $run['ID']);
}
+1733 -1600
View File
File diff suppressed because it is too large Load Diff
+2 -4
View File
@@ -1,9 +1,7 @@
<?php
require(dirname(__FILE__)."/../bin/config.php");
require_once(WWW_DIR."/lib/framework/db.php");
require(dirname(__FILE__) . "/../bin/config.php");
require_once(WWW_DIR . "/lib/framework/db.php");
$db = new DB;
$rel = $db->query("update releases set passwordstatus = -1 where rarinnerfilecount = 0");
?>
+9 -11
View File
@@ -1,6 +1,6 @@
<?php
require(dirname(__FILE__)."/../bin/config.php");
require_once(WWW_DIR."/lib/framework/db.php");
require(dirname(__FILE__) . "/../bin/config.php");
require_once(WWW_DIR . "/lib/framework/db.php");
$db = new DB;
@@ -10,23 +10,21 @@ printf("Reseting all groups completed.\n");
$arr = array("parts", "partrepair", "binaries");
foreach ($arr as &$value) {
$rel = $db->query("truncate table $value");
printf("Truncating $value completed.\n");
$rel = $db->query("truncate table $value");
printf("Truncating $value completed.\n");
}
unset($value);
//get variables from config.sh and defaults.sh
$path = dirname(__FILE__);
$varnames = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$varnames .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat ".$path."/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$vardata .= shell_exec("cat ".$path."/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = shell_exec("cat " . $path . "/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$varnames .= shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
$vardata = shell_exec("cat " . $path . "/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$vardata .= shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
$varnames = explode("\n", $varnames);
$vardata = explode("\n", $vardata);
$array = array_combine($varnames, $vardata);
unset($array['']);
$TESTING="{$array['NEWZPATH']}{$array['TESTING_PATH']}";
$TESTING = "{$array['NEWZPATH']}{$array['TESTING_PATH']}";
passthru("cd $TESTING && php spotnab.php -r");
?>
+2 -5
View File
@@ -1,6 +1,6 @@
<?php
require(dirname(__FILE__)."/../bin/config.php");
require_once(WWW_DIR."/lib/framework/db.php");
require(dirname(__FILE__) . "/../bin/config.php");
require_once(WWW_DIR . "/lib/framework/db.php");
$db = new DB;
@@ -11,6 +11,3 @@ foreach ($arr as &$value) {
printf("Truncating $value completed.\n");
}
unset($value);
?>