Cleanup the scripts, fix more references to site table.

This commit is contained in:
Darko
2015-06-10 10:25:55 +02:00
parent 653ed5fdf7
commit 0fd5f1ae80
27 changed files with 35 additions and 96 deletions
-2
View File
@@ -106,8 +106,6 @@ class Backfill
$this->_nntp = ($options['NNTP'] instanceof \NNTP
? $options['NNTP'] : new \NNTP(['Settings' => $this->pdo])
);
$s = new Sites();
$this->site = $s->get();
$this->_debug = (NN_LOGGING || NN_DEBUG);
if ($this->_debug) {
+10 -12
View File
@@ -161,8 +161,6 @@ class Binaries
$this->_echoCLI = ($options['Echo'] && NN_ECHOCLI);
$s = new Sites();
$this->_site = $s->get();
$this->_pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$this->_groups = ($options['Groups'] instanceof \Groups ? $options['Groups'] : new \Groups(['Settings' => $this->_pdo]));
$this->_colorCLI = ($options['ColorCLI'] instanceof \ColorCLI ? $options['ColorCLI'] : new \ColorCLI());
@@ -179,16 +177,16 @@ class Binaries
}
}
$this->messageBuffer = ($this->_site->maxmssgs != '') ? $this->_site->maxmssgs : 20000;
$this->_compressedHeaders = ($this->_site->compressedheaders == 1 ? true : false);
$this->_partRepair = ($this->_site->partrepair == 0 ? false : true);
$this->_newGroupScanByDays = ($this->_site->newgroupscanmethod == 1 ? true : false);
$this->_newGroupMessagesToScan = ($this->_site->newgroupmsgstoscan != '') ? $this->_site->newgroupmsgstoscan : 50000;
$this->_newGroupDaysToScan = ($this->_site->newgroupdaystoscan != '') ? (int)$this->_site->newgroupdaystoscan : 3;
$this->_partRepairLimit = ($this->_site->maxpartrepair != '') ? (int)$this->_site->maxpartrepair : 15000;
$this->_partRepairMaxTries = ($this->_site->partrepairmaxtries != '' ? (int)$this->_site->partrepairmaxtries : 3);
$this->_showDroppedYEncParts = ($this->_site->showdroppedyencparts == 1 ? true : false);
$this->_tablePerGroup = ($this->_site->tablepergroup == 1 ? true : false);
$this->messageBuffer = ($this->_pdo->getSetting('maxmssgs') != '') ? $this->_pdo->getSetting('maxmssgs') : 20000;
$this->_compressedHeaders = ($this->_pdo->getSetting('compressedheaders') == 1 ? true : false);
$this->_partRepair = ($this->_pdo->getSetting('partrepair') == 0 ? false : true);
$this->_newGroupScanByDays = ($this->_pdo->getSetting('newgroupscanmethod') == 1 ? true : false);
$this->_newGroupMessagesToScan = ($this->_pdo->getSetting('newgroupmsgstoscan') != '') ? $this->_pdo->getSetting('newgroupmsgstoscan') : 50000;
$this->_newGroupDaysToScan = ($this->_pdo->getSetting('newgroupdaystoscan') != '') ? (int)$this->_pdo->getSetting('newgroupdaystoscan') : 3;
$this->_partRepairLimit = ($this->_pdo->getSetting('maxpartrepair') != '') ? (int)$this->_pdo->getSetting('maxpartrepair') : 15000;
$this->_partRepairMaxTries = ($this->_pdo->getSetting('partrepairmaxtries') != '' ? (int)$this->_pdo->getSetting('partrepairmaxtries') : 3);
$this->_showDroppedYEncParts = ($this->_pdo->getSetting('showdroppedyencparts') == 1 ? true : false);
$this->_tablePerGroup = ($this->_pdo->getSetting('tablepergroup') == 1 ? true : false);
$this->blackList = $this->whiteList = [];
}
+3 -5
View File
@@ -28,12 +28,10 @@ class Book
public function __construct($echooutput = false)
{
$this->echooutput = (NN_ECHOCLI && $echooutput);
$s = new Sites();
$site = $s->get();
$this->pubkey = $site->amazonpubkey;
$this->privkey = $site->amazonprivkey;
$this->asstag = $site->amazonassociatetag;
$this->pdo = new Settings();
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
$this->privkey = $this->pdo->getSetting('amazonprivkey');
$this->asstag = $this->pdo->getSetting('amazonassociatetag');
$this->imgSavePath = WWW_DIR.'covers/book/';
}
-2
View File
@@ -79,8 +79,6 @@ class Books
$this->echooutput = ($options['Echo'] && NN_ECHOCLI);
$this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$s = new Sites();
$this->site = $s->get();
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
$this->privkey = $this->pdo->getSetting('amazonprivkey');
-2
View File
@@ -48,8 +48,6 @@ class Categorize extends Category
public function __construct(array $options = array())
{
//parent::__construct($options);
$s = new Sites();
$this->site = $s->get();
$this->pdo = new newznab\db\Settings();
$this->categorizeForeign = ($this->pdo->getSetting('categorizeforeign') == "0") ? false : true;
$this->catWebDL = ($this->pdo->getSetting('catwebdl') == "0") ? false : true;
+4 -6
View File
@@ -29,12 +29,10 @@ class Console
public function __construct($echooutput=false)
{
$this->echooutput = (NN_ECHOCLI && $echooutput);
$s = new Sites();
$site = $s->get();
$this->pubkey = $site->amazonpubkey;
$this->privkey = $site->amazonprivkey;
$this->asstag = $site->amazonassociatetag;
$this->pdo = new newznab\db\Settings();
$this->pdo = new Settings();
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
$this->privkey = $this->pdo->getSetting('amazonprivkey');
$this->asstag = $this->pdo->getSetting('amazonassociatetag');
$this->imgSavePath = WWW_DIR.'covers/console/';
}
+1 -2
View File
@@ -102,7 +102,6 @@ class Enzebe
public function initiateForWrite($groupID)
{
$this->groupid = $groupID;
$site = new Sites();
// Set table names
if ($this->tablePerGroup === true) {
if ($this->groupid == '') {
@@ -132,7 +131,7 @@ class Enzebe
$this->_nzbHeadString = (
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE nzb PUBLIC \"-//newzBin//DTD NZB 1.1//EN\" \"http://www.newzbin.com/DTD/nzb/nzb-1.1.dtd\">\n<!-- NZB Generated by: newznab " .
$site->version() . ' ' . htmlspecialchars(date('F j, Y, g:i a O'), ENT_QUOTES, 'utf-8') .
$this->pdo->version() . ' ' . htmlspecialchars(date('F j, Y, g:i a O'), ENT_QUOTES, 'utf-8') .
" -->\n<nzb xmlns=\"http://www.newzbin.com/DTD/2003/nzb\">\n<head>\n <meta type=\"category\">%s</meta>\n <meta type=\"name\">%s</meta>\n</head>\n\n"
);
}
-2
View File
@@ -145,8 +145,6 @@ class Film
$options += $defaults;
$this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$s = new Sites();
$this->site = $s->get();
$this->releaseImage = ($options['ReleaseImage'] instanceof \ReleaseImage ? $options['ReleaseImage'] : new \ReleaseImage($this->pdo));
$this->lookuplanguage = ($this->pdo->getSetting('lookuplanguage') != '') ? (string)$this->pdo->getSetting('lookuplanguage') : 'en';
+3 -10
View File
@@ -81,13 +81,8 @@ class Info
'Settings' => null,
];
$options += $defaults;
$s = new Sites();
$this->site = $s->get();
$this->echo = ($options['Echo'] && NN_ECHOCLI);
$this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$s = new Sites();
$this->site = $s->get();
$this->nzbs = ($this->pdo->getSetting('maxnfoprocessed') != '') ? (int)$this->pdo->getSetting('maxnfoprocessed') : 100;
$this->maxsize = ($this->pdo->getSetting('maxsizetoprocessnfo') != '') ? (int)$this->pdo->getSetting('maxsizetoprocessnfo') : 100;
$this->maxsize = ($this->maxsize > 0 ? ('AND size < ' . ($this->maxsize * 1073741824)) : '');
@@ -248,11 +243,9 @@ class Info
*/
static public function NfoQueryString(Settings &$pdo)
{
$s = new Sites();
$site = $s->get();
$maxSize = $site->maxsizetoprocessnfo;
$minSize = $site->minsizetoprocessnfo;
$maxRetries = (int)($site->maxnforetries >= 0 ? -((int)$site->maxnforetries + 1) : self::NFO_UNPROC);
$maxSize = $pdo->getSetting('maxsizetoprocessnfo');
$minSize = $pdo->getSetting('minsizetoprocessnfo');
$maxRetries = (int)($pdo->getSetting('maxnforetries') >= 0 ? -((int)$pdo->getSetting('maxnforetries') + 1) : self::NFO_UNPROC);
return (
sprintf(
'AND r.nzbstatus = %d AND r.nfostatus BETWEEN %d AND %d %s %s',
-2
View File
@@ -75,8 +75,6 @@ class Konsole
$this->echooutput = ($options['Echo'] && NN_ECHOCLI);
$this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$s = new Sites();
$this->site = $s->get();
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
$this->privkey = $this->pdo->getSetting('amazonprivkey');
-2
View File
@@ -51,8 +51,6 @@ class MiscSorter
$this->category = new Categorize(['Settings' => $this->pdo]);
$this->movie = new Film(['Echo' => $this->echooutput, 'Settings' => $this->pdo]);
$s = new Sites();
$this->site = $s->get();
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
$this->privkey = $this->pdo->getSetting('amazonprivkey');
$this->asstag = $this->pdo->getSetting('amazonassociatetag');
+5 -8
View File
@@ -49,11 +49,9 @@ class Movie
public function __construct($echooutput = false)
{
$this->echooutput = (NN_ECHOCLI && $echooutput);
$s = new \Sites();
$site = $s->get();
$this->apikey = $site->tmdbkey;
$this->lookuplanguage = $site->lookuplanguage;
$this->pdo = new Settings();
$this->apikey = $this->pdo->getSetting('tmdbkey');
$this->lookuplanguage = $this->pdo->getSetting('lookuplanguage');
$this->imgSavePath = NN_COVERS . 'movies' . DS;
}
@@ -793,11 +791,10 @@ class Movie
*/
public function updateUpcoming()
{
$s = new Sites();
$site = $s->get();
if (isset($site->rottentomatokey))
$rtkey = $this->pdo->getSetting('rottentomatokey');
if (isset($rtkey))
{
$rt = new RottenTomato($site->rottentomatokey);
$rt = new RottenTomato($this->pdo->getSetting('rottentomatokey'));
$ret = $rt->getMoviesBoxOffice();
if ($ret != "")
+4 -6
View File
@@ -29,12 +29,10 @@ class Music
public function __construct($echooutput = false)
{
$this->echooutput = (NN_ECHOCLI && $echooutput);
$s = new Sites();
$site = $s->get();
$this->pubkey = $site->amazonpubkey;
$this->privkey = $site->amazonprivkey;
$this->asstag = $site->amazonassociatetag;
$this->pdo = new newznab\db\Settings();
$this->pdo = new Settings();
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
$this->privkey = $this->pdo->getSetting('amazonprivkey');
$this->asstag = $this->pdo->getSetting('amazonassociatetag');
$this->imgSavePath = WWW_DIR.'covers/music/';
}
-2
View File
@@ -72,8 +72,6 @@ class Musik
$options += $defaults;
$this->echooutput = ($options['Echo'] && NN_ECHOCLI);
$s = new Sites();
$this->site = $s->get();
$this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
-2
View File
@@ -108,8 +108,6 @@ class NNTP extends Net_NNTP_Client
$this->_echo = ($options['Echo'] && NN_ECHOCLI);
$this->pdo = ($options['Settings'] instanceof \newznab\db\Settings ? $options['Settings'] : new \newznab\db\Settings());
$s = new Sites();
$this->site = $s->get();
$this->_debugBool = (NN_LOGGING || NN_DEBUG);
if ($this->_debugBool) {
+1 -4
View File
@@ -97,8 +97,6 @@ class NZB
{
$this->pdo = ($pdo instanceof Settings ? $pdo : new Settings());
$s = new Sites();
$this->site = $s->get();
$this->tablePerGroup = ($this->pdo->getSetting('tablepergroup') == 0 ? false : true);
$nzbSplitLevel = $this->pdo->getSetting('nzbsplitlevel');
$this->nzbSplitLevel = (empty($nzbSplitLevel) ? 1 : $nzbSplitLevel);
@@ -118,7 +116,6 @@ class NZB
public function initiateForWrite($groupID)
{
$this->groupID = $groupID;
$site = new Sites();
// Set table names
if ($this->tablePerGroup === true) {
if ($this->groupID == '') {
@@ -158,7 +155,7 @@ class NZB
$this->_nzbHeadString = (
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE nzb PUBLIC \"-//newzBin//DTD NZB 1.1//EN\" \"http://www.newzbin.com/DTD/nzb/nzb-1.1.dtd\">\n<!-- NZB Generated by: newznab " .
$site->version() . ' ' . htmlspecialchars(date('F j, Y, g:i a O'), ENT_QUOTES, 'utf-8') .
$this->pdo->version() . ' ' . htmlspecialchars(date('F j, Y, g:i a O'), ENT_QUOTES, 'utf-8') .
" -->\n<nzb xmlns=\"http://www.newzbin.com/DTD/2003/nzb\">\n<head>\n <meta type=\"category\">%s</meta>\n <meta type=\"name\">%s</meta>\n</head>\n\n"
);
}
-2
View File
@@ -98,8 +98,6 @@ Class NZBContents
$this->nzb = ($options['NZB'] instanceof \NZB ? $options['NZB'] : new \NZB($this->pdo));
$t = new Tmux();
$this->tmux = $t->get();
$s = new Sites();
$this->site = $s->get();
$this->lookuppar2 = ($this->tmux->lookuppar2 == 1 ? true : false);
$this->alternateNNTP = ($this->pdo->getSetting('alternate_nntp') == 1 ? true : false);
}
-2
View File
@@ -33,8 +33,6 @@ class Parsing
$this->parsprocessed = 0;
$this->releasefilesprocessed = 0;
$this->cleanup = ['nuke' => [], 'misc' => []];
$s = new Sites();
$this->site = $s->get();
$this->pdo = new newznab\db\Settings();
}
-2
View File
@@ -29,8 +29,6 @@ class PostProcess
public function __construct($echooutput = false)
{
$this->echooutput = (NN_ECHOCLI && $echooutput);;
$s = new \Sites();
$this->site = $s->get();
$this->pdo = new Settings();
$this->mediafileregex = 'AVI|VOB|MKV|MP4|TS|WMV|MOV|M4V|F4V|MPG|MPEG|M2TS';
$this->audiofileregex = 'MP3|AAC|OGG';
+1 -4
View File
@@ -131,10 +131,7 @@ class ReleaseComments
return false;
$db = new Settings();
$site = new Sites();
$s = $site->get();
if ($s->storeuserips != "1")
if ($db->getSetting('storeuserips') != "1")
$host = "";
$comid = $db->queryInsert(sprintf("INSERT INTO releasecomment (releaseid, gid, text, userid, createddate, host) VALUES (%d, %s, %s, %d, now(), %s)", $id, $db->escapeString($gid), $db->escapeString($text), $userid, $db->escapeString($host)));
-2
View File
@@ -29,8 +29,6 @@ class ReleaseRegex
{
$this->regexes = [];
$this->pdo = new Settings();
$s = new Sites();
$this->site = $s->get();
$this->tablePerGroup = $this->pdo->getSetting('tablepergroup');
}
-2
View File
@@ -31,8 +31,6 @@ class RequestIDWeb extends RequestID
public function __construct(array $options = array())
{
parent::__construct($options);
$s = new Sites();
$this->site = $s->get();
$this->_request_hours = ($this->pdo->getSetting('request_hours') != '') ? (int)$this->pdo->getSetting('request_hours') : 1;
}
-2
View File
@@ -15,8 +15,6 @@ class Tmux
function __construct(Settings $pdo = null)
{
$this->pdo = (empty($pdo) ? new Settings() : $pdo);
$s = new Sites;
$this->site = $s->get();
}
public function version()
-2
View File
@@ -33,8 +33,6 @@ class TmuxOutput extends Tmux
{
parent::__construct($pdo);
$s = new Sites();
$site = $s->get();
$t = new Tmux();
$tmux = $t->get();
$this->_git = new \newznab\utility\Git(); // Do not remove the full namespace/ PHP gets confused for some reason without it.
+3 -2
View File
@@ -1,6 +1,7 @@
<?php
use newznab\utility\Utility;
use newznab\db\Settings;
/**
* Class TraktTv
@@ -24,8 +25,8 @@ Class TraktTv
];
$options += $defaults;
$settings = ($options['Settings'] instanceof Sites ? $options['Settings'] : new Sites());
$this->APIKEY = $settings->get()->trakttvkey;
$settings = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$this->APIKEY = $settings->getSetting('trakttvkey');
}
/**
-2
View File
@@ -36,8 +36,6 @@ class TvAnger
'Settings' => null,
];
$options += $defaults;
$s = new Sites();
$this->site = $s->get();
$this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$this->rageqty = ($this->pdo->getSetting('maxrageprocessed') != '') ? $this->pdo->getSetting('maxrageprocessed') : 75;
-5
View File
@@ -477,8 +477,6 @@ class Users
public function signup($uname, $pass, $email, $host, $role = self::ROLE_USER, $notes, $invites = self::DEFAULT_INVITES, $invitecode = '', $forceinvitemode = false)
{
$site = new Sites;
$this->site = $site->get();
$uname = trim($uname);
$pass = trim($pass);
@@ -563,9 +561,6 @@ class Users
public function add($uname, $pass, $email, $role, $notes, $host, $invites = self::DEFAULT_INVITES, $invitedby = 0)
{
$site = new Sites();
$this->site = $site->get();
if ($this->pdo->getSetting('storeuserips') != "1")
$host = "";