diff --git a/bin/update_binaries.php b/bin/update_binaries.php index b9ccc6d98..eb6091f4f 100644 --- a/bin/update_binaries.php +++ b/bin/update_binaries.php @@ -24,6 +24,7 @@ if (isset($argv[1])) { function relativeTime($_time) { + $d = array(); $d[0] = array(1, "sec"); $d[1] = array(60, "min"); $d[2] = array(3600, "hr"); diff --git a/lib/Konsole.php b/lib/Konsole.php index 55ecb58d4..a41b73bea 100644 --- a/lib/Konsole.php +++ b/lib/Konsole.php @@ -417,6 +417,7 @@ class Konsole protected function _setConBeforeMatch($amaz, $gameInfo) { + $con = array(); $con['platform'] = (string)$amaz->Items->Item->ItemAttributes->Platform; if (empty($con['platform'])) { $con['platform'] = $gameInfo['platform']; @@ -439,6 +440,7 @@ class Konsole protected function _setConAfterMatch($amaz = array()) { + $con = array(); $con['asin'] = (string)$amaz->Items->Item->ASIN; $con['url'] = (string)$amaz->Items->Item->DetailPageURL; diff --git a/lib/copy_this/www/lib/AEBN.php b/lib/copy_this/www/lib/AEBN.php index a1ed32694..8988a95e2 100644 --- a/lib/copy_this/www/lib/AEBN.php +++ b/lib/copy_this/www/lib/AEBN.php @@ -196,7 +196,7 @@ class AEBN } $i = $i + 1; } - if ($i === $count OR $count === 0) { + if ($i === $count || $count === 0) { if ($this->_currentSite === "gay") { return false; } diff --git a/lib/copy_this/www/lib/GiantBombAPI.php b/lib/copy_this/www/lib/GiantBombAPI.php index 9f01a8876..5034ed0a0 100644 --- a/lib/copy_this/www/lib/GiantBombAPI.php +++ b/lib/copy_this/www/lib/GiantBombAPI.php @@ -122,6 +122,7 @@ class GiantBomb curl_setopt($this->ch, CURLOPT_URL, $url); // Send the request & save response to $resp + $resp = array(); $resp["data"] = curl_exec($this->ch); if (curl_errno($this->ch)) { throw new GiantBombException('API call failed: ' . curl_error($this->ch)); diff --git a/lib/copy_this/www/lib/IAFD.php b/lib/copy_this/www/lib/IAFD.php index 99f9c2774..8369b7c20 100644 --- a/lib/copy_this/www/lib/IAFD.php +++ b/lib/copy_this/www/lib/IAFD.php @@ -148,7 +148,7 @@ class IAFD $secondtitle = $ret->find("dd", 0)->innertext; } unset($ret); - if (isset($secondtitle) OR isset($firsttitle)) { + if (isset($secondtitle) || isset($firsttitle)) { $firsttitle = preg_replace('/\(([0-9]+)\)/', "", $firsttitle); $firsttitle = preg_replace('/XXX/', '', $firsttitle); $firsttitle = preg_replace('/\(.*?\)|[-._]/i', ' ', $firsttitle); diff --git a/lib/copy_this/www/lib/ReleaseCleaning.php b/lib/copy_this/www/lib/ReleaseCleaning.php index 38a9b1901..1d920898c 100644 --- a/lib/copy_this/www/lib/ReleaseCleaning.php +++ b/lib/copy_this/www/lib/ReleaseCleaning.php @@ -108,7 +108,7 @@ class ReleaseCleaning $title = $this->pdo->queryOneRow("SELECT title, id from prehash WHERE title = " . $this->pdo->escapeString(trim($val))); // don't match against ab.teevee if title is for just the season - if ($this->groupName == 'alt.binaries.teevee' and preg_match('/\.S\d\d\./', $title['title'], $match)) { + if ($this->groupName == 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $match)) { $title = false; } if ($title !== false) { @@ -169,7 +169,7 @@ class ReleaseCleaning ); } // don't match against ab.teevee if title is for just the season - if ($this->groupName == 'alt.binaries.teevee' and preg_match('/\.S\d\d\./', $title['title'], $match)) { + if ($this->groupName == 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $match)) { $title = false; } if ($title !== false) { diff --git a/lib/copy_this/www/lib/TMDb.php b/lib/copy_this/www/lib/TMDb.php index 412cb3ca0..eb7682bff 100644 --- a/lib/copy_this/www/lib/TMDb.php +++ b/lib/copy_this/www/lib/TMDb.php @@ -67,10 +67,12 @@ class TMDb /** * Default constructor * - * @param string $apikey API-key recieved from TMDb - * @param string $defaultLang Default language (ISO 3166-1) - * @param boolean $config Load the TMDb-config - * @return void + * @param string $apikey API-key recieved from TMDb + * @param string $default_lang + * @param boolean $config Load the TMDb-config + * @param string $scheme + * + * @internal param string $defaultLang Default language (ISO 3166-1) */ public function __construct($apikey, $default_lang = 'en', $config = FALSE, $scheme = TMDb::API_SCHEME) { @@ -87,11 +89,15 @@ class TMDb /** * Search a movie by querystring * - * @param string $text Query to search after in the TMDb database - * @param int $page Number of the page with results (default first page) - * @param bool $adult Whether of not to include adult movies in the results (default FALSE) - * @param mixed $lang Filter the result with a language (ISO 3166-1) other then default, use FALSE to retrieve results from all languages + * @param $query + * @param int $page Number of the page with results (default first page) + * @param bool $adult Whether of not to include adult movies in the results (default FALSE) + * @param null $year + * @param mixed $lang Filter the result with a language (ISO 3166-1) other then default, use FALSE to retrieve results from all languages + * * @return TMDb result array + * @throws TMDbException + * @internal param string $text Query to search after in the TMDb database */ public function searchMovie($query, $page = 1, $adult = FALSE, $year = NULL, $lang = NULL) { @@ -108,10 +114,13 @@ class TMDb /** * Search a person by querystring * - * @param string $text Query to search after in the TMDb database - * @param int $page Number of the page with results (default first page) - * @param bool $adult Whether of not to include adult movies in the results (default FALSE) + * @param $query + * @param int $page Number of the page with results (default first page) + * @param bool $adult Whether of not to include adult movies in the results (default FALSE) + * * @return TMDb result array + * @throws TMDbException + * @internal param string $text Query to search after in the TMDb database */ public function searchPerson($query, $page = 1, $adult = FALSE) { @@ -126,9 +135,12 @@ class TMDb /** * Search a company by querystring * - * @param string $text Query to search after in the TMDb database - * @param int $page Number of the page with results (default first page) + * @param $query + * @param int $page Number of the page with results (default first page) + * * @return TMDb result array + * @throws TMDbException + * @internal param string $text Query to search after in the TMDb database */ public function searchCompany($query, $page = 1) { @@ -673,10 +685,12 @@ class TMDb /** * Add a rating to a movie * - * @param string $session_id Set session_id for the account you want to retrieve information from - * @param int $movie_id TMDb movie-id - * @param float $value Value between 1 and 10 + * @param string $session_id Set session_id for the account you want to retrieve information from + * @param int $movie_id TMDb movie-id + * @param float|int $value Value between 1 and 10 + * * @return TMDb result array + * @throws TMDbException */ public function addMovieRating($session_id = NULL, $movie_id = 0, $value = 0) { @@ -707,10 +721,12 @@ class TMDb /** * Get Image URL * - * @param string $filepath Filepath to image - * @param const $imagetype Image type: TMDb::IMAGE_BACKDROP, TMDb::IMAGE_POSTER, TMDb::IMAGE_PROFILE - * @param string $size Valid size for the image + * @param string $filepath Filepath to image + * @param const $imagetype Image type: TMDb::IMAGE_BACKDROP, TMDb::IMAGE_POSTER, TMDb::IMAGE_PROFILE + * @param string $size Valid size for the image + * * @return string + * @throws TMDbException */ public function getImageUrl($filepath, $imagetype, $size) { @@ -739,8 +755,10 @@ class TMDb /** * Get available image sizes for a particular image type * - * @param const $imagetype Image type: TMDb::IMAGE_BACKDROP, TMDb::IMAGE_POSTER, TMDb::IMAGE_PROFILE + * @param const $imagetype Image type: TMDb::IMAGE_BACKDROP, TMDb::IMAGE_POSTER, TMDb::IMAGE_PROFILE + * * @return array + * @throws TMDbException */ public function getAvailableImageSizes($imagetype) { @@ -771,11 +789,13 @@ class TMDb /** * Makes the call to the API * - * @param string $function API specific function name for in the URL - * @param array $params Unencoded parameters for in the URL - * @param string $session_id Session_id for authentication to the API for specific API methods - * @param const $method TMDb::GET or TMDb:POST (default TMDb::GET) + * @param string $function API specific function name for in the URL + * @param array $params Unencoded parameters for in the URL + * @param string $session_id Session_id for authentication to the API for specific API methods + * @param const|string $method TMDb::GET or TMDb:POST (default TMDb::GET) + * * @return TMDb result array + * @throws TMDbException */ private function _makeCall($function, $params = NULL, $session_id = NULL, $method = TMDb::GET) { @@ -791,7 +811,7 @@ class TMDb if($method === TMDb::GET) { - if(isset($params['language']) AND $params['language'] === FALSE) + if(isset($params['language']) && $params['language'] === FALSE) { unset($params['language']); } diff --git a/lib/copy_this/www/lib/Tmux.php b/lib/copy_this/www/lib/Tmux.php index 3b28f40cf..dd5312146 100644 --- a/lib/copy_this/www/lib/Tmux.php +++ b/lib/copy_this/www/lib/Tmux.php @@ -60,6 +60,7 @@ class Tmux public function getConnectionsInfo($constants) { + $runVar = array(); $runVar['connections']['port_a'] = $runVar['connections']['host_a'] = $runVar['connections']['ip_a'] = false; if ($constants['nntpproxy'] == 0) { @@ -73,7 +74,7 @@ class Tmux } } else { $filename = NN_MISC . "update_scripts/nix_scripts/tmux/python/lib/nntpproxy.conf"; - $fp = fopen($filename, "r") or die("Couldn't open $filename"); + $fp = fopen($filename, "r") || die("Couldn't open $filename"); while (!feof($fp)) { $line = fgets($fp); if (preg_match('/"host": "(.+)",$/', $line, $match)) { @@ -86,7 +87,7 @@ class Tmux } if ($constants['alternate_nntp']) { $filename = NN_MISC . "update_scripts/nix_scripts/tmux/python/lib/nntpproxy_a.conf"; - $fp = fopen($filename, "r") or die("Couldn't open $filename"); + $fp = fopen($filename, "r") || die("Couldn't open $filename"); while (!feof($fp)) { $line = fgets($fp); if (preg_match('/"host": "(.+)",$/', $line, $match)) { @@ -120,6 +121,7 @@ class Tmux $port = 'port'; break; } + $runVar = array(); $runVar['conncounts'][$which]['active'] = $runVar['conncounts'][$which]['total'] = 0; @@ -348,6 +350,7 @@ class Tmux public function relativeTime($_time) { + $d = array(); $d[0] = [1, "sec"]; $d[1] = [60, "min"]; $d[2] = [3600, "hr"]; diff --git a/lib/copy_this/www/lib/XXX.php b/lib/copy_this/www/lib/XXX.php index e1c192cfa..5803aabbc 100644 --- a/lib/copy_this/www/lib/XXX.php +++ b/lib/copy_this/www/lib/XXX.php @@ -485,7 +485,7 @@ class XXX $xxxID = $check['id']; } - if($check === false OR $xxxID > 0){ + if($check === false || $xxxID > 0){ // Update Current XXX Information - getXXXCovers.php if($xxxID > 0){ diff --git a/lib/copy_this/www/lib/nfo.php b/lib/copy_this/www/lib/nfo.php index 00562c46f..6efd7bf74 100644 --- a/lib/copy_this/www/lib/nfo.php +++ b/lib/copy_this/www/lib/nfo.php @@ -157,9 +157,9 @@ class Nfo // Returns true if data passed in is binary, otherwise // returns false, $has_binary = ( - 0 or substr_count($raw, "^\r\n")/512 > 0.3 - or substr_count($raw, "^ -~")/512 > 0.3 - or substr_count($raw, "\x00") > 0 + 0 || substr_count($raw, "^\r\n")/512 > 0.3 + || substr_count($raw, "^ -~")/512 > 0.3 + || substr_count($raw, "\x00") > 0 ); if($has_binary) @@ -502,7 +502,7 @@ class Nfo "WHERE r.releasenfoid = ".Nfo::FLAG_NFO_PENDING. " ORDER BY postdate DESC"; - if ($limit !==Null and $limit > 0) + if ($limit !== Null && $limit > 0) $mnfo .= " LIMIT $limit"; $res = $db->query($mnfo); diff --git a/lib/copy_this/www/lib/nzbinfo.php b/lib/copy_this/www/lib/nzbinfo.php index 600ae8ebf..471a43c41 100644 --- a/lib/copy_this/www/lib/nzbinfo.php +++ b/lib/copy_this/www/lib/nzbinfo.php @@ -1,7 +1,7 @@ nfofileregex = '/[ "\(\[].*?\.(nfo|ofn)[ "\)\]]/iS'; @@ -51,19 +51,19 @@ class nzbInfo $this->txtfileregex = '/\.(txt)[ "\)\]]/iS'; $this->sfvfileregex = '/\.(sfv)[ "\)\]]/iS'; } - + public function loadFromString($str, $loadAllVars=false) { if (empty($this->source)) $this->source = 'string'; $this->loadAllVars = $loadAllVars; - + $xmlObj = @simplexml_load_string($str); if ($this->isValidNzb($xmlObj)) $this->parseNzb($xmlObj); - + unset($xmlObj); - + return $this->isLoaded; } @@ -100,7 +100,7 @@ class nzbInfo } return $this->isLoaded; } - + public function summarize() { $out = array(); @@ -113,16 +113,16 @@ class nzbInfo $out[] = ' -media detected'; if (!empty($this->audio)) $out[] = ' -audio detected'; - + if (!empty($this->metadata)) { $out[] = ' -metadata:'; foreach($this->metadata as $mk=>$mv) $out[] = ' -'.$mk.': '.$mv; } - + $out[] = ' -sngl: '.sizeof($this->segmentfiles); - + $out[] = ' -pstr: '.$this->poster; $out[] = ' -grps: '.implode(', ', $this->groups); $out[] = ' -size: '.round(($this->filesize / 1048576), 2).' MB in '.$this->filecount.' Files'; @@ -136,10 +136,10 @@ class nzbInfo $out[] = ' -pstd: '.date("Y-m-d H:i:s", $this->postedlast); $out[] = ''; $out[] = ''; - + return implode(PHP_EOL, $out); } - + private function isValidNzb($xmlObj) { if (!$xmlObj || strtolower($xmlObj->getName()) != 'nzb' || !isset($xmlObj->file)) @@ -147,9 +147,9 @@ class nzbInfo return true; } - + private function parseNzb($xmlObj) - { + { //Metadata if (isset($xmlObj->head->meta)) { @@ -162,14 +162,14 @@ class nzbInfo } } } - + //NZB GID = first segment of first file $gid = (string) $xmlObj->file->segments->segment; if (!empty($gid)) $this->gid = md5($gid); - - foreach($xmlObj->file as $file) - { + + foreach($xmlObj->file as $file) + { $fileArr = array(); $fileArr['subject'] = (string) $file->attributes()->subject; $fileArr['poster'] = (string) $file->attributes()->poster; @@ -180,44 +180,44 @@ class nzbInfo $fileArr['segmentactual'] = 0; $fileArr['completion'] = 0; $fileArr['segments'] = array(); - + //subject $subject = $fileArr['subject']; - + //poster $this->poster = $fileArr['poster']; - + //dates $date = $fileArr['posted']; if ($date > $this->postedlast || $this->postedlast == 0) $this->postedlast = $date; - + if ($date < $this->postedfirst || $this->postedfirst == 0) $this->postedfirst = $date; - - + + //groups foreach ($file->groups->group as $group) { $this->groups[] = (string) $group; $fileArr['groups'][] = (string) $group; } - + //file segments - foreach($file->segments->segment as $segment) + foreach($file->segments->segment as $segment) { $bytes = (int) $segment->attributes()->bytes; $number = (int) $segment->attributes()->number; - + $this->filesize += $bytes; $this->segmentactual++; - + $fileArr['filesize'] += $bytes; $fileArr['segmentactual']++; $fileArr['segments'][$number] = (string) $segment; $fileArr['segmentbytes'][$number] = $bytes; } - + $pattern = '|\((\d+)[\/](\d+)\)|i'; preg_match_all($pattern, $subject, $matches, PREG_PATTERN_ORDER); $matchcnt = sizeof($matches[0]); @@ -239,28 +239,28 @@ class nzbInfo //file counts $this->filecount++; - + if ($fileArr['segmenttotal'] == 1) $this->segmentfiles[] = $fileArr; - + if (preg_match($this->nfofileregex, $subject)) $this->nfofiles[] = $fileArr; - + if (preg_match($this->mediafileregex, $subject) && preg_match('/sample[\.\-]/i', $subject) && !preg_match('/\.par2|\.srs/i', $subject)) $this->samplefiles[] = $fileArr; - + if (preg_match($this->mediafileregex, $subject) && !preg_match('/sample[\.\-]/i', $subject) && !preg_match('/\.par2|\.srs/i', $subject)) { $this->mediafiles[] = $fileArr; $this->videocount++; } - + if (preg_match('/\.(rar|r\d{2,3})(?!\.)/i', $subject) && !preg_match('/\.(par2|vol\d+\+|sfv|nzb)/i', $subject)) $this->rarcount++; - + if (preg_match($this->rarfileregex, $subject) && !preg_match('/\.(par2|vol\d+\+|sfv|nzb)/i', $subject)) $this->rarfiles[] = $fileArr; - + if (preg_match($this->audiofileregex, $subject) && !preg_match('/\.(par2|vol\d+\+|sfv|nzb)/i', $subject)) { $this->audiofiles[] = $fileArr; @@ -300,7 +300,7 @@ class nzbInfo if (preg_match('/\.zip(?!\.)/i', $subject) && !preg_match('/\.(par2|vol\d+\+|sfv|nzb)/i', $subject)) $this->zipcount++; - + if ($this->loadAllVars === true) $this->nzb[] = $fileArr; else @@ -308,13 +308,13 @@ class nzbInfo } $this->groups = array_unique($this->groups); - + if ($this->segmenttotal > 0) $this->completion = number_format(($this->segmentactual/$this->segmenttotal)*100, 0); - + if (is_array($this->nzb) && !empty($this->nzb)) $this->isLoaded = true; - + return $this->isLoaded; } @@ -329,6 +329,7 @@ class nzbInfo if (!empty($this->metadata)) { $nzb .= "\n"; + $out = array(); foreach($this->metadata as $mk=>$mv) $out[] = ' '.$mv."\n"; $nzb .= "\n"; diff --git a/lib/copy_this/www/lib/util.php b/lib/copy_this/www/lib/util.php index 03e4c717c..f57880a1d 100644 --- a/lib/copy_this/www/lib/util.php +++ b/lib/copy_this/www/lib/util.php @@ -358,6 +358,7 @@ class Utility default: $language = 'en'; } + $header = array(); $header[] = "Accept-Language: " . $language; $ch = curl_init(); diff --git a/lib/copy_this/www/pages/api.php b/lib/copy_this/www/pages/api.php index 12d07ffdd..5f2161fde 100644 --- a/lib/copy_this/www/pages/api.php +++ b/lib/copy_this/www/pages/api.php @@ -574,6 +574,7 @@ function maxAge() */ function categoryid() { + $categoryID = array(); $categoryID[] = -1; if (isset($_GET['cat'])) { $categoryIDs = $_GET['cat']; diff --git a/lib/copy_this/www/populate/AniDB.php b/lib/copy_this/www/populate/AniDB.php index d41671e14..c5f3e8686 100644 --- a/lib/copy_this/www/populate/AniDB.php +++ b/lib/copy_this/www/populate/AniDB.php @@ -174,6 +174,7 @@ class PopulateAniDB foreach ($AniDBAPIXML->episodes->episode AS $episode) { $titleArray = array(); + $episodeArray = array(); $episodeArray[$i]['episode_id'] = (int)$episode->attributes()->id[0]; $episodeArray[$i]['episode_no'] = (int)$episode->epno; $episodeArray[$i]['airdate'] = (string)$episode->airdate;