diff --git a/Blacklight/AniDB.php b/Blacklight/AniDB.php index 1b09d9605..8759d68f6 100755 --- a/Blacklight/AniDB.php +++ b/Blacklight/AniDB.php @@ -33,9 +33,6 @@ class AniDB * @param string $rating * @param string $categories * @param string $characters - * @param $epnos - * @param $airdates - * @param $episodetitles */ public function updateTitle($anidbID, $title, $type, $startdate, $enddate, $related, $similar, $creators, $description, $rating, $categories, $characters, $epnos, $airdates, $episodetitles): void { @@ -69,24 +66,22 @@ class AniDB } /** - * @param $anidbID - * * @throws \Throwable */ public function deleteTitle($anidbID): void { DB::transaction(function () use ($anidbID) { DB::delete( - sprintf( - ' + sprintf( + ' DELETE at, ai, ae FROM anidb_titles AS at LEFT OUTER JOIN anidb_info ai USING (anidbid) LEFT OUTER JOIN anidb_episodes ae USING (anidbid) WHERE anidbid = %d', - $anidbID - ) - ); + $anidbID + ) + ); }, 3); } @@ -96,7 +91,6 @@ class AniDB * * @param string $letter * @param string $animetitle - * @return array */ public function getAnimeList($letter = '', $animetitle = ''): array { @@ -137,7 +131,6 @@ class AniDB * * * @param string $animetitle - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ public function getAnimeRange($animetitle = ''): \Illuminate\Contracts\Pagination\LengthAwarePaginator { @@ -159,7 +152,6 @@ class AniDB * Retrieves all info for a specific AniDB ID. * * - * @param $anidbID * @return mixed */ public function getAnimeInfo($anidbID) diff --git a/Blacklight/Backfill.php b/Blacklight/Backfill.php index 5d3d28047..4f804a931 100755 --- a/Blacklight/Backfill.php +++ b/Blacklight/Backfill.php @@ -21,6 +21,7 @@ class Backfill * @var \Blacklight\NNTP */ protected $_nntp; + /** * Should we use compression for headers? * @@ -76,11 +77,11 @@ class Backfill public function __construct(array $options = []) { $defaults = [ - 'Echo' => true, - 'Logger' => null, - 'Groups' => null, - 'NNTP' => null, - 'Settings' => null, + 'Echo' => true, + 'Logger' => null, + 'Groups' => null, + 'NNTP' => null, + 'Settings' => null, ]; $options += $defaults; @@ -169,7 +170,6 @@ class Backfill * @param array $groupArr * @param int $left * @param int|string $articles - * @return void * * @throws \Throwable */ @@ -258,7 +258,7 @@ class Backfill '. Our oldest article is article '. number_format($groupArr['first_record']). '.' - ); + ); } // Set first and last, moving the window by max messages. @@ -328,7 +328,7 @@ class Backfill ' processed in '. number_format(now()->timestamp - $startGroup, 2). ' seconds.' - ); + ); } } diff --git a/Blacklight/Binaries.php b/Blacklight/Binaries.php index b57867731..5b89f3748 100644 --- a/Blacklight/Binaries.php +++ b/Blacklight/Binaries.php @@ -19,28 +19,23 @@ use Illuminate\Support\Str; class Binaries { public const OPTYPE_BLACKLIST = 1; + public const OPTYPE_WHITELIST = 2; public const BLACKLIST_DISABLED = 0; + public const BLACKLIST_ENABLED = 1; public const BLACKLIST_FIELD_SUBJECT = 1; + public const BLACKLIST_FIELD_FROM = 2; + public const BLACKLIST_FIELD_MESSAGEID = 3; - /** - * @var array - */ public array $blackList = []; - /** - * @var array - */ public array $whiteList = []; - /** - * @var int - */ public int $messageBuffer; /** @@ -60,80 +55,53 @@ class Binaries /** * Should we use header compression? - * - * @var bool */ protected bool $_compressedHeaders; /** * Should we use part repair? - * - * @var bool */ protected bool $_partRepair; - /** - * @var \Closure|\PDO - */ protected \Closure|\PDO $_pdo; /** * How many days to go back on a new group? - * - * @var bool */ protected bool $_newGroupScanByDays; /** * How many headers to download on new groups? - * - * @var int */ protected int $_newGroupMessagesToScan; /** * How many days to go back on new groups? - * - * @var int */ protected int $_newGroupDaysToScan; /** * How many headers to download per run of part repair? - * - * @var int */ protected int $_partRepairLimit; /** * Echo to cli? - * - * @var bool */ protected bool $_echoCLI; /** * Max tries to download headers. - * - * @var int */ protected int $_partRepairMaxTries; /** * An array of BinaryBlacklist IDs that should have their activity date updated. - * - * @var array */ protected array $_binaryBlacklistIdsToUpdate = []; - /** - * @var \DateTime - */ protected \DateTime $startCleaning; - /** - * @var \DateTime - */ protected \DateTime $startLoop; /** @@ -146,14 +114,8 @@ class Binaries */ protected int $timeCleaning; - /** - * @var \DateTime - */ protected \DateTime $startPR; - /** - * @var \DateTime - */ protected \DateTime $startUpdate; /** @@ -216,13 +178,13 @@ class Binaries public function __construct(array $options = []) { $defaults = [ - 'Echo' => true, + 'Echo' => true, 'CollectionsCleaning' => null, - 'ColorCLI' => null, - 'Logger' => null, - 'Groups' => null, - 'NNTP' => null, - 'Settings' => null, + 'ColorCLI' => null, + 'Logger' => null, + 'Groups' => null, + 'NNTP' => null, + 'Settings' => null, ]; $options += $defaults; @@ -253,7 +215,6 @@ class Binaries * Download new headers for all active groups. * * @param int $maxHeaders (Optional) How many headers to download max. - * @return void * * @throws \Exception * @throws \Throwable @@ -312,7 +273,6 @@ class Binaries * * @param array $groupMySQL Array of MySQL results for a single group. * @param int $maxHeaders (Optional) How many headers to download max. - * @return void * * @throws \Exception * @throws \Throwable @@ -425,18 +385,17 @@ class Binaries : number_format($this->_newGroupMessagesToScan).' messages' ).' worth.' : 'Group '.$groupNNTP['group'].' has '.number_format($realTotal).' new articles.' - ). - ' Leaving '.number_format($leaveOver). - " for next pass.\nServer oldest: ".number_format($groupNNTP['first']). - ' Server newest: '.number_format($groupNNTP['last']). - ' Local newest: '.number_format($groupMySQL['last_record']) - ); + ). + ' Leaving '.number_format($leaveOver). + " for next pass.\nServer oldest: ".number_format($groupNNTP['first']). + ' Server newest: '.number_format($groupNNTP['last']). + ' Local newest: '.number_format($groupMySQL['last_record']) + ); } $done = false; // Get all the parts (in portions of $this->messageBuffer to not use too much memory). while (! $done) { - // Increment last until we reach $groupLast (group newest article). if ($total > $this->messageBuffer) { if ((string) ($first + $this->messageBuffer) > $groupLast) { @@ -453,7 +412,7 @@ class Binaries PHP_EOL.'Getting '.number_format($last - $first + 1).' articles ('.number_format($first). ' to '.number_format($last).') from '.$groupMySQL['name'].' - ('. number_format($groupLast - $last).' articles in queue).' - ); + ); } // Get article headers from newsgroup. @@ -461,7 +420,6 @@ class Binaries // Check if we fetched headers. if (! empty($scanSummary)) { - // If new group, update first record & postdate if ($groupMySQL['first_record_postdate'] === null && (int) $groupMySQL['first_record'] === 0) { $groupMySQL['first_record'] = $scanSummary['firstArticleNumber']; @@ -522,7 +480,7 @@ class Binaries $this->colorCli->primary( PHP_EOL.'Group '.$groupMySQL['name'].' processed in '. $endGroup.Str::plural(' second', $endGroup) - ); + ); } } elseif ($this->_echoCLI) { $this->colorCli->primary( @@ -530,7 +488,7 @@ class Binaries ', last '.number_format($last).', grouplast '.number_format($groupMySQL['last_record']). ', total '.number_format($total).")\n".'Server oldest: '.number_format($groupNNTP['first']). ' Server newest: '.number_format($groupNNTP['last']).' Local newest: '.number_format($groupMySQL['last_record']) - ); + ); } } @@ -572,7 +530,6 @@ class Binaries // If there was an error, try to reconnect. if ($this->_nntp::isError($headers)) { - // Increment if part repair and return false. if ($partRepair) { MissedPart::query()->where('groups_id', $this->groupMySQL['id'])->where('numberid', ((int) $this->first === (int) $this->last ? '= '.$this->first : 'IN ('.implode(',', range($this->first, $this->last)).')'))->increment('attempts', 1); @@ -622,7 +579,6 @@ class Binaries $headersRepaired = $rangeNotReceived = $this->headersReceived = $this->headersNotInserted = []; foreach ($headers as $header) { - // Check if we got the article or not. if (isset($header['Number'])) { $this->headersReceived[] = $header['Number']; @@ -630,6 +586,7 @@ class Binaries if ($this->addToPartRepair) { $rangeNotReceived[] = $header['Number']; } + continue; } @@ -660,12 +617,14 @@ class Binaries } } else { $this->notYEnc++; + continue; } // Filter subject based on black/white list. if ($this->isBlackListed($header, $this->groupMySQL['name'])) { $this->headersBlackListed++; + continue; } @@ -731,7 +690,7 @@ class Binaries $this->colorCli->alternate( 'Server did not return '.$notReceivedCount. ' articles from '.$this->groupMySQL['name'].'.' - ); + ); } } unset($rangeNotReceived); @@ -746,7 +705,6 @@ class Binaries * Parse headers into collections/binaries and store header data as parts. * * - * @param array $headers * * @throws \Exception * @throws \Throwable @@ -763,7 +721,6 @@ class Binaries foreach ($headers as $this->header) { // Set up the info for inserting into parts/binaries/collections tables. if (! isset($articles[$this->header['matches'][1]])) { - // check whether file count should be ignored (XXX packs for now only). $whitelistMatch = false; if ($this->_ignoreFileCount($this->groupMySQL['name'], $this->header['matches'][1])) { @@ -785,7 +742,6 @@ class Binaries // If this header's collection key isn't in memory, attempt to insert the collection if (! isset($collectionIDs[$this->header['CollectionKey']])) { - /* Date from header should be a string this format: * 31 Mar 2014 15:36:04 GMT or 6 Oct 1998 04:38:40 -0500 * Still make sure it's not unix time, convert it to unix time if it is. @@ -853,6 +809,7 @@ class Binaries } DB::rollBack(); DB::beginTransaction(); + continue; } $collectionIDs[$this->header['CollectionKey']] = $collectionID; @@ -885,6 +842,7 @@ class Binaries } DB::rollBack(); DB::beginTransaction(); + continue; } @@ -944,10 +902,6 @@ class Binaries /** * Gets the First and Last Article Number and Date for the received headers. - * - * @param array $returnArray - * @param array $headers - * @param int $msgCount */ protected function getHighLowArticleInfo(array &$returnArray, array $headers, int $msgCount): void { @@ -995,7 +949,7 @@ class Binaries 'Received '.\count($this->headersReceived). ' articles of '.number_format($this->last - $this->first + 1).' requested, '. $this->headersBlackListed.' blacklisted, '.$this->notYEnc.' not yEnc.' - ); + ); } /** @@ -1044,7 +998,6 @@ class Binaries * Attempt to get missing article headers. * * @param array $groupArr The info for this group from mysql. - * @return void * * @throws \Exception * @throws \Throwable @@ -1072,7 +1025,7 @@ class Binaries 'Attempting to repair '. number_format($missingCount). ' parts.' - ); + ); } // Loop through each part to group into continuous ranges with a maximum range of messagebuffer/4. @@ -1083,7 +1036,7 @@ class Binaries if (($part->numberid - $firstPart) > ($this->messageBuffer / 4)) { $ranges[] = [ 'partfrom' => $firstPart, - 'partto' => $lastNum, + 'partto' => $lastNum, 'partlist' => $partList, ]; @@ -1096,7 +1049,7 @@ class Binaries $ranges[] = [ 'partfrom' => $firstPart, - 'partto' => $lastNum, + 'partto' => $lastNum, 'partlist' => $partList, ]; @@ -1152,7 +1105,7 @@ class Binaries PHP_EOL. number_format($partsRepaired). ' parts repaired.' - ); + ); } } @@ -1194,8 +1147,8 @@ class Binaries INNER JOIN parts p ON(b.id=p.binaries_id) WHERE p.number = %s', $currentPost - ) - ); + ) + ); if (! empty($local) && \count($local) > 0) { $date = $local[0]->date; break; @@ -1242,7 +1195,6 @@ class Binaries * * @param int $days How many days back we want to go. * @param array $data Group data from usenet. - * @return string * * @throws \Exception */ @@ -1269,7 +1221,7 @@ class Binaries if ($this->_echoCLI) { $this->colorCli->primary( 'Searching for an approximate article number for group '.$data['group'].' '.$days.' days back.' - ); + ); } // Pick the middle to start with @@ -1328,7 +1280,7 @@ class Binaries $this->colorCli->primary( PHP_EOL.'Found article #'.$wantedArticle.' which has a date of '.date('r', $articleTime). ', vs wanted date of '.date('r', $goalTime).'. Difference from goal is '.Carbon::createFromTimestamp($goalTime)->diffInDays(Carbon::createFromTimestamp($articleTime)).'days.' - ); + ); } return $wantedArticle; @@ -1339,7 +1291,6 @@ class Binaries * * @param array $numbers The article numbers of the missing headers. * @param int $groupID The ID of this groups. - * @return string */ private function addMissingParts(array $numbers, int $groupID): string { @@ -1358,7 +1309,6 @@ class Binaries * * @param array $numbers The article numbers. * @param int $groupID The ID of the group. - * @return void * * @throws \Throwable */ @@ -1375,16 +1325,11 @@ class Binaries /** * Are white or black lists loaded for a group name? - * - * @var array */ protected array $_listsFound = []; /** * Get blacklist and cache it. Return if already cached. - * - * @param string $groupName - * @return void */ protected function _retrieveBlackList(string $groupName): void { @@ -1402,7 +1347,6 @@ class Binaries * * @param array $msg The article header (OVER format). * @param string $groupName The group name. - * @return bool */ public function isBlackListed(array $msg, string $groupName): bool { @@ -1416,8 +1360,8 @@ class Binaries $blackListed = false; $field = [ - self::BLACKLIST_FIELD_SUBJECT => $msg['Subject'], - self::BLACKLIST_FIELD_FROM => $msg['From'], + self::BLACKLIST_FIELD_SUBJECT => $msg['Subject'], + self::BLACKLIST_FIELD_FROM => $msg['From'], self::BLACKLIST_FIELD_MESSAGEID => $msg['Message-ID'], ]; @@ -1457,7 +1401,6 @@ class Binaries * @param int|string $opType Optional, get white or black lists (use Binaries constants). * @param string $groupName Optional, group. * @param bool $groupRegex Optional Join groups / binaryblacklist using regexp for equals. - * @return array */ public function getBlacklist(bool $activeOnly = true, int|string $opType = -1, string $groupName = '', bool $groupRegex = false): array { @@ -1487,7 +1430,6 @@ class Binaries } /** - * @param int $id * @return \App\Models\BinaryBlacklist|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null */ public function getBlacklistByID(int $id) @@ -1505,10 +1447,6 @@ class Binaries BinaryBlacklist::query()->where('id', $id)->delete(); } - /** - * @param array $blacklistArray - * @return void - */ public function updateBlacklist(array $blacklistArray): void { BinaryBlacklist::query()->where('id', $blacklistArray['id'])->update( @@ -1525,8 +1463,6 @@ class Binaries /** * Adds a new blacklist from binary blacklist edit admin web page. - * - * @param array $blacklistArray */ public function addBlacklist(array $blacklistArray): void { @@ -1549,8 +1485,6 @@ class Binaries * * @note A trigger automatically deletes the parts/binaries. * - * @return void - * * @throws \Throwable */ public function delete(int $collectionID): void @@ -1578,10 +1512,6 @@ class Binaries /** * Check if we should ignore the file count and return true or false. - * - * @param string $groupName - * @param string $subject - * @return bool */ protected function _ignoreFileCount(string $groupName, string $subject): bool { @@ -1593,10 +1523,6 @@ class Binaries return $ignore; } - /** - * @param $query - * @return bool - */ protected function runQuery($query): bool { try { diff --git a/Blacklight/Books.php b/Blacklight/Books.php index ed5f022d1..c33bff34c 100755 --- a/Blacklight/Books.php +++ b/Blacklight/Books.php @@ -17,9 +17,6 @@ use Illuminate\Support\Facades\DB; */ class Books { - /** - * @var bool - */ public bool $echooutput; /** @@ -37,19 +34,10 @@ class Books */ public mixed $asstag; - /** - * @var int|null|string - */ public string|int|null $bookqty; - /** - * @var int|null|string - */ public string|int|null $sleeptime; - /** - * @var string - */ public string $imgSavePath; /** @@ -57,14 +45,8 @@ class Books */ public mixed $bookreqids; - /** - * @var string - */ public string $renamed; - /** - * @var array - */ public array $failCache; /** @@ -80,7 +62,7 @@ class Books public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, + 'Echo' => false, 'Settings' => null, ]; $options += $defaults; @@ -103,7 +85,6 @@ class Books } /** - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public function getBookInfo($id) @@ -112,12 +93,10 @@ class Books } /** - * @param $title * @return \Illuminate\Database\Eloquent\Model */ public function getBookInfoByName($title) { - //only used to get a count of words $searchWords = ''; $title = preg_replace(['/( - | -|\(.+\)|\(|\))/', '/[^\w ]+/'], [' ', ''], $title); @@ -134,15 +113,6 @@ class Books return BookInfo::search($searchWords)->first(); } - /** - * @param $page - * @param $cat - * @param $start - * @param $num - * @param $orderby - * @param array $excludedcats - * @return array - */ public function getBookRange($page, $cat, $start, $num, $orderby, array $excludedcats = []): array { $browseby = $this->getBrowseBy(); @@ -229,10 +199,6 @@ class Books return $return; } - /** - * @param $orderby - * @return array - */ public function getBookOrder($orderby): array { $order = $orderby === '' ? 'r.postdate' : $orderby; @@ -251,9 +217,6 @@ class Books return [$orderfield, $ordersort]; } - /** - * @return array - */ public function getBookOrdering(): array { return [ @@ -274,17 +237,11 @@ class Books ]; } - /** - * @return array - */ public function getBrowseByOptions(): array { return ['author' => 'author', 'title' => 'title']; } - /** - * @return string - */ public function getBrowseBy(): string { $browseby = ' '; @@ -328,9 +285,6 @@ class Books } /** - * @param $res - * @param $categoryID - * * @throws \Exception */ protected function processBookReleasesHelper($res, $categoryID): void @@ -397,9 +351,6 @@ class Books } /** - * @param $release_name - * @param $releaseID - * @param $releasetype * @return bool|string */ public function parseTitle($release_name, $releaseID, $releasetype) @@ -452,7 +403,6 @@ class Books } /** - * @param string $bookInfo * @param null $amazdata * @return false|int|string * @@ -546,7 +496,6 @@ class Books } /** - * @param string $bookInfo * @return array|bool * * @throws \DariusIII\ItunesApi\Exceptions\InvalidProviderException diff --git a/Blacklight/Categorize.php b/Blacklight/Categorize.php index c509e4ae3..afd02a970 100755 --- a/Blacklight/Categorize.php +++ b/Blacklight/Categorize.php @@ -16,45 +16,28 @@ class Categorize { /** * Temporary category while we sort through the name. - * - * @var int */ protected int $tmpCat = Category::OTHER_MISC; - /** - * @var bool - */ protected bool $categorizeForeign; - /** - * @var bool - */ protected bool $catWebDL; /** * Release name to sort through. - * - * @var string */ public string $releaseName; /** * Release poster to sort through. - * - * @var string */ public string $poster; /** * Group id of the releasename we are sorting through. - * - * @var int|string */ public string|int $groupId; - /** - * @var string - */ public string $groupName; /** @@ -73,10 +56,6 @@ class Categorize * Then work out which category is applicable for either a group or a binary. * Returns Category::OTHER_MISC if no category is appropriate. * - * @param $groupId - * @param string $releaseName - * @param string $poster - * @return array * * @throws \Exception */ @@ -95,12 +74,8 @@ class Categorize }; } - /** - * @param $groupName - * @return bool - */ public function byGroupName($groupName): bool - { + { switch(true) { case preg_match('/alt\.binaries\.erotica([.]\w+)?/i', $groupName): if ($this->isXxx()) { @@ -116,15 +91,12 @@ class Categorize default: return false; } - } + } // // Beginning of functions to determine category by release name. // - /** - * @return bool - */ public function isTV(): bool { if (preg_match('/Daily[\-_\.]Show|Nightly News|^\[[a-zA-Z\.\-]+\].*[\-_].*\d{1,3}[\-_. ](([\[\(])(h264-)?\d{3,4}([pi])([\]\)])\s?(\[AAC\])?|\[[a-fA-F0-9]{8}\]|(8|10)BIT|hi10p)(\[[a-fA-F0-9]{8}\])?|(\d\d-){2}[12]\d{3}|[12]\d{3}(\.\d\d){2}|\d+x\d+|\.e\d{1,3}\.|s\d{1,3}[._ -]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])|[._ -](\dx\d\d|C4TV|Complete[._ -]Season|DSR|([DHPS])DTV|EP[._ -]?\d{1,3}|S\d{1,3}.+Extras|SUBPACK|Season[._ -]\d{1,2})([._ -]|$)|TVRIP|TV[._ -](19|20)\d\d|Troll(HD|UHD)/i', $this->releaseName) @@ -161,9 +133,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isOtherTV(): bool { if (preg_match('/[._ -]S\d{1,3}.+(EP\d{1,3}|Extras|SUBPACK)[._ -]|News/i', $this->releaseName) @@ -178,9 +147,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isForeignTV(): bool { switch (true) { @@ -197,9 +163,6 @@ class Categorize } } - /** - * @return bool - */ public function isSportTV(): bool { switch (true) { @@ -216,9 +179,6 @@ class Categorize } } - /** - * @return bool - */ public function isDocumentaryTV(): bool { if (preg_match('/[._ -](Docu|Documentary)[._ -]/i', $this->releaseName)) { @@ -230,9 +190,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isWEBDL(): bool { if (preg_match('/(S\d+).*.web[._-]?(dl|rip).*/i', $this->releaseName)) { @@ -244,9 +201,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isAnimeTV(): bool { if (preg_match('/[._ -]Anime[._ -]|^\[[a-zA-Z\.\-]+\].*[\-_].*\d{1,3}[\-_. ](([\[\(])((\d{1,4}x\d{1,4})|(h264-)?\d{3,4}([pi]))([\]\)])\s?(\[AAC\])?|\[[a-fA-F0-9]{8}\]|(8|10)BIT|hi10p)(\[[a-fA-F0-9]{8}\])?/i', $this->releaseName)) { @@ -263,9 +217,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isHDTV(): bool { if (preg_match('/1080([ip])|720p|bluray/i', $this->releaseName)) { @@ -282,9 +233,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isUHDTV(): bool { if (preg_match('/(S\d+).*(2160p).*(Netflix|Amazon|NF|AMZN).*(TrollUHD|NTb|VLAD|DEFLATE|POFUDUK)/i', $this->releaseName)) { @@ -296,9 +244,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isSDTV(): bool { switch (true) { @@ -313,9 +258,6 @@ class Categorize } } - /** - * @return bool - */ public function isOtherTV2(): bool { if (preg_match('/[._ -]s\d{1,3}[._ -]?(e|d(isc)?)\d{1,3}([._ -]|$)/i', $this->releaseName)) { @@ -327,9 +269,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isTVx265(): bool { if (preg_match('/(S\d+).*(x265).*(rmteam|MeGusta|HETeam|PSA|ONLY|H4S5S|TrollHD|ImE)/i', $this->releaseName)) { @@ -343,9 +282,6 @@ class Categorize // Movies. - /** - * @return bool - */ public function isMovie(): bool { if (preg_match('/[._ -]AVC|[._ -]|[BH][DR]RIP|Bluray|BD[._ -]?(25|50)?|\bBR\b|Camrip|[._ -]\d{4}[._ -].+(720p|1080p|Cam|HDTS)|DIVX|[._ -]DVD[._ -]|DVD-?(5|9|R|Rip)|Untouched|VHSRip|XVID|[._ -](DTS|TVrip)[._ -]/i', $this->releaseName) && ! preg_match('/auto(cad|desk)|divx[._ -]plus|[._ -]exe$|[._ -](jav|XXX)[._ -]|SWE6RUS|\wXXX(1080p|720p|DVD)|Xilisoft/i', $this->releaseName)) { @@ -358,9 +294,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMovieForeign(): bool { switch (true) { @@ -377,9 +310,6 @@ class Categorize } } - /** - * @return bool - */ public function isMovieDVD(): bool { if (preg_match('/(dvd\-?r|[._ -]dvd|dvd9|dvd5|[._ -]r5)[._ -]/i', $this->releaseName)) { @@ -391,9 +321,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMovieSD(): bool { if (preg_match('/(divx|dvdscr|extrascene|dvdrip|\.CAM|HDTS(-LINE)?|vhsrip|xvid(vd)?)[._ -]/i', $this->releaseName)) { @@ -405,9 +332,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMovie3D(): bool { if (preg_match('/[._ -]3D\s?[\.\-_\[ ](1080p|(19|20)\d\d|AVC|BD(25|50)|Blu[._ -]?ray|CEE|Complete|GER|MVC|MULTi|SBS|H(-)?SBS)[._ -]/i', $this->releaseName)) { @@ -419,9 +343,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMovieBluRay(): bool { if (preg_match('/bluray-|[._ -]bd?[._ -]?(25|50)|blu-ray|Bluray\s-\sUntouched|[._ -]untouched[._ -]/i', $this->releaseName) @@ -434,9 +355,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMovieHD(): bool { if (preg_match('/720p|1080p|AVC|VC1|VC-1|web-dl|wmvhd|x264|XvidHD|bdrip/i', $this->releaseName)) { @@ -453,9 +371,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMovieUHD(): bool { if (! preg_match('/(S\d+).*(2160p).*(Netflix|Amazon).*(TrollUHD|NTb|VLAD)/i', $this->releaseName) && false !== stripos($this->releaseName, '2160p')) { @@ -467,9 +382,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMovieOther(): bool { if (preg_match('/[._ -]cam[._ -]/i', $this->releaseName)) { @@ -481,9 +393,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMovieWEBDL(): bool { if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { @@ -495,9 +404,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMovieX265(): bool { if (preg_match('/(\w+[\.-_\s]+).*(x265).*(Tigole|SESKAPiLE|CHD|IAMABLE|THREESOME|OohLaLa|DEFLATE|NCmt)/i', $this->releaseName)) { @@ -511,9 +417,6 @@ class Categorize // PC. - /** - * @return bool - */ public function isPC(): bool { return match (true) { @@ -522,9 +425,6 @@ class Categorize }; } - /** - * @return bool - */ public function isPhone(): bool { switch (true) { @@ -544,9 +444,6 @@ class Categorize return true; } - /** - * @return bool - */ public function isISO(): bool { switch (true) { @@ -560,9 +457,6 @@ class Categorize } } - /** - * @return bool - */ public function is0day(): bool { switch (true) { @@ -577,9 +471,6 @@ class Categorize } } - /** - * @return bool - */ public function isMac(): bool { if (preg_match('/(\b|[._ -])mac([\.\s])?osx(\b|[\-_. ])/i', $this->releaseName)) { @@ -591,9 +482,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isPCGame(): bool { if (preg_match('/[^a-z0-9](0x0007|ALiAS|BACKLASH|BAT|CLONECD|CPY|FAS(DOX|iSO)|FLT([._ -]|COGENT)|FLT(DOX)?|PC GAMES?|\(?(Game([sz])|GAME([SZ]))\)? ?(\(([Cc])\))|GENESIS|-GOG|-HATRED|HI2U|INLAWS|JAGUAR|MAZE|MONEY|OUTLAWS|PPTCLASSiCS|PC Game|PROPHET|RAiN|Razor1911|RELOADED|DEViANCE|PLAZA|RiTUELYPOGEiOS|[rR][iI][pP]-[uU][nN][lL][eE][aA][sS][hH][eE][dD]|Steam(\b)?Rip|SKIDROW|TiNYiSO|CODEX|SiMPLEX)[^a-z0-9]?/', $this->releaseName)) { @@ -611,9 +499,6 @@ class Categorize // XXX. - /** - * @return bool - */ public function isXxx(): bool { switch (true) { @@ -640,9 +525,6 @@ class Categorize } } - /** - * @return bool - */ public function isXxx264(): bool { if (preg_match('/720p|1080(hd|[ip])|[xh][^a-z0-9]?264/i', $this->releaseName) && ! preg_match('/\bwmv\b/i', $this->releaseName) && stripos($this->releaseName, 'SDX264XXX') === false) { @@ -659,9 +541,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxUHD(): bool { if (preg_match('/XXX.+(2160p)+[\w\-.]+(M[PO][V4]-(KTR|GUSH|FaiLED|SEXORS|hUSHhUSH|YAPG|WRB|NBQ|FETiSH))/i', $this->releaseName)) { @@ -673,9 +552,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxClipHD(): bool { if (preg_match('/^[\w\-.]+(\d{2}\.\d{2}\.\d{2}).+(720|1080)+[\w\-.]+(M[PO][V4]-(KTR|GUSH|FaiLED|SEXORS|hUSHhUSH|YAPG|TRASHBIN|WRB|NBQ|FETiSH))/i', $this->releaseName)) { @@ -687,9 +563,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxWMV(): bool { if (preg_match('/(\d{2}\.\d{2}\.\d{2})|([ex]\d{2,})|[^a-z0-9](f4v|flv|isom|(issue\.\d{2,})|mov|mp(4|eg)|multiformat|pack-|realmedia|uhq|wmv)[^a-z0-9]/i', $this->releaseName) && stripos($this->releaseName, 'SDX264XXX') === false) { @@ -701,9 +574,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxXvid(): bool { if (preg_match('/(b[dr]|dvd)rip|detoxication|divx|nympho|pornolation|swe6|tesoro|xvid/i', $this->releaseName)) { @@ -715,9 +585,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxDVD(): bool { if (preg_match('/dvdr[^i]|dvd[59]/i', $this->releaseName)) { @@ -729,9 +596,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxImageset(): bool { if (preg_match('/IMAGESET|PICTURESET|ABPEA/i', $this->releaseName)) { @@ -743,9 +607,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxPack(): bool { if (preg_match('/[ .]PACK[ .]/i', $this->releaseName)) { @@ -757,9 +618,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxOther(): bool { // If nothing else matches, then try these words. @@ -772,9 +630,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxClipSD(): bool { switch (true) { @@ -792,9 +647,6 @@ class Categorize } } - /** - * @return bool - */ public function isXxxSD(): bool { if (preg_match('/SDX264XXX|XXX\.HR\./i', $this->releaseName)) { @@ -806,9 +658,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isXxxWEBDL(): bool { if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { @@ -822,9 +671,6 @@ class Categorize // Console. - /** - * @return bool - */ public function isConsole(): bool { return match (true) { @@ -833,9 +679,6 @@ class Categorize }; } - /** - * @return bool - */ public function isGameNDS(): bool { if (preg_match('/^NDS|[^a-zA-Z0-9]NDS|[\._-](nds|NDS)|nintendo.+[^3]n?dsi?/', $this->releaseName)) { @@ -854,9 +697,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGame3DS(): bool { if (preg_match('/\b3DS\b[^max]|[\._-]3ds|nintendo.+3ds|[_\.]3DS-/i', $this->releaseName) && ! preg_match('/3ds max/i', $this->releaseName) && preg_match('/(EUR|FR|GAME|HOL|JP|JPN|NL|NTSC|PAL|KS|USA|ASIA)/i', $this->releaseName)) { @@ -868,9 +708,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGameNGC(): bool { if (preg_match('/[\._-]N?G(AME)?C(UBE)?-/i', $this->releaseName)) { @@ -889,9 +726,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGamePS3(): bool { if (preg_match('/[^e]PS3/i', $this->releaseName)) { @@ -910,9 +744,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGamePS4(): bool { if (preg_match('/[ \(_.-]PS4[ \)_.-]/i', $this->releaseName)) { @@ -931,9 +762,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGamePSP(): bool { if (stripos($this->releaseName, 'PSP') !== false) { @@ -952,9 +780,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGamePSVita(): bool { if (preg_match('/PS ?Vita/i', $this->releaseName)) { @@ -966,9 +791,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGameWiiWare(): bool { if (preg_match('/(Console|DLC|VC).+[._ -]WII|(Console|DLC|VC)[._ -]WII|WII[._ -].+(Console|DLC|VC)|WII[._ -](Console|DLC|VC)|WIIWARE/i', $this->releaseName)) { @@ -980,9 +802,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGameWiiU(): bool { switch (true) { @@ -997,9 +816,6 @@ class Categorize } } - /** - * @return bool - */ public function isGameWii(): bool { switch (true) { @@ -1014,9 +830,6 @@ class Categorize } } - /** - * @return bool - */ public function isGameXBOX360DLC(): bool { if (preg_match('/DLC.+xbox360|xbox360.+DLC|XBLA.+xbox360|xbox360.+XBLA/i', $this->releaseName)) { @@ -1028,9 +841,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGameXBOX360(): bool { if (stripos($this->releaseName, '/XBOX360/i') !== false) { @@ -1054,9 +864,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGameXBOXONE(): bool { if (preg_match('/XBOXONE|XBOX\.ONE/i', $this->releaseName)) { @@ -1068,9 +875,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGameXBOX(): bool { if (stripos($this->releaseName, 'XBOX') !== false) { @@ -1082,9 +886,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isGameOther(): bool { if (preg_match('/\b(PS(1)X|PS2|SNES|NES|SEGA\s(GENESIS|CD)|GB([AC])|Dreamcast|SEGA\sSaturn|Atari\s(Jaguar)?|3DO)\b/i', $this->releaseName) && preg_match('/EUR|FR|GAME|HOL|\bISO\b|JP|JPN|NL|NTSC|PAL|KS|USA|ROMS?(et)?/i', $this->releaseName)) { @@ -1098,9 +899,6 @@ class Categorize // Music. - /** - * @return bool - */ public function isMusic(): bool { return match (true) { @@ -1109,9 +907,6 @@ class Categorize }; } - /** - * @return bool - */ public function isMusicForeign(): bool { if ($this->categorizeForeign && preg_match('/[ \-\._](brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|ita|latin|mandarin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish|bl|cz|de|es|fr|ger|heb|hu|hun|it(a| 19|20\d\d)|jap|ko|kor|nl|pl|se)[ \-\._]/i', $this->releaseName)) { @@ -1123,9 +918,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isAudiobook(): bool { if ($this->categorizeForeign && stripos($this->releaseName, 'Audiobook') !== false) { @@ -1146,9 +938,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMusicVideo(): bool { if (preg_match('/(720P|x264)\-(19|20)\d\d\-[a-z0-9]{1,12}/i', $this->releaseName)) { @@ -1171,9 +960,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMusicLossless(): bool { if (preg_match('/\[(19|20)\d\d\][._ -]\[FLAC\]|([\(\[])flac([\)\]])|FLAC\-(19|20)\d\d\-[a-z0-9]{1,12}|\.flac"|(19|20)\d\d\sFLAC|[._ -]FLAC.+(19|20)\d\d[._ -]| FLAC$/i', $this->releaseName)) { @@ -1188,9 +974,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMusicMP3(): bool { if (preg_match('/[a-z0-9]{1,12}\-(19|20)\d\d\-[a-z0-9]{1,12}|[\.\-\(\[_ ]\d{2,3}k[\.\-\)\]_ ]|\((192|256|320)\)|(320|cd|eac|vbr).+mp3|(cd|eac|mp3|vbr).+320|FIH\_INT|\s\dCDs|[._ -]MP3[._ -]|MP3\-\d{3}kbps|\.(m3u|mp3)"|NMR\s\d{2,3}\skbps|\(320\)\.|\-\((Bootleg|Promo)\)|\.mp3$|\-\sMP3\s(19|20)\d\d|\(vbr\)|rip(192|256|320)|[._ -](CDR|SBD|WEB).+(19|20)\d\d/i', $this->releaseName)) { @@ -1213,9 +996,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMusicOther(): bool { if (preg_match('/(19|20)\d\d\-(C4)$|[._ -]\d?CD[._ -](19|20)\d\d|\(\d\-?CD\)|\-\dcd\-|\d[._ -]Albums|Albums.+(EP)|Bonus.+Tracks|Box.+?CD.+SET|Discography|D\.O\.M|Greatest\sSongs|Live.+(Bootleg|Remastered)|Music.+Vol|([\(\[\s])NMR([\)\]\s])|Promo.+CD|Reggaeton|Tiesto.+Club|Vinyl\s2496|\WV\.A\.|^\(VA\s|^VA[._ -]/i', $this->releaseName)) { @@ -1234,9 +1014,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isMusicPodcast(): bool { if (preg_match('/podcast/i', $this->releaseName)) { @@ -1250,9 +1027,6 @@ class Categorize // Books. - /** - * @return bool - */ public function isBook(): bool { return match (true) { @@ -1261,9 +1035,6 @@ class Categorize }; } - /** - * @return bool - */ public function isBookForeign(): bool { switch (true) { @@ -1276,9 +1047,6 @@ class Categorize } } - /** - * @return bool - */ public function isComic(): bool { switch (true) { @@ -1294,9 +1062,6 @@ class Categorize return true; } - /** - * @return bool - */ public function isTechnicalBook(): bool { switch (true) { @@ -1312,9 +1077,6 @@ class Categorize return true; } - /** - * @return bool - */ public function isMagazine(): bool { switch (true) { @@ -1330,9 +1092,6 @@ class Categorize return true; } - /** - * @return bool - */ public function isBookOther(): bool { if (preg_match('/"\d\d-\d\d-20\d\d\./', $this->releaseName)) { @@ -1344,9 +1103,6 @@ class Categorize return false; } - /** - * @return bool - */ public function isEBook(): bool { switch (true) { @@ -1364,9 +1120,6 @@ class Categorize // Misc, all hash/misc go in other misc. - /** - * @return bool - */ public function isMisc(): bool { switch (true) { @@ -1388,7 +1141,6 @@ class Categorize * @param string $regex Regex to use for match * @param string $fromName Poster that needs to be matched by regex * @param string $category Category to set if there is a match - * @return bool */ public function checkPoster(string $regex, string $fromName, string $category): bool { diff --git a/Blacklight/CollectionsCleaning.php b/Blacklight/CollectionsCleaning.php index 093e0b30b..2e664aa21 100755 --- a/Blacklight/CollectionsCleaning.php +++ b/Blacklight/CollectionsCleaning.php @@ -14,6 +14,7 @@ class CollectionsCleaning * Used for matching endings in article subjects. * * @const + * * @string */ public const REGEX_END = '[\-_\s]{0,3}yEnc$/ui'; @@ -22,6 +23,7 @@ class CollectionsCleaning * Used for matching file extension endings in article subjects. * * @const + * * @string */ public const REGEX_FILE_EXTENSIONS = '([\-_](proof|sample|thumbs?))*(\.part\d*(\.rar)?|\.rar|\.7z|\.par2)?(\d{1,3}\.rev"|\.vol\d+\+\d+.+?"|\.[A-Za-z0-9]{2,4}"|")'; @@ -30,7 +32,9 @@ class CollectionsCleaning * Used for matching size strings in article subjects. * * @example ' - 365.15 KB - ' + * * @const + * * @string */ public const REGEX_SUBJECT_SIZE = '[\-_\s]{0,3}\d+([.,]\d+)? [kKmMgG][bB][\-_\s]{0,3}'; @@ -50,29 +54,14 @@ class CollectionsCleaning */ public const REGEX_MUSIC_MATCH = -20; - /** - * @var string - */ public string $e0; - /** - * @var string - */ public string $e1; - /** - * @var string - */ public string $e2; - /** - * @var string - */ public string $groupName = ''; - /** - * @var string - */ public string $subject = ''; /** @@ -96,10 +85,6 @@ class CollectionsCleaning } /** - * @param string $subject - * @param string $groupName - * @return array - * * @throws \Exception */ public function collectionsCleaner(string $subject, string $groupName = ''): array @@ -111,7 +96,7 @@ class CollectionsCleaning $potentialString = $this->_regexes->tryRegex($subject, $groupName); if ($potentialString) { return [ - 'id' => $this->_regexes->matchedRegex, + 'id' => $this->_regexes->matchedRegex, 'name' => $potentialString, ]; } @@ -121,9 +106,6 @@ class CollectionsCleaning /** * Cleans usenet subject before inserting, used for collection hash. If no regexes matched on collectionsCleaner. - * - * - * @return array */ protected function generic(): array { @@ -144,7 +126,7 @@ class CollectionsCleaning // Multi spaces. return [ - 'id' => self::REGEX_GENERIC_MATCH, + 'id' => self::REGEX_GENERIC_MATCH, 'name' => utf8_encode(trim(preg_replace('/\s\s+/', ' ', $cleanSubject))), ]; } // Music groups. @@ -153,7 +135,7 @@ class CollectionsCleaning $musicSubject = $this->musicSubject(); if ($musicSubject !== false) { return [ - 'id' => self::REGEX_MUSIC_MATCH, + 'id' => self::REGEX_MUSIC_MATCH, 'name' => $musicSubject, ]; // Parts/files @@ -191,13 +173,13 @@ class CollectionsCleaning $newName = preg_replace(['/".+?"/', '/[a-z0-9]|'.$this->e0.'/i'], '', $this->subject); return [ - 'id' => self::REGEX_MUSIC_MATCH, + 'id' => self::REGEX_MUSIC_MATCH, 'name' => $cleanSubject.$newName.$x, ]; } return [ - 'id' => self::REGEX_MUSIC_MATCH, + 'id' => self::REGEX_MUSIC_MATCH, 'name' => $cleanSubject, ]; } diff --git a/Blacklight/ColorCLI.php b/Blacklight/ColorCLI.php index 00b95df7e..f81eb33a0 100755 --- a/Blacklight/ColorCLI.php +++ b/Blacklight/ColorCLI.php @@ -22,10 +22,6 @@ class ColorCLI $this->climate = new CLImate(); } - /** - * @param string $str - * @param bool $newline - */ public function debug(string $str, bool $newline = false): void { if ($newline) { @@ -34,10 +30,6 @@ class ColorCLI $this->climate->lightGray()->out($str); } - /** - * @param string $str - * @param bool $newline - */ public function info(string $str, bool $newline = false): void { if ($newline) { @@ -46,10 +38,6 @@ class ColorCLI $this->climate->magenta()->out($str); } - /** - * @param string $str - * @param bool $newline - */ public function notice(string $str, bool $newline = false): void { if ($newline) { @@ -58,10 +46,6 @@ class ColorCLI $this->climate->blue()->out($str); } - /** - * @param string $str - * @param bool $newline - */ public function warning(string $str, bool $newline = false): void { if ($newline) { @@ -70,10 +54,6 @@ class ColorCLI $this->climate->yellow()->out($str); } - /** - * @param string $str - * @param bool $newline - */ public function error(string $str, bool $newline = false): void { if ($newline) { @@ -82,10 +62,6 @@ class ColorCLI $this->climate->red()->out($str); } - /** - * @param string $str - * @param bool $newline - */ public function primary(string $str, bool $newline = false): void { if ($newline) { @@ -94,10 +70,6 @@ class ColorCLI $this->climate->green()->out($str); } - /** - * @param string $str - * @param bool $newline - */ public function header(string $str, bool $newline = false): void { if ($newline) { @@ -106,10 +78,6 @@ class ColorCLI $this->climate->yellow()->out($str); } - /** - * @param string $str - * @param bool $newline - */ public function alternate(string $str, bool $newline = false): void { if ($newline) { @@ -118,10 +86,6 @@ class ColorCLI $this->climate->magenta()->bold()->out($str); } - /** - * @param string $str - * @param bool $newline - */ public function tmuxOrange(string $str, bool $newline = false): void { if ($newline) { @@ -130,33 +94,21 @@ class ColorCLI $this->climate->yellow()->bold()->out($str); } - /** - * @param string $str - */ public function primaryOver(string $str): void { $this->climate->green()->inline($str); } - /** - * @param string $str - */ public function headerOver(string $str): void { $this->climate->yellow()->inline($str); } - /** - * @param string $str - */ public function alternateOver(string $str): void { $this->climate->magenta()->bold()->inline($str); } - /** - * @param string $str - */ public function warningOver(string $str): void { $this->climate->red()->inline($str); diff --git a/Blacklight/Console.php b/Blacklight/Console.php index efb249441..0ac36f697 100755 --- a/Blacklight/Console.php +++ b/Blacklight/Console.php @@ -20,13 +20,11 @@ use MarcReichel\IGDBLaravel\Models\Platform; class Console { public const CONS_UPROC = 0; // Release has not been processed. + public const CONS_NTFND = -2; protected const MATCH_PERCENT = 60; - /** - * @var - */ protected $igdbSleep; /** @@ -94,7 +92,7 @@ class Console public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, + 'Echo' => false, 'Settings' => null, ]; $options += $defaults; @@ -115,7 +113,6 @@ class Console } /** - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public function getConsoleInfo($id) @@ -149,14 +146,6 @@ class Console } /** - * @param $page - * @param $cat - * @param $start - * @param $num - * @param $orderBy - * @param array $excludedCats - * @return array - * * @throws \Exception */ public function getConsoleRange($page, $cat, $start, $num, $orderBy, array $excludedCats = []): array @@ -249,10 +238,6 @@ class Console return $return; } - /** - * @param $orderBy - * @return array - */ public function getConsoleOrder($orderBy): array { $order = ($orderBy === '') ? 'r.postdate' : $orderBy; @@ -289,25 +274,16 @@ class Console return [$orderfield, $ordersort]; } - /** - * @return array - */ public function getConsoleOrdering(): array { return ['title_asc', 'title_desc', 'posted_asc', 'posted_desc', 'size_asc', 'size_desc', 'files_asc', 'files_desc', 'stats_asc', 'stats_desc', 'platform_asc', 'platform_desc', 'releasedate_asc', 'releasedate_desc', 'genre_asc', 'genre_desc']; } - /** - * @return array - */ public function getBrowseByOptions(): array { return ['platform' => 'platform', 'title' => 'title', 'genre' => 'genres_id']; } - /** - * @return string - */ public function getBrowseBy(): string { $browseBy = ' '; @@ -322,17 +298,6 @@ class Console } /** - * @param $id - * @param $title - * @param $asin - * @param $url - * @param $salesrank - * @param $platform - * @param $publisher - * @param $releasedate - * @param $esrb - * @param $cover - * @param $genres_id * @param string $review */ public function update($id, $title, $asin, $url, $salesrank, $platform, $publisher, $releasedate, $esrb, $cover, $genres_id, $review = 'review'): void @@ -345,7 +310,6 @@ class Console } /** - * @param $gameInfo * @return int|mixed * * @throws \Exception @@ -372,11 +336,6 @@ class Console return $consoleId; } - /** - * @param array $gameInfo - * @param array $con - * @return bool - */ protected function _matchConToGameInfo(array $gameInfo = [], array $con = []): bool { $matched = false; @@ -416,11 +375,6 @@ class Console return $matched; } - /** - * @param $amaz - * @param $gameInfo - * @return array - */ protected function _setConBeforeMatch($amaz, $gameInfo): array { $con = []; @@ -445,10 +399,6 @@ class Console return $con; } - /** - * @param $amaz - * @return array - */ protected function _setConAfterMatch($amaz): array { $con = []; @@ -483,9 +433,6 @@ class Console } /** - * @param $amaz - * @return array - * * @throws \Exception */ protected function _matchGenre($amaz): array @@ -535,7 +482,6 @@ class Console } /** - * @param $genreName * @return false|int|string * * @throws \Exception @@ -554,8 +500,6 @@ class Console } /** - * @return array - * * @throws \Exception */ protected function _loadGenres(): array @@ -570,12 +514,10 @@ class Console * from the release to the Amazon equivalent. * * @param string $platform - * @return string */ protected function _replacePlatform($platform): string { switch (strtoupper($platform)) { - case 'X360': case 'XBOX360': $platform = 'Xbox 360'; @@ -636,7 +578,6 @@ class Console } /** - * @param array $con * @return int|mixed */ protected function _updateConsoleTable(array $con = []) @@ -693,8 +634,6 @@ class Console } /** - * @param $gameInfo - * @param $gamePlatform * @return array|bool|\StdClass * * @throws \Exception @@ -858,7 +797,7 @@ class Console } // Update release. - Release::query()->where('id', $arr['id'])->update(['consoleinfo_id'=> $gameId]); + Release::query()->where('id', $arr['id'])->update(['consoleinfo_id' => $gameId]); // Sleep to not flood amazon. $diff = floor((now()->timestamp - $startTime) * 1000000); @@ -872,7 +811,6 @@ class Console } /** - * @param $releaseName * @return array|false */ public function parseTitle($releaseName) @@ -938,10 +876,6 @@ class Console return (isset($result['title'], $result['platform']) && ! empty($result['title'])) ? $result : false; } - /** - * @param $platform - * @return string - */ public function getBrowseNode($platform): string { switch ($platform) { @@ -1010,7 +944,6 @@ class Console } /** - * @param $nodeName * @return bool|string */ public function matchBrowseNode($nodeName) diff --git a/Blacklight/ConsoleTools.php b/Blacklight/ConsoleTools.php index b2e2a8cdc..e9ab70376 100755 --- a/Blacklight/ConsoleTools.php +++ b/Blacklight/ConsoleTools.php @@ -7,9 +7,6 @@ namespace Blacklight; */ class ConsoleTools extends ColorCLI { - /** - * @var int - */ public int $lastMessageLength; /** @@ -21,10 +18,6 @@ class ConsoleTools extends ColorCLI $this->lastMessageLength = 0; } - /** - * @param string $message - * @param bool $reset - */ public function overWriteHeader(string $message, bool $reset = false): void { if ($reset) { @@ -39,10 +32,6 @@ class ConsoleTools extends ColorCLI $this->headerOver($message); } - /** - * @param string $message - * @param bool $reset - */ public function overWritePrimary(string $message, bool $reset = false): void { if ($reset) { @@ -57,10 +46,6 @@ class ConsoleTools extends ColorCLI $this->primaryOver($message); } - /** - * @param string $message - * @param bool $reset - */ public function overWrite(string $message, bool $reset = false): void { if ($reset) { @@ -75,20 +60,12 @@ class ConsoleTools extends ColorCLI echo $message; } - /** - * @param string $message - */ public function appendWrite(string $message): void { echo $message; $this->lastMessageLength += \strlen($message); } - /** - * @param int $cur - * @param int $total - * @return string - */ public function percentString(int $cur, int $total): string { $percent = 100 * $cur / $total; @@ -97,12 +74,6 @@ class ConsoleTools extends ColorCLI return sprintf($formatString, $cur, $total, $percent); } - /** - * @param int $first - * @param int $last - * @param int $total - * @return string - */ public function percentString2(int $first, int $last, int $total): string { $percent1 = 100 * ($first - 1) / $total; @@ -114,9 +85,6 @@ class ConsoleTools extends ColorCLI /** * Convert seconds to minutes or hours, appending type at the end. - * - * @param int $seconds - * @return string */ public function convertTime(int $seconds): string { @@ -132,9 +100,6 @@ class ConsoleTools extends ColorCLI /** * Convert seconds to a timer, 00h:00m:00s. - * - * @param int $seconds - * @return string */ public function convertTimer(int $seconds): string { @@ -143,8 +108,6 @@ class ConsoleTools extends ColorCLI /** * Sleep for x seconds, printing timer on screen. - * - * @param int $seconds */ public function showSleep(int $seconds): void { diff --git a/Blacklight/Contents.php b/Blacklight/Contents.php index 8b005726a..c4beaed61 100755 --- a/Blacklight/Contents.php +++ b/Blacklight/Contents.php @@ -12,7 +12,9 @@ use Illuminate\Support\Arr; class Contents { public const TYPEUSEFUL = 1; + public const TYPEARTICLE = 2; + public const TYPEINDEX = 3; /** @@ -97,8 +99,6 @@ class Contents } /** - * @param $id - * @param $role * @return array|false */ public function getForMenuByTypeAndRole($id, $role): bool|array @@ -124,8 +124,6 @@ class Contents } /** - * @param $id - * @param $role * @return false|mixed */ public function getByID($id, $role): mixed @@ -139,10 +137,6 @@ class Contents return Arr::first($row); } - /** - * @param $content - * @return mixed - */ public function validate($content): mixed { if ($content['url'] !== '/') { @@ -156,10 +150,6 @@ class Contents return $content; } - /** - * @param $form - * @return int - */ public function add($form): int { if ($form['ordinal'] === 1) { @@ -169,17 +159,12 @@ class Contents return $this->data_add($form); } - /** - * @param $id - * @return mixed - */ public function delete($id): mixed { return Content::query()->where('id', $id)->delete(); } /** - * @param $form * @return mixed|Content */ public function update($form): mixed @@ -189,10 +174,6 @@ class Contents return $form; } - /** - * @param $content - * @return int - */ public function data_update($content): int { return Content::query() @@ -213,10 +194,6 @@ class Contents ); } - /** - * @param $content - * @return int - */ public function data_add($content): int { return Content::query() @@ -267,8 +244,6 @@ class Contents } /** - * @param $id - * @param $role * @return \Illuminate\Database\Eloquent\Collection|static[] */ public function data_getByID($id, $role): \Illuminate\Database\Eloquent\Collection|static @@ -297,9 +272,6 @@ class Contents ->get(); } - /** - * @return \App\Models\Content|null - */ public function data_getIndex(): Content|null { return Content::query()->where( @@ -311,8 +283,6 @@ class Contents } /** - * @param $id - * @param $role * @return \Illuminate\Database\Eloquent\Collection|static[] */ public function data_getForMenuByTypeAndRole($id, $role): \Illuminate\Database\Eloquent\Collection|static diff --git a/Blacklight/CouchPotato.php b/Blacklight/CouchPotato.php index e6772d43e..44cd62bd4 100755 --- a/Blacklight/CouchPotato.php +++ b/Blacklight/CouchPotato.php @@ -74,11 +74,11 @@ class CouchPotato $this->imdbid = $id; return (new Client(['verify' => false]))->get( - $this->cpurl. - '/api/'. - $this->cpapi. - '/movie.add/?identifier=tt'. - $this->imdbid + $this->cpurl. + '/api/'. + $this->cpapi. + '/movie.add/?identifier=tt'. + $this->imdbid )->getBody()->getContents(); } diff --git a/Blacklight/ElasticSearchSiteSearch.php b/Blacklight/ElasticSearchSiteSearch.php index 8159b127d..528a7b333 100644 --- a/Blacklight/ElasticSearchSiteSearch.php +++ b/Blacklight/ElasticSearchSiteSearch.php @@ -10,11 +10,6 @@ use sspat\ESQuerySanitizer\Sanitizer; class ElasticSearchSiteSearch { - /** - * @param array|string $phrases - * @param int $limit - * @return mixed - */ public function indexSearch(array|string $phrases, int $limit): mixed { $keywords = $this->sanitize($phrases); @@ -50,11 +45,6 @@ class ElasticSearchSiteSearch } } - /** - * @param array|string $searchName - * @param int $limit - * @return array - */ public function indexSearchApi(array|string $searchName, int $limit): array { $keywords = $this->sanitize($searchName); @@ -91,10 +81,6 @@ class ElasticSearchSiteSearch /** * Search function used in TV, TV API, Movies and Anime searches. - * - * @param array|string $name - * @param int $limit - * @return array */ public function indexSearchTMA(array|string $name, int $limit): array { @@ -115,7 +101,7 @@ class ElasticSearchSiteSearch 'size' => $limit, 'sort' => [ 'add_date' => [ - 'order' =>'desc', + 'order' => 'desc', ], 'post_date' => [ 'order' => 'desc', @@ -130,10 +116,6 @@ class ElasticSearchSiteSearch } } - /** - * @param array|string $search - * @return array|\Illuminate\Support\Collection - */ public function predbIndexSearch(array|string $search): array|\Illuminate\Support\Collection { try { @@ -159,9 +141,6 @@ class ElasticSearchSiteSearch } } - /** - * @param array $parameters - */ public function insertRelease(array $parameters): void { $searchNameDotless = str_replace(['.', '-'], ' ', $parameters['searchname']); @@ -184,9 +163,6 @@ class ElasticSearchSiteSearch \Elasticsearch::index($data); } - /** - * @param int $id - */ public function updateRelease(int $id): void { $new = Release::query() @@ -219,10 +195,6 @@ class ElasticSearchSiteSearch } } - /** - * @param $searchTerm - * @return array - */ public function searchPreDb($searchTerm): array { $search = [ @@ -253,9 +225,6 @@ class ElasticSearchSiteSearch return $results; } - /** - * @param array $parameters - */ public function insertPreDb(array $parameters): void { $data = [ @@ -272,9 +241,6 @@ class ElasticSearchSiteSearch \Elasticsearch::index($data); } - /** - * @param array $parameters - */ public function updatePreDb(array $parameters): void { $data = [ @@ -295,10 +261,6 @@ class ElasticSearchSiteSearch \Elasticsearch::update($data); } - /** - * @param array|string $phrases - * @return string - */ private function sanitize(array|string $phrases): string { if (! is_array($phrases)) { @@ -328,11 +290,6 @@ class ElasticSearchSiteSearch return implode(' ', $keywords); } - /** - * @param array $search - * @param bool $fullResults - * @return array|\Illuminate\Support\Collection - */ protected function search(array $search, bool $fullResults = false): array|\Illuminate\Support\Collection { $results = \Elasticsearch::search($search); diff --git a/Blacklight/Games.php b/Blacklight/Games.php index 421316d27..620abc80a 100755 --- a/Blacklight/Games.php +++ b/Blacklight/Games.php @@ -79,9 +79,6 @@ class Games */ protected $_gameResults; - /** - * @var - */ protected $_getGame; /** @@ -104,9 +101,6 @@ class Games */ protected $giantBomb; - /** - * @var - */ protected $igdbSleep; /** @@ -117,14 +111,13 @@ class Games /** * Games constructor. * - * @param array $options * * @throws \Exception */ public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, + 'Echo' => false, 'ColorCLI' => null, 'Settings' => null, ]; @@ -147,7 +140,6 @@ class Games } /** - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public function getGamesInfoById($id) @@ -212,9 +204,6 @@ class Games ->paginate(config('nntmux.items_per_page')); } - /** - * @return int - */ public function getCount(): int { $res = GamesInfo::query()->count(['id']); @@ -223,14 +212,8 @@ class Games } /** - * @param $page - * @param $cat - * @param $start - * @param $num * @param string|array $orderBy * @param string $maxAge - * @param array $excludedCats - * @return array * * @throws \Exception */ @@ -326,7 +309,6 @@ class Games /** * @param string|array $orderBy - * @return array */ public function getGamesOrder($orderBy): array { @@ -361,9 +343,6 @@ class Games return [$orderField, $orderSort]; } - /** - * @return array - */ public function getGamesOrdering(): array { return [ @@ -373,17 +352,11 @@ class Games ]; } - /** - * @return array - */ public function getBrowseByOptions(): array { return ['title' => 'title', 'genre' => 'genres_id', 'year' => 'year']; } - /** - * @return string - */ public function getBrowseBy(): string { $browseBy = ' '; @@ -403,17 +376,6 @@ class Games /** * Updates the game for game-edit.php. - * - * @param $id - * @param $title - * @param $asin - * @param $url - * @param $publisher - * @param $releaseDate - * @param $esrb - * @param $cover - * @param $trailerUrl - * @param $genreID */ public function update($id, $title, $asin, $url, $publisher, $releaseDate, $esrb, $cover, $trailerUrl, $genreID): void { @@ -429,7 +391,7 @@ class Games 'esrb' => $esrb, 'cover' => $cover, 'trailer' => $trailerUrl, - 'genres_id' =>$genreID, + 'genres_id' => $genreID, ] ); } @@ -437,8 +399,6 @@ class Games /** * Process each game, updating game information from Steam and Giantbomb. * - * @param $gameInfo - * @return bool * * @throws \Exception * @throws \RuntimeException @@ -795,7 +755,6 @@ class Games } foreach ($res as $arr) { - // Reset maxhitrequest $this->maxHitRequest = false; @@ -846,7 +805,6 @@ class Games */ public function parseTitle($releaseName) { - // Get name of the game from name of release. if (preg_match(self::GAMES_TITLE_PARSE_REGEX, preg_replace('/\sMulti\d?\s/i', '', $releaseName), $hits)) { // Replace dots, underscores, colons, or brackets with spaces. @@ -872,7 +830,6 @@ class Games /** * See if genre name exists. * - * @param $gameGenre * @return bool|string */ public function matchGenreName($gameGenre) @@ -907,7 +864,6 @@ class Games * Matches Genres. * * @param string $genre - * @return string */ protected function _matchGenre($genre = ''): string { diff --git a/Blacklight/Genres.php b/Blacklight/Genres.php index 7352fbc4e..d4f0b8bcf 100755 --- a/Blacklight/Genres.php +++ b/Blacklight/Genres.php @@ -14,10 +14,13 @@ use Illuminate\Support\Facades\DB; class Genres { public const CONSOLE_TYPE = Category::GAME_ROOT; + public const MUSIC_TYPE = Category::MUSIC_ROOT; + public const GAME_TYPE = Category::PC_ROOT; public const STATUS_ENABLED = 0; + public const STATUS_DISABLED = 1; /** @@ -52,10 +55,6 @@ class Genres return $genres; } - /** - * @param $type - * @return array - */ public function loadGenres($type): array { $genres = $this->getGenres($type); @@ -70,7 +69,6 @@ class Genres /** * @param string $type * @param bool $activeOnly - * @return string */ private function getListQuery($type = '', $activeOnly = false): string { @@ -110,13 +108,6 @@ class Genres return $sql; } - /** - * @param string $type - * @param bool $activeOnly - * @param int $start - * @param int $num - * @return array - */ public function getRange(int $start, int $num, string $type = '', bool $activeOnly = false): array { $sql = $this->getListQuery($type, $activeOnly); @@ -125,11 +116,6 @@ class Genres return (array) Arr::first(DB::select($sql)); } - /** - * @param string $type - * @param bool $activeOnly - * @return mixed - */ public function getCount(string $type = '', bool $activeOnly = false): mixed { if (! empty($type)) { @@ -170,7 +156,6 @@ class Genres } /** - * @param $id * @return \App\Models\Genre|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null */ public function getById($id) @@ -178,11 +163,6 @@ class Genres return Genre::query()->where('id', $id)->first(); } - /** - * @param $id - * @param $disabled - * @return int - */ public function update($id, $disabled): int { return Genre::query()->where('id', $id)->update(['disabled' => $disabled]); diff --git a/Blacklight/IRCClient.php b/Blacklight/IRCClient.php index d7eb50a36..1bc319f33 100755 --- a/Blacklight/IRCClient.php +++ b/Blacklight/IRCClient.php @@ -369,7 +369,7 @@ class IRCClient return false; } } - //ERROR :Closing Link: kevin123[100.100.100.100] (This server is full.) + //ERROR :Closing Link: kevin123[100.100.100.100] (This server is full.) } elseif (preg_match('/^ERROR\s*:/', $this->_buffer)) { echo $this->_buffer.PHP_EOL; @@ -410,7 +410,7 @@ class IRCClient $this->_pong($hits[1]); } - // Check for a channel message. + // Check for a channel message. } elseif (preg_match( '/^:(?P.+?)\!.+?\s+PRIVMSG\s+(?P#.+?)\s+:\s*(?P.+?)\s*$/', $this->_stripControlCharacters($this->_buffer), @@ -420,8 +420,8 @@ class IRCClient $this->_channelData = [ 'nickname' => $hits['nickname'], - 'channel' => $hits['channel'], - 'message' => $hits['message'], + 'channel' => $hits['channel'], + 'message' => $hits['message'], ]; $this->processChannelMessages(); @@ -566,7 +566,6 @@ class IRCClient // http://www.php.net/manual/en/function.fwrite.php#96951 | fwrite can return 0 causing an infinite loop. if ($fWrite === false || $fWrite <= 0) { - // If it failed, try a second time. $fWrite = $this->_writeSocketChar(substr($command, $written)); if ($fWrite === false || $fWrite <= 0) { diff --git a/Blacklight/IRCScraper.php b/Blacklight/IRCScraper.php index 26469e8a9..08b334d11 100755 --- a/Blacklight/IRCScraper.php +++ b/Blacklight/IRCScraper.php @@ -47,9 +47,6 @@ class IRCScraper extends IRCClient */ protected $_nuked; - /** - * @var - */ protected $_oldPre; /** @@ -70,6 +67,7 @@ class IRCScraper extends IRCClient * @var \Blacklight\SphinxSearch */ protected $sphinxsearch; + /** * @var ElasticSearchSiteSearch */ @@ -113,26 +111,26 @@ class IRCScraper extends IRCClient ); } else { $this->_ignoredChannels = [ - '#a.b.cd.image' => false, - '#a.b.console.ps3' => false, - '#a.b.dvd' => false, - '#a.b.erotica' => false, - '#a.b.flac' => false, - '#a.b.foreign' => false, - '#a.b.games.nintendods' => false, - '#a.b.inner-sanctum' => false, - '#a.b.moovee' => false, - '#a.b.movies.divx' => false, - '#a.b.sony.psp' => false, + '#a.b.cd.image' => false, + '#a.b.console.ps3' => false, + '#a.b.dvd' => false, + '#a.b.erotica' => false, + '#a.b.flac' => false, + '#a.b.foreign' => false, + '#a.b.games.nintendods' => false, + '#a.b.inner-sanctum' => false, + '#a.b.moovee' => false, + '#a.b.movies.divx' => false, + '#a.b.sony.psp' => false, '#a.b.sounds.mp3.complete_cd' => false, - '#a.b.teevee' => false, - '#a.b.games.wii' => false, - '#a.b.warez' => false, - '#a.b.games.xbox360' => false, - '#pre@corrupt' => false, - '#scnzb' => false, - '#tvnzb' => false, - 'srrdb' => false, + '#a.b.teevee' => false, + '#a.b.games.wii' => false, + '#a.b.warez' => false, + '#a.b.games.xbox360' => false, + '#pre@corrupt' => false, + '#scnzb' => false, + '#tvnzb' => false, + 'srrdb' => false, ]; } @@ -166,7 +164,6 @@ class IRCScraper extends IRCClient */ protected function _startScraping() { - // Connect to IRC. if ($this->connect(config('irc_settings.scrape_irc_server'), config('irc_settings.scrape_irc_port'), config('irc_settings.scrape_irc_tls')) === false) { exit( @@ -385,9 +382,9 @@ class IRCScraper extends IRCClient $query .= (! empty($this->_curPre['nuked']) ? 'nuked = '.$this->_curPre['nuked'].', ' : ''); $query .= (! empty($this->_curPre['filename']) ? 'filename = '.escapeString($this->_curPre['filename']).', ' : ''); $query .= ( - (empty($this->_oldPre['category']) && ! empty($this->_curPre['category'])) - ? 'category = '.escapeString($this->_curPre['category']).', ' - : '' + (empty($this->_oldPre['category']) && ! empty($this->_curPre['category'])) + ? 'category = '.escapeString($this->_curPre['category']).', ' + : '' ); if ($query === 'UPDATE predb SET ') { @@ -496,16 +493,16 @@ class IRCScraper extends IRCClient $this->_oldPre = []; $this->_curPre = [ - 'title' => '', - 'size' => '', - 'predate' => '', + 'title' => '', + 'size' => '', + 'predate' => '', 'category' => '', - 'source' => '', - 'group_id' => '', - 'reqid' => '', - 'nuked' => '', - 'reason' => '', - 'files' => '', + 'source' => '', + 'group_id' => '', + 'reqid' => '', + 'nuked' => '', + 'reason' => '', + 'files' => '', 'filename' => '', ]; } diff --git a/Blacklight/Movie.php b/Blacklight/Movie.php index 4d40b67d4..e4775f8e2 100755 --- a/Blacklight/Movie.php +++ b/Blacklight/Movie.php @@ -158,11 +158,11 @@ class Movie public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, - 'Logger' => null, + 'Echo' => false, + 'Logger' => null, 'ReleaseImage' => null, - 'Settings' => null, - 'TMDb' => null, + 'Settings' => null, + 'TMDb' => null, ]; $options += $defaults; @@ -202,7 +202,6 @@ class Movie } /** - * @param $imdbId * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|null|object */ public function getMovieInfo($imdbId) @@ -214,13 +213,7 @@ class Movie * Get movie releases with covers for movie browse page. * * - * @param $page - * @param $cat - * @param $start - * @param $num - * @param $orderBy * @param int $maxAge - * @param array $excludedCats * @return array|mixed */ public function getMovieRange($page, $cat, $start, $num, $orderBy, $maxAge = -1, array $excludedCats = []) @@ -328,9 +321,6 @@ class Movie /** * Get the order type the user requested on the movies page. - * - * @param $orderBy - * @return array */ protected function getMovieOrder($orderBy): array { @@ -356,17 +346,12 @@ class Movie /** * Order types for movies page. - * - * @return array */ public function getMovieOrdering(): array { return ['title_asc', 'title_desc', 'year_asc', 'year_desc', 'rating_asc', 'rating_desc']; } - /** - * @return string - */ protected function getBrowseBy(): string { $browseBy = ' '; @@ -446,23 +431,22 @@ class Movie } return $this->update([ - 'genre' => implode(', ', $data['genres']), - 'imdbid' => $this->checkTraktValue($imdbId), + 'genre' => implode(', ', $data['genres']), + 'imdbid' => $this->checkTraktValue($imdbId), 'language' => $this->checkTraktValue($data['language']), - 'plot' => $this->checkTraktValue($data['overview']), - 'rating' => $this->checkTraktValue($data['rating']), - 'tagline' => $this->checkTraktValue($data['tagline']), - 'title' => $this->checkTraktValue($data['title']), - 'tmdbid' => $this->checkTraktValue($data['ids']['tmdb']), - 'traktid' => $this->checkTraktValue($data['ids']['trakt']), - 'trailer' => $this->checkTraktValue($data['trailer']), - 'cover' => $cover, - 'year' => $this->checkTraktValue($data['year']), + 'plot' => $this->checkTraktValue($data['overview']), + 'rating' => $this->checkTraktValue($data['rating']), + 'tagline' => $this->checkTraktValue($data['tagline']), + 'title' => $this->checkTraktValue($data['title']), + 'tmdbid' => $this->checkTraktValue($data['ids']['tmdb']), + 'traktid' => $this->checkTraktValue($data['ids']['trakt']), + 'trailer' => $this->checkTraktValue($data['trailer']), + 'cover' => $cover, + 'year' => $this->checkTraktValue($data['year']), ]); } /** - * @param $value * @return mixed|string */ private function checkTraktValue($value) @@ -482,8 +466,6 @@ class Movie /** * Get array of column keys, for inserting / updating. - * - * @return array */ public function getColumnKeys(): array { @@ -497,7 +479,6 @@ class Movie * Update movie on movie-edit page. * * @param array $values Array of keys/values to update. See $validKeys - * @return bool */ public function update(array $values): bool { @@ -564,8 +545,6 @@ class Movie /** * Fetch IMDB/TMDB/TRAKT/OMDB/iTunes info for the movie. * - * @param $imdbId - * @return bool * * @throws \Exception */ @@ -682,22 +661,22 @@ class Movie $mov['title'] = str_replace(['/', '\\'], '', $mov['title']); $movieID = $this->update([ - 'actors' => html_entity_decode($mov['actors'], ENT_QUOTES, 'UTF-8'), - 'backdrop' => $mov['backdrop'], - 'cover' => $mov['cover'], - 'director' => html_entity_decode($mov['director'], ENT_QUOTES, 'UTF-8'), - 'genre' => html_entity_decode($mov['genre'], ENT_QUOTES, 'UTF-8'), - 'imdbid' => $mov['imdbid'], - 'language' => html_entity_decode($mov['language'], ENT_QUOTES, 'UTF-8'), - 'plot' => html_entity_decode(preg_replace('/\s+See full summary »/u', ' ', $mov['plot']), ENT_QUOTES, 'UTF-8'), - 'rating' => round((int) $mov['rating'], 1), + 'actors' => html_entity_decode($mov['actors'], ENT_QUOTES, 'UTF-8'), + 'backdrop' => $mov['backdrop'], + 'cover' => $mov['cover'], + 'director' => html_entity_decode($mov['director'], ENT_QUOTES, 'UTF-8'), + 'genre' => html_entity_decode($mov['genre'], ENT_QUOTES, 'UTF-8'), + 'imdbid' => $mov['imdbid'], + 'language' => html_entity_decode($mov['language'], ENT_QUOTES, 'UTF-8'), + 'plot' => html_entity_decode(preg_replace('/\s+See full summary »/u', ' ', $mov['plot']), ENT_QUOTES, 'UTF-8'), + 'rating' => round((int) $mov['rating'], 1), 'rtrating' => $mov['rtrating'] ?? 'N/A', - 'tagline' => html_entity_decode($mov['tagline'], ENT_QUOTES, 'UTF-8'), - 'title' => $mov['title'], - 'tmdbid' => $mov['tmdbid'], - 'traktid' => $mov['traktid'], - 'type' => html_entity_decode(ucwords(preg_replace('/[\.\_]/', ' ', $mov['type'])), ENT_QUOTES, 'UTF-8'), - 'year' => $mov['year'], + 'tagline' => html_entity_decode($mov['tagline'], ENT_QUOTES, 'UTF-8'), + 'title' => $mov['title'], + 'tmdbid' => $mov['tmdbid'], + 'traktid' => $mov['traktid'], + 'type' => html_entity_decode(ucwords(preg_replace('/[\.\_]/', ' ', $mov['type'])), ENT_QUOTES, 'UTF-8'), + 'year' => $mov['year'], ]); if ($this->echooutput && $this->service !== '' && Utility::isCLI()) { @@ -717,7 +696,6 @@ class Movie /** * Fetch FanArt.tv backdrop / cover / title. * - * @param $imdbId * @return array|false */ protected function fetchFanartTVProperties($imdbId) @@ -763,7 +741,6 @@ class Movie * Fetch info for IMDB id from TMDB. * * - * @param $imdbId * @param bool $text * @return array|false */ @@ -869,7 +846,6 @@ class Movie } /** - * @param $imdbId * @return array|false */ public function fetchIMDBProperties($imdbId) @@ -929,7 +905,6 @@ class Movie /** * Fetch TraktTV backdrop / cover / title. * - * @param $imdbId * @return array|false * * @throws \Exception @@ -981,7 +956,6 @@ class Movie /** * Fetch OMDb backdrop / cover / title. * - * @param $imdbId * @return array|false */ public function fetchOmdbAPIProperties($imdbId) @@ -1073,7 +1047,6 @@ class Movie * @param string $service Method that called this method. * @param int $id id of the release. * @param int $processImdb To get IMDB info on this IMDB id or not. - * @return string * * @throws \Exception */ @@ -1092,7 +1065,7 @@ class Movie $movieInfoId = MovieInfo::query()->where('imdbid', $imdbId)->first(['id']); - Release::query()->where('id', $id)->update(['imdbid' =>$imdbId, 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]); + Release::query()->where('id', $id)->update(['imdbid' => $imdbId, 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]); // If set, scan for imdb info. if ($processImdb === 1) { @@ -1104,7 +1077,7 @@ class Movie } elseif ($info === true) { $movieInfoId = MovieInfo::query()->where('imdbid', $imdbId)->first(['id']); - Release::query()->where('id', $id)->update(['imdbid' =>$imdbId, 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]); + Release::query()->where('id', $id)->update(['imdbid' => $imdbId, 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]); } } } @@ -1162,6 +1135,7 @@ class Movie if (! $this->parseMovieSearchName($arr['searchname'])) { //We didn't find a name, so set to all 0's so we don't parse again. Release::query()->where('id', $arr['id'])->update(['imdbid' => 0000000]); + continue; } $this->currentRelID = $arr['id']; @@ -1209,7 +1183,6 @@ class Movie $this->colorCli->error('Error fetching data from imdb occured', true); Log::debug($e->getMessage()); } - } } @@ -1310,7 +1283,6 @@ class Movie * Parse a movie name from a release search name. * * @param string $releaseName - * @return bool */ protected function parseMovieSearchName($releaseName): bool { @@ -1326,16 +1298,15 @@ class Movie $name = $hits['name']; $year = $hits['year']; - /* If we didn't find a year, try to get a name anyways. - * Try to look for a title before the $followingList and after anything but a-z0-9 two times or more (-[ for example) - */ + /* If we didn't find a year, try to get a name anyways. + * Try to look for a title before the $followingList and after anything but a-z0-9 two times or more (-[ for example) + */ } elseif (preg_match('/([^\w]{2,})?(?P[\w .-]+?)'.$followingList.'/i', $releaseName, $hits)) { $name = $hits['name']; } // Check if we got something. if ($name !== '') { - // If we still have any of the words in $followingList, remove them. $name = preg_replace('/'.$followingList.'/i', ' ', $name); // Remove periods, underscored, anything between parenthesis. @@ -1356,8 +1327,6 @@ class Movie /** * Get IMDB genres. - * - * @return array */ public function getGenres(): array { diff --git a/Blacklight/Music.php b/Blacklight/Music.php index 231821b00..d8dcdafd0 100755 --- a/Blacklight/Music.php +++ b/Blacklight/Music.php @@ -82,7 +82,7 @@ class Music public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, + 'Echo' => false, 'Settings' => null, ]; $options += $defaults; @@ -103,7 +103,6 @@ class Music } /** - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public function getMusicInfo($id) @@ -112,8 +111,6 @@ class Music } /** - * @param $artist - * @param $album * @return \Illuminate\Database\Eloquent\Model|null|static */ public function getMusicInfoByName($artist, $album) @@ -137,12 +134,6 @@ class Music } /** - * @param $page - * @param $cat - * @param $start - * @param $num - * @param $orderBy - * @param array $excludedCats * @return \Illuminate\Cache\|\Illuminate\Database\Eloquent\Collection|mixed */ public function getMusicRange($page, $cat, $start, $num, $orderBy, array $excludedCats = []): mixed @@ -234,10 +225,6 @@ class Music return $return; } - /** - * @param $orderBy - * @return array - */ public function getMusicOrder($orderBy): array { $order = ($orderBy === '') ? 'r.postdate' : $orderBy; @@ -271,25 +258,16 @@ class Music return [$orderfield, $ordersort]; } - /** - * @return array - */ public function getMusicOrdering(): array { return ['artist_asc', 'artist_desc', 'posted_asc', 'posted_desc', 'size_asc', 'size_desc', 'files_asc', 'files_desc', 'stats_asc', 'stats_desc', 'year_asc', 'year_desc', 'genre_asc', 'genre_desc']; } - /** - * @return array - */ public function getBrowseByOptions(): array { return ['artist' => 'artist', 'title' => 'title', 'genre' => 'genres_id', 'year' => 'year']; } - /** - * @return string - */ public function getBrowseBy(): string { $browseby = ' '; @@ -307,20 +285,6 @@ class Music return $browseby; } - /** - * @param $id - * @param $title - * @param $asin - * @param $url - * @param $salesrank - * @param $artist - * @param $publisher - * @param $releasedate - * @param $year - * @param $tracks - * @param $cover - * @param $genres_id - */ public function update($id, $title, $asin, $url, $salesrank, $artist, $publisher, $releasedate, $year, $tracks, $cover, $genres_id): void { MusicInfo::query()->where('id', $id)->update( @@ -341,8 +305,6 @@ class Music } /** - * @param $title - * @param $year * @param null $amazdata * @return int|mixed * @@ -368,7 +330,7 @@ class Music $musicId = MusicInfo::query()->insertGetId( [ 'title' => $mus['title'], - 'asin' =>$mus['asin'], + 'asin' => $mus['asin'], 'url' => $mus['url'], 'salesrank' => $mus['salesrank'], 'artist' => $mus['artist'], @@ -461,7 +423,7 @@ class Music Category::MUSIC_LOSSLESS, Category::MUSIC_OTHER, $this->musicqty - ) + ) ); if (! empty($res)) { @@ -551,7 +513,6 @@ class Music } /** - * @param $nodeId * @return bool|string */ public function matchBrowseNode($nodeId) diff --git a/Blacklight/NNTP.php b/Blacklight/NNTP.php index 70b1dd40e..7aa6a6c36 100755 --- a/Blacklight/NNTP.php +++ b/Blacklight/NNTP.php @@ -43,95 +43,64 @@ class NNTP extends \Net_NNTP_Client */ protected ColorCLI $colorCli; - /** - * @var bool - */ protected bool $_debugBool; - /** - * @var bool - */ protected bool $_echo; /** * Does the server support XFeature GZip header compression? - * - * @var bool */ protected bool $_compressionSupported = true; /** * Is header compression enabled for the session? - * - * @var bool */ protected bool $_compressionEnabled = false; /** * Currently selected group. - * - * @var string */ protected string $_currentGroup = ''; - /** - * @var string - */ protected string $_currentPort = 'NNTP_PORT'; /** * Address of the current NNTP server. - * - * @var string */ protected string $_currentServer = 'NNTP_SERVER'; /** * Are we allowed to post to usenet? - * - * @var bool */ protected bool $_postingAllowed = false; /** * How many times should we try to reconnect to the NNTP server? - * - * @var int */ protected int $_nntpRetries; /** * How many connections should we use on primary NNTP server. - * - * @var string */ protected string $_primaryNntpConnections; /** * How many connections should we use on alternate NNTP server. - * - * @var string */ protected string $_alternateNntpConnections; /** * How many connections do we use on primary NNTP server. - * - * @var int */ protected int $_primaryCurrentNntpConnections; /** * How many connections do we use on alternate NNTP server. - * - * @var int */ protected int $_alternateCurrentNntpConnections; /** * Seconds to wait for the blocking socket to timeout. - * - * @var int */ protected int $_socketTimeout = 120; @@ -150,7 +119,7 @@ class NNTP extends \Net_NNTP_Client public function __construct(array $options = []) { $defaults = [ - 'Echo' => true, + 'Echo' => true, 'Logger' => null, ]; $options += $defaults; @@ -268,7 +237,6 @@ class NNTP extends \Net_NNTP_Client // If we are connected, try to authenticate. if ($connected) { - // If the username is empty it probably means the server does not require a username. if ($userName === '') { $authenticated = true; @@ -502,7 +470,6 @@ class NNTP extends \Net_NNTP_Client // Loop over strings of headers. foreach ($data as $key => $header) { - // Split the individual headers by tab. $header = explode("\t", $header); @@ -580,7 +547,6 @@ class NNTP extends \Net_NNTP_Client // Loop over the message-ID's or article numbers. foreach ($identifiers as $wanted) { - /* This is to attempt to prevent string size overflow. * We get the size of 1 body in bytes, we increment the loop on every loop, * then we multiply the # of loops by the first size we got and check if it @@ -603,7 +569,7 @@ class NNTP extends \Net_NNTP_Client $messageSize = \strlen($message); } - // If there is an error try the alternate provider or return the PEAR error. + // If there is an error try the alternate provider or return the PEAR error. } elseif ($alternate) { if (! $aConnected) { // Check if the current connected server is the alternate or not. @@ -637,7 +603,7 @@ class NNTP extends \Net_NNTP_Client } } - // If it's a string check if it's a valid message-ID. + // If it's a string check if it's a valid message-ID. } elseif (\is_string($identifiers) || is_numeric($identifiers)) { $body = $this->_getMessage($groupName, $identifiers); if ($alternate && self::isError($body)) { @@ -646,7 +612,7 @@ class NNTP extends \Net_NNTP_Client $aConnected = true; } - // Else return an error. + // Else return an error. } else { $message = 'Wrong Identifier type, array, int or string accepted. This type of var was passed: '.gettype($identifiers); @@ -714,6 +680,7 @@ class NNTP extends \Net_NNTP_Client if (! $emptyLine) { if ($line === '') { $emptyLine = true; + continue; } @@ -727,7 +694,7 @@ class NNTP extends \Net_NNTP_Client } } - // Now we have the header, so get the body from the rest of the lines. + // Now we have the header, so get the body from the rest of the lines. } else { $body .= $line; } @@ -903,22 +870,16 @@ class NNTP extends \Net_NNTP_Client /** * If on unix, hide yydecode CLI output. - * - * @var string */ protected string $_yEncSilence; /** * Path to temp yEnc input storage file. - * - * @var string */ protected string $_yEncTempInput; /** * Path to temp yEnc output storage file. - * - * @var string */ protected string $_yEncTempOutput; @@ -1031,10 +992,8 @@ class NNTP extends \Net_NNTP_Client $data = null; while (! feof($this->_socket)) { - // Did we find a possible ending ? (.\r\n) if ($possibleTerm) { - // Loop, sleeping shortly, to allow the server time to upload data, if it has any. for ($i = 0; $i < 3; $i++) { // If the socket is really empty, fGets will get stuck here, so set the socket to non blocking in case. @@ -1064,9 +1023,9 @@ class NNTP extends \Net_NNTP_Client $bytesReceived = \strlen($data); if ($this->_echo && $bytesReceived > 10240) { $this->colorCli->primaryOver( - 'Received '.round($bytesReceived / 1024). - 'KB from group ('.$this->group().').' - ); + 'Received '.round($bytesReceived / 1024). + 'KB from group ('.$this->group().').' + ); } // Split the string of headers into an array of individual headers, then return it. @@ -1142,8 +1101,6 @@ class NNTP extends \Net_NNTP_Client /** * Download an article body (an article without the header). * - * @param string $groupName - * @param mixed $identifier * @return mixed|object|string * * @throws \Exception @@ -1174,10 +1131,8 @@ class NNTP extends \Net_NNTP_Client $body = ''; if ($response === NET_NNTP_PROTOCOL_RESPONSECODE_BODY_FOLLOWS) { - // Continue until connection is lost while (! feof($this->_socket)) { - // Retrieve and append up to 1024 characters from the server. $line = fgets($this->_socket, 1024); @@ -1189,7 +1144,6 @@ class NNTP extends \Net_NNTP_Client // Check if the line terminates the text response. if ($line === ".\r\n") { - // Attempt to yEnc decode and return the body. return PhpYenc::decodeIgnore($body); } @@ -1265,64 +1219,64 @@ class NNTP extends \Net_NNTP_Client // 381, RFC2980: 'More authentication information required' case NET_NNTP_PROTOCOL_RESPONSECODE_AUTHENTICATION_CONTINUE: return $this->throwError('More authentication information required', $response, $this->_currentStatusResponse()); - // 400, RFC977: 'Service discontinued' + // 400, RFC977: 'Service discontinued' case NET_NNTP_PROTOCOL_RESPONSECODE_DISCONNECTING_FORCED: return $this->throwError('Server refused connection', $response, $this->_currentStatusResponse()); - // 411, RFC977: 'no such news group' + // 411, RFC977: 'no such news group' case NET_NNTP_PROTOCOL_RESPONSECODE_NO_SUCH_GROUP: return $this->throwError('No such news group on server', $response, $this->_currentStatusResponse()); - // 412, RFC2980: 'No news group current selected' + // 412, RFC2980: 'No news group current selected' case NET_NNTP_PROTOCOL_RESPONSECODE_NO_GROUP_SELECTED: return $this->throwError('No news group current selected', $response, $this->_currentStatusResponse()); - // 420, RFC2980: 'Current article number is invalid' + // 420, RFC2980: 'Current article number is invalid' case NET_NNTP_PROTOCOL_RESPONSECODE_NO_ARTICLE_SELECTED: return $this->throwError('Current article number is invalid', $response, $this->_currentStatusResponse()); - // 421, RFC977: 'no next article in this group' + // 421, RFC977: 'no next article in this group' case NET_NNTP_PROTOCOL_RESPONSECODE_NO_NEXT_ARTICLE: return $this->throwError('No next article in this group', $response, $this->_currentStatusResponse()); - // 422, RFC977: 'no previous article in this group' + // 422, RFC977: 'no previous article in this group' case NET_NNTP_PROTOCOL_RESPONSECODE_NO_PREVIOUS_ARTICLE: return $this->throwError('No previous article in this group', $response, $this->_currentStatusResponse()); - // 423, RFC977: 'No such article number in this group' + // 423, RFC977: 'No such article number in this group' case NET_NNTP_PROTOCOL_RESPONSECODE_NO_SUCH_ARTICLE_NUMBER: return $this->throwError('No such article number in this group', $response, $this->_currentStatusResponse()); - // 430, RFC977: 'No such article found' + // 430, RFC977: 'No such article found' case NET_NNTP_PROTOCOL_RESPONSECODE_NO_SUCH_ARTICLE_ID: return $this->throwError('No such article found', $response, $this->_currentStatusResponse()); - // 435, RFC977: 'Article not wanted' + // 435, RFC977: 'Article not wanted' case NET_NNTP_PROTOCOL_RESPONSECODE_TRANSFER_UNWANTED: return $this->throwError('Article not wanted', $response, $this->_currentStatusResponse()); - // 436, RFC977: 'Transfer failed - try again later' + // 436, RFC977: 'Transfer failed - try again later' case NET_NNTP_PROTOCOL_RESPONSECODE_TRANSFER_FAILURE: return $this->throwError('Transfer failed - try again later', $response, $this->_currentStatusResponse()); - // 437, RFC977: 'Article rejected - do not try again' + // 437, RFC977: 'Article rejected - do not try again' case NET_NNTP_PROTOCOL_RESPONSECODE_TRANSFER_REJECTED: return $this->throwError('Article rejected - do not try again', $response, $this->_currentStatusResponse()); - // 440, RFC977: 'posting not allowed' + // 440, RFC977: 'posting not allowed' case NET_NNTP_PROTOCOL_RESPONSECODE_POSTING_PROHIBITED: return $this->throwError('Posting not allowed', $response, $this->_currentStatusResponse()); - // 441, RFC977: 'posting failed' + // 441, RFC977: 'posting failed' case NET_NNTP_PROTOCOL_RESPONSECODE_POSTING_FAILURE: return $this->throwError('Posting failed', $response, $this->_currentStatusResponse()); - // 481, RFC2980: 'Groups and descriptions unavailable' + // 481, RFC2980: 'Groups and descriptions unavailable' case NET_NNTP_PROTOCOL_RESPONSECODE_XGTITLE_GROUPS_UNAVAILABLE: return $this->throwError('Groups and descriptions unavailable', $response, $this->_currentStatusResponse()); - // 482, RFC2980: 'Authentication rejected' + // 482, RFC2980: 'Authentication rejected' case NET_NNTP_PROTOCOL_RESPONSECODE_AUTHENTICATION_REJECTED: return $this->throwError('Authentication rejected', $response, $this->_currentStatusResponse()); - // 500, RFC977: 'Command not recognized' + // 500, RFC977: 'Command not recognized' case NET_NNTP_PROTOCOL_RESPONSECODE_UNKNOWN_COMMAND: return $this->throwError('Command not recognized', $response, $this->_currentStatusResponse()); - // 501, RFC977: 'Command syntax error' + // 501, RFC977: 'Command syntax error' case NET_NNTP_PROTOCOL_RESPONSECODE_SYNTAX_ERROR: return $this->throwError('Command syntax error', $response, $this->_currentStatusResponse()); - // 502, RFC2980: 'No permission' + // 502, RFC2980: 'No permission' case NET_NNTP_PROTOCOL_RESPONSECODE_NOT_PERMITTED: return $this->throwError('No permission', $response, $this->_currentStatusResponse()); - // 503, RFC2980: 'Program fault - command not performed' + // 503, RFC2980: 'Program fault - command not performed' case NET_NNTP_PROTOCOL_RESPONSECODE_NOT_SUPPORTED: return $this->throwError('Internal server error, function not performed', $response, $this->_currentStatusResponse()); - // RFC4642: 'Can not initiate TLS negotiation' + // RFC4642: 'Can not initiate TLS negotiation' case NET_NNTP_PROTOCOL_RESPONSECODE_TLS_FAILED_NEGOTIATION: return $this->throwError('Can not initiate TLS negotiation', $response, $this->_currentStatusResponse()); default: @@ -1410,7 +1364,7 @@ class NNTP extends \Net_NNTP_Client // 200, Posting allowed case NET_NNTP_PROTOCOL_RESPONSECODE_READY_POSTING_ALLOWED: return true; - // 201, Posting NOT allowed + // 201, Posting NOT allowed case NET_NNTP_PROTOCOL_RESPONSECODE_READY_POSTING_PROHIBITED: $this->_logger?->info('Posting not allowed!'); diff --git a/Blacklight/NZB.php b/Blacklight/NZB.php index dac29bae1..5b3be4a7f 100755 --- a/Blacklight/NZB.php +++ b/Blacklight/NZB.php @@ -21,11 +21,15 @@ use Illuminate\Support\Str; class NZB { public const NZB_NONE = 0; // Release has no NZB file yet. + public const NZB_ADDED = 1; // Release had an NZB file created. protected const NZB_DTD_NAME = 'nzb'; + protected const NZB_DTD_PUBLIC = '-//newzBin//DTD NZB 1.1//EN'; + protected const NZB_DTD_EXTERNAL = 'http://www.newzbin.com/DTD/nzb/nzb-1.1.dtd'; + protected const NZB_XML_NS = 'http://www.newzbin.com/DTD/2003/nzb'; /** @@ -125,8 +129,6 @@ class NZB * * * - * @param \App\Models\Release $release - * @return bool * * @throws \Throwable */ diff --git a/Blacklight/NZBContents.php b/Blacklight/NZBContents.php index c398a78f8..243cf23ad 100755 --- a/Blacklight/NZBContents.php +++ b/Blacklight/NZBContents.php @@ -68,11 +68,11 @@ class NZBContents public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, - 'NNTP' => null, - 'Nfo' => null, - 'NZB' => null, - 'Settings' => null, + 'Echo' => false, + 'NNTP' => null, + 'Nfo' => null, + 'NZB' => null, + 'Settings' => null, 'PostProcess' => null, ]; $options += $defaults; @@ -94,10 +94,6 @@ class NZBContents * Look for an .nfo file in the NZB, return the NFO message id. * * - * @param $guid - * @param $relID - * @param $groupID - * @param $groupName * @return bool|mixed * * @throws \Exception @@ -143,9 +139,6 @@ class NZBContents * Gets the completion from the NZB, optionally looks if there is an NFO/PAR2 file. * * - * @param $guid - * @param $relID - * @param $groupID * @param bool $nfoCheck * @return array|false * @@ -210,7 +203,6 @@ class NZBContents } /** - * @param $guid * @return bool|\SimpleXMLElement */ public function LoadNZB($guid) @@ -256,7 +248,6 @@ class NZBContents * @param int $groupID * @param int $nameStatus * @param int $show - * @return bool * * @throws \Exception */ diff --git a/Blacklight/NZBExport.php b/Blacklight/NZBExport.php index e4eb4d406..e8ce54ace 100755 --- a/Blacklight/NZBExport.php +++ b/Blacklight/NZBExport.php @@ -16,9 +16,6 @@ class NZBExport */ protected $browser; - /** - * @var - */ protected $retVal; /** @@ -39,16 +36,15 @@ class NZBExport /** * NZBExport constructor. * - * @param array $options * * @throws \Exception */ public function __construct(array $options = []) { $defaults = [ - 'Browser' => false, // Started from browser? - 'Echo' => true, // Echo to CLI? - 'NZB' => null, + 'Browser' => false, // Started from browser? + 'Echo' => true, // Echo to CLI? + 'NZB' => null, 'Releases' => null, 'Settings' => null, ]; @@ -61,7 +57,6 @@ class NZBExport } /** - * @param $params * @return bool|string */ public function beginExport($params) @@ -137,6 +132,7 @@ class NZBExport if ($this->echoCLI) { echo 'No releases found to export for group: '.$group['name'].PHP_EOL; } + continue; } if ($this->echoCLI) { @@ -149,7 +145,6 @@ class NZBExport throw new \RuntimeException(sprintf('Directory "%s" was not created', $currentPath)); } foreach ($releases as $release) { - // Get path to the NZB file. $nzbFile = $this->nzb->NZBPath($release['guid']); // Check if it exists. @@ -157,6 +152,7 @@ class NZBExport if ($this->echoCLI) { echo 'Unable to find NZB for release with GUID: '.$release['guid']; } + continue; } @@ -169,15 +165,17 @@ class NZBExport if ($this->echoCLI) { echo 'Unable to export NZB with GUID: '.$release['guid']; } + continue; } - // If not, decompress it and create a file to store it in. + // If not, decompress it and create a file to store it in. } else { $nzbContents = Utility::unzipGzipFile($nzbFile); if (! $nzbContents) { if ($this->echoCLI) { echo 'Unable to export NZB with GUID: '.$release['guid']; } + continue; } $fh = fopen($currentFile.'.nzb', 'w'); @@ -211,10 +209,6 @@ class NZBExport return $this->browser ? $this->retVal : true; } - /** - * @param $date - * @return bool - */ protected function checkDate($date): bool { if (! preg_match('/^(\d{2}\/){2}\d{4}$/', $date)) { @@ -226,9 +220,6 @@ class NZBExport return true; } - /** - * @param $message - */ protected function echoOut($message): void { if ($this->browser) { @@ -238,10 +229,6 @@ class NZBExport } } - /** - * @param $filename - * @return string - */ protected function safeFilename($filename): string { return trim(preg_replace('/[^\w\s.-]*/i', '', $filename)); diff --git a/Blacklight/NZBGet.php b/Blacklight/NZBGet.php index afd21f02a..e9561a8a9 100755 --- a/Blacklight/NZBGet.php +++ b/Blacklight/NZBGet.php @@ -106,7 +106,6 @@ class NZBGet } /** - * @param $guid * @return \GuzzleHttp\Psr7\Request */ public function sendNZBToNZBGet($guid) diff --git a/Blacklight/NZBImport.php b/Blacklight/NZBImport.php index 5c3a08755..856253b8d 100755 --- a/Blacklight/NZBImport.php +++ b/Blacklight/NZBImport.php @@ -97,14 +97,14 @@ class NZBImport public function __construct(array $options = []) { $defaults = [ - 'Browser' => false, // Was this started from the browser? - 'Echo' => true, // Echo to CLI? - 'Binaries' => null, - 'Categorize' => null, - 'NZB' => null, + 'Browser' => false, // Was this started from the browser? + 'Echo' => true, // Echo to CLI? + 'Binaries' => null, + 'Categorize' => null, + 'NZB' => null, 'ReleaseCleaning' => null, - 'Releases' => null, - 'Settings' => null, + 'Releases' => null, + 'Settings' => null, ]; $options += $defaults; @@ -149,7 +149,6 @@ class NZBImport // Check if the file is really there. if (File::isFile($nzbFile)) { - // Get the contents of the NZB file as a string. if (strtolower(substr($nzbFile, -7)) === '.nzb.gz') { $nzbString = Utility::unzipGzipFile($nzbFile); @@ -164,6 +163,7 @@ class NZBImport @unlink($nzbFile); } $nzbsSkipped++; + continue; } @@ -176,6 +176,7 @@ class NZBImport @unlink($nzbFile); } $nzbsSkipped++; + continue; } @@ -183,7 +184,6 @@ class NZBImport $inserted = $this->scanNZBFile($nzbXML, ($useNzbName ? str_ireplace('.nzb', '', basename($nzbFile)) : false)); if ($inserted) { - // Try to copy the NZB to the NZB folder. $path = $this->nzb->getNZBPath($this->relGuid, 0, true); @@ -241,9 +241,7 @@ class NZBImport } /** - * @param $nzbXML * @param bool $useNzbName - * @return bool * * @throws \Exception */ @@ -317,7 +315,6 @@ class NZBImport // If we found a group and it's not blacklisted. if ($groupID !== -1 && ! $isBlackListed) { - // Get the size of the release. if (\count($file->segments->segment) > 0) { foreach ($file->segments->segment as $segment) { @@ -350,14 +347,14 @@ class NZBImport // Try to insert the NZB details into the DB. return $this->insertNZB( [ - 'subject' => $firstName, - 'useFName' => $useNzbName, - 'postDate' => empty($postDate) ? now()->format('Y-m-d H:i:s') : $postDate, - 'from' => empty($posterName) ? '' : $posterName, - 'groups_id' => $groupID, - 'groupName' => $groupName, + 'subject' => $firstName, + 'useFName' => $useNzbName, + 'postDate' => empty($postDate) ? now()->format('Y-m-d H:i:s') : $postDate, + 'from' => empty($posterName) ? '' : $posterName, + 'groups_id' => $groupID, + 'groupName' => $groupName, 'totalFiles' => $totalFiles, - 'totalSize' => $totalSize, + 'totalSize' => $totalSize, ] ); } @@ -365,8 +362,6 @@ class NZBImport /** * Insert the NZB details into the database. * - * @param $nzbDetails - * @return bool * * @throws \Exception */ @@ -406,19 +401,19 @@ class NZBImport // Insert the release into the DB. $relID = Release::insertRelease( [ - 'name' => $escapedSubject, - 'searchname' => $escapedSearchName ?? $escapedSubject, - 'totalpart' => $nzbDetails['totalFiles'], - 'groups_id' => $nzbDetails['groups_id'], - 'guid' => $this->relGuid, - 'postdate' => $nzbDetails['postDate'], - 'fromname' => $escapedFromName, - 'size' => $nzbDetails['totalSize'], - 'categories_id' => $determinedCategory['categories_id'], - 'isrenamed' => $renamed, - 'reqidstatus' => 0, - 'predb_id' => 0, - 'nzbstatus' => NZB::NZB_ADDED, + 'name' => $escapedSubject, + 'searchname' => $escapedSearchName ?? $escapedSubject, + 'totalpart' => $nzbDetails['totalFiles'], + 'groups_id' => $nzbDetails['groups_id'], + 'guid' => $this->relGuid, + 'postdate' => $nzbDetails['postDate'], + 'fromname' => $escapedFromName, + 'size' => $nzbDetails['totalSize'], + 'categories_id' => $determinedCategory['categories_id'], + 'isrenamed' => $renamed, + 'reqidstatus' => 0, + 'predb_id' => 0, + 'nzbstatus' => NZB::NZB_ADDED, ] ); } else { @@ -438,8 +433,6 @@ class NZBImport /** * Get all groups in the DB. - * - * @return bool */ protected function getAllGroups(): bool { diff --git a/Blacklight/NZBVortex.php b/Blacklight/NZBVortex.php index 84e49dbaa..08a9c0077 100755 --- a/Blacklight/NZBVortex.php +++ b/Blacklight/NZBVortex.php @@ -11,6 +11,7 @@ use Page; final class NZBVortex { private $nonce = null; + private $session = null; public function __construct() @@ -30,16 +31,16 @@ final class NZBVortex public function getState($code = 0) { $states = [ - 0 => 'Waiting', - 1 => 'Downloading', - 2 => 'Waiting for save', - 3 => 'Saving', - 4 => 'Saved', - 5 => 'Password request', - 6 => 'Queued for processing', - 7 => 'User wait for processing', - 8 => 'Checking', - 9 => 'Repairing', + 0 => 'Waiting', + 1 => 'Downloading', + 2 => 'Waiting for save', + 3 => 'Saving', + 4 => 'Saved', + 5 => 'Password request', + 6 => 'Queued for processing', + 7 => 'User wait for processing', + 8 => 'Checking', + 9 => 'Repairing', 10 => 'Joining', 11 => 'Wait for further processing', 12 => 'Joining', @@ -97,7 +98,7 @@ final class NZBVortex $params = [ 'sessionid' => $this->session, - 'url' => $url, + 'url' => $url, ]; $response = $this->sendRequest('nzb/add', $params); @@ -108,7 +109,6 @@ final class NZBVortex * resume NZB. * * @param int $id - * @return void * * @throws \Exception */ @@ -269,9 +269,9 @@ final class NZBVortex $hash = base64_encode($hash); $params = [ - 'nonce' => $this->nonce, + 'nonce' => $this->nonce, 'cnonce' => $cnonce, - 'hash' => $hash, + 'hash' => $hash, ]; $response = $this->sendRequest('auth/login', $params); @@ -287,7 +287,6 @@ final class NZBVortex /** * sendRequest(). * - * @param $path * @param array $params * @return array * diff --git a/Blacklight/NameFixer.php b/Blacklight/NameFixer.php index 7c6928d15..0383b33d2 100755 --- a/Blacklight/NameFixer.php +++ b/Blacklight/NameFixer.php @@ -20,103 +20,86 @@ class NameFixer // Constants for name fixing status public const PROC_NFO_NONE = 0; + public const PROC_NFO_DONE = 1; + public const PROC_FILES_NONE = 0; + public const PROC_FILES_DONE = 1; + public const PROC_PAR2_NONE = 0; + public const PROC_PAR2_DONE = 1; + public const PROC_UID_NONE = 0; + public const PROC_UID_DONE = 1; + public const PROC_HASH16K_NONE = 0; + public const PROC_HASH16K_DONE = 1; + public const PROC_SRR_NONE = 0; + public const PROC_SRR_DONE = 1; + public const PROC_CRC_NONE = 0; + public const PROC_CRC_DONE = 1; // Constants for overall rename status public const IS_RENAMED_NONE = 0; + public const IS_RENAMED_DONE = 1; /** * Has the current release found a new name? - * - * @var bool */ public bool $matched; /** * How many releases have got a new name? - * - * @var int */ public int $fixed; /** * How many releases were checked. - * - * @var int */ public int $checked; /** * Was the check completed? - * - * @var bool */ public bool $done; /** * Do we want to echo info to CLI? - * - * @var bool */ public bool $echoOutput; /** * Total releases we are working on. - * - * @var int */ protected int $_totalReleases; /** * The cleaned filename we want to match. - * - * @var string */ protected string $_fileName; /** * The release ID we are trying to rename. - * - * @var int */ protected int $relid; - /** - * @var string - */ protected string $othercats; - /** - * @var string - */ protected string $timeother; - /** - * @var string - */ protected string $timeall; - /** - * @var string - */ protected string $fullother; - /** - * @var string - */ protected string $fullall; /** @@ -129,9 +112,6 @@ class NameFixer */ public mixed $category; - /** - * @var \Blacklight\utility\Utility - */ public Utility $text; /** @@ -143,9 +123,7 @@ class NameFixer * @var \Blacklight\ColorCLI */ protected ColorCLI $colorCli; - /** - * @var ElasticSearchSiteSearch - */ + private ElasticSearchSiteSearch $elasticsearch; /** @@ -156,12 +134,12 @@ class NameFixer public function __construct(array $options = []) { $defaults = [ - 'Echo' => true, - 'Categorize' => null, + 'Echo' => true, + 'Categorize' => null, 'ConsoleTools' => null, - 'Groups' => null, - 'Misc' => null, - 'Settings' => null, + 'Groups' => null, + 'Misc' => null, + 'Settings' => null, 'SphinxSearch' => null, ]; $options += $defaults; @@ -185,11 +163,6 @@ class NameFixer * Attempts to fix release names using the NFO. * * - * @param $time - * @param $echo - * @param $cats - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -238,22 +211,23 @@ class NameFixer foreach ($releases as $rel) { $releaseRow = Release::fromQuery( - sprintf( - ' + sprintf( + ' SELECT nfo.releases_id AS nfoid, rel.groups_id, rel.fromname, rel.categories_id, rel.name, rel.searchname, UNCOMPRESS(nfo) AS textstring, rel.id AS releases_id FROM releases rel INNER JOIN release_nfos nfo ON (nfo.releases_id = rel.id) WHERE rel.id = %d LIMIT 1', - $rel->releases_id - ) - ); + $rel->releases_id + ) + ); $this->checked++; // Ignore encrypted NFOs. if (preg_match('/^=newz\[NZB\]=\w+/', $releaseRow[0]->textstring)) { $this->_updateSingleColumn('proc_nfo', self::PROC_NFO_DONE, $rel->releases_id); + continue; } @@ -271,11 +245,6 @@ class NameFixer * Attempts to fix release names using the File name. * * - * @param $time - * @param $echo - * @param $cats - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -338,11 +307,6 @@ class NameFixer * Attempts to fix release names using the rar file crc32 hash. * * - * @param $time - * @param $echo - * @param $cats - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -405,11 +369,6 @@ class NameFixer * Attempts to fix XXX release names using the File name. * * - * @param $time - * @param $echo - * @param $cats - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -469,11 +428,6 @@ class NameFixer * Attempts to fix release names using the SRR filename. * * - * @param $time - * @param $echo - * @param $cats - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -537,9 +491,6 @@ class NameFixer * @param int $time 1: 24 hours, 2: no time limit * @param int $echo 1: change the name, anything else: preview of what could have been changed. * @param int $cats 1: other categories, 2: all categories - * @param $nameStatus - * @param $show - * @param NNTP $nntp * * @throws \Exception */ @@ -581,13 +532,13 @@ class NameFixer $this->consoletools->primary(number_format($total).' releases to process.'); $Nfo = new Nfo(); $nzbContents = new NZBContents( - [ - 'Echo' => $this->echoOutput, - 'NNTP' => $nntp, - 'Nfo' => $Nfo, - 'PostProcess' => new PostProcess(['Nfo' => $Nfo]), - ] - ); + [ + 'Echo' => $this->echoOutput, + 'NNTP' => $nntp, + 'Nfo' => $Nfo, + 'PostProcess' => new PostProcess(['Nfo' => $Nfo]), + ] + ); foreach ($releases as $release) { if ($nzbContents->checkPAR2($release->guid, $release->releases_id, $release->groups_id, $nameStatus, $show)) { @@ -607,11 +558,6 @@ class NameFixer * Attempts to fix release names using the mediainfo xml Unique_ID. * * - * @param $time - * @param $echo - * @param $cats - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -678,12 +624,6 @@ class NameFixer } /** - * @param $time - * @param $echo - * @param $cats - * @param $nameStatus - * @param $show - * * @throws \Exception */ public function fixNamesWithMediaMovieName($time, $echo, $cats, $nameStatus, $show): void @@ -747,11 +687,6 @@ class NameFixer * Attempts to fix release names using the par2 hash_16K block. * * - * @param $time - * @param $echo - * @param $cats - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -819,10 +754,6 @@ class NameFixer } /** - * @param $time - * @param $cats - * @param $query - * @param int $limit * @return false|\Illuminate\Database\Eloquent\Collection */ protected function _getReleases($time, $cats, $query, int $limit = 0): \Illuminate\Database\Eloquent\Collection|bool @@ -888,9 +819,6 @@ class NameFixer ); } - /** - * @param int $show - */ protected function _echoRenamed(int $show): void { if ($this->checked % 500 === 0 && $show === 1) { @@ -911,14 +839,6 @@ class NameFixer * Update the release with the new information. * * - * @param $release - * @param $name - * @param $method - * @param $echo - * @param $type - * @param int $nameStatus - * @param bool $show - * @param int $preId * * @throws \Exception */ @@ -1051,20 +971,20 @@ class NameFixer } } else { $release->update( - [ - 'videos_id' => 0, - 'tv_episodes_id' => 0, - 'imdbid' => null, - 'musicinfo_id' => null, - 'consoleinfo_id' => null, - 'bookinfo_id' => null, - 'anidbid' => null, - 'predb_id' => $preId, - 'searchname' => $newTitle, - 'categories_id' => $determinedCategory['categories_id'], - 'iscategorized' => 1, - ] - ); + [ + 'videos_id' => 0, + 'tv_episodes_id' => 0, + 'imdbid' => null, + 'musicinfo_id' => null, + 'consoleinfo_id' => null, + 'bookinfo_id' => null, + 'anidbid' => null, + 'predb_id' => $preId, + 'searchname' => $newTitle, + 'categories_id' => $determinedCategory['categories_id'], + 'iscategorized' => 1, + ] + ); if (config('nntmux.elasticsearch_enabled') === true) { $this->elasticsearch->updateRelease($release->_releases_id); @@ -1093,18 +1013,19 @@ class NameFixer * ] * * @static + * * @void */ public static function echoChangedReleaseName( array $data = [ - 'new_name' => '', - 'old_name' => '', + 'new_name' => '', + 'old_name' => '', 'new_category' => '', 'old_category' => '', - 'group' => '', - 'releases_id' => 0, - 'method' => '', + 'group' => '', + 'releases_id' => 0, + 'method' => '', ] ): void { $colorCLI = new ColorCLI(); @@ -1122,11 +1043,6 @@ class NameFixer /** * Match a PreDB title to a release name or searchname using an exact full-text match. * - * @param $pre - * @param $echo - * @param $nameStatus - * @param $show - * @return int * * @throws \Exception */ @@ -1175,9 +1091,6 @@ class NameFixer } /** - * @param $preTitle - * @return string - * * @throws \Foolz\SphinxQL\Exception\ConnectionException * @throws \Foolz\SphinxQL\Exception\DatabaseException * @throws \Foolz\SphinxQL\Exception\SphinxQLException @@ -1267,11 +1180,6 @@ class NameFixer /** * Match a release filename to a PreDB filename or title. * - * @param $release - * @param bool $echo - * @param int $nameStatus - * @param bool $show - * @return int * * @throws \Exception */ @@ -1315,13 +1223,9 @@ class NameFixer /** * Cleans file names for PreDB Match. - * - * - * @return string */ protected function _cleanMatchFiles(): string { - // first strip all non-printing chars from filename $this->_fileName = Utility::stripNonPrintingChars($this->_fileName); @@ -1344,12 +1248,6 @@ class NameFixer /** * Match a Hash from the predb to a release. * - * @param string $hash - * @param $release - * @param $echo - * @param $nameStatus - * @param $show - * @return int * * @throws \Exception */ @@ -1393,12 +1291,6 @@ class NameFixer /** * Matches the hashes within the predb table to release files and subjects (names) which are hashed. * - * @param $time - * @param $echo - * @param $cats - * @param $nameStatus - * @param $show - * @return int * * @throws \Exception */ @@ -1461,13 +1353,6 @@ class NameFixer /** * Check the array using regex for a clean name. * - * @param $release - * @param bool $echo - * @param string $type - * @param int $nameStatus - * @param bool $show - * @param bool $preId - * @return bool * * @throws \Exception */ @@ -1558,10 +1443,6 @@ class NameFixer * This function updates a single variable column in releases * The first parameter is the column to update, the second is the value * The final parameter is the ID of the release to update. - * - * @param string $column - * @param int $status - * @param int $id */ public function _updateSingleColumn(string $column = '', int $status = 0, int $id = 0): void { @@ -1573,11 +1454,8 @@ class NameFixer /** * Look for a TV name. * - * @param $release * @param bool $echo * @param string $type - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -1607,11 +1485,6 @@ class NameFixer /** * Look for a movie name. * - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -1653,11 +1526,6 @@ class NameFixer /** * Look for a game name. * - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -1683,11 +1551,6 @@ class NameFixer /** * Look for a app name. * - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -1707,11 +1570,6 @@ class NameFixer /** * TV. * - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -1731,11 +1589,6 @@ class NameFixer /** * Movies. * - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -1755,12 +1608,6 @@ class NameFixer } /** - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show - * * @throws \Exception */ public function nfoCheckMus($release, bool $echo, string $type, $nameStatus, $show): void @@ -1776,11 +1623,6 @@ class NameFixer /** * Title (year). * - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -1953,11 +1795,6 @@ class NameFixer /** * Games. * - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -1983,11 +1820,6 @@ class NameFixer /** * Misc. * - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show * * @throws \Exception */ @@ -2024,12 +1856,6 @@ class NameFixer /** * Just for filenames. * - * @param $release - * @param bool $echo - * @param string $type - * @param $nameStatus - * @param $show - * @return bool * * @throws \Exception */ @@ -2123,12 +1949,6 @@ class NameFixer * Look for a name based on mediainfo xml Unique_ID. * * - * @param $release - * @param $echo - * @param $type - * @param $nameStatus - * @param $show - * @return bool * * @throws \Exception */ @@ -2153,15 +1973,15 @@ class NameFixer $floor = round(($res['relsize'] - $release->relsize) / $res['relsize'] * 100, 1); if ($floor >= -10 && $floor <= 10) { $this->updateRelease( - $release, - $res->searchname, - 'uidCheck: Unique_ID', - $echo, - $type, - $nameStatus, - $show, - $res->predb_id - ); + $release, + $res->searchname, + 'uidCheck: Unique_ID', + $echo, + $type, + $nameStatus, + $show, + $res->predb_id + ); return true; } @@ -2176,12 +1996,6 @@ class NameFixer * Look for a name based on mediainfo xml Unique_ID. * * - * @param $release - * @param $echo - * @param $type - * @param $nameStatus - * @param $show - * @return bool * * @throws \Exception */ @@ -2215,12 +2029,6 @@ class NameFixer * Look for a name based on xxx release filename. * * - * @param $release - * @param $echo - * @param $type - * @param $nameStatus - * @param $show - * @return bool * * @throws \Exception */ @@ -2246,14 +2054,14 @@ class NameFixer foreach ($result as $res) { if (preg_match('/^.+?SDPORN/i', $res->textstring, $hit)) { $this->updateRelease( - $release, - $hit['0'], - 'fileCheck: XXX SDPORN', - $echo, - $type, - $nameStatus, - $show - ); + $release, + $hit['0'], + 'fileCheck: XXX SDPORN', + $echo, + $type, + $nameStatus, + $show + ); return true; } @@ -2268,12 +2076,6 @@ class NameFixer * Look for a name based on .srr release files extension. * * - * @param $release - * @param $echo - * @param $type - * @param $nameStatus - * @param $show - * @return bool * * @throws \Exception */ @@ -2299,14 +2101,14 @@ class NameFixer foreach ($result as $res) { if (preg_match('/^(.*)\.srr$/i', $res->textstring, $hit)) { $this->updateRelease( - $release, - $hit['1'], - 'fileCheck: SRR extension', - $echo, - $type, - $nameStatus, - $show - ); + $release, + $hit['1'], + 'fileCheck: SRR extension', + $echo, + $type, + $nameStatus, + $show + ); return true; } @@ -2321,12 +2123,6 @@ class NameFixer * Look for a name based on par2 hash_16K block. * * - * @param $release - * @param $echo - * @param $type - * @param $nameStatus - * @param $show - * @return bool * * @throws \Exception */ @@ -2349,15 +2145,15 @@ class NameFixer $floor = round(($res->relsize - $release->relsize) / $res->relsize * 100, 1); if ($floor >= -5 && $floor <= 5) { $this->updateRelease( - $release, - $res->searchname, - 'hashCheck: PAR2 hash_16K', - $echo, - $type, - $nameStatus, - $show, - $res->predb_id - ); + $release, + $res->searchname, + 'hashCheck: PAR2 hash_16K', + $echo, + $type, + $nameStatus, + $show, + $res->predb_id + ); return true; } @@ -2372,12 +2168,6 @@ class NameFixer * Look for a name based on rar crc32 hash. * * - * @param $release - * @param $echo - * @param $type - * @param $nameStatus - * @param $show - * @return bool * * @throws \Exception */ @@ -2428,10 +2218,6 @@ class NameFixer $this->done = $this->matched = false; } - /** - * @param string $fileName - * @return array - */ private function preMatch(string $fileName): array { $result = preg_match('/(\d{2}\.\d{2}\.\d{2})+([\w\-.]+[\w]$)/i', $fileName, $hit); @@ -2440,13 +2226,6 @@ class NameFixer } /** - * @param $release - * @param bool $echo - * @param string $type - * @param int $nameStatus - * @param bool $show - * @return bool - * * @throws \Exception */ public function preDbFileCheck($release, bool $echo, string $type, int $nameStatus, bool $show): bool @@ -2479,13 +2258,6 @@ class NameFixer } /** - * @param $release - * @param bool $echo - * @param string $type - * @param int $nameStatus - * @param bool $show - * @return bool - * * @throws \Exception */ public function preDbTitleCheck($release, bool $echo, string $type, int $nameStatus, bool $show): bool @@ -2517,9 +2289,6 @@ class NameFixer return false; } - /** - * @return array|string|null - */ private function cleanFileNames(): array|string|null { if (preg_match('/(\.[a-zA-Z]{2})?(\.4k|\.fullhd|\.hd|\.int|\.\d+)?$/i', $this->_fileName, $hit)) { @@ -2552,7 +2321,6 @@ class NameFixer } /** - * @param $string * @return string|string[] */ private function escapeString($string): array|string diff --git a/Blacklight/Nfo.php b/Blacklight/Nfo.php index 7fdf72a63..796af1c65 100755 --- a/Blacklight/Nfo.php +++ b/Blacklight/Nfo.php @@ -49,8 +49,11 @@ class Nfo protected $echo; public const NFO_FAILED = -9; // We failed to get a NFO after admin set max retries. + public const NFO_UNPROC = -1; // Release has not been processed yet. + public const NFO_NONFO = 0; // Release has no NFO. + public const NFO_FOUND = 1; // Release has an NFO. /** @@ -93,7 +96,7 @@ class Nfo $return = [ 'showid' => trim($hits[1]), - 'site' => 'tvmaze', + 'site' => 'tvmaze', ]; } @@ -101,7 +104,7 @@ class Nfo $return = [ 'showid' => trim($hits[1]), - 'site' => 'imdb', + 'site' => 'imdb', ]; } @@ -109,7 +112,7 @@ class Nfo $return = [ 'showid' => trim($hits[1]), - 'site' => 'thetvdb', + 'site' => 'thetvdb', ]; } @@ -146,7 +149,6 @@ class Nfo // Linux boxes have 'file' (so should Macs), Windows *can* have it too: see GNUWIN.txt in docs. $result = Utility::fileInfo($tmpPath); if (! empty($result)) { - // Check if it's text. if (preg_match('/(ASCII|ISO-8859|UTF-(8|16|32).*?)\s*text/', $result)) { @File::delete($tmpPath); @@ -167,7 +169,6 @@ class Nfo $check = (new \getID3())->analyze($tmpPath); @File::delete($tmpPath); if (isset($check['error'])) { - // Check if it's a par2. $par2info = new Par2Info(); $par2info->setData($possibleNFO); @@ -189,7 +190,6 @@ class Nfo * Add an NFO from alternate sources. ex.: PreDB, rar, zip, etc... * * @param string $nfo The nfo. - * @param $release * @param NNTP $nntp Instance of class NNTP. * @return bool True on success, False on failure. * @@ -215,9 +215,9 @@ class Nfo [ 'Echo' => $this->echo, 'NNTP' => $nntp, - 'Nfo' => $this, - 'Settings' => null, - 'PostProcess' => new PostProcess(['Echo' => $this->echo, 'Nfo' => $this]), + 'Nfo' => $this, + 'Settings' => null, + 'PostProcess' => new PostProcess(['Echo' => $this->echo, 'Nfo' => $this]), ] ); $nzbContents->parseNZB($release->guid, $release->id, $release->guid); @@ -232,7 +232,6 @@ class Nfo /** * Attempt to find NFO files inside the NZB's of releases. * - * @param $nntp * @param string $groupID (optional) Group ID. * @param string $guidChar (optional) First character of the release GUID (used for multi-processing). * @param int $processImdb (optional) Attempt to find IMDB id's in the NZB? @@ -280,7 +279,7 @@ class Nfo 'Processing '.$nfoCount. ' NFO(s), starting at '.$this->nzbs. ' * = hidden NFO, + = NFO, - = no NFO, f = download failed.' - ); + ); if ($this->echo) { // Get count of releases per nfo status @@ -387,9 +386,9 @@ class Nfo * "AND r.nzbstatus = 1 AND r.nfostatus BETWEEN -8 AND -1 AND r.size < 1073741824 AND r.size > 1048576" * To use in a query. * - * @return string * * @throws \Exception + * * @static */ public static function NfoQueryString(): string diff --git a/Blacklight/Regexes.php b/Blacklight/Regexes.php index 8f49a66bd..0703e11b3 100755 --- a/Blacklight/Regexes.php +++ b/Blacklight/Regexes.php @@ -38,8 +38,6 @@ class Regexes protected $_categoriesID = Category::OTHER_MISC; /** - * @param array $options - * * @throws \Exception */ public function __construct(array $options = []) @@ -55,9 +53,6 @@ class Regexes /** * Add a new regex. - * - * @param array $data - * @return bool */ public function addRegex(array $data): bool { @@ -78,9 +73,6 @@ class Regexes /** * Update a regex with new info. - * - * @param array $data - * @return bool */ public function updateRegex(array $data): bool { @@ -105,7 +97,6 @@ class Regexes * Get a single regex using its id. * * @param int $id - * @return array */ public function getRegexByID($id): array { @@ -139,7 +130,6 @@ class Regexes * Get the count of regex in the DB. * * @param string $group_regex Optional, keyword to find a group. - * @return int */ public function getCount($group_regex = ''): int { @@ -176,7 +166,6 @@ class Regexes * @param string $groupName * @param string $regex * @param int $limit - * @return array * * @throws \Exception */ @@ -218,10 +207,10 @@ class Regexes $newCollectionHash = sha1($string.$row->fromname.$groupID.$files); $data['New hash: '.$newCollectionHash.$string2][$row->binaryhash] = [ 'new_collection_hash' => $newCollectionHash, - 'file_name' => $row->name, - 'file_total_parts' => $row->totalparts, - 'file_current_parts' => $row->currentparts, - 'collection_poster' => $row->fromname, + 'file_name' => $row->name, + 'file_total_parts' => $row->totalparts, + 'file_current_parts' => $row->currentparts, + 'collection_poster' => $row->fromname, 'old_collection_hash' => $row->collectionhash, ]; @@ -239,12 +228,6 @@ class Regexes } /** - * @param $groupName - * @param $regex - * @param $displayLimit - * @param $queryLimit - * @return array - * * @throws \Exception */ public function testReleaseNamingRegex($groupName, $regex, $displayLimit, $queryLimit): array @@ -269,7 +252,7 @@ class Regexes $hit = $this->_matchRegex($regex, $row['name']); if ($hit) { $data[$row['id']] = [ - 'subject' => $row['name'], + 'subject' => $row['name'], 'old_name' => $row['searchname'], 'new_name' => $hit, ]; @@ -286,9 +269,6 @@ class Regexes /** * This will try to find regex in the DB for a group and a usenet subject, attempt to match them and return the matches. * - * @param string $subject - * @param string $groupName - * @return string * * @throws \Exception */ @@ -321,18 +301,16 @@ class Regexes /** * Get the regex from the DB, cache them locally for 15 mins. * Cache them also in the cache server, as this script might be terminated. - * - * @param string $groupName */ protected function _fetchRegex(string $groupName): void { // Get all regex from DB which match the current group name. Cache them for 15 minutes. #CACHEDQUERY# $sql = sprintf( - 'SELECT r.id, r.regex %s FROM %s r WHERE %s REGEXP r.group_regex AND r.status = 1 ORDER BY r.ordinal ASC, r.group_regex ASC', - ($this->tableName === 'category_regexes' ? ', r.categories_id' : ''), - $this->tableName, - $groupName - ); + 'SELECT r.id, r.regex %s FROM %s r WHERE %s REGEXP r.group_regex AND r.status = 1 ORDER BY r.ordinal ASC, r.group_regex ASC', + ($this->tableName === 'category_regexes' ? ', r.categories_id' : ''), + $this->tableName, + $groupName + ); $this->_regexCache[$groupName]['regex'] = Cache::get(md5($sql)); if ($this->_regexCache[$groupName]['regex'] !== null) { @@ -350,7 +328,6 @@ class Regexes * * @param string $regex * @param string $subject - * @return string * * @throws \Exception */ @@ -384,7 +361,6 @@ class Regexes * Format part of a query. * * @param string $group_regex - * @return string */ protected function _groupQueryString($group_regex): string { diff --git a/Blacklight/ReleaseCleaning.php b/Blacklight/ReleaseCleaning.php index 814e8253b..3da62e6c0 100755 --- a/Blacklight/ReleaseCleaning.php +++ b/Blacklight/ReleaseCleaning.php @@ -17,6 +17,7 @@ class ReleaseCleaning * Used for matching endings in article subjects. * * @const + * * @string */ private const REGEX_END = '[ -]{0,3}yEnc$/u'; @@ -25,6 +26,7 @@ class ReleaseCleaning * Used for matching file extension endings in article subjects. * * @const + * * @string */ private const REGEX_FILE_EXTENSIONS = '([\-_](proof|sample|thumbs?))*(\.part\d*(\.rar)?|\.rar|\.7z)?(\d{1,3}\.rev"|\.vol.+?"|\.[A-Za-z0-9]{2,4}"|")'; @@ -33,7 +35,9 @@ class ReleaseCleaning * Used for matching size strings in article subjects. * * @example ' - 365.15 KB - ' + * * @const + * * @string */ private const REGEX_SUBJECT_SIZE = '[ -]{0,3}\d+([.,]\d+)? [kKmMgG][bB][ -]{0,3}'; @@ -93,9 +97,6 @@ class ReleaseCleaning } /** - * @param $subject - * @param $fromName - * @param $groupName * @param bool $usePre * @return array|false|string * @@ -119,11 +120,11 @@ class ReleaseCleaning } if ($title !== null) { return [ - 'cleansubject' => $title['title'], + 'cleansubject' => $title['title'], 'properlynamed' => true, - 'increment' => false, - 'predb' => $title['id'], - 'requestid' => false, + 'increment' => false, + 'predb' => $title['id'], + 'requestid' => false, ]; } } @@ -135,7 +136,7 @@ class ReleaseCleaning preg_match('/^(\d{4,6})-\d{1}\[/', $subject, $hit) || preg_match('/(\d{4,6}) -/', $subject, $hit) ) { - $title = Predb::query()->where(['predb.requestid'=> $hit[1], 'g.name' => $groupName])->join('usenet_groups as g', 'g.id', '=', 'predb.groups_id')->first(['predb.title', 'predb.id']); + $title = Predb::query()->where(['predb.requestid' => $hit[1], 'g.name' => $groupName])->join('usenet_groups as g', 'g.id', '=', 'predb.groups_id')->first(['predb.title', 'predb.id']); //check for predb title matches against other groups where it matches relative size / fromname //known crossposted requests only atm $reqGname = ''; @@ -159,7 +160,7 @@ class ReleaseCleaning break; } if ($title === null && ! empty($reqGname)) { - $title = Predb::query()->where(['predb.requestid'=> $hit[1], 'g.name' => $reqGname])->join('usenet_groups as g', 'g.id', '=', 'predb.groups_id')->first(['predb.title', 'predb.id']); + $title = Predb::query()->where(['predb.requestid' => $hit[1], 'g.name' => $reqGname])->join('usenet_groups as g', 'g.id', '=', 'predb.groups_id')->first(['predb.title', 'predb.id']); } // don't match against ab.teevee if title is for just the season if ($groupName === 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $hit)) { @@ -167,11 +168,11 @@ class ReleaseCleaning } if ($title !== null) { return [ - 'cleansubject' => $title['title'], + 'cleansubject' => $title['title'], 'properlynamed' => true, - 'increment' => false, - 'predb' => $title['id'], - 'requestid' => true, + 'increment' => false, + 'predb' => $title['id'], + 'requestid' => true, ]; } } @@ -183,7 +184,7 @@ class ReleaseCleaning $potentialName = $this->_regexes->tryRegex($subject, $groupName); if ($potentialName) { return [ - 'id' => $this->_regexes->matchedRegex, + 'id' => $this->_regexes->matchedRegex, 'cleansubject' => $potentialName, 'properlynamed' => false, ]; @@ -200,9 +201,6 @@ class ReleaseCleaning return $this->generic(); } - /** - * @return array - */ public function teevee(): array { //[140022]-[04] - [01/40] - "140022-04.nfo" yEnc @@ -425,10 +423,6 @@ class ReleaseCleaning ]; } - /** - * @param $subject - * @return string - */ public function releaseCleanerHelper($subject): string { $cleanerName = preg_replace('/(\- )?yEnc$/', '', $subject); @@ -439,7 +433,6 @@ class ReleaseCleaning /** * Cleans release name for the namefixer class. * - * @param $name * @return mixed|string */ public function fixerCleaner($name) diff --git a/Blacklight/ReleaseExtra.php b/Blacklight/ReleaseExtra.php index 01a845207..01f031409 100755 --- a/Blacklight/ReleaseExtra.php +++ b/Blacklight/ReleaseExtra.php @@ -23,7 +23,6 @@ class ReleaseExtra } /** - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public function get($id) @@ -33,7 +32,6 @@ class ReleaseExtra } /** - * @param $id * @return array|false */ public function getVideo($id) @@ -48,7 +46,6 @@ class ReleaseExtra } /** - * @param $id * @return array|false */ public function getAudio($id) @@ -63,7 +60,6 @@ class ReleaseExtra } /** - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public function getSubs($id) @@ -73,7 +69,6 @@ class ReleaseExtra /** * @param string $guid - * @return array */ public function getBriefByGuid($guid): array { @@ -92,7 +87,6 @@ class ReleaseExtra } /** - * @param $guid * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|\Illuminate\Database\Query\Builder|null|object */ public function getByGuid($guid) @@ -100,9 +94,6 @@ class ReleaseExtra return VideoData::query()->where('r.guid', $guid)->leftJoin('releases as r', 'r.id', '=', 'video_data.releases_id')->first(); } - /** - * @param $id - */ public function delete($id): void { AudioData::query()->where('releases_id', $id)->delete(); @@ -110,10 +101,6 @@ class ReleaseExtra VideoData::query()->where('releases_id', $id)->delete(); } - /** - * @param $releaseID - * @param \Mhor\MediaInfo\Container\MediaInfoContainer $arrXml - */ public function addFromXml($releaseID, MediaInfoContainer $arrXml): void { $containerFormat = ''; @@ -260,19 +247,6 @@ class ReleaseExtra } } - /** - * @param $releaseID - * @param $containerFormat - * @param $overallBitRate - * @param $videoDuration - * @param $videoFormat - * @param $videoCodec - * @param $videoWidth - * @param $videoHeight - * @param $videoAspect - * @param $videoFrameRate - * @param $videoLibrary - */ public function addVideo( $releaseID, $containerFormat, @@ -304,19 +278,6 @@ class ReleaseExtra } } - /** - * @param $releaseID - * @param $audioID - * @param $audioFormat - * @param $audioMode - * @param $audioBitRateMode - * @param $audioBitRate - * @param $audioChannels - * @param $audioSampleRate - * @param $audioLibrary - * @param $audioLanguage - * @param $audioTitle - */ private function addAudio($releaseID, $audioID, $audioFormat, $audioMode, $audioBitRateMode, $audioBitRate, $audioChannels, $audioSampleRate, $audioLibrary, $audioLanguage, $audioTitle): void { $ckid = AudioData::query()->where('releases_id', $releaseID)->first(['releases_id']); @@ -337,11 +298,6 @@ class ReleaseExtra } } - /** - * @param $releaseID - * @param $subsID - * @param $subsLanguage - */ private function addSubs($releaseID, $subsID, $subsLanguage): void { $ckid = ReleaseSubtitle::query()->where('releases_id', $releaseID)->first(['releases_id']); @@ -381,7 +337,6 @@ class ReleaseExtra } /** - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public function getFull($id) @@ -399,10 +354,6 @@ class ReleaseExtra return ReleaseExtraFull::query()->where('releases_id', $id)->delete(); } - /** - * @param $id - * @param \Mhor\MediaInfo\Container\MediaInfoContainer $xmlArray - */ public function addFull($id, MediaInfoContainer $xmlArray): void { $ckid = ReleaseExtraFull::query()->where('releases_id', $id)->first(); diff --git a/Blacklight/ReleaseImage.php b/Blacklight/ReleaseImage.php index a9ad65ac7..0131a1aea 100755 --- a/Blacklight/ReleaseImage.php +++ b/Blacklight/ReleaseImage.php @@ -71,7 +71,6 @@ class ReleaseImage } /** - * @param $imgLoc * @return bool|\Intervention\Image\Image */ protected function fetchImage($imgLoc) @@ -155,7 +154,6 @@ class ReleaseImage * Delete images for the release. * * @param string $guid The GUID of the release. - * @return void */ public function delete($guid): void { diff --git a/Blacklight/ReleaseRemover.php b/Blacklight/ReleaseRemover.php index 2cd92f8ed..c2db6827f 100755 --- a/Blacklight/ReleaseRemover.php +++ b/Blacklight/ReleaseRemover.php @@ -113,13 +113,13 @@ class ReleaseRemover public function __construct(array $options = []) { $defaults = [ - 'Browser' => false, // Are we coming from the web script. + 'Browser' => false, // Are we coming from the web script. 'ConsoleTools' => null, - 'Echo' => true, // Echo to CLI? - 'NZB' => null, + 'Echo' => true, // Echo to CLI? + 'NZB' => null, 'ReleaseImage' => null, - 'Releases' => null, - 'Settings' => null, + 'Releases' => null, + 'Settings' => null, ]; $options += $defaults; @@ -720,7 +720,6 @@ class ReleaseRemover /** * Remove releases using the site blacklist regexes. * - * @return bool * * @throws \Exception */ @@ -813,12 +812,12 @@ class ReleaseRemover // Provide useful output of operations $this->consoleTools->header( sprintf( - 'Finding crap releases for %s: Using %s method against release %s.'. - '%s', - $this->method, - $blType, - $opTypeName, - $ftUsing + 'Finding crap releases for %s: Using %s method against release %s.'. + '%s', + $this->method, + $blType, + $opTypeName, + $ftUsing ), true ); @@ -854,7 +853,6 @@ class ReleaseRemover /** * Remove releases using the site blacklist regexes against file names. * - * @return bool * * @throws \Exception */ @@ -918,11 +916,11 @@ class ReleaseRemover // Provide useful output of operations $this->consoleTools->header( sprintf( - 'Finding crap releases for %s: Using %s method against release filenames.'.PHP_EOL. - '%s', - $this->method, - $blType, - $ftUsing + 'Finding crap releases for %s: Using %s method against release filenames.'.PHP_EOL. + '%s', + $this->method, + $blType, + $ftUsing ), true ); @@ -1291,7 +1289,6 @@ class ReleaseRemover * Remove multiple spaces and trim leading spaces. * * @param string $string - * @return string */ protected function cleanSpaces($string): string { @@ -1303,7 +1300,6 @@ class ReleaseRemover * * @param string $string The string to format. * @param string $type The column name. - * @return string */ protected function formatLike($string, $type): string { diff --git a/Blacklight/Releases.php b/Blacklight/Releases.php index 8e5d18041..f50ada469 100644 --- a/Blacklight/Releases.php +++ b/Blacklight/Releases.php @@ -20,6 +20,7 @@ class Releases extends Release { // RAR/ZIP Password indicator. public const PASSWD_NONE = 0; // No password. + public const PASSWD_RAR = 1; // Definitely passworded. /** @@ -27,13 +28,8 @@ class Releases extends Release */ public SphinxSearch $sphinxSearch; - /** - * @var int - */ public int $passwordStatus; - /** - * @var ElasticSearchSiteSearch - */ + private ElasticSearchSiteSearch $elasticSearch; /** @@ -52,16 +48,6 @@ class Releases extends Release * Used for Browse results. * * - * @param $page - * @param $cat - * @param $start - * @param $num - * @param $orderBy - * @param int $maxAge - * @param array $excludedCats - * @param array $tags - * @param int|string $groupName - * @param int $minSize * @return Collection|mixed */ public function getBrowseRange($page, $cat, $start, $num, $orderBy, int $maxAge = -1, array $excludedCats = [], int|string $groupName = -1, int $minSize = 0, array $tags = []): mixed @@ -128,13 +114,6 @@ class Releases extends Release /** * Used for pager on browse page. - * - * @param array $cat - * @param int $maxAge - * @param array $excludedCats - * @param int|string $groupName - * @param array $tags - * @return int */ public function getBrowseCount(array $cat, int $maxAge = -1, array $excludedCats = [], int|string $groupName = '', array $tags = []): int { @@ -158,9 +137,6 @@ class Releases extends Release )); } - /** - * @return string - */ public function showPasswords(): string { $show = (int) Settings::settingValue('..showpasswordedrelease'); @@ -174,9 +150,6 @@ class Releases extends Release /** * Use to order releases on site. - * - * @param array|string $orderBy - * @return array */ public function getBrowseOrder(array|string $orderBy): array { @@ -217,9 +190,6 @@ class Releases extends Release } /** - * @param string $postFrom - * @param string $postTo - * @param string $groupID * @return \App\Models\Release[]|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Query\Builder[]|\Illuminate\Support\Collection */ public function getForExport(string $postFrom = '', string $postTo = '', string $groupID = '') @@ -273,10 +243,6 @@ class Releases extends Release return $row === null ? '01/01/2014' : $row['postdate']; } - /** - * @param bool $blnIncludeAll - * @return array - */ public function getReleasedGroupsForSelect(bool $blnIncludeAll = true): array { $groups = self::query() @@ -297,12 +263,6 @@ class Releases extends Release } /** - * @param $userShows - * @param $offset - * @param $limit - * @param $orderBy - * @param int $maxAge - * @param array $excludedCats * @return \Illuminate\Cache\|\Illuminate\Database\Eloquent\Collection|mixed */ public function getShowsRange($userShows, $offset, $limit, $orderBy, int $maxAge = -1, array $excludedCats = []) @@ -343,12 +303,6 @@ class Releases extends Release return $result; } - /** - * @param $userShows - * @param int $maxAge - * @param array $excludedCats - * @return int - */ public function getShowsCount($userShows, int $maxAge = -1, array $excludedCats = []): int { return $this->getPagerCount( @@ -372,9 +326,6 @@ class Releases extends Release } /** - * @param int|array|string $list - * @return void - * * @throws \Exception */ public function deleteMultiple(int|array|string $list): void @@ -439,13 +390,6 @@ class Releases extends Release } /** - * @param $guids - * @param $category - * @param $grabs - * @param $videoId - * @param $episodeId - * @param $anidbId - * @param $imdbId * @return bool|int */ public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) @@ -455,12 +399,12 @@ class Releases extends Release } $update = [ - 'categories_id' => $category === -1 ? 'categories_id' : $category, - 'grabs' => $grabs, - 'videos_id' => $videoId, + 'categories_id' => $category === -1 ? 'categories_id' : $category, + 'grabs' => $grabs, + 'videos_id' => $videoId, 'tv_episodes_id' => $episodeId, - 'anidbid' => $anidbId, - 'imdbid' => $imdbId, + 'anidbid' => $anidbId, + 'imdbid' => $imdbId, ]; return self::query()->whereIn('guid', $guids)->update($update); @@ -468,10 +412,6 @@ class Releases extends Release /** * Creates part of a query for some functions. - * - * @param array|Collection $userQuery - * @param string $type - * @return string */ public function uSQL(Collection|array $userQuery, string $type): string { @@ -497,21 +437,6 @@ class Releases extends Release * Function for searching on the site (by subject, searchname or advanced). * * - * @param array $searchArr - * @param $groupName - * @param $sizeFrom - * @param $sizeTo - * @param $daysNew - * @param $daysOld - * @param int $offset - * @param int $limit - * @param array|string $orderBy - * @param int $maxAge - * @param array $excludedCats - * @param string $type - * @param array $cat - * @param int $minSize - * @param array $tags * @return array|Collection|mixed * * @throws \Foolz\SphinxQL\Exception\ConnectionException @@ -634,15 +559,6 @@ class Releases extends Release * Search function for API. * * - * @param $searchName - * @param $groupName - * @param int $offset - * @param int $limit - * @param int $maxAge - * @param array $excludedCats - * @param array $cat - * @param int $minSize - * @param array $tags * @return Collection|mixed * * @throws \Foolz\SphinxQL\Exception\ConnectionException @@ -726,18 +642,6 @@ class Releases extends Release /** * Search for TV shows via API. * - * @param array $siteIdArr - * @param string $series - * @param string $episode - * @param string $airDate - * @param int $offset - * @param int $limit - * @param string $name - * @param array $cat - * @param int $maxAge - * @param int $minSize - * @param array $excludedCategories - * @param array $tags * @return array|\Illuminate\Cache\|\Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|mixed * * @throws \Foolz\SphinxQL\Exception\ConnectionException @@ -876,18 +780,6 @@ class Releases extends Release * Search TV Shows via APIv2. * * - * @param array $siteIdArr - * @param string $series - * @param string $episode - * @param string $airDate - * @param int $offset - * @param int $limit - * @param string $name - * @param array $cat - * @param int $maxAge - * @param int $minSize - * @param array $excludedCategories - * @param array $tags * @return Collection|mixed * * @throws \Foolz\SphinxQL\Exception\ConnectionException @@ -1020,13 +912,6 @@ class Releases extends Release * Search anime releases. * * - * @param $aniDbID - * @param int $offset - * @param int $limit - * @param string $name - * @param array $cat - * @param int $maxAge - * @param array $excludedCategories * @return Collection|mixed * * @throws \Foolz\SphinxQL\Exception\ConnectionException @@ -1100,17 +985,6 @@ class Releases extends Release * Movies search through API and site. * * - * @param int $imDbId - * @param int $tmDbId - * @param int $traktId - * @param int $offset - * @param int $limit - * @param string $name - * @param array $cat - * @param int $maxAge - * @param int $minSize - * @param array $excludedCategories - * @param array $tags * @return Collection|mixed * * @throws \Foolz\SphinxQL\Exception\ConnectionException @@ -1187,11 +1061,6 @@ class Releases extends Release } /** - * @param $currentID - * @param $name - * @param array $excludedCats - * @return array|bool - * * @throws \Foolz\SphinxQL\Exception\ConnectionException * @throws \Foolz\SphinxQL\Exception\DatabaseException * @throws \Foolz\SphinxQL\Exception\SphinxQLException @@ -1226,7 +1095,6 @@ class Releases extends Release * * * @param string $query The query to get the count from. - * @return int */ private function getPagerCount(string $query): int { diff --git a/Blacklight/SABnzbd.php b/Blacklight/SABnzbd.php index deca66b16..20e001c28 100755 --- a/Blacklight/SABnzbd.php +++ b/Blacklight/SABnzbd.php @@ -14,21 +14,27 @@ class SABnzbd * Type of site integration. */ public const INTEGRATION_TYPE_NONE = 0; + public const INTEGRATION_TYPE_USER = 2; /** * Type of SAB API key. */ public const API_TYPE_NZB = 1; + public const API_TYPE_FULL = 2; /** * Priority to send the NZB to SAB. */ public const PRIORITY_PAUSED = -2; + public const PRIORITY_LOW = -1; + public const PRIORITY_NORMAL = 0; + public const PRIORITY_HIGH = 1; // Sab is completely disabled - no user can use it. + public const PRIORITY_FORCE = 2; // Sab is enabled, 1 remote SAB server for the whole site. /** @@ -152,48 +158,41 @@ class SABnzbd } /** - * @param $guid - * @return string - * * @throws \RuntimeException */ public function sendToSab($guid): string { return $this->client->post( - $this->url. - 'api?mode=addurl&priority='. - $this->priority. - '&apikey='. - $this->apikey. - '&name='. - urlencode( - $this->serverurl. - 'getnzb?id='. - $guid. - '&r='. - $this->api_token - ) + $this->url. + 'api?mode=addurl&priority='. + $this->priority. + '&apikey='. + $this->apikey. + '&name='. + urlencode( + $this->serverurl. + 'getnzb?id='. + $guid. + '&r='. + $this->api_token + ) )->getBody()->getContents(); } /** - * @return string - * * @throws \RuntimeException */ public function getAdvQueue(): string { return $this->client->get( - $this->url. - 'api?mode=queue&start=START&limit=LIMIT&output=json&apikey='. - $this->apikey + $this->url. + 'api?mode=queue&start=START&limit=LIMIT&output=json&apikey='. + $this->apikey )->getBody()->getContents(); } /** - * @return string - * * @throws \RuntimeException */ public function getHistory(): string @@ -207,41 +206,34 @@ class SABnzbd } /** - * @param $id - * @return string - * * @throws \RuntimeException */ public function delFromQueue($id): string { return $this->client->get( - $this->url. - 'api?mode=queue&name=delete&value='. - $id. - '&apikey='. - $this->apikey + $this->url. + 'api?mode=queue&name=delete&value='. + $id. + '&apikey='. + $this->apikey )->getBody()->getContents(); } /** - * @param $id - * @return string - * * @throws \RuntimeException */ public function pauseFromQueue($id): string { return $this->client->get( - $this->url. - 'api?mode=queue&name=pause&value='. - $id. - '&apikey='. - $this->apikey + $this->url. + 'api?mode=queue&name=pause&value='. + $id. + '&apikey='. + $this->apikey )->getBody()->getContents(); } /** - * @param $id * @return string * * @throws \RuntimeException @@ -249,43 +241,40 @@ class SABnzbd public function resumeFromQueue($id) { return $this->client->get( - $this->url. - 'api?mode=queue&name=resume&value='. - $id. - '&apikey='. - $this->apikey + $this->url. + 'api?mode=queue&name=resume&value='. + $id. + '&apikey='. + $this->apikey )->getBody()->getContents(); } /** - * @return string - * * @throws \RuntimeException */ public function pauseAll(): string { return $this->client->get( - $this->url. - 'api?mode=pause'. - '&apikey='. - $this->apikey + $this->url. + 'api?mode=pause'. + '&apikey='. + $this->apikey )->getBody()->getContents(); } /** * Resume all NZB's in the SAB queue. * - * @return string * * @throws \RuntimeException */ public function resumeAll(): string { return $this->client->get( - $this->url. - 'api?mode=resume'. - '&apikey='. - $this->apikey + $this->url. + 'api?mode=resume'. + '&apikey='. + $this->apikey )->getBody()->getContents(); } @@ -315,11 +304,6 @@ class SABnzbd /** * Creates the SAB cookies for the user's browser. - * - * @param $host - * @param $apikey - * @param $priority - * @param $apitype */ public function setCookie($host, $apikey, $priority, $apitype) { diff --git a/Blacklight/Sharing.php b/Blacklight/Sharing.php index f8d8b40f3..4b0cdaa28 100755 --- a/Blacklight/Sharing.php +++ b/Blacklight/Sharing.php @@ -73,7 +73,7 @@ class Sharing { $defaults = [ 'Settings' => null, - 'NNTP' => null, + 'NNTP' => null, ]; $options += $defaults; @@ -220,8 +220,6 @@ class Sharing } /** - * @param $row - * * @throws \Exception */ protected function postComment(&$row) @@ -232,7 +230,6 @@ class Sharing // Check if the comment is already shared. $check = DB::selectOne(sprintf('SELECT id FROM release_comments WHERE shareid = %s', escapeString($sid))); if ($check === null) { - // Example of a subject. //(_nZEDb_)nZEDb_533f16e46a5091.73152965_3d12d7c1169d468aaf50d5541ef02cc88f3ede10 - [1/1] "92ba694cebc4fbbd0d9ccabc8604c71b23af1131" (1/1) yEnc @@ -244,8 +241,8 @@ class Sharing [ 'USER' => $this->siteSettings->hide_users ? 'ANON' : $row->username, 'TIME' => $row->unix_time, - 'SID' => $sid, - 'RID' => $row->nzb_guid, + 'SID' => $sid, + 'RID' => $row->nzb_guid, 'BODY' => $row->text, ] ), @@ -254,7 +251,6 @@ class Sharing // Check if we succesfully uploaded it. if ($success === true && $this->nntp->isError($success) === false) { - // Update DB to say we posted the article. DB::update( sprintf( @@ -310,8 +306,8 @@ class Sharing // Update first time seen. DB::update( - sprintf( - " + sprintf( + " UPDATE sharing_sites ss INNER JOIN (SELECT siteid, created_at @@ -322,8 +318,8 @@ class Sharing ON ss.site_guid = rc.siteid SET ss.first_time = rc.created_at WHERE ss.first_time IS NULL OR ss.first_time > rc.created_at" - ) - ); + ) + ); } /** @@ -383,7 +379,6 @@ class Sharing $found = $total = $currentArticle = 0; // Loop over NNTP headers until we find comments. foreach ($headers as $header) { - // Check if the article is missing. if (! isset($header['Number'])) { continue; @@ -401,7 +396,6 @@ class Sharing //(_nZEDb_)nZEDb_533f16e46a5091.73152965_3d12d7c1169d468aaf50d5541ef02cc88f3ede10 - [1/1] "92ba694cebc4fbbd0d9ccabc8604c71b23af1131" (1/1) yEnc if ($header['From'] === '' && preg_match('/^\(_nZEDb_\)(?P.+?)_(?P[a-f0-9]{40}) - \[1\/1\] "(?P[a-f0-9]{40})" yEnc \(1\/1\)$/i', $header['Subject'], $hits)) { - // Check if this is from our own site. if ($hits['guid'] === $this->siteSettings->site_guid) { continue; @@ -417,7 +411,6 @@ class Sharing // We don't have it, so insert it. if ($check === null) { - // Check if we have the site and if it is enabled. $check = DB::selectOne( sprintf( @@ -440,6 +433,7 @@ class Sharing escapeString($hits['guid']) ) ); + continue; } @@ -505,7 +499,6 @@ class Sharing * * @param string $messageID Message-ID for the article. * @param string $siteID id of the site. - * @return bool * * @throws \Exception */ diff --git a/Blacklight/SphinxSearch.php b/Blacklight/SphinxSearch.php index c08467eb4..669511ae6 100755 --- a/Blacklight/SphinxSearch.php +++ b/Blacklight/SphinxSearch.php @@ -16,14 +16,8 @@ use Illuminate\Support\Facades\DB; */ class SphinxSearch { - /** - * @var \Foolz\SphinxQL\SphinxQL - */ public SphinxQL $sphinxQL; - /** - * @var \Foolz\SphinxQL\Drivers\Pdo\Connection - */ protected Connection $connection; /** @@ -31,9 +25,6 @@ class SphinxSearch */ protected mixed $config; - /** - * @var \Foolz\SphinxQL\Helper - */ protected Helper $helper; /** @@ -59,7 +50,6 @@ class SphinxSearch /** * Insert release into Sphinx RT table. * - * @param array $parameters * * @throws \Foolz\SphinxQL\Exception\ConnectionException * @throws \Foolz\SphinxQL\Exception\DatabaseException @@ -79,7 +69,6 @@ class SphinxSearch /** * Insert release into Sphinx RT table. * - * @param array $parameters * * @throws \Foolz\SphinxQL\Exception\ConnectionException * @throws \Foolz\SphinxQL\Exception\DatabaseException @@ -131,7 +120,6 @@ class SphinxSearch /** * Update Sphinx Relases index for given releases_id. * - * @param int $releaseID * * @throws \Exception */ @@ -152,7 +140,6 @@ class SphinxSearch /** * Update Sphinx Predb index for given predb_id. * - * @param array $parameters * * @throws \Exception */ @@ -164,9 +151,6 @@ class SphinxSearch } /** - * @param array $indexes - * @return bool - * * @throws \Foolz\SphinxQL\Exception\ConnectionException * @throws \Foolz\SphinxQL\Exception\DatabaseException * @throws \Foolz\SphinxQL\Exception\SphinxQLException @@ -205,8 +189,6 @@ class SphinxSearch * @param string $rt_index (releases_rt or predb_rt) * @param string $searchString (what are we looking for?) * @param array $column (one or multiple columns from the columns that exist in indexes) - * @param array $searchArray - * @return array * * @throws \Foolz\SphinxQL\Exception\ConnectionException * @throws \Foolz\SphinxQL\Exception\DatabaseException diff --git a/Blacklight/Steam.php b/Blacklight/Steam.php index 8903e2e82..a413797fe 100755 --- a/Blacklight/Steam.php +++ b/Blacklight/Steam.php @@ -23,9 +23,6 @@ class Steam */ protected $steamGameID; - /** - * @var - */ protected $lastUpdate; /** @@ -41,7 +38,6 @@ class Steam /** * Steam constructor. * - * @param array $options * * @throws \Exception */ @@ -53,7 +49,7 @@ class Steam $this->steamFront = new Main( [ 'country_code' => 'us', - 'local_lang' => 'english', + 'local_lang' => 'english', ] ); @@ -72,16 +68,16 @@ class Steam if ($res !== false) { $result = [ - 'title' => $res->name, + 'title' => $res->name, 'description' => $res->description['short'] ?? null, - 'cover' => $res->images['header'] ?? null, - 'backdrop' => $res->images['background'] ?? null, - 'steamid' => $res->appid, - 'directurl' => Main::STEAM_STORE_ROOT.'app/'.$res->appid, - 'publisher' => $res->publishers, - 'rating' => $res->metacritic['score'] ?? null, + 'cover' => $res->images['header'] ?? null, + 'backdrop' => $res->images['background'] ?? null, + 'steamid' => $res->appid, + 'directurl' => Main::STEAM_STORE_ROOT.'app/'.$res->appid, + 'publisher' => $res->publishers, + 'rating' => $res->metacritic['score'] ?? null, 'releasedate' => $res->releasedate['date'] ?? null, - 'genres' => $res->genres !== null ? implode(',', array_column($res->genres, 'description')) : '', + 'genres' => $res->genres !== null ? implode(',', array_column($res->genres, 'description')) : '', ]; return $result; diff --git a/Blacklight/Tmux.php b/Blacklight/Tmux.php index ede49f56c..0805239be 100755 --- a/Blacklight/Tmux.php +++ b/Blacklight/Tmux.php @@ -17,9 +17,6 @@ class Tmux */ public \Closure|\PDO $pdo; - /** - * @var - */ public $tmux_session; /** @@ -37,7 +34,6 @@ class Tmux } /** - * @param $constants * @return mixed */ public function getConnectionsInfo($constants) @@ -55,11 +51,6 @@ class Tmux return $runVar['connections']; } - /** - * @param string $which - * @param $connections - * @return mixed - */ public function getUSPConnections(string $which, $connections): mixed { switch ($which) { @@ -93,10 +84,6 @@ class Tmux return $runVar['conncounts']; } - /** - * @param $constants - * @return array - */ public function getListOfPanes($constants): array { $panes = ['zero' => '', 'one' => '', 'two' => '']; @@ -121,9 +108,6 @@ class Tmux return $panes; } - /** - * @return string - */ public function getConstantSettings(): string { $settstr = 'SELECT value FROM settings WHERE setting ='; @@ -141,9 +125,6 @@ class Tmux return $sql; } - /** - * @return string - */ public function getMonitorSettings(): string { $settstr = 'SELECT value FROM settings WHERE setting ='; @@ -215,8 +196,6 @@ class Tmux } /** - * @param $setting - * @param $value * @return int */ public function updateItem($setting, $value) @@ -224,9 +203,6 @@ class Tmux return Settings::query()->where('setting', '=', $setting)->update(['value' => $value]); } - /** - * @return float - */ public function microtime_float(): float { [$usec, $sec] = explode(' ', microtime()); @@ -234,10 +210,6 @@ class Tmux return (float) $usec + (float) $sec; } - /** - * @param float $bytes - * @return string - */ public function decodeSize(float $bytes): string { $types = ['B', 'KB', 'MB', 'GB', 'TB']; @@ -253,10 +225,6 @@ class Tmux return round($bytes, 2).' '.$suffix; } - /** - * @param $pane - * @return string|null - */ public function writelog($pane): ?string { $path = NN_LOGS; @@ -270,11 +238,6 @@ class Tmux } /** - * @param $colors_start - * @param $colors_end - * @param $colors_exc - * @return int - * * @throws \Exception */ public function get_color($colors_start, $colors_end, $colors_exc): int @@ -298,9 +261,7 @@ class Tmux * Returns random bool, weighted by $chance. * * - * @param $loop * @param int $chance - * @return bool * * @throws \Exception */ @@ -314,19 +275,11 @@ class Tmux return random_int(1, 100) <= $chance; } - /** - * @param $_time - * @return string - */ public function relativeTime($_time): string { return Carbon::createFromTimestamp($_time)->ago(); } - /** - * @param $cmd - * @return bool - */ public function command_exist($cmd): bool { $returnVal = shell_exec("which $cmd 2>/dev/null"); @@ -335,12 +288,9 @@ class Tmux } /** - * @param $qry - * @param $bookreqids * @param string $db_name * @param string $ppmax * @param string $ppmin - * @return bool|string * * @throws \Exception */ @@ -463,8 +413,6 @@ class Tmux } /** - * @return bool - * * @throws \Exception */ public function stopIfRunning(): bool @@ -492,9 +440,6 @@ class Tmux } } - /** - * @return array - */ public function cbpmTableQuery(): array { return DB::select( diff --git a/Blacklight/TmuxOutput.php b/Blacklight/TmuxOutput.php index 0fbe2224a..f58a8a4f8 100755 --- a/Blacklight/TmuxOutput.php +++ b/Blacklight/TmuxOutput.php @@ -2,7 +2,7 @@ namespace Blacklight; -use App\Extensions\util\Git; +use Illuminate\Support\Facades\Process; /** * Tmux output functions for printing monitor data. @@ -12,19 +12,11 @@ use App\Extensions\util\Git; */ class TmuxOutput extends Tmux { - /** - * @var - */ + protected $_colourMasks; - /** - * @var - */ private $runVar; - /** - * @var - */ private $tmpMasks; /** @@ -39,10 +31,6 @@ class TmuxOutput extends Tmux $this->_setColourMasks(); } - /** - * @param $runVar - * @return void - */ public function updateMonitorPane(&$runVar): void { $this->runVar = $runVar; @@ -63,9 +51,6 @@ class TmuxOutput extends Tmux echo $buffer; } - /** - * @return string - */ protected function _getBackfill(): string { $buffer = sprintf($this->tmpMasks[3], 'Groups', 'Active', 'Backfill'); @@ -106,10 +91,6 @@ class TmuxOutput extends Tmux return $buffer; } - /** - * @param $compressed - * @return array - */ protected function _getFormatMasks($compressed): array { $index = ((int) $compressed === 1 ? '2.1' : '2.0'); @@ -125,15 +106,13 @@ class TmuxOutput extends Tmux /** * @return string - * - * @throws \CzProject\GitPhp\GitException */ protected function _getHeader(): string { $buffer = ''; $state = ((int) $this->runVar['settings']['is_running'] === 1) ? 'Running' : 'Disabled'; - $version = (new Git())->tagLatest(); - $branch = (new Git())->getBranch(); + $version = Process::run('git describe --tags')->output(); + $branch = Process::run('git branch')->output(); $buffer .= sprintf( $this->tmpMasks[2], @@ -222,9 +201,6 @@ class TmuxOutput extends Tmux return $buffer.PHP_EOL; } - /** - * @return string - */ protected function _getMonitor(): string { $buffer = $this->_getTableCounts(); @@ -417,9 +393,6 @@ class TmuxOutput extends Tmux return $buffer; } - /** - * @return string - */ protected function _getPaths(): string { $buffer = ''; @@ -473,9 +446,6 @@ class TmuxOutput extends Tmux return $buffer.PHP_EOL; } - /** - * @return string - */ protected function _getQueries(): string { $buffer = PHP_EOL; @@ -523,9 +493,6 @@ class TmuxOutput extends Tmux return $buffer; } - /** - * @return string - */ protected function _getSeparator(): string { return sprintf( @@ -536,9 +503,6 @@ class TmuxOutput extends Tmux ); } - /** - * @return string - */ protected function _getTableCounts(): string { $buffer = sprintf($this->tmpMasks[3], 'Collections', 'Binaries', 'Parts'); diff --git a/Blacklight/TmuxRun.php b/Blacklight/TmuxRun.php index d1ebeccc1..6ab84653a 100755 --- a/Blacklight/TmuxRun.php +++ b/Blacklight/TmuxRun.php @@ -35,8 +35,6 @@ class TmuxRun extends Tmux * Main switch for running tmux panes. * * - * @param $cmdParam - * @param $runVar * * @throws \Exception */ @@ -127,8 +125,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runDehash(&$runVar): void @@ -167,8 +163,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runFixReleaseNames(&$runVar): void @@ -201,27 +195,25 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runAmazon(&$runVar): void { switch (true) { case (int) $runVar['settings']['post_amazon'] === 1 && - ( - (int) $runVar['counts']['now']['processmusic'] > 0 || - (int) $runVar['counts']['now']['processbooks'] > 0 || - (int) $runVar['counts']['now']['processconsole'] > 0 || - (int) $runVar['counts']['now']['processgames'] > 0 || - (int) $runVar['counts']['now']['processxxx'] > 0 - ) && - ( + ( + (int) $runVar['counts']['now']['processmusic'] > 0 || + (int) $runVar['counts']['now']['processbooks'] > 0 || + (int) $runVar['counts']['now']['processconsole'] > 0 || + (int) $runVar['counts']['now']['processgames'] > 0 || + (int) $runVar['counts']['now']['processxxx'] > 0 + ) && + ( (int) $runVar['settings']['processbooks'] === 1 || (int) $runVar['settings']['processmusic'] === 1 || (int) $runVar['settings']['processgames'] === 1 || (int) $runVar['settings']['processxxx'] === 1 - ): + ): $log = $this->writelog($runVar['panes']['two'][2]); shell_exec( @@ -230,15 +222,15 @@ class TmuxRun extends Tmux ); break; case (int) $runVar['settings']['post_amazon'] === 1 && (int) $runVar['settings']['processbooks'] === 0 - && (int) $runVar['settings']['processmusic'] === 0 && (int) $runVar['settings']['processgames'] === 0 - && (int) $runVar['settings']['processxxx'] === 0: + && (int) $runVar['settings']['processmusic'] === 0 && (int) $runVar['settings']['processgames'] === 0 + && (int) $runVar['settings']['processxxx'] === 0: $color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.2 \ 'echo \"\033[38;5;${color}m\n{$runVar['panes']['two'][2]} has been disabled/terminated in Admin Disable Music/Books/Console/XXX\"'"); break; case (int) $runVar['settings']['post_amazon'] === 1 && (int) $runVar['counts']['now']['processmusic'] === 0 && - (int) $runVar['counts']['now']['processbooks'] === 0 && (int) $runVar['counts']['now']['processconsole'] === 0 && (int) $runVar['counts']['now']['processgames'] === 0 && (int) $runVar['counts']['now']['processxxx'] === 0: + (int) $runVar['counts']['now']['processbooks'] === 0 && (int) $runVar['counts']['now']['processconsole'] === 0 && (int) $runVar['counts']['now']['processgames'] === 0 && (int) $runVar['counts']['now']['processxxx'] === 0: $color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); shell_exec("tmux respawnp -k -t{$runVar['constants']['tmux_session']}:2.2 \ 'echo \"\033[38;5;${color}m\n{$runVar['panes']['two'][2]} has been disabled/terminated by No Music/Books/Console/Games/XXX to process\"'"); @@ -251,8 +243,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runAmazonFull(&$runVar): void @@ -261,10 +251,10 @@ class TmuxRun extends Tmux case ((int) $runVar['settings']['post_amazon'] === 1) && (((int) $runVar['counts']['now']['processmusic'] > 0) || ((int) $runVar['counts']['now']['processbooks'] > 0) || ((int) $runVar['counts']['now']['processconsole'] > 0) || ((int) $runVar['counts']['now']['processgames'] > 0) || ((int) $runVar['counts']['now']['processxxx'] > 0)) - && (((int) $runVar['settings']['processbooks'] !== 0) || ((int) $runVar['settings']['processconsole'] !== 0) - || ((int) $runVar['settings']['processmusic'] !== 0) || + && (((int) $runVar['settings']['processbooks'] !== 0) || ((int) $runVar['settings']['processconsole'] !== 0) + || ((int) $runVar['settings']['processmusic'] !== 0) || ((int) $runVar['settings']['processgames'] !== 0) - || ((int) $runVar['settings']['processxxx'] !== 0)): + || ((int) $runVar['settings']['processxxx'] !== 0)): $log = $this->writelog($runVar['panes']['one'][1]); shell_exec( @@ -274,8 +264,8 @@ class TmuxRun extends Tmux ); break; case ((int) $runVar['settings']['post_amazon'] === 1) && ((int) $runVar['settings']['processbooks'] === 0) - && ((int) $runVar['counts']['now']['processconsole'] === 0) && ((int) $runVar['settings']['processmusic'] === 0) - && ((int) $runVar['settings']['processgames'] === 0): + && ((int) $runVar['counts']['now']['processconsole'] === 0) && ((int) $runVar['settings']['processmusic'] === 0) + && ((int) $runVar['settings']['processgames'] === 0): $color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); shell_exec( @@ -284,8 +274,8 @@ class TmuxRun extends Tmux ); break; case ((int) $runVar['settings']['post_amazon'] === 1) && ((int) $runVar['counts']['now']['processmusic'] === 0) - && ((int) $runVar['counts']['now']['processbooks'] === 0) && ((int) $runVar['counts']['now']['processconsole'] === 0) - && ((int) $runVar['counts']['now']['processgames'] === 0) && ((int) $runVar['counts']['now']['processxxx'] === 0): + && ((int) $runVar['counts']['now']['processbooks'] === 0) && ((int) $runVar['counts']['now']['processconsole'] === 0) + && ((int) $runVar['counts']['now']['processgames'] === 0) && ((int) $runVar['counts']['now']['processxxx'] === 0): $color = $this->get_color($runVar['settings']['colors_start'], $runVar['settings']['colors_end'], $runVar['settings']['colors_exc']); shell_exec( @@ -303,8 +293,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runNonAmazon(&$runVar): void @@ -334,8 +322,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runNonUpdateBinaries(&$runVar): void @@ -358,8 +344,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runNonBackfill(&$runVar): void @@ -387,8 +371,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runNonUpdateReleases(&$runVar): void @@ -407,8 +389,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runNZBImport(&$runVar): void @@ -444,7 +424,6 @@ class TmuxRun extends Tmux * Run postprocess_releases additional. * * - * @param $runVar * * @throws \Exception */ @@ -491,14 +470,11 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runRemoveCrap(&$runVar): void { switch ($runVar['settings']['fix_crap_opt']) { - // Do all types up to 2 hours. case 'All': $log = $this->writelog($runVar['panes']['one'][1]); @@ -508,7 +484,7 @@ class TmuxRun extends Tmux date +\"{$this->_dateFormat}\"; {$runVar['commands']['_sleep']} {$runVar['settings']['crap_timer']}' 2>&1 1> /dev/null" ); break; - // The user has specified custom types. + // The user has specified custom types. case 'Custom': $log = $this->writelog($runVar['panes']['one'][1]); @@ -517,7 +493,6 @@ class TmuxRun extends Tmux // Make sure the user actually selected some. if ($runVar['modsettings']['fc']['max'] > 0) { - // If this is the first run, do a full run, else run on last 2 hours of releases. $runVar['modsettings']['fc']['time'] = '4'; if (($runVar['counts']['iterations'] == 1) || $runVar['modsettings']['fc']['firstrun']) { @@ -526,7 +501,6 @@ class TmuxRun extends Tmux //Check to see if the pane is dead, if so respawn it. if (shell_exec("tmux list-panes -t{$runVar['constants']['tmux_session']}:1 | grep ^1 | grep -c dead") == 1) { - // Run remove crap releases. shell_exec( "tmux respawnp -t{$runVar['constants']['tmux_session']}:1.1 ' \ @@ -556,8 +530,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runUpdateTv(&$runVar): void @@ -568,8 +540,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runUpdateTvFull(&$runVar): void @@ -580,8 +550,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runMainNon(&$runVar): void @@ -592,8 +560,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _runMainBasic(&$runVar): void @@ -655,8 +621,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _notRunningNon(&$runVar): void @@ -674,8 +638,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _notRunningBasic(&$runVar): void @@ -693,8 +655,6 @@ class TmuxRun extends Tmux } /** - * @param $runVar - * * @throws \Exception */ protected function _notRunningFull(&$runVar): void @@ -708,10 +668,6 @@ class TmuxRun extends Tmux } } - /** - * @param $pane - * @param $runVar - */ protected function _runIRCScraper($pane, &$runVar): void { if ((int) $runVar['constants']['run_ircscraper'] === 1) { @@ -727,10 +683,6 @@ class TmuxRun extends Tmux } } - /** - * @param $pane - * @param $runVar - */ protected function _runSharing($pane, &$runVar): void { $sharing = (array) Arr::first(DB::select('SELECT enabled, posting, fetching FROM sharing')); diff --git a/Blacklight/XXX.php b/Blacklight/XXX.php index f2ab0c3dd..cb8190dda 100755 --- a/Blacklight/XXX.php +++ b/Blacklight/XXX.php @@ -22,26 +22,16 @@ class XXX { /** * What scraper class did we use -- used for template and trailer information. - * - * @var string */ protected string $whichClass = ''; /** * Current title being passed through various sites/api's. - * - * @var string */ protected string $currentTitle = ''; - /** - * @var bool - */ protected bool $echoOutput; - /** - * @var string - */ protected string $imgSavePath; /** @@ -49,19 +39,10 @@ class XXX */ protected ReleaseImage $releaseImage; - /** - * @var int|null|string - */ protected string|int|null $movieQty; - /** - * @var string - */ protected string $showPasswords; - /** - * @var string - */ protected string $cookie; /** @@ -77,9 +58,9 @@ class XXX public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, + 'Echo' => false, 'ReleaseImage' => null, - 'Settings' => null, + 'Settings' => null, ]; $options += $defaults; $this->releaseImage = ($options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage()); @@ -95,7 +76,6 @@ class XXX /** * Get info for a xxx id. * - * @param $xxxid * @return \Illuminate\Database\Query\Builder|static */ public function getXXXInfo($xxxid) @@ -106,14 +86,7 @@ class XXX /** * Get XXX releases with covers for xxx browse page. * - * @param $page - * @param $cat - * @param $start - * @param $num - * @param $orderBy * @param int $maxAge - * @param array $excludedCats - * @return array */ public function getXXXRange($page, $cat, $start, $num, $orderBy, $maxAge = -1, array $excludedCats = []): array { @@ -141,9 +114,9 @@ class XXX $this->getBrowseBy(), $catSrch, ( - $maxAge > 0 - ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY ' - : '' + $maxAge > 0 + ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY ' + : '' ), (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), $order[0], @@ -204,9 +177,9 @@ class XXX $this->getBrowseBy(), $catSrch, ( - $maxAge > 0 - ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY ' - : '' + $maxAge > 0 + ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY ' + : '' ), (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), $order[0], @@ -227,9 +200,6 @@ class XXX /** * Get the order type the user requested on the xxx page. - * - * @param $orderBy - * @return array */ protected function getXXXOrder($orderBy): array { @@ -244,17 +214,12 @@ class XXX /** * Order types for xxx page. - * - * @return array */ public function getXXXOrdering(): array { return ['title_asc', 'title_desc', 'name_asc', 'name_desc', 'size_asc', 'size_desc', 'posted_asc', 'posted_desc', 'cat_asc', 'cat_desc']; } - /** - * @return string - */ protected function getBrowseBy(): string { $browseBy = ' '; @@ -277,21 +242,6 @@ class XXX /** * Update XXX Information from getXXXCovers.php in misc/testing/PostProc. - * - * @param string $id - * @param string $title - * @param string $tagLine - * @param string $plot - * @param string $genre - * @param string $director - * @param string $actors - * @param string $extras - * @param string $productInfo - * @param string $trailers - * @param string $directUrl - * @param string $classUsed - * @param string $cover - * @param string $backdrop */ public function update( string $id = '', @@ -320,7 +270,7 @@ class XXX 'actors' => $actors, 'extras' => $extras, 'productinfo' => $productInfo, - 'trailers'=> $trailers, + 'trailers' => $trailers, 'directurl' => $directUrl, 'classused' => $classUsed, 'cover' => empty($cover) ? 0 : $cover, @@ -332,10 +282,6 @@ class XXX /** * Get all genres for search-filter.tpl. - * - * - * @param bool $activeOnly - * @return array */ public function getAllGenres(bool $activeOnly = false): array { @@ -350,9 +296,7 @@ class XXX } /** - * @param bool $activeOnly * @param null $gid - * @return mixed */ public function getGenres(bool $activeOnly = false, $gid = null): mixed { @@ -400,10 +344,6 @@ class XXX /** * Inserts Genre and returns last affected row (Genre ID). - * - * - * @param $genre - * @return int|string */ private function insertGenre($genre): int|string { @@ -417,10 +357,6 @@ class XXX /** * Inserts Trailer Code by Class. - * - * @param $whichClass - * @param $res - * @return string */ public function insertSwf($whichClass, $res): string { @@ -446,7 +382,6 @@ class XXX } /** - * @param $movie * @return false|int|string * * @throws \Exception @@ -515,19 +450,19 @@ class XXX $res['genres'] = ! empty($res['genres']) ? $this->getGenreID($res['genres']) : ''; $mov = [ - 'trailers' => ! empty($res['trailers']) ? serialize($res['trailers']) : '', - 'extras' => ! empty($res['extras']) ? serialize($res['extras']) : '', + 'trailers' => ! empty($res['trailers']) ? serialize($res['trailers']) : '', + 'extras' => ! empty($res['extras']) ? serialize($res['extras']) : '', 'productinfo' => ! empty($res['productinfo']) ? serialize($res['productinfo']) : '', - 'backdrop' => ! empty($res['backcover']) ? $res['backcover'] : 0, - 'cover' => ! empty($res['boxcover']) ? $res['boxcover'] : 0, - 'title' => ! empty($res['title']) ? html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8') : '', - 'plot' => ! empty($res['synopsis']) ? html_entity_decode($res['synopsis'], ENT_QUOTES, 'UTF-8') : '', - 'tagline' => ! empty($res['tagline']) ? html_entity_decode($res['tagline'], ENT_QUOTES, 'UTF-8') : '', - 'genre' => ! empty($res['genres']) ? html_entity_decode($res['genres'], ENT_QUOTES, 'UTF-8') : '', - 'director' => ! empty($res['director']) ? html_entity_decode($res['director'], ENT_QUOTES, 'UTF-8') : '', - 'actors' => ! empty($res['cast']) ? html_entity_decode($res['cast'], ENT_QUOTES, 'UTF-8') : '', - 'directurl' => ! empty($res['directurl']) ? html_entity_decode($res['directurl'], ENT_QUOTES, 'UTF-8') : '', - 'classused' => $this->whichClass, + 'backdrop' => ! empty($res['backcover']) ? $res['backcover'] : 0, + 'cover' => ! empty($res['boxcover']) ? $res['boxcover'] : 0, + 'title' => ! empty($res['title']) ? html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8') : '', + 'plot' => ! empty($res['synopsis']) ? html_entity_decode($res['synopsis'], ENT_QUOTES, 'UTF-8') : '', + 'tagline' => ! empty($res['tagline']) ? html_entity_decode($res['tagline'], ENT_QUOTES, 'UTF-8') : '', + 'genre' => ! empty($res['genres']) ? html_entity_decode($res['genres'], ENT_QUOTES, 'UTF-8') : '', + 'director' => ! empty($res['director']) ? html_entity_decode($res['director'], ENT_QUOTES, 'UTF-8') : '', + 'actors' => ! empty($res['cast']) ? html_entity_decode($res['cast'], ENT_QUOTES, 'UTF-8') : '', + 'directurl' => ! empty($res['directurl']) ? html_entity_decode($res['directurl'], ENT_QUOTES, 'UTF-8') : '', + 'classused' => $this->whichClass, ]; $check = XxxInfo::query()->where('title', $mov['title'])->first(['id']); @@ -599,16 +534,16 @@ class XXX ->where(['nzbstatus' => 1, 'xxxinfo_id' => 0]) ->whereIn( 'categories_id', - [ - Category::XXX_DVD, - Category::XXX_WMV, - Category::XXX_XVID, - Category::XXX_X264, - Category::XXX_SD, - Category::XXX_CLIPHD, - Category::XXX_CLIPSD, - Category::XXX_WEBDL, - ] + [ + Category::XXX_DVD, + Category::XXX_WMV, + Category::XXX_XVID, + Category::XXX_X264, + Category::XXX_SD, + Category::XXX_CLIPHD, + Category::XXX_CLIPSD, + Category::XXX_WEBDL, + ] ) ->limit($this->movieQty) ->get(['searchname', 'id']); @@ -654,7 +589,6 @@ class XXX /** * Checks xxxinfo to make sure releases exist. * - * @param $releaseName * @return \Illuminate\Database\Eloquent\Model|null|static */ protected function checkXXXInfoExists($releaseName) @@ -664,9 +598,6 @@ class XXX /** * Cleans up a searchname to make it easier to scrape. - * - * @param string $releaseName - * @return bool */ protected function parseXXXSearchName(string $releaseName): bool { @@ -679,7 +610,6 @@ class XXX // Check if we got something. if ($name !== '') { - // If we still have any of the words in $followingList, remove them. $name = preg_replace('/'.$followingList.'/i', ' ', $name); // Remove periods, underscored, anything between parenthesis. diff --git a/Blacklight/db/PreDb.php b/Blacklight/db/PreDb.php index 7a9a73b83..5613c4038 100755 --- a/Blacklight/db/PreDb.php +++ b/Blacklight/db/PreDb.php @@ -31,14 +31,14 @@ class PreDb * @var array Prepared Statement objects */ protected $ps = [ - 'AddGroups' => null, - 'DeleteShort' => null, - 'Export' => null, - 'Import' => null, - 'Insert' => null, - 'LoadData' => null, - 'Truncate' => null, - 'UpdateGroupID' => null, + 'AddGroups' => null, + 'DeleteShort' => null, + 'Export' => null, + 'Import' => null, + 'Insert' => null, + 'LoadData' => null, + 'Truncate' => null, + 'UpdateGroupID' => null, ]; /** @@ -96,12 +96,12 @@ class PreDb public function executeExport(array $options = null) { $defaults = [ - 'enclosedby' => '', - 'fields' => '\t', - 'limit' => 0, - 'lines' => '\r\n', // use Windows style endings so that text can contain \n - 'local' => false, - 'path' => null, + 'enclosedby' => '', + 'fields' => '\t', + 'limit' => 0, + 'lines' => '\r\n', // use Windows style endings so that text can contain \n + 'local' => false, + 'path' => null, ]; $options += $defaults; @@ -141,13 +141,12 @@ SQL_EXPORT; } /** - * @param array|null $options * @return null */ public function executeLoadData(array $options = null) { $defaults = [ - 'path' => null, + 'path' => null, ]; $options += $defaults; @@ -188,7 +187,6 @@ SQL_EXPORT; } /** - * @param $filespec * @param bool $localDB */ public function import($filespec, $localDB = false) @@ -212,7 +210,6 @@ SQL_EXPORT; /** * @param null $settings - * @param array $options * @return mixed|null * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException @@ -220,8 +217,8 @@ SQL_EXPORT; public function progress($settings = null, array $options = []) { $defaults = [ - 'path' => base_path().'/cli/data/predb_progress.txt', - 'read' => true, + 'path' => base_path().'/cli/data/predb_progress.txt', + 'read' => true, ]; $options += $defaults; @@ -254,7 +251,6 @@ SQL_EXPORT; } /** - * @param $sql * @param string $index */ protected function prepareSQLStatement($sql, $index): void @@ -303,18 +299,15 @@ SQL_INSERT; $this->prepareSQLStatement($sql, 'Insert'); } - /** - * @param array $options - */ protected function prepareSQLLoadData(array $options = []): void { $enclosedby = ''; $defaults = [ - 'enclosedby' => "'", - 'fields' => '\t', - 'lines' => '\r\n', // Windows' style EOL to allow \n to be used in text. - 'local' => true, - 'optional' => true, + 'enclosedby' => "'", + 'fields' => '\t', + 'lines' => '\r\n', // Windows' style EOL to allow \n to be used in text. + 'local' => true, + 'optional' => true, ]; $options += $defaults; diff --git a/Blacklight/db/populate/AniDB.php b/Blacklight/db/populate/AniDB.php index 3ea6e5160..a4bdb6c2f 100755 --- a/Blacklight/db/populate/AniDB.php +++ b/Blacklight/db/populate/AniDB.php @@ -16,49 +16,34 @@ class AniDB /** * Whether or not to echo message output. - * - * @var bool */ public bool $echooutput; /** * The directory to store AniDB covers. - * - * @var string */ public string $imgSavePath; /** * The name of the nZEDb client for AniDB lookups. - * - * @var string */ private string $apiKey; /** * Whether or not AniDB thinks our client is banned. - * - * @var bool */ private bool $banned; /** * The last unixtime a full AniDB update was run. - * - * @var string */ private string $lastUpdate; /** * The number of days between full AniDB updates. - * - * @var string */ private string $updateInterval; - /** - * @var \Blacklight\ColorCLI - */ protected ColorCLI $colorCli; /** @@ -69,7 +54,7 @@ class AniDB public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, + 'Echo' => false, 'Settings' => null, ]; $options += $defaults; @@ -91,8 +76,6 @@ class AniDB /** * Main switch that initiates AniDB table population. * - * @param string $type - * @param int|string $aniDbId * * @throws \Exception */ @@ -109,7 +92,6 @@ class AniDB } /** - * @param $aniDbId * @return array|false * * @throws \Exception @@ -176,10 +158,10 @@ class AniDB } $AniDBAPIArray += [ - 'type' => isset($AniDBAPIXML->type[0]) ? (string) $AniDBAPIXML->type : '', + 'type' => isset($AniDBAPIXML->type[0]) ? (string) $AniDBAPIXML->type : '', 'description' => isset($AniDBAPIXML->description) ? (string) $AniDBAPIXML->description : '', - 'picture' => isset($AniDBAPIXML->picture[0]) ? (string) $AniDBAPIXML->picture : '', - 'epsarr' => $episodeArray, + 'picture' => isset($AniDBAPIXML->picture[0]) ? (string) $AniDBAPIXML->picture : '', + 'epsarr' => $episodeArray, ]; return $AniDBAPIArray; @@ -188,12 +170,6 @@ class AniDB return false; } - /** - * @param \SimpleXMLElement $element - * @param string|null $property - * @param bool $children - * @return string - */ private function processAPIResponseElement(\SimpleXMLElement $element, string $property = null, bool $children = false): string { $property = $property ?? 'name'; @@ -211,9 +187,6 @@ class AniDB /** * Requests and returns the API data from AniDB. - * - * @param $aniDbId - * @return string */ private function getAniDbResponse($aniDbId): string { @@ -228,9 +201,9 @@ class AniDB $curlOpts = [ CURLOPT_RETURNTRANSFER => 1, - CURLOPT_HEADER => 0, - CURLOPT_FAILONERROR => 1, - CURLOPT_ENCODING => 'gzip', + CURLOPT_HEADER => 0, + CURLOPT_FAILONERROR => 1, + CURLOPT_ENCODING => 'gzip', ]; curl_setopt_array($ch, $curlOpts); @@ -259,11 +232,6 @@ class AniDB } } - /** - * @param array $AniDBInfoArray - * @param $aniDbId - * @return string - */ private function insertAniDBInfoEps($aniDbId, array $AniDBInfoArray = []): string { AnidbInfo::query() @@ -291,11 +259,6 @@ class AniDB return $AniDBInfoArray['picture']; } - /** - * @param $aniDbId - * @param array $episodeArr - * @return void - */ private function insertAniDBEpisodes($aniDbId, array $episodeArr = []): void { if (! empty($episodeArr)) { @@ -369,8 +332,8 @@ class AniDB } } else { $this->colorCli->info( - 'AniDB has been updated within the past '.$this->updateInterval.' days. '. - 'Either set this value lower in Site Edit (at your own risk of being banned) or try again later.' + 'AniDB has been updated within the past '.$this->updateInterval.' days. '. + 'Either set this value lower in Site Edit (at your own risk of being banned) or try again later.' ); } } @@ -378,7 +341,6 @@ class AniDB /** * Directs flow for populating the AniDB Info/Episodes table. * - * @param string $aniDbId * * @throws \Exception */ @@ -396,15 +358,15 @@ class AniDB if ($this->banned) { $this->colorCli->error( - 'AniDB Banned, import will fail, please wait 24 hours before retrying.' - ); + 'AniDB Banned, import will fail, please wait 24 hours before retrying.' + ); exit; } if ($AniDBAPIArray === false && $this->echooutput) { $this->colorCli->info( - 'Anime ID: '.$anidb['anidbid'].' not available for update yet.' - ); + 'Anime ID: '.$anidb['anidbid'].' not available for update yet.' + ); } else { $this->updateAniChildTables($anidb['anidbid'], $AniDBAPIArray); } @@ -415,15 +377,15 @@ class AniDB if ($this->banned) { $this->colorCli->error( - 'AniDB Banned, import will fail, please wait 24 hours before retrying.' - ); + 'AniDB Banned, import will fail, please wait 24 hours before retrying.' + ); exit; } if ($AniDBAPIArray === false && $this->echooutput) { $this->colorCli->info( - 'Anime ID: '.$aniDbId.' not available for update yet.' - ); + 'Anime ID: '.$aniDbId.' not available for update yet.' + ); } else { $this->updateAniChildTables($aniDbId, $AniDBAPIArray); } @@ -438,11 +400,6 @@ class AniDB Settings::query()->where(['section' => 'APIs', 'subsection' => 'AniDB', 'name' => 'last_full_update'])->update(['value' => time()]); } - /** - * @param $aniDbId - * @param array $AniDBInfoArray - * @return string - */ private function updateAniDBInfoEps($aniDbId, array $AniDBInfoArray = []): string { AnidbInfo::query() @@ -470,11 +427,6 @@ class AniDB return $AniDBInfoArray['picture']; } - /** - * @param $aniDbId - * @param array $AniDBInfoArray - * @return void - */ private function updateAniChildTables($aniDbId, array $AniDBInfoArray = []): void { $check = AnidbInfo::query()->where('anidbid', $aniDbId)->first(['anidbid']); diff --git a/Blacklight/libraries/FanartTV.php b/Blacklight/libraries/FanartTV.php index 5e597139b..d51cebf5f 100644 --- a/Blacklight/libraries/FanartTV.php +++ b/Blacklight/libraries/FanartTV.php @@ -8,7 +8,9 @@ * @author DariusIII * @copyright 2013 confact * @copyright 2017 NNTmux + * * @date 2017-04-12 + * * @release <0.0.2> */ @@ -28,8 +30,6 @@ class FanartTV /** * The constructor setting the config variables. - * - * @param $apiKey */ public function __construct($apiKey) { diff --git a/Blacklight/libraries/Forking.php b/Blacklight/libraries/Forking.php index d82564f5f..5c954b52d 100755 --- a/Blacklight/libraries/Forking.php +++ b/Blacklight/libraries/Forking.php @@ -12,10 +12,10 @@ use Blacklight\processing\PostProcess; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Process; use Opis\Closure\SerializableClosure; use Spatie\Async\Output\SerializableException; use Spatie\Async\Pool; -use Illuminate\Support\Facades\Process; /** * Class Forking. @@ -27,9 +27,6 @@ use Illuminate\Support\Facades\Process; */ class Forking { - /** - * @var \Blacklight\ColorCLI - */ public ColorCLI $colorCli; /** @@ -39,75 +36,47 @@ class Forking /** * Path to do not run folder. - * - * @var string */ private string $dnr_path; /** * Work to work on. - * - * @var array */ private array $work = []; /** * How much work do we have to do? - * - * @var int */ public int $_workCount = 0; /** * The type of work we want to work on. - * - * @var string */ private string $workType = ''; /** * List of passed in options for the current work type. - * - * @var array */ private array $workTypeOptions = []; /** * Max amount of child processes to do work at a time. - * - * @var int */ private int $maxProcesses = 1; /** * Group used for safe backfill. - * - * @var string */ private string $safeBackfillGroup = ''; - /** - * @var int - */ + protected int $maxSize; - /** - * @var int - */ protected int $minSize; - /** - * @var int - */ protected int $maxRetries; - /** - * @var int - */ protected int $dummy; - /** - * @var bool - */ private bool $processAdditional = false; // Should we process additional? private bool $processNFO = false; // Should we process NFOs? @@ -171,8 +140,6 @@ class Forking /** * Only post process renamed movie / tv releases? - * - * @var bool */ private bool $ppRenamedOnly; @@ -186,7 +153,6 @@ class Forking $this->maxProcesses = 0; switch ($this->workType) { - case 'backfill': $this->backfill(); break; @@ -322,9 +288,6 @@ class Forking $pool->wait(); } - /** - * @return void - */ private function safeBackfill(): void { $backfill_qty = (int) Settings::settingValue('site.tmux.backfill_qty'); @@ -648,10 +611,6 @@ class Forking /** * Only 1 exit method is used for post process, since they are all similar. - * - * - * @param array $releases - * @param int $maxProcess */ public function postProcess(array $releases, int $maxProcess): void { @@ -729,15 +688,11 @@ class Forking $this->postProcess($this->work, $this->maxProcesses); } - /** - * @var string - */ private string $nfoQueryString = ''; /** * Check if we should process NFO's. * - * @return bool * * @throws \Exception */ @@ -778,8 +733,6 @@ class Forking } /** - * @return bool - * * @throws \Exception */ private function checkProcessMovies(): bool @@ -832,7 +785,6 @@ class Forking /** * Check if we should process TV's. * - * @return bool * * @throws \Exception */ @@ -888,7 +840,6 @@ class Forking /** * Process sharing. * - * @return bool * * @throws \Exception */ @@ -959,10 +910,6 @@ class Forking //////////////////////////////////////////// Various methods /////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * @param string $command - * @return void - */ protected function _executeCommand(string $command): void { Process::timeout(config('nntmux.multiprocessing_max_child_time'))->run($command, function (string $type, string $output) { @@ -972,8 +919,6 @@ class Forking /** * Echo a message to CLI. - * - * @param string $message */ public function logger(string $message): void { diff --git a/Blacklight/libraries/ForkingImportNZB.php b/Blacklight/libraries/ForkingImportNZB.php index 4fe5a6d5b..8b4940b0b 100755 --- a/Blacklight/libraries/ForkingImportNZB.php +++ b/Blacklight/libraries/ForkingImportNZB.php @@ -16,24 +16,12 @@ class ForkingImportNZB extends Forking */ private $importPath; - /** - * @var - */ private $deleteComplete; - /** - * @var - */ private $deleteFailed; - /** - * @var - */ private $useFileName; - /** - * @var - */ private $maxPerProcess; /** @@ -47,14 +35,6 @@ class ForkingImportNZB extends Forking $this->importPath = PHP_BINARY.' misc/testing/nzb-import.php '; } - /** - * @param $folder - * @param $maxProcesses - * @param $deleteComplete - * @param $deleteFailed - * @param $useFileName - * @param $maxPerProcess - */ public function start($folder, $maxProcesses, $deleteComplete, $deleteFailed, $useFileName, $maxPerProcess): void { $startTime = now()->timestamp; @@ -102,7 +82,7 @@ class ForkingImportNZB extends Forking $this->colorCli->header( 'Multi-processing for import finished in '.(now()->timestamp - $startTime). ' seconds at '.now()->toRfc2822String().'.'.PHP_EOL - ); + ); } } } diff --git a/Blacklight/libraries/Geary.php b/Blacklight/libraries/Geary.php index 2a28355e9..d0822c917 100644 --- a/Blacklight/libraries/Geary.php +++ b/Blacklight/libraries/Geary.php @@ -37,9 +37,11 @@ if (! \function_exists('getAllHeaders')) { class Geary { public const CONNECT_TIMEOUT = 60; + public const API_URL = 'https://gateway.gear.mycelium.com'; private $gateway_id; + private $gateway_secret; /** @@ -62,8 +64,6 @@ class Geary * have previously set for the gateway. If the * gateway currency is BTC, then the amount is * normally in satoshis - * @param $keychain_id - * @param $callback_data * @return mixed */ public function create_order($amount, $keychain_id, $callback_data) @@ -152,14 +152,14 @@ class Geary if ($signature === $header_signature) { return [ - 'order_id' => $_GET['order_id'], - 'amount' => $_GET['amount'], - 'amount_in_btc' => $_GET['amount_in_btc'], - 'amount_paid_in_btc' => $_GET['amount_paid_in_btc'], - 'status' => $_GET['status'], - 'address' => $_GET['address'], - 'transaction_ids' => $_GET['transaction_ids'], - 'callback_data' => $_GET['callback_data'], + 'order_id' => $_GET['order_id'], + 'amount' => $_GET['amount'], + 'amount_in_btc' => $_GET['amount_in_btc'], + 'amount_paid_in_btc' => $_GET['amount_paid_in_btc'], + 'status' => $_GET['status'], + 'address' => $_GET['address'], + 'transaction_ids' => $_GET['transaction_ids'], + 'callback_data' => $_GET['callback_data'], ]; } @@ -172,7 +172,6 @@ class Geary * Get an order link for status monitoring via websocket * * @param int $id Id is an existing order ID - * @return string */ public function order_websocket_link($id): string { @@ -203,9 +202,6 @@ class Geary *Curl Error. * * Output curl error if possible - * - * @param $ch - * @return bool */ private function curl_error($ch): bool { @@ -225,7 +221,6 @@ class Geary * Construct an endpoint URL * * @param string $method - * @return string */ private function endpoint($method): string { @@ -238,7 +233,6 @@ class Geary * Construct URL parameters * * @param mixed $params - * @return string */ private function get_params($params): string { @@ -263,7 +257,6 @@ class Geary * Get single data from header * * @param string $name - * @return string */ private function get_header($name): string { @@ -286,7 +279,6 @@ class Geary * Add data to header for authentication purpose * * @param array $data - * @return array */ private function prepare_header($data): array { @@ -324,12 +316,12 @@ class Geary $params = $this->get_params($data['params']); $curl_data = [ - CURLOPT_URL => $url.$params, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_HTTPHEADER => $headers, - CURLOPT_SSL_VERIFYPEER => true, - CURLOPT_CONNECTTIMEOUT => self::CONNECT_TIMEOUT, - CURLOPT_POST => $data['request_method'] === 'POST', + CURLOPT_URL => $url.$params, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HTTPHEADER => $headers, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CONNECTTIMEOUT => self::CONNECT_TIMEOUT, + CURLOPT_POST => $data['request_method'] === 'POST', ]; curl_setopt_array($ch, $curl_data); diff --git a/Blacklight/libraries/TraktAPI.php b/Blacklight/libraries/TraktAPI.php index 05438ac85..9ff2ebc77 100755 --- a/Blacklight/libraries/TraktAPI.php +++ b/Blacklight/libraries/TraktAPI.php @@ -37,7 +37,6 @@ class TraktAPI * Construct. Assign passed request headers. Headers should be complete with API key. * * - * @param $headers * * @throws \Exception */ @@ -95,7 +94,7 @@ class TraktAPI public function getBoxOffice() { $array = $this->getJsonArray( - self::API_URL.'movies/boxoffice' + self::API_URL.'movies/boxoffice' ); if (! $array) { return false; @@ -116,7 +115,7 @@ class TraktAPI public function getCalendar($start = '', $days = 7) { $array = $this->getJsonArray( - self::API_URL.'calendars/all/shows/'.$start.'/'.$days + self::API_URL.'calendars/all/shows/'.$start.'/'.$days ); if (! $array) { return false; diff --git a/Blacklight/processing/PostProcess.php b/Blacklight/processing/PostProcess.php index eaa63e911..1620d9282 100755 --- a/Blacklight/processing/PostProcess.php +++ b/Blacklight/processing/PostProcess.php @@ -28,40 +28,25 @@ use Illuminate\Support\Carbon; class PostProcess { - /** - * @var \Blacklight\NameFixer - */ protected NameFixer $nameFixer; - /** - * @var \dariusiii\rarinfo\Par2Info - */ protected Par2Info $_par2Info; /** * Use alternate NNTP provider when download fails? - * - * @var bool */ private bool $alternateNNTP; /** * Add par2 info to rar list? - * - * @var bool */ private bool $addpar2; /** * Should we echo to CLI? - * - * @var bool */ private bool $echooutput; - /** - * @var \Blacklight\Nfo - */ private Nfo $Nfo; /** @@ -74,13 +59,13 @@ class PostProcess public function __construct(array $options = []) { $defaults = [ - 'Echo' => true, - 'Logger' => null, - 'Groups' => null, - 'NameFixer' => null, - 'Nfo' => null, + 'Echo' => true, + 'Logger' => null, + 'Groups' => null, + 'NameFixer' => null, + 'Nfo' => null, 'ReleaseFiles' => null, - 'Settings' => null, + 'Settings' => null, ]; $options += $defaults; @@ -100,8 +85,6 @@ class PostProcess /** * Go through every type of post proc. * - * @param $nntp - * @return void * * @throws \Exception */ @@ -136,7 +119,6 @@ class PostProcess /** * Process books using amazon.com. * - * @return void * * @throws \Exception */ @@ -174,7 +156,6 @@ class PostProcess * @param string $guidChar (Optional) First letter of a release GUID to use to get work. * @param int|string|null $processMovies (Optional) 0 Don't process, 1 process all releases, * 2 process renamed releases only, '' check site setting - * @return void * * @throws \Exception */ @@ -199,10 +180,8 @@ class PostProcess /** * Process nfo files. * - * @param NNTP $nntp * @param string $groupID (Optional) ID of a group to work on. * @param string $guidChar (Optional) First letter of a release GUID to use to get work. - * @return void * * @throws \Exception */ @@ -216,7 +195,6 @@ class PostProcess /** * Process comments. * - * @param NNTP $nntp * * @throws \Exception */ @@ -232,7 +210,6 @@ class PostProcess * @param string $guidChar (Optional) First letter of a release GUID to use to get work. * @param int|string|null $processTV (Optional) 0 Don't process, 1 process all releases, * 2 process renamed releases only, '' check site setting - * @return void * * @throws \Exception */ @@ -267,7 +244,6 @@ class PostProcess * @param NNTP $nntp Class NNTP * @param int|string $groupID (Optional) ID of a group to work on. * @param string $guidChar (Optional) First char of release GUID, can be used to select work. - * @return void * * @throws \Exception */ @@ -286,7 +262,6 @@ class PostProcess * @param int $groupID Group ID of the release. * @param NNTP $nntp Class NNTP * @param int $show Only show result or apply iy. - * @return bool * * @throws \Exception */ @@ -342,7 +317,6 @@ class PostProcess if ($this->addpar2) { // Add to release files. if ($filesAdded < 21 && ReleaseFile::query()->where(['releases_id' => $relID, 'name' => $file['name']])->first() === null) { - // Try to add the files to the DB. if (ReleaseFile::addReleaseFiles($relID, $file['name'], $file['size'], $query['postdate'] !== null ? Carbon::createFromFormat('Y-m-d H:i:s', $query['postdate']) : now(), 0, $file['hash_16K'])) { $filesAdded++; @@ -363,7 +337,6 @@ class PostProcess // If we found some files. if ($filesAdded > 0) { - // Update the file count with the new file count + old file count. Release::whereId($relID)->increment('rarinnerfilecount', $filesAdded); } diff --git a/Blacklight/processing/ProcessReleases.php b/Blacklight/processing/ProcessReleases.php index 3405a6951..7fc6f565f 100755 --- a/Blacklight/processing/ProcessReleases.php +++ b/Blacklight/processing/ProcessReleases.php @@ -27,77 +27,49 @@ use JetBrains\PhpStorm\ArrayShape; class ProcessReleases { public const COLLFC_DEFAULT = 0; // Collection has default filecheck status + public const COLLFC_COMPCOLL = 1; // Collection is a complete collection + public const COLLFC_COMPPART = 2; // Collection is a complete collection and has all parts available + public const COLLFC_SIZED = 3; // Collection has been calculated for total size + public const COLLFC_INSERTED = 4; // Collection has been inserted into releases + public const COLLFC_DELETE = 5; // Collection is ready for deletion + public const COLLFC_TEMPCOMP = 15; // Collection is complete and being checked for complete parts + public const COLLFC_ZEROPART = 16; // Collection has a 00/0XX designator (temporary) public const FILE_INCOMPLETE = 0; // We don't have all the parts yet for the file (binaries table partcheck column). + public const FILE_COMPLETE = 1; // We have all the parts for the file (binaries table partcheck column). - /** - * @var int - */ public int $collectionDelayTime; - /** - * @var int - */ public int $crossPostTime; - /** - * @var int - */ public int $releaseCreationLimit; - /** - * @var int - */ public int $completion; - /** - * @var bool - */ public bool $echoCLI; - /** - * @var \PDO - */ public \PDO $pdo; - /** - * @var \Blacklight\ConsoleTools - */ public ConsoleTools $consoleTools; - /** - * @var \Blacklight\NZB - */ public NZB $nzb; - /** - * @var \Blacklight\ReleaseCleaning - */ public ReleaseCleaning $releaseCleaning; - /** - * @var \Blacklight\Releases - */ public Releases $releases; - /** - * @var \Blacklight\ReleaseImage - */ public ReleaseImage $releaseImage; /** * Time (hours) to wait before delete a stuck/broken collection. - * - * - * @var int */ private int $collectionTimeout; @@ -109,14 +81,14 @@ class ProcessReleases public function __construct(array $options = []) { $defaults = [ - 'Echo' => true, - 'ConsoleTools' => null, - 'Groups' => null, - 'NZB' => null, + 'Echo' => true, + 'ConsoleTools' => null, + 'Groups' => null, + 'NZB' => null, 'ReleaseCleaning' => null, - 'ReleaseImage' => null, - 'Releases' => null, - 'Settings' => null, + 'ReleaseImage' => null, + 'Releases' => null, + 'Settings' => null, ]; $options += $defaults; @@ -146,12 +118,7 @@ class ProcessReleases /** * Main method for creating releases/NZB files from collections. * - * @param int $categorize - * @param int $postProcess * @param string $groupName (optional) - * @param \Blacklight\NNTP $nntp - * @param bool $echooutput - * @return int * * @throws \Throwable */ @@ -223,7 +190,6 @@ class ProcessReleases * Categorizes releases. * * @param string $type name or searchname | Categorize using the search name or subject. - * @param $groupId * @return int Quantity of categorized releases. * * @throws \Exception @@ -258,8 +224,6 @@ class ProcessReleases } /** - * @param $groupID - * * @throws \Exception * @throws \Throwable */ @@ -300,8 +264,6 @@ class ProcessReleases } /** - * @param $groupID - * * @throws \Exception * @throws \Throwable */ @@ -344,8 +306,6 @@ class ProcessReleases } /** - * @param $groupID - * * @throws \Exception * @throws \Throwable */ @@ -435,186 +395,184 @@ class ProcessReleases /** * @param int|string $groupID (optional) - * @return array * * @throws \Throwable */ #[ArrayShape(['added' => 'int', 'dupes' => 'int'])] public function createReleases(int|string $groupID): array - { - $startTime = now()->toImmutable(); + { + $startTime = now()->toImmutable(); - $categorize = new Categorize(); - $returnCount = $duplicate = 0; + $categorize = new Categorize(); + $returnCount = $duplicate = 0; - if ($this->echoCLI) { - $this->consoleTools->header('Process Releases -> Create releases from complete collections.'); - } - $collectionsQuery = Collection::query() - ->where('collections.filecheck', self::COLLFC_SIZED) - ->where('collections.filesize', '>', 0); - if (! empty($groupID)) { - $collectionsQuery->where('collections.groups_id', $groupID); - } - $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname']) - ->join('usenet_groups', 'usenet_groups.id', '=', 'collections.groups_id') - ->limit($this->releaseCreationLimit); - $collections = $collectionsQuery->get(); - if ($this->echoCLI && $collections->count() > 0) { - $this->consoleTools->primary(\count($collections).' Collections ready to be converted to releases.', true); - } + if ($this->echoCLI) { + $this->consoleTools->header('Process Releases -> Create releases from complete collections.'); + } + $collectionsQuery = Collection::query() + ->where('collections.filecheck', self::COLLFC_SIZED) + ->where('collections.filesize', '>', 0); + if (! empty($groupID)) { + $collectionsQuery->where('collections.groups_id', $groupID); + } + $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname']) + ->join('usenet_groups', 'usenet_groups.id', '=', 'collections.groups_id') + ->limit($this->releaseCreationLimit); + $collections = $collectionsQuery->get(); + if ($this->echoCLI && $collections->count() > 0) { + $this->consoleTools->primary(\count($collections).' Collections ready to be converted to releases.', true); + } - foreach ($collections as $collection) { - $cleanRelName = utf8_encode(str_replace(['#', '@', '$', '%', '^', '§', '¨', '©', 'Ö'], '', $collection->subject)); - $fromName = utf8_encode( - trim($collection->fromname, "'") - ); + foreach ($collections as $collection) { + $cleanRelName = utf8_encode(str_replace(['#', '@', '$', '%', '^', '§', '¨', '©', 'Ö'], '', $collection->subject)); + $fromName = utf8_encode( + trim($collection->fromname, "'") + ); - // Look for duplicates, duplicates match on releases.name, releases.fromname and releases.size - // A 1% variance in size is considered the same size when the subject and poster are the same - $dupeCheck = Release::query() - ->where(['name' => $cleanRelName, 'fromname' => $fromName]) - ->whereBetween('size', [$collection->filesize * .99, $collection->filesize * 1.01]) - ->first(['id']); + // Look for duplicates, duplicates match on releases.name, releases.fromname and releases.size + // A 1% variance in size is considered the same size when the subject and poster are the same + $dupeCheck = Release::query() + ->where(['name' => $cleanRelName, 'fromname' => $fromName]) + ->whereBetween('size', [$collection->filesize * .99, $collection->filesize * 1.01]) + ->first(['id']); - if ($dupeCheck === null) { - $cleanedName = $this->releaseCleaning->releaseCleaner( - $collection->subject, - $collection->fromname, - $collection->gname - ); + if ($dupeCheck === null) { + $cleanedName = $this->releaseCleaning->releaseCleaner( + $collection->subject, + $collection->fromname, + $collection->gname + ); - if (\is_array($cleanedName)) { - $properName = $cleanedName['properlynamed'] ?? false; - $preID = $cleanedName['predb'] ?? false; - $cleanedName = $cleanedName['cleansubject'] ?? $cleanRelName; - } else { - $properName = true; - $preID = false; - } + if (\is_array($cleanedName)) { + $properName = $cleanedName['properlynamed'] ?? false; + $preID = $cleanedName['predb'] ?? false; + $cleanedName = $cleanedName['cleansubject'] ?? $cleanRelName; + } else { + $properName = true; + $preID = false; + } - if ($preID === false && $cleanedName !== '') { - // try to match the cleaned searchname to predb title or filename here - $preMatch = Predb::matchPre($cleanedName); - if ($preMatch !== false) { - $cleanedName = $preMatch['title']; - $preID = $preMatch['predb_id']; - $properName = true; - } - } + if ($preID === false && $cleanedName !== '') { + // try to match the cleaned searchname to predb title or filename here + $preMatch = Predb::matchPre($cleanedName); + if ($preMatch !== false) { + $cleanedName = $preMatch['title']; + $preID = $preMatch['predb_id']; + $properName = true; + } + } - $determinedCategory = $categorize->determineCategory($collection->groups_id, $cleanedName); + $determinedCategory = $categorize->determineCategory($collection->groups_id, $cleanedName); - $releaseID = Release::insertRelease( - [ - 'name' => $cleanRelName, - 'searchname' => ! empty($cleanedName) ? utf8_encode($cleanedName) : $cleanRelName, - 'totalpart' => $collection->totalfiles, - 'groups_id' => $collection->groups_id, - 'guid' => createGUID(), - 'postdate' => $collection->date, - 'fromname' => $fromName, - 'size' => $collection->filesize, - 'categories_id' => $determinedCategory['categories_id'] ?? Category::OTHER_MISC, - 'isrenamed' => $properName === true ? 1 : 0, - 'predb_id' => $preID === false ? 0 : $preID, - 'nzbstatus' => NZB::NZB_NONE, - ] - ); + $releaseID = Release::insertRelease( + [ + 'name' => $cleanRelName, + 'searchname' => ! empty($cleanedName) ? utf8_encode($cleanedName) : $cleanRelName, + 'totalpart' => $collection->totalfiles, + 'groups_id' => $collection->groups_id, + 'guid' => createGUID(), + 'postdate' => $collection->date, + 'fromname' => $fromName, + 'size' => $collection->filesize, + 'categories_id' => $determinedCategory['categories_id'] ?? Category::OTHER_MISC, + 'isrenamed' => $properName === true ? 1 : 0, + 'predb_id' => $preID === false ? 0 : $preID, + 'nzbstatus' => NZB::NZB_NONE, + ] + ); - if ($releaseID !== null) { - // Update collections table to say we inserted the release. - DB::transaction(static function () use ($collection, $releaseID) { - Collection::query()->where('id', $collection->id)->update(['filecheck' => self::COLLFC_INSERTED, 'releases_id' => $releaseID]); - }, 10); + if ($releaseID !== null) { + // Update collections table to say we inserted the release. + DB::transaction(static function () use ($collection, $releaseID) { + Collection::query()->where('id', $collection->id)->update(['filecheck' => self::COLLFC_INSERTED, 'releases_id' => $releaseID]); + }, 10); - // Add the id of regex that matched the collection and release name to release_regexes table - ReleaseRegex::insertOrIgnore([ - 'releases_id' => $releaseID, - 'collection_regex_id' => $collection->collection_regexes_id, - 'naming_regex_id' => $cleanedName['id'] ?? 0, - ]); + // Add the id of regex that matched the collection and release name to release_regexes table + ReleaseRegex::insertOrIgnore([ + 'releases_id' => $releaseID, + 'collection_regex_id' => $collection->collection_regexes_id, + 'naming_regex_id' => $cleanedName['id'] ?? 0, + ]); - if (preg_match_all('#(\S+):\S+#', $collection->xref, $hits)) { - foreach ($hits[1] as $grp) { - //check if the group name is in a valid format - $grpTmp = UsenetGroup::isValidGroup($grp); - if ($grpTmp !== false) { - //check if the group already exists in database - $xrefGrpID = UsenetGroup::getIDByName($grpTmp); - if ($xrefGrpID === '') { - $xrefGrpID = UsenetGroup::addGroup( - [ - 'name' => $grpTmp, - 'description' => 'Added by Release processing', - 'backfill_target' => 1, - 'first_record' => 0, - 'last_record' => 0, - 'active' => 0, - 'backfill' => 0, - 'minfilestoformrelease' => '', - 'minsizetoformrelease' => '', - ] - ); - } + if (preg_match_all('#(\S+):\S+#', $collection->xref, $hits)) { + foreach ($hits[1] as $grp) { + //check if the group name is in a valid format + $grpTmp = UsenetGroup::isValidGroup($grp); + if ($grpTmp !== false) { + //check if the group already exists in database + $xrefGrpID = UsenetGroup::getIDByName($grpTmp); + if ($xrefGrpID === '') { + $xrefGrpID = UsenetGroup::addGroup( + [ + 'name' => $grpTmp, + 'description' => 'Added by Release processing', + 'backfill_target' => 1, + 'first_record' => 0, + 'last_record' => 0, + 'active' => 0, + 'backfill' => 0, + 'minfilestoformrelease' => '', + 'minsizetoformrelease' => '', + ] + ); + } - $relGroupsChk = ReleasesGroups::query()->where( - [ - ['releases_id', '=', $releaseID], - ['groups_id', '=', $xrefGrpID], - ] - )->first(); + $relGroupsChk = ReleasesGroups::query()->where( + [ + ['releases_id', '=', $releaseID], + ['groups_id', '=', $xrefGrpID], + ] + )->first(); - if ($relGroupsChk === null) { - ReleasesGroups::query()->insert( - [ - 'releases_id' => $releaseID, - 'groups_id' => $xrefGrpID, - ] - ); - } - } - } - } + if ($relGroupsChk === null) { + ReleasesGroups::query()->insert( + [ + 'releases_id' => $releaseID, + 'groups_id' => $xrefGrpID, + ] + ); + } + } + } + } - $returnCount++; + $returnCount++; - if ($this->echoCLI) { - echo "Added $returnCount releases.\r"; - } - } - } else { - // The release was already in the DB, so delete the collection. - DB::transaction(static function () use ($collection) { - Collection::query()->where('collectionhash', $collection->collectionhash)->delete(); - }, 10); + if ($this->echoCLI) { + echo "Added $returnCount releases.\r"; + } + } + } else { + // The release was already in the DB, so delete the collection. + DB::transaction(static function () use ($collection) { + Collection::query()->where('collectionhash', $collection->collectionhash)->delete(); + }, 10); - $duplicate++; - } - } + $duplicate++; + } + } - $totalTime = now()->diffInSeconds($startTime); + $totalTime = now()->diffInSeconds($startTime); - if ($this->echoCLI) { - $this->consoleTools->primary( - PHP_EOL. - number_format($returnCount). - ' Releases added and '. - number_format($duplicate). - ' duplicate collections deleted in '. - $totalTime.Str::plural(' second', $totalTime), - true - ); - } + if ($this->echoCLI) { + $this->consoleTools->primary( + PHP_EOL. + number_format($returnCount). + ' Releases added and '. + number_format($duplicate). + ' duplicate collections deleted in '. + $totalTime.Str::plural(' second', $totalTime), + true + ); + } - return ['added' => $returnCount, 'dupes' => $duplicate]; - } + return ['added' => $returnCount, 'dupes' => $duplicate]; + } /** * Create NZB files from complete releases. * * @param int|string $groupID (optional) - * @return int * * @throws \Throwable */ @@ -663,7 +621,6 @@ class ProcessReleases /** * Categorize releases. * - * @param int $categorize * @param int|string $groupID (optional) * * @void @@ -695,8 +652,6 @@ class ProcessReleases /** * Post-process releases. * - * @param int $postProcess - * @param NNTP $nntp * * @void * @@ -715,8 +670,6 @@ class ProcessReleases } /** - * @param $groupID - * * @throws \Exception * @throws \Throwable */ @@ -1030,7 +983,6 @@ class ProcessReleases * This means the the binary table has the same count as the file count in the subject, but * the collection might not be complete yet since we might not have all the articles in the parts table. * - * @param int $groupID * * @void * @@ -1063,7 +1015,6 @@ class ProcessReleases * at 0 then you would never get a complete collection if it starts with 1 and if it starts, you can end up creating * a incomplete collection, since you assumed it was complete. * - * @param int $groupID * * @void * @@ -1100,7 +1051,6 @@ class ProcessReleases * Check if the files (binaries table) in a complete collection has all the parts. * If we have all the parts, set binaries table partcheck to FILE_COMPLETE. * - * @param string $where * * @void * @@ -1162,7 +1112,6 @@ class ProcessReleases * Set collections filecheck column to COLLFC_COMPPART. * This means the collection is complete. * - * @param string $where * * @void * @@ -1193,7 +1142,6 @@ class ProcessReleases * If not all files (binaries table) had their parts on the previous stage, * reset the collection filecheck column to COLLFC_COMPCOLL so we reprocess them next time. * - * @param int $groupId * * @void * @@ -1214,7 +1162,6 @@ class ProcessReleases * If a collection did not have the file count (ie: [00/12]) or the collection is incomplete after * $this->collectionDelayTime hours, set the collection to complete to create it into a release/nzb. * - * @param string $where * * @void * @@ -1242,7 +1189,6 @@ class ProcessReleases /** * If a collection has been stuck for $this->collectionTimeout hours, delete it, it's bad. * - * @param int $groupID * * @void * diff --git a/Blacklight/processing/Videos.php b/Blacklight/processing/Videos.php index 3ae5aecad..148c8dd59 100755 --- a/Blacklight/processing/Videos.php +++ b/Blacklight/processing/Videos.php @@ -35,7 +35,9 @@ abstract class Videos { // Video Type Identifiers protected const TYPE_TV = 0; // Type of video is a TV Programme/Show + protected const TYPE_FILM = 1; // Type of video is a Film/Movie + protected const TYPE_ANIME = 2; // Type of video is a Anime /** @@ -56,7 +58,7 @@ abstract class Videos public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, + 'Echo' => false, 'Settings' => null, ]; $options += $defaults; @@ -69,9 +71,6 @@ abstract class Videos * Main processing director function for scrapers * Calls work query function and initiates processing. * - * @param $groupID - * @param $guidChar - * @param $process * @param bool $local */ abstract protected function processSite($groupID, $guidChar, $process, $local = false): void; @@ -111,8 +110,6 @@ abstract class Videos * Get video info from a Site ID and column. * * - * @param $siteColumn - * @param $siteID * @return bool|int */ protected function getVideoIDFromSiteID($siteColumn, $siteID) @@ -126,8 +123,6 @@ abstract class Videos } /** - * @param $title - * @param $type * @param int $source * @return $this|array|bool|false|\Illuminate\Database\Eloquent\Model|mixed|null */ @@ -180,7 +175,6 @@ abstract class Videos return $res; } } else { - // If there was not an exact title match, look for title with missing chars // example release name :Zorro 1990, tvrage name Zorro (1990) // Only search if the title contains more than one word to prevent incorrect matches @@ -201,8 +195,6 @@ abstract class Videos } /** - * @param $title - * @param $type * @param int $source * @return bool|\Illuminate\Database\Eloquent\Model|null|static */ @@ -239,8 +231,6 @@ abstract class Videos /** * Supplementary function for getByTitle that queries for a like match. * - * @param $title - * @param $type * @param int $source * @return array|false */ @@ -282,8 +272,6 @@ abstract class Videos * Supplementary function for getByTitle that replaces special chars to find an exact match. * Add more ->whereRaw() methods if needed. Might slow TV PP down though. * - * @param $title - * @param $type * @param int $source * @return bool|\Illuminate\Database\Eloquent\Model|null|static */ @@ -315,9 +303,6 @@ abstract class Videos /** * Inserts aliases for videos. - * - * @param $videoId - * @param array $aliases */ public function addAliases($videoId, array $aliases = []): void { @@ -341,8 +326,6 @@ abstract class Videos * Retrieves all aliases for given VideoID or VideoID for a given alias. * * - * @param int $videoId - * @param string $alias * @return VideoAlias[]|bool|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|mixed */ public function getAliases(int $videoId, string $alias = '') diff --git a/Blacklight/processing/adult/ADE.php b/Blacklight/processing/adult/ADE.php index 6ea0c299c..f824f338f 100755 --- a/Blacklight/processing/adult/ADE.php +++ b/Blacklight/processing/adult/ADE.php @@ -42,16 +42,25 @@ class ADE extends AdultMovies /** Trailing urls */ protected $_dvdQuery = '/dvd/search?q='; + protected $_scenes = '/scenes'; + protected $_boxCover = '/boxcover'; + protected $_backCover = '/backcover'; + protected $_reviews = '/reviews'; + protected $_trailers = '/trailers'; protected $_url; + protected $_response; + protected $_res = []; + protected $_tmpResponse; + protected $_ch; /** diff --git a/Blacklight/processing/adult/ADM.php b/Blacklight/processing/adult/ADM.php index 73bf1e50b..e74eb6ae6 100755 --- a/Blacklight/processing/adult/ADM.php +++ b/Blacklight/processing/adult/ADM.php @@ -12,6 +12,7 @@ class ADM extends AdultMovies * Needed Search Queries Constant. */ private const ADMURL = 'http://www.adultdvdmarketplace.com'; + private const TRAILINGSEARCH = '/xcart/adult_dvd/advanced_search.php?sort_by=relev&title='; /** @@ -92,8 +93,6 @@ class ADM extends AdultMovies /** * Gets the synopsis. - * - * @return array */ protected function synopsis(): array { @@ -112,7 +111,6 @@ class ADM extends AdultMovies * * * @param bool $extras - * @return array */ protected function productInfo($extras = false): array { @@ -135,8 +133,6 @@ class ADM extends AdultMovies /** * Gets the cast members. - * - * @return array */ protected function cast(): array { @@ -160,8 +156,6 @@ class ADM extends AdultMovies /** * Gets categories. - * - * @return array */ protected function genres(): array { @@ -182,7 +176,6 @@ class ADM extends AdultMovies /** * Searches for match against searchterm. * - * @param $movie * @return bool - true if search = 100% */ public function processSite($movie): bool diff --git a/Blacklight/processing/adult/AEBN.php b/Blacklight/processing/adult/AEBN.php index d1906e87e..f7577e1b3 100755 --- a/Blacklight/processing/adult/AEBN.php +++ b/Blacklight/processing/adult/AEBN.php @@ -17,7 +17,9 @@ class AEBN extends AdultMovies * Url Constants used within this class. */ private const AEBNSURL = 'http://straight.theater.aebn.net'; + private const TRAILINGSEARCH = '/dispatcher/fts?theaterId=13992&genreId=101&locale=en&count=30&imageType=Large&targetSearchMode=basic&isAdvancedSearch=false&isFlushAdvancedSearchCriteria=false&sortType=Relevance&userQuery=title%3A+%2B'; + private const TRAILERURL = '/dispatcher/previewPlayer?locale=en&theaterId=13992&genreId=101&movieId='; /** @@ -43,14 +45,14 @@ class AEBN extends AdultMovies * @var array */ protected $_res = [ - 'backcover' => [], - 'boxcover' => [], - 'cast' => [], - 'director' => [], - 'genres' => [], + 'backcover' => [], + 'boxcover' => [], + 'cast' => [], + 'director' => [], + 'genres' => [], 'productinfo' => [], - 'synopsis' => [], - 'trailers' => ['url' => []], + 'synopsis' => [], + 'trailers' => ['url' => []], ]; /** @@ -79,8 +81,6 @@ class AEBN extends AdultMovies /** * Gets the front and back cover of the box. - * - * @return array */ protected function covers(): array { @@ -99,8 +99,6 @@ class AEBN extends AdultMovies /** * Gets the Genres "Categories". - * - * @return array */ protected function genres(): array { @@ -118,8 +116,6 @@ class AEBN extends AdultMovies /** * Gets the Cast Members "Stars" and Director if any. - * - * @return array */ protected function cast(): array { @@ -147,7 +143,6 @@ class AEBN extends AdultMovies * Gets the product information. * * @param bool $extras - * @return array */ protected function productInfo($extras = false): array { @@ -174,8 +169,6 @@ class AEBN extends AdultMovies /** * Gets the synopsis "plot". - * - * @return array */ protected function synopsis(): array { @@ -196,7 +189,6 @@ class AEBN extends AdultMovies * Searches for a XXX name. * * @param string $movie - * @return bool */ public function processSite($movie): bool { @@ -223,6 +215,7 @@ class AEBN extends AdultMovies return true; } + continue; } $i++; diff --git a/Blacklight/processing/adult/Hotmovies.php b/Blacklight/processing/adult/Hotmovies.php index 9555e68df..cb748d7df 100755 --- a/Blacklight/processing/adult/Hotmovies.php +++ b/Blacklight/processing/adult/Hotmovies.php @@ -9,26 +9,32 @@ class Hotmovies extends AdultMovies * Needed Search Queries Variables. */ private const EXTRASEARCH = '&complete=on&search_in=video_title'; + private const HMURL = 'http://www.hotmovies.com'; + private const TRAILINGSEARCH = '/search.php?words='; + /** * Keyword Search. * * @var string */ protected $searchTerm = ''; + /** * Define a cookie location. * * @var string */ public $cookie = ''; + /** * If a direct link is set parse it instead of search for it. * * @var string */ protected $directLink = ''; + /** * Sets the direct url in the getAll method. * @@ -78,8 +84,6 @@ class Hotmovies extends AdultMovies /** * Gets the synopsis. - * - * @return array */ protected function synopsis(): array { @@ -98,7 +102,6 @@ class Hotmovies extends AdultMovies * Process ProductInfo. * * @param bool $extras - * @return array */ protected function productInfo($extras = false): array { @@ -141,8 +144,6 @@ class Hotmovies extends AdultMovies /** * Gets the cast members and director. - * - * @return array */ protected function cast(): array { @@ -161,8 +162,6 @@ class Hotmovies extends AdultMovies /** * Gets categories. - * - * @return array */ protected function genres(): array { diff --git a/Blacklight/processing/adult/Popporn.php b/Blacklight/processing/adult/Popporn.php index a6e21daf2..087d0a17f 100755 --- a/Blacklight/processing/adult/Popporn.php +++ b/Blacklight/processing/adult/Popporn.php @@ -24,7 +24,9 @@ class Popporn extends AdultMovies * Needed Search Queries Constant. */ private const IF18 = 'https://www.popporn.com/popporn/4'; + private const POPURL = 'https://www.popporn.com'; + private const TRAILINGSEARCH = '/search&q='; /** @@ -187,9 +189,6 @@ class Popporn extends AdultMovies return $this->_res; } - /** - * @return array - */ protected function cast(): array { $cast = false; diff --git a/Blacklight/processing/post/AniDB.php b/Blacklight/processing/post/AniDB.php index 0497c752e..fb07c4023 100755 --- a/Blacklight/processing/post/AniDB.php +++ b/Blacklight/processing/post/AniDB.php @@ -14,6 +14,7 @@ use Illuminate\Support\Facades\DB; class AniDB { private const PROC_EXTFAIL = -1; // Release Anime title/episode # could not be extracted from searchname + private const PROC_NOMATCH = -2; // AniDB ID was not found in anidb table using extracted title/episode # /** @@ -54,7 +55,7 @@ class AniDB public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, + 'Echo' => false, 'Settings' => null, ]; $options += $defaults; @@ -118,7 +119,6 @@ class AniDB /** * Selects episode info for a local match. * - * @param $anidbId * @param int $episode * @return \Illuminate\Database\Eloquent\Model|null|static */ @@ -215,8 +215,6 @@ class AniDB * If no info is available locally the AniDB API is invoked. * * - * @param $release - * @return bool * * @throws \Exception */ @@ -279,10 +277,6 @@ class AniDB return $matched; } - /** - * @param $anidbId - * @param $relId - */ private function updateRelease($anidbId, $relId): void { Release::update(['anidbid' => $anidbId])->where('id', $relId); @@ -292,7 +286,6 @@ class AniDB * Checks a specific Anime title's last update time. * * - * @param $anidbId * @return mixed */ private function updateTimeCheck($anidbId) diff --git a/Blacklight/processing/post/ProcessAdditional.php b/Blacklight/processing/post/ProcessAdditional.php index 4102f7926..a33db0ab7 100755 --- a/Blacklight/processing/post/ProcessAdditional.php +++ b/Blacklight/processing/post/ProcessAdditional.php @@ -45,42 +45,26 @@ class ProcessAdditional */ public const maxCompressedFilesToCheck = 10; - /** - * @var bool - */ protected bool $_echoDebug; protected $_releases; /** * Count of releases to work on. - * - * @var int */ protected int $_totalReleases; protected $_release; - /** - * @var \Blacklight\NZB - */ protected NZB $_nzb; /** * List of files with sizes/etc contained in the NZB. - * - * @var array */ protected array $_nzbContents; - /** - * @var \dariusiii\rarinfo\Par2Info - */ protected Par2Info $_par2Info; - /** - * @var \dariusiii\rarinfo\ArchiveInfo - */ protected ArchiveInfo $_archiveInfo; /** @@ -88,9 +72,6 @@ class ProcessAdditional */ protected mixed $_innerFileBlacklist; - /** - * @var int - */ protected int $_maxNestedLevels; /** @@ -103,336 +84,196 @@ class ProcessAdditional */ protected mixed $_unrarPath; - /** - * @var string - */ protected string $_killString; - /** - * @var bool|string - */ protected string|bool $_showCLIReleaseID; - /** - * @var int - */ protected int $_queryLimit; - /** - * @var int - */ protected int $_segmentsToDownload; - /** - * @var int - */ protected int $_maximumRarSegments; - /** - * @var int - */ protected int $_maximumRarPasswordChecks; - /** - * @var string - */ protected string $_maxSize; - /** - * @var string - */ protected string $_minSize; - /** - * @var bool - */ protected bool $_processThumbnails; - /** - * @var string - */ protected string $_audioSavePath; - /** - * @var string - */ protected string $_supportFileRegex; - /** - * @var bool - */ protected bool $_echoCLI; - /** - * @var \Blacklight\NNTP - */ protected NNTP $_nntp; - /** - * @var \Blacklight\Categorize - */ protected Categorize $_categorize; - /** - * @var \Blacklight\NameFixer - */ protected NameFixer $_nameFixer; - /** - * @var \Blacklight\ReleaseExtra - */ protected ReleaseExtra $_releaseExtra; - /** - * @var \Blacklight\ReleaseImage - */ protected ReleaseImage $_releaseImage; - /** - * @var \Blacklight\Nfo - */ protected Nfo $_nfo; - /** - * @var bool - */ protected bool $_extractUsingRarInfo; - /** - * @var bool - */ protected bool $_alternateNNTP; - /** - * @var int - */ protected int $_ffMPEGDuration; - /** - * @var bool - */ protected bool $_addPAR2Files; - /** - * @var bool - */ protected bool $_processVideo; - /** - * @var bool - */ protected bool $_processJPGSample; - /** - * @var bool - */ protected bool $_processAudioSample; - /** - * @var bool - */ protected bool $_processMediaInfo; - /** - * @var bool - */ protected bool $_processAudioInfo; - /** - * @var bool - */ protected bool $_processPasswords; - /** - * @var string - */ protected string $_audioFileRegex; - /** - * @var string - */ protected string $_ignoreBookRegex; - /** - * @var string - */ protected string $_videoFileRegex; /** * Have we created a video file for the current release? - * - * @var bool */ protected bool $_foundVideo; /** * Have we found MediaInfo data for a Video for the current release? - * - * @var bool */ protected bool $_foundMediaInfo; /** * Have we found MediaInfo data for a Audio file for the current release? - * - * @var bool */ protected bool $_foundAudioInfo; /** * Have we created a short Audio file sample for the current release? - * - * @var bool */ protected bool $_foundAudioSample; /** * Extension of the found audio file (MP3/FLAC/etc). - * - * @var string */ protected string $_AudioInfoExtension; /** * Have we downloaded a JPG file for the current release? - * - * @var bool */ protected bool $_foundJPGSample; /** * Have we created a Video JPG image sample for the current release? - * - * @var bool */ protected bool $_foundSample; /** * Have we found PAR2 info on this release? - * - * @var bool */ protected bool $_foundPAR2Info; /** * Message ID's for found content to download. - * - * @var array */ protected array $_sampleMessageIDs; + protected $_JPGMessageIDs; + protected $_MediaInfoMessageIDs; + protected $_AudioInfoMessageIDs; + protected $_RARFileMessageIDs; /** * Password status of the current release. - * - * @var int */ protected int $_passwordStatus; /** * Does the current release have a password? - * - * @var bool */ protected bool $_releaseHasPassword; /** * Does the current release have an NFO file? - * - * @var bool */ protected bool $_releaseHasNoNFO; /** * Name of the current release's usenet group. - * - * @var string */ protected string $_releaseGroupName; /** * Number of file information added to DB (from rar/zip/par2 contents). - * - * @var int */ protected int $_addedFileInfo; /** * Number of file information we found from RAR/ZIP. * (if some of it was already in DB, this count goes up, while the count above does not). - * - * @var int */ protected int $_totalFileInfo; /** * How many compressed (rar/zip) files have we checked. - * - * @var int */ protected int $_compressedFilesChecked; /** * Should we download the last rar? - * - * @var bool */ protected bool $_fetchLastFiles; /** * Are we downloading the last rar? - * - * @var bool */ protected bool $_reverse; - /** - * @var \Blacklight\SphinxSearch - */ protected SphinxSearch $sphinx; - /** - * @var \FFMpeg\FFMpeg - */ private FFMpeg $ffmpeg; - /** - * @var \FFMpeg\FFProbe - */ private FFProbe $ffprobe; - /** - * @var \Mhor\MediaInfo\MediaInfo - */ private MediaInfo $mediaInfo; - /** - * @var ElasticSearchSiteSearch - */ + private ElasticSearchSiteSearch $elasticsearch; /** * ProcessAdditional constructor. * - * @param array $options * * @throws \Exception */ public function __construct(array $options = []) { $defaults = [ - 'Echo' => false, - 'Categorize' => null, - 'Groups' => null, - 'NameFixer' => null, - 'Nfo' => null, - 'NNTP' => null, - 'NZB' => null, + 'Echo' => false, + 'Categorize' => null, + 'Groups' => null, + 'NameFixer' => null, + 'Nfo' => null, + 'NNTP' => null, + 'NZB' => null, 'ReleaseExtra' => null, 'ReleaseImage' => null, - 'Settings' => null, + 'Settings' => null, 'SphinxSearch' => null, ]; $options += $defaults; @@ -444,7 +285,7 @@ class ProcessAdditional $this->_nzb = $options['NZB'] ?? new NZB(); $this->_archiveInfo = new ArchiveInfo(); $this->_categorize = $options['Categorize'] ?? new Categorize(); - $this->_nameFixer = $options['NameFixer'] ?? new NameFixer(['Echo' =>$this->_echoCLI, 'Categorize' => $this->_categorize]); + $this->_nameFixer = $options['NameFixer'] ?? new NameFixer(['Echo' => $this->_echoCLI, 'Categorize' => $this->_categorize]); $this->_releaseExtra = $options['ReleaseExtra'] ?? new ReleaseExtra(); $this->_releaseImage = $options['ReleaseImage'] ?? new ReleaseImage(); $this->_par2Info = new Par2Info(); @@ -548,9 +389,6 @@ class ProcessAdditional } /** - * @param string $groupID - * @param string $guidChar - * * @throws \Exception */ public function start(string $groupID = '', string $guidChar = ''): void @@ -580,9 +418,6 @@ class ProcessAdditional protected string $tmpPath; /** - * @param $guidChar - * @param string $groupID - * * @throws \RuntimeException * @throws \Exception */ @@ -638,8 +473,6 @@ class ProcessAdditional /** * Get all releases that need to be processed. * - * @param int|string $groupID - * @param string $guidChar * * @void */ @@ -736,7 +569,6 @@ class ProcessAdditional if ($this->_processPasswords || $this->_processThumbnails || $this->_processMediaInfo || $this->_processAudioInfo || $this->_processVideo ) { - // Process usenet Message-ID downloads. $this->_processMessageIDDownloads(); @@ -796,7 +628,6 @@ class ProcessAdditional * Create a temporary storage folder for the current release. * * - * @return bool * * @throws \Exception */ @@ -819,7 +650,6 @@ class ProcessAdditional /** * Get list of contents inside a release's NZB file. * - * @return bool * * @throws \Exception */ @@ -853,9 +683,6 @@ class ProcessAdditional return false; } - /** - * @return void - */ protected function _deleteRelease(): void { Release::whereId($this->_release->id)->delete(); @@ -863,92 +690,85 @@ class ProcessAdditional /** * Current file we are working on inside a NZB. - * - * @var array */ protected array $_currentNZBFile; /** * Does the current NZB contain a compressed (RAR/ZIP) file? - * - * @var bool */ protected bool $_NZBHasCompressedFile; /** * Process the files inside the NZB, find Message-ID's to download. * If we find files with book extensions, return the amount. - * - * @return int */ protected function _processNZBContents(): int { $totalBookFiles = 0; foreach ($this->_nzbContents as $this->_currentNZBFile) { - try{ - - // Check if it's not a nfo, nzb, par2 etc... - if (preg_match($this->_supportFileRegex.'|nfo\b|inf\b|ofn\b)($|[ ")\]-])(?!.{20,})/i', $this->_currentNZBFile['title'])) { - continue; - } - - // Check if it's a rar/zip. - if (! $this->_NZBHasCompressedFile && - preg_match( - '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i', - $this->_currentNZBFile['title'] - ) - ) { - $this->_NZBHasCompressedFile = true; - } - - // Look for a video sample, make sure it's not an image. - if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) - ) { - // Get the amount of segments for this file. - $segCount = (\count($this->_currentNZBFile['segments']) - 1); - // If it's more than 1 try to get up to the site specified value of segments. - for ($i = 0; $i < $this->_segmentsToDownload; $i++) { - if ($i > $segCount) { - break; - } - $this->_sampleMessageIDs[] = (string) $this->_currentNZBFile['segments'][$i]; + try { + // Check if it's not a nfo, nzb, par2 etc... + if (preg_match($this->_supportFileRegex.'|nfo\b|inf\b|ofn\b)($|[ ")\]-])(?!.{20,})/i', $this->_currentNZBFile['title'])) { + continue; } - } - // Look for a JPG picture, make sure it's not a CD cover. - if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && ! preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title']) - ) { - // Get the amount of segments for this file. - $segCount = (\count($this->_currentNZBFile['segments']) - 1); - // If it's more than 1 try to get up to the site specified value of segments. - for ($i = 0; $i < $this->_segmentsToDownload; $i++) { - if ($i > $segCount) { - break; - } - $this->_JPGMessageIDs[] = (string) $this->_currentNZBFile['segments'][$i]; + // Check if it's a rar/zip. + if (! $this->_NZBHasCompressedFile && + preg_match( + '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i', + $this->_currentNZBFile['title'] + ) + ) { + $this->_NZBHasCompressedFile = true; } - } - // Look for a video file, make sure it's not a sample, for MediaInfo. - if ($this->_processMediaInfo && empty($this->_MediaInfoMessageIDs) && isset($this->_currentNZBFile['segments'][0]) && stripos($this->_currentNZBFile['title'], 'sample') !== false && preg_match('/'.$this->_videoFileRegex.'[. ")\]]/i', $this->_currentNZBFile['title']) - ) { - $this->_MediaInfoMessageIDs = (string) $this->_currentNZBFile['segments'][0]; - } + // Look for a video sample, make sure it's not an image. + if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title']) + ) { + // Get the amount of segments for this file. + $segCount = (\count($this->_currentNZBFile['segments']) - 1); + // If it's more than 1 try to get up to the site specified value of segments. + for ($i = 0; $i < $this->_segmentsToDownload; $i++) { + if ($i > $segCount) { + break; + } + $this->_sampleMessageIDs[] = (string) $this->_currentNZBFile['segments'][$i]; + } + } - // Look for an audio file. - if ($this->_processAudioInfo && empty($this->_AudioInfoMessageIDs) && isset($this->_currentNZBFile['segments']) && preg_match('/'.$this->_audioFileRegex.'[. ")\]]/i', $this->_currentNZBFile['title'], $type) - ) { - // Get the extension. - $this->_AudioInfoExtension = $type[1]; - $this->_AudioInfoMessageIDs = (string) $this->_currentNZBFile['segments'][0]; - } + // Look for a JPG picture, make sure it's not a CD cover. + if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && ! preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title']) + ) { + // Get the amount of segments for this file. + $segCount = (\count($this->_currentNZBFile['segments']) - 1); + // If it's more than 1 try to get up to the site specified value of segments. + for ($i = 0; $i < $this->_segmentsToDownload; $i++) { + if ($i > $segCount) { + break; + } + $this->_JPGMessageIDs[] = (string) $this->_currentNZBFile['segments'][$i]; + } + } - // Some releases contain many books, increment this to ignore them later. - if (preg_match($this->_ignoreBookRegex, $this->_currentNZBFile['title'])) { - $totalBookFiles++; - } - } catch (\ErrorException $e) { + // Look for a video file, make sure it's not a sample, for MediaInfo. + if ($this->_processMediaInfo && empty($this->_MediaInfoMessageIDs) && isset($this->_currentNZBFile['segments'][0]) && stripos($this->_currentNZBFile['title'], 'sample') !== false && preg_match('/'.$this->_videoFileRegex.'[. ")\]]/i', $this->_currentNZBFile['title']) + ) { + $this->_MediaInfoMessageIDs = (string) $this->_currentNZBFile['segments'][0]; + } + + // Look for an audio file. + if ($this->_processAudioInfo && empty($this->_AudioInfoMessageIDs) && isset($this->_currentNZBFile['segments']) && preg_match('/'.$this->_audioFileRegex.'[. ")\]]/i', $this->_currentNZBFile['title'], $type) + ) { + // Get the extension. + $this->_AudioInfoExtension = $type[1]; + $this->_AudioInfoMessageIDs = (string) $this->_currentNZBFile['segments'][0]; + } + + // Some releases contain many books, increment this to ignore them later. + if (preg_match($this->_ignoreBookRegex, $this->_currentNZBFile['title'])) { + $totalBookFiles++; + } + } catch (\ErrorException $e) { Log::debug($e->getTraceAsString()); } } @@ -958,14 +778,10 @@ class ProcessAdditional /** * List of message-id's we have tried for rar/zip files. - * - * @var array */ protected array $_triedCompressedMids = []; /** - * @param bool $reverse - * * @throws \Exception */ protected function _processNZBCompressedFiles(bool $reverse = false): void @@ -1033,7 +849,6 @@ class ProcessAdditional } if ($fetchedBinary !== false) { - // Echo we downloaded compressed file. if ($this->_echoCLI) { $this->_echo('(cB)', 'primaryOver'); @@ -1059,8 +874,6 @@ class ProcessAdditional /** * Check if the data is a ZIP / RAR file, extract files, get file info. * - * @param string $compressedData - * @return bool * * @throws \Exception */ @@ -1161,7 +974,6 @@ class ProcessAdditional /** * Get a list of all files in the compressed file, add the file info to the DB. * - * @return bool * * @throws \Exception */ @@ -1184,6 +996,7 @@ class ProcessAdditional if (config('app.debug') === true) { $this->_debug("Error: {$file['error']} (in: {$file['source']})"); } + continue; } @@ -1233,8 +1046,6 @@ class ProcessAdditional } /** - * @param $file - * * @throws \Exception */ protected function _addFileInfo(&$file): void @@ -1243,7 +1054,6 @@ class ProcessAdditional if (! isset($file['error']) && isset($file['source']) && ! preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name']) ) { - // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content. // This is so we don't download more RAR or ZIP files for no reason. $this->_totalFileInfo++; @@ -1251,8 +1061,7 @@ class ProcessAdditional /* Check if we already have the file or not. * Also make sure we don't add too many files, some releases have 100's of files, like PS3 releases. */ - if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file - ['size'], ])->first() === null) { + if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) { $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? ''); if (! empty($addReleaseFiles)) { $this->_addedFileInfo++; @@ -1292,7 +1101,6 @@ class ProcessAdditional // Go through all the files in the temp folder, look for compressed files, extract them and the nested ones. while ($nestedLevels < $this->_maxNestedLevels) { - // Break out if we checked more than x compressed files. if ($this->_compressedFilesChecked >= self::maxCompressedFilesToCheck) { break; @@ -1305,7 +1113,6 @@ class ProcessAdditional if ($files !== false) { foreach ($files as $file) { - // Check if the file exists. if (File::isFile($file[0])) { $rarData = @File::get($file[0]); @@ -1340,7 +1147,6 @@ class ProcessAdditional } if (File::isFile($file)) { - // Process PAR2 files. if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) { $this->_siftPAR2Info($file); @@ -1365,19 +1171,18 @@ class ProcessAdditional $output = Utility::fileInfo($file); if (! empty($output)) { switch (true) { - case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output): $this->_getJPGSample($file); File::delete($file); break; case - (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): + (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output): $this->_processVideoFile($file); break; case - (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): + (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType): switch ($fileType[0]) { case 'FLAC': $fileType = 'FLAC'; @@ -1432,7 +1237,6 @@ class ProcessAdditional // Download and process sample image. if (! $this->_foundSample || ! $this->_foundVideo) { if (! empty($this->_sampleMessageIDs)) { - // Download it from usenet. $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP); if ($this->_nntp::isError($sampleBinary)) { @@ -1566,7 +1370,6 @@ class ProcessAdditional { // Download JPG file. if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) { - // Try to download it. $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP); if ($this->_nntp::isError($jpgBinary)) { @@ -1648,7 +1451,7 @@ class ProcessAdditional $release = Release::query()->where('id', $this->_release->id); $release->decrement('passwordstatus'); $release->update( - $updateRows + $updateRows ); } // Else update the release with the password status (if the admin enabled the setting). else { @@ -1661,8 +1464,6 @@ class ProcessAdditional } /** - * @param string $pattern - * @param string $path * @return bool|string|\Symfony\Component\Finder\SplFileInfo[] */ protected function _getTempDirectoryContents(string $pattern = '', string $path = ''): array|bool|string @@ -1696,10 +1497,6 @@ class ProcessAdditional } /** - * @param $fileLocation - * @param $fileExtension - * @return bool - * * @throws \Exception */ protected function _getAudioInfo($fileLocation, $fileExtension): bool @@ -1722,23 +1519,21 @@ class ProcessAdditional $musicParent = (string) Category::MUSIC_ROOT; if ($rQuery === null || ! preg_match( sprintf( - '/%d\d{3}|%d|%d|%d/', - $musicParent[0], - Category::OTHER_MISC, - Category::MOVIE_OTHER, - Category::TV_OTHER - ), + '/%d\d{3}|%d|%d|%d/', + $musicParent[0], + Category::OTHER_MISC, + Category::MOVIE_OTHER, + Category::TV_OTHER + ), $rQuery->id - ) + ) ) { return false; } if (File::isFile($fileLocation)) { - // Check if media info is enabled. if (! $retVal) { - // Get the media info for the file. try { $xmlArray = $this->mediaInfo->getInfo($fileLocation, false); @@ -1814,7 +1609,6 @@ class ProcessAdditional // Check if creating audio samples is enabled. if (! $audVal) { - // File name to store audio file. $audioFileName = ($this->_release->guid.'.ogg'); @@ -1835,7 +1629,6 @@ class ProcessAdditional // Check if the new file was created. if (File::isFile($this->tmpPath.$audioFileName)) { - // Try to move the temp audio file. $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName); @@ -1872,8 +1665,6 @@ class ProcessAdditional /** * Try to get JPG picture, resize it and store it on disk. - * - * @param string $fileLocation */ protected function _getJPGSample(string $fileLocation): void { @@ -1894,10 +1685,6 @@ class ProcessAdditional } } - /** - * @param string $videoLocation - * @return string - */ private function getVideoTime(string $videoLocation): string { // Get the real duration of the file. @@ -1922,9 +1709,6 @@ class ProcessAdditional } /** - * @param string $fileLocation - * @return bool - * * @throws \Exception */ protected function _getSample(string $fileLocation): bool @@ -1934,7 +1718,6 @@ class ProcessAdditional } if (File::isFile($fileLocation)) { - // Create path to temp file. $fileName = ($this->tmpPath.'zzzz'.random_int(5, 12).random_int(5, 12).'.jpg'); @@ -1964,7 +1747,6 @@ class ProcessAdditional // Check if the file exists. if (File::isFile($fileName)) { - // Try to resize/move the image. $saved = $this->_releaseImage->saveImage( $this->_release->guid.'_thumb', @@ -1992,9 +1774,6 @@ class ProcessAdditional } /** - * @param string $fileLocation - * @return bool - * * @throws \Exception */ protected function _getVideo(string $fileLocation): bool @@ -2005,7 +1784,6 @@ class ProcessAdditional // Try to find an avi file. if (File::isFile($fileLocation)) { - // Create a filename to store the temp file. $fileName = ($this->tmpPath.'zzzz'.$this->_release->guid.'.ogv'); @@ -2073,7 +1851,6 @@ class ProcessAdditional // Until we find the video file. if (File::isFile($fileName)) { - // Create a path to where the file should be moved. $newFile = ($this->_releaseImage->vidSavePath.$this->_release->guid.'.ogv'); @@ -2108,9 +1885,6 @@ class ProcessAdditional } /** - * @param $fileLocation - * @return bool - * * @throws \Exception */ protected function _getMediaInfo($fileLocation): bool @@ -2158,8 +1932,6 @@ class ProcessAdditional } /** - * @param $fileLocation - * * @throws \Exception */ protected function _siftPAR2Info($fileLocation): void @@ -2205,7 +1977,6 @@ class ProcessAdditional if ($this->_addPAR2Files) { if ($filesAdded < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name']])->first() === null ) { - // Try to add the files to the DB. if (ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $postDate, 0, $file['hash_16K'])) { $filesAdded++; @@ -2230,8 +2001,6 @@ class ProcessAdditional } /** - * @param $fileLocation - * * @throws \Exception */ protected function _processNfoFile($fileLocation): void @@ -2243,8 +2012,6 @@ class ProcessAdditional } /** - * @param $fileLocation - * * @throws \Exception */ protected function _processVideoFile($fileLocation): void @@ -2270,10 +2037,6 @@ class ProcessAdditional /** * Comparison function for uSort, for sorting NZB files. - * - * @param array|string|null $a - * @param array|string|null $b - * @return int */ protected function _sortNZB(array|string|null $a, array|string|null $b): int { @@ -2379,7 +2142,6 @@ class ProcessAdditional /** * Echo a string to CLI. For debugging. * - * @param string $string * * @void */ diff --git a/Blacklight/processing/tv/TMDB.php b/Blacklight/processing/tv/TMDB.php index 5f2f2b59b..7c0df6806 100644 --- a/Blacklight/processing/tv/TMDB.php +++ b/Blacklight/processing/tv/TMDB.php @@ -19,33 +19,19 @@ class TMDB extends TV * @string URL for show poster art */ public string $posterUrl = ''; - /** - * @var ApiToken - */ + public ApiToken $token; - /** - * @var Client - */ + public Client $client; - /** - * @var ConfigurationRepository - */ + public ConfigurationRepository $configRepository; - /** - * @var \Tmdb\Model\Configuration - */ + public \Tmdb\Model\Configuration $config; - /** - * @var ImageHelper - */ + public ImageHelper $helper; /** * Fetch banner from site. - * - * @param $videoId - * @param $siteID - * @return bool */ public function getBanner($videoId, $siteID): bool { @@ -56,9 +42,6 @@ class TMDB extends TV * Main processing director function for TMDB * Calls work query function and initiates processing. * - * @param $groupID - * @param $guidChar - * @param $process * @param bool $local */ public function processSite($groupID, $guidChar, $process, $local = false): void @@ -90,6 +73,7 @@ class TMDB extends TV $this->colorCli->header(' already failed lookup for this site. Skipping.', true); } $this->setVideoNotFound(parent::PROCESS_TRAKT, $row['id']); + continue; } @@ -144,6 +128,7 @@ class TMDB extends TV // Set the video ID and leave episode 0 $this->setVideoIdFound($videoId, $row['id'], 0); $this->colorCli->primary('Found TMDB Match for Full Season!', true); + continue; } @@ -221,8 +206,6 @@ class TMDB extends TV } /** - * @param array $shows - * @param string $cleanName * @return array|false */ private function matchShowInfo(array $shows, string $cleanName): bool|array @@ -277,7 +260,6 @@ class TMDB extends TV * Retrieves the poster art for the processed show. * * @param int $videoId -- the local Video ID - * @return int */ public function getPoster($videoId): int { @@ -332,9 +314,6 @@ class TMDB extends TV /** * Assigns API show response values to a formatted array for insertion * Returns the formatted array. - * - * @param $show - * @return array */ protected function formatShowInfo($show): array { @@ -345,20 +324,20 @@ class TMDB extends TV } return [ - 'type' => parent::TYPE_TV, - 'title' => (string) $show['name'], - 'summary' => (string) $show['overview'], - 'started' => (string) $show['first_air_date'], + 'type' => parent::TYPE_TV, + 'title' => (string) $show['name'], + 'summary' => (string) $show['overview'], + 'started' => (string) $show['first_air_date'], 'publisher' => isset($show['network']) ? (string) $show['network'] : '', - 'country' => $show['origin_country'][0] ?? '', - 'source' => parent::SOURCE_TMDB, - 'imdb' => isset($imdb['imdbid']) ? (int) $imdb['imdbid'] : 0, - 'tvdb' => isset($show['external_ids']['tvdb_id']) ? (int) $show['external_ids']['tvdb_id'] : 0, - 'trakt' => 0, - 'tvrage' => isset($show['external_ids']['tvrage_id']) ? (int) $show['external_ids']['tvrage_id'] : 0, - 'tvmaze' => 0, - 'tmdb' => (int) $show['id'], - 'aliases' => ! empty($show['alternative_titles']) ? (array) $show['alternative_titles'] : '', + 'country' => $show['origin_country'][0] ?? '', + 'source' => parent::SOURCE_TMDB, + 'imdb' => isset($imdb['imdbid']) ? (int) $imdb['imdbid'] : 0, + 'tvdb' => isset($show['external_ids']['tvdb_id']) ? (int) $show['external_ids']['tvdb_id'] : 0, + 'trakt' => 0, + 'tvrage' => isset($show['external_ids']['tvrage_id']) ? (int) $show['external_ids']['tvrage_id'] : 0, + 'tvmaze' => 0, + 'tmdb' => (int) $show['id'], + 'aliases' => ! empty($show['alternative_titles']) ? (array) $show['alternative_titles'] : '', 'localzone' => "''", ]; } @@ -366,9 +345,6 @@ class TMDB extends TV /** * Assigns API episode response values to a formatted array for insertion * Returns the formatted array. - * - * @param $episode - * @return array */ #[ArrayShape([ 'title' => 'string', @@ -379,14 +355,14 @@ class TMDB extends TV 'summary' => 'string', ])] protected function formatEpisodeInfo($episode): array - { - return [ - 'title' => (string) $episode['name'], - 'series' => (int) $episode['season_number'], - 'episode' => (int) $episode['episode_number'], - 'se_complete' => 'S'.sprintf('%02d', $episode['season_number']).'E'.sprintf('%02d', $episode['episode_number']), - 'firstaired' => (string) $episode['air_date'], - 'summary' => (string) $episode['overview'], - ]; - } + { + return [ + 'title' => (string) $episode['name'], + 'series' => (int) $episode['season_number'], + 'episode' => (int) $episode['episode_number'], + 'se_complete' => 'S'.sprintf('%02d', $episode['season_number']).'E'.sprintf('%02d', $episode['episode_number']), + 'firstaired' => (string) $episode['air_date'], + 'summary' => (string) $episode['overview'], + ]; + } } diff --git a/Blacklight/processing/tv/TV.php b/Blacklight/processing/tv/TV.php index bfa0538fd..a50eaecc2 100755 --- a/Blacklight/processing/tv/TV.php +++ b/Blacklight/processing/tv/TV.php @@ -21,10 +21,15 @@ abstract class TV extends Videos { // Television Sources protected const SOURCE_NONE = 0; // No Scrape source + protected const SOURCE_TVDB = 1; // Scrape source was TVDB + protected const SOURCE_TVMAZE = 2; // Scrape source was TVMAZE + protected const SOURCE_TMDB = 3; // Scrape source was TMDB + protected const SOURCE_TRAKT = 4; // Scrape source was Trakt + protected const SOURCE_IMDB = 5; // Scrape source was IMDB // Anime Sources @@ -32,11 +37,17 @@ abstract class TV extends Videos // Processing signifiers protected const PROCESS_TVDB = 0; // Process TVDB First + protected const PROCESS_TVMAZE = -1; // Process TVMaze Second + protected const PROCESS_TMDB = -2; // Process TMDB Third + protected const PROCESS_TRAKT = -3; // Process Trakt Fourth + protected const PROCESS_IMDB = -4; // Process IMDB Fifth + protected const NO_MATCH_FOUND = -6; // Failed All Methods + protected const FAILED_PARSE = -100; // Failed Parsing /** @@ -67,7 +78,6 @@ abstract class TV extends Videos /** * TV constructor. * - * @param array $options * * @throws \Exception */ @@ -84,8 +94,6 @@ abstract class TV extends Videos /** * Retrieve banner image from site using its API. * - * @param $videoID - * @param $siteId * @return mixed */ abstract protected function getBanner($videoID, $siteId); @@ -104,7 +112,6 @@ abstract class TV extends Videos * Retrieve poster image for TV episode from site using its API. * * @param int $videoId ID from videos table. - * @return int */ abstract protected function getPoster($videoId): int; @@ -119,18 +126,12 @@ abstract class TV extends Videos /** * Assigns API show response values to a formatted array for insertion * Returns the formatted array. - * - * @param $show - * @return array */ abstract protected function formatShowInfo($show): array; /** * Assigns API episode response values to a formatted array for insertion * Returns the formatted array. - * - * @param $episode - * @return array */ abstract protected function formatEpisodeInfo($episode): array; @@ -174,8 +175,6 @@ abstract class TV extends Videos /** * Updates the release when match for the current scraper is found. * - * @param $videoId - * @param $releaseId * @param int $episodeId */ public function setVideoIdFound($videoId, $releaseId, $episodeId): void @@ -187,9 +186,6 @@ abstract class TV extends Videos /** * Updates the release tv_episodes_id status when scraper match is not found. - * - * @param $status - * @param $Id */ public function setVideoNotFound($status, $Id): void { @@ -201,9 +197,6 @@ abstract class TV extends Videos /** * Inserts a new video ID into the database for TV shows * If a duplicate is found it is handle by calling update instead. - * - * @param array $show - * @return int */ public function add(array $show = []): int { @@ -265,8 +258,6 @@ abstract class TV extends Videos /** * Inserts a new TV episode into the tv_episodes table following a match to a Video ID. * - * @param $videoId - * @param array $episode * @return false|int */ public function addEpisode($videoId, array $episode = []) @@ -295,7 +286,6 @@ abstract class TV extends Videos * Only called when a duplicate show is found during insert. * * @param int $videoId - * @param array $show */ public function update($videoId, array $show = []): void { @@ -308,25 +298,25 @@ abstract class TV extends Videos DB::update( sprintf( - ' + ' UPDATE videos v LEFT JOIN tv_info tvi ON v.id = tvi.videos_id SET v.countries_id = %s, v.tvdb = %s, v.trakt = %s, v.tvrage = %s, v.tvmaze = %s, v.imdb = %s, v.tmdb = %s, tvi.summary = %s, tvi.publisher = %s, tvi.localzone = %s WHERE v.id = %d', - sprintf($ifStringInfo, 'v.countries_id', escapeString($show['country']), 'v.countries_id'), - sprintf($ifStringID, 'v.tvdb', $show['tvdb'], 'v.tvdb'), - sprintf($ifStringID, 'v.trakt', $show['trakt'], 'v.trakt'), - sprintf($ifStringID, 'v.tvrage', $show['tvrage'], 'v.tvrage'), - sprintf($ifStringID, 'v.tvmaze', $show['tvmaze'], 'v.tvmaze'), - sprintf($ifStringID, 'v.imdb', $show['imdb'], 'v.imdb'), - sprintf($ifStringID, 'v.tmdb', $show['tmdb'], 'v.tmdb'), - sprintf($ifStringInfo, 'tvi.summary', escapeString($show['summary']), 'tvi.summary'), - sprintf($ifStringInfo, 'tvi.publisher', escapeString($show['publisher']), 'tvi.publisher'), - sprintf($ifStringInfo, 'tvi.localzone', escapeString($show['localzone']), 'tvi.localzone'), - $videoId - ) + sprintf($ifStringInfo, 'v.countries_id', escapeString($show['country']), 'v.countries_id'), + sprintf($ifStringID, 'v.tvdb', $show['tvdb'], 'v.tvdb'), + sprintf($ifStringID, 'v.trakt', $show['trakt'], 'v.trakt'), + sprintf($ifStringID, 'v.tvrage', $show['tvrage'], 'v.tvrage'), + sprintf($ifStringID, 'v.tvmaze', $show['tvmaze'], 'v.tvmaze'), + sprintf($ifStringID, 'v.imdb', $show['imdb'], 'v.imdb'), + sprintf($ifStringID, 'v.tmdb', $show['tmdb'], 'v.tmdb'), + sprintf($ifStringInfo, 'tvi.summary', escapeString($show['summary']), 'tvi.summary'), + sprintf($ifStringInfo, 'tvi.publisher', escapeString($show['publisher']), 'tvi.publisher'), + sprintf($ifStringInfo, 'tvi.localzone', escapeString($show['localzone']), 'tvi.localzone'), + $videoId + ) ); if (! empty($show['aliases'])) { $this->addAliases($videoId, $show['aliases']); @@ -337,7 +327,6 @@ abstract class TV extends Videos * Deletes a TV show entirely from all child tables via the Video ID. * * - * @param $id * @return mixed * * @throws \Throwable @@ -362,8 +351,6 @@ abstract class TV extends Videos /** * Sets the TV show's image column to found (1). - * - * @param $videoId */ public function setCoverFound($videoId): void { @@ -375,8 +362,6 @@ abstract class TV extends Videos * Returns the ID value or false if none found. * * - * @param $column - * @param $id * @return bool|\Illuminate\Database\Eloquent\Model|mixed|null|static */ public function getSiteByID($column, $id) @@ -398,9 +383,6 @@ abstract class TV extends Videos * * Returns the Episode ID or false if not found * - * @param $id - * @param $series - * @param $episode * @param string $airdate * @return int|false */ @@ -431,10 +413,6 @@ abstract class TV extends Videos /** * Returns (true) if episodes for a given Video ID exist or don't (false). - * - * - * @param $videoId - * @return bool */ public function countEpsByVideoID($videoId): bool { @@ -448,7 +426,6 @@ abstract class TV extends Videos * Parses a release searchname for specific TV show data * Returns an array of show data. * - * @param $relname * @return array|false */ public function parseInfo($relname) @@ -456,7 +433,6 @@ abstract class TV extends Videos $showInfo['name'] = $this->parseName($relname); if (! empty($showInfo['name'])) { - // Retrieve the country from the cleaned name $showInfo['country'] = $this->parseCountry($showInfo['name']); @@ -522,7 +498,6 @@ abstract class TV extends Videos /** * Parses the release searchname for the season/episode/airdate information. * - * @param $relname * @return array */ private function parseSeasonEp($relname) @@ -613,7 +588,6 @@ abstract class TV extends Videos * Parses the cleaned release name to determine if it has a country appended. * * @param string $showName - * @return string */ private function parseCountry($showName): string { @@ -642,9 +616,6 @@ abstract class TV extends Videos * Supplementary to parseInfo * Cleans a derived local 'showname' for better matching probability * Returns the cleaned string. - * - * @param $str - * @return string */ public function cleanName($str): string { @@ -673,9 +644,6 @@ abstract class TV extends Videos * Simple function that compares two strings of text * Returns percentage of similarity. * - * @param $ourName - * @param $scrapeName - * @param $probability * @return int|float */ public function checkMatch($ourName, $scrapeName, $probability) @@ -698,7 +666,6 @@ abstract class TV extends Videos * Could this be a mistake? i.e. trying to solve the mm-dd-yyyy/dd-mm-yyyy confusion into a yyyy-mm-dd? * * @param string|bool|null $date - * @return string */ public function checkDate($date): string { @@ -718,10 +685,6 @@ abstract class TV extends Videos /** * Checks API response returns have all REQUIRED attributes set * Returns true or false. - * - * @param $array - * @param string $type - * @return bool */ public function checkRequiredAttr($array, string $type): bool { diff --git a/Blacklight/processing/tv/TVDB.php b/Blacklight/processing/tv/TVDB.php index b6c476313..15e2caaab 100755 --- a/Blacklight/processing/tv/TVDB.php +++ b/Blacklight/processing/tv/TVDB.php @@ -14,9 +14,6 @@ class TVDB extends TV { private const MATCH_PROBABILITY = 75; - /** - * @var \CanIHaveSomeCoffee\TheTVDbAPI\TheTVDbAPI - */ public TheTVDbAPI $client; /** @@ -37,7 +34,6 @@ class TVDB extends TV /** * TVDB constructor. * - * @param array $options * * @throws \Exception */ @@ -65,9 +61,6 @@ class TVDB extends TV * Main processing director function for scrapers * Calls work query function and initiates processing. * - * @param $groupID - * @param $guidChar - * @param $process * @param bool $local */ public function processSite($groupID, $guidChar, $process, $local = false): void @@ -95,6 +88,7 @@ class TVDB extends TV $this->colorCli->header(' already failed lookup for this site. Skipping.', true); } $this->setVideoNotFound(parent::PROCESS_TVMAZE, $row['id']); + continue; } @@ -112,8 +106,7 @@ class TVDB extends TV } if ($tvDbId === false && $lookupSetting) { - - // If it doesnt exist locally and lookups are allowed lets try to get it. + // If it doesnt exist locally and lookups are allowed lets try to get it. if ($this->echooutput) { $this->colorCli->primaryOver('Video ID for '). $this->colorCli->headerOver($release['cleanname']). @@ -125,7 +118,7 @@ class TVDB extends TV isset($release['country']) && \strlen($release['country']) === 2 ? (string) $release['country'] : '' - ); + ); // Get the show from TVDB $tvdbShow = $this->getShowInfo((string) $release['cleanname'], $country); @@ -153,6 +146,7 @@ class TVDB extends TV // Set the video ID and leave episode 0 $this->setVideoIdFound($videoId, $row['id'], 0); $this->colorCli->primary('Found TVDB Match for Full Season!', true); + continue; } @@ -171,7 +165,7 @@ class TVDB extends TV $seasonNo, $episodeNo, $release['airdate'] - ); + ); if ($tvdbEpisode) { $episode = $this->addEpisode($videoId, $tvdbEpisode); @@ -204,10 +198,6 @@ class TVDB extends TV /** * Placeholder for Videos getBanner. - * - * @param $videoID - * @param $siteId - * @return bool */ protected function getBanner($videoID, $siteId): bool { @@ -286,7 +276,6 @@ class TVDB extends TV * Retrieves the poster art for the processed show. * * @param int $videoId -- the local Video ID - * @return int */ public function getPoster($videoId): int { @@ -375,20 +364,20 @@ class TVDB extends TV } return [ - 'type' => parent::TYPE_TV, - 'title' => (string) $show->name, - 'summary' => (string) $show->overview, - 'started' => $show->first_air_time, + 'type' => parent::TYPE_TV, + 'title' => (string) $show->name, + 'summary' => (string) $show->overview, + 'started' => $show->first_air_time, 'publisher' => $imdbId->originalNetwork->name ?? '', - 'poster' => $this->posterUrl, - 'source' => parent::SOURCE_TVDB, - 'imdb' => (int) ($imdb['imdbid'] ?? 0), - 'tvdb' => (int) $show->tvdb_id, - 'trakt' => 0, - 'tvrage' => 0, - 'tvmaze' => 0, - 'tmdb' => 0, - 'aliases' => ! empty($show->aliases) ? $show->aliases : '', + 'poster' => $this->posterUrl, + 'source' => parent::SOURCE_TVDB, + 'imdb' => (int) ($imdb['imdbid'] ?? 0), + 'tvdb' => (int) $show->tvdb_id, + 'trakt' => 0, + 'tvrage' => 0, + 'tvmaze' => 0, + 'tmdb' => 0, + 'aliases' => ! empty($show->aliases) ? $show->aliases : '', 'localzone' => "''", ]; } @@ -396,19 +385,16 @@ class TVDB extends TV /** * Assigns API episode response values to a formatted array for insertion * Returns the formatted array. - * - * @param $episode - * @return array */ protected function formatEpisodeInfo($episode): array - { - return [ - 'title' => (string) $episode->name, - 'series' => (int) $episode->seasonNumber, - 'episode' => (int) $episode->number, - 'se_complete' => 'S'.sprintf('%02d', $episode->seasonNumber).'E'.sprintf('%02d', $episode->number), - 'firstaired' => $episode->aired, - 'summary' => (string) $episode->overview, - ]; - } + { + return [ + 'title' => (string) $episode->name, + 'series' => (int) $episode->seasonNumber, + 'episode' => (int) $episode->number, + 'se_complete' => 'S'.sprintf('%02d', $episode->seasonNumber).'E'.sprintf('%02d', $episode->number), + 'firstaired' => $episode->aired, + 'summary' => (string) $episode->overview, + ]; + } } diff --git a/Blacklight/processing/tv/TVMaze.php b/Blacklight/processing/tv/TVMaze.php index 2d6b2396c..45d0bc0cb 100644 --- a/Blacklight/processing/tv/TVMaze.php +++ b/Blacklight/processing/tv/TVMaze.php @@ -29,7 +29,6 @@ class TVMaze extends TV /** * TVMaze constructor. * - * @param array $options * * @throws \Exception */ @@ -41,10 +40,6 @@ class TVMaze extends TV /** * Fetch banner from site. - * - * @param $videoId - * @param $siteID - * @return bool */ public function getBanner($videoId, $siteID): bool { @@ -55,9 +50,6 @@ class TVMaze extends TV * Main processing director function for scrapers * Calls work query function and initiates processing. * - * @param $groupID - * @param $guidChar - * @param $process * @param bool $local */ public function processSite($groupID, $guidChar, $process, $local = false): void @@ -87,6 +79,7 @@ class TVMaze extends TV $this->colorCli->header(' already failed lookup for this site. Skipping.', true); } $this->setVideoNotFound(parent::PROCESS_TMDB, $row['id']); + continue; } @@ -144,6 +137,7 @@ class TVMaze extends TV // Set the video ID and leave episode 0 $this->setVideoIdFound($videoId, $row['id'], 0); $this->colorCli->primary('Found TVMaze Match for Full Season!', true); + continue; } @@ -198,8 +192,6 @@ class TVMaze extends TV * Calls the API to lookup the TvMaze info for a given TVDB or TVRage ID * Returns a formatted array of show data or false if no match. * - * @param $site - * @param $siteId * @return array|false */ protected function getShowInfoBySiteID($site, $siteId) @@ -258,8 +250,6 @@ class TVMaze extends TV } /** - * @param $shows - * @param $cleanName * @return array|false */ private function matchShowInfo(array $shows, $cleanName) @@ -307,7 +297,6 @@ class TVMaze extends TV * Retrieves the poster art for the processed show. * * @param int $videoId -- the local Video ID - * @return int */ public function getPoster($videoId): int { @@ -379,29 +368,26 @@ class TVMaze extends TV /** * Assigns API show response values to a formatted array for insertion * Returns the formatted array. - * - * @param $show - * @return array */ protected function formatShowInfo($show): array { $this->posterUrl = (string) ($show->mediumImage ?? ''); return [ - 'type' => parent::TYPE_TV, - 'title' => (string) $show->name, - 'summary' => (string) $show->summary, - 'started' => (string) $show->premiered, + 'type' => parent::TYPE_TV, + 'title' => (string) $show->name, + 'summary' => (string) $show->summary, + 'started' => (string) $show->premiered, 'publisher' => (string) $show->network, - 'country' => (string) $show->country, - 'source' => parent::SOURCE_TVMAZE, - 'imdb' => 0, - 'tvdb' => (int) ($show->externalIDs['thetvdb'] ?? 0), - 'tvmaze' => (int) $show->id, - 'trakt' => 0, - 'tvrage' => (int) ($show->externalIDs['tvrage'] ?? 0), - 'tmdb' => 0, - 'aliases' => ! empty($show->akas) ? (array) $show->akas : '', + 'country' => (string) $show->country, + 'source' => parent::SOURCE_TVMAZE, + 'imdb' => 0, + 'tvdb' => (int) ($show->externalIDs['thetvdb'] ?? 0), + 'tvmaze' => (int) $show->id, + 'trakt' => 0, + 'tvrage' => (int) ($show->externalIDs['tvrage'] ?? 0), + 'tmdb' => 0, + 'aliases' => ! empty($show->akas) ? (array) $show->akas : '', 'localzone' => "''", ]; } @@ -409,19 +395,16 @@ class TVMaze extends TV /** * Assigns API episode response values to a formatted array for insertion * Returns the formatted array. - * - * @param $episode - * @return array */ protected function formatEpisodeInfo($episode): array { return [ - 'title' => (string) $episode->name, - 'series' => (int) $episode->season, - 'episode' => (int) $episode->number, + 'title' => (string) $episode->name, + 'series' => (int) $episode->season, + 'episode' => (int) $episode->number, 'se_complete' => 'S'.sprintf('%02d', $episode->season).'E'.sprintf('%02d', $episode->number), - 'firstaired' => (string) $episode->airdate, - 'summary' => (string) $episode->summary, + 'firstaired' => (string) $episode->airdate, + 'summary' => (string) $episode->summary, ]; } } diff --git a/Blacklight/processing/tv/TraktTv.php b/Blacklight/processing/tv/TraktTv.php index e50312f7f..7e99ff91b 100755 --- a/Blacklight/processing/tv/TraktTv.php +++ b/Blacklight/processing/tv/TraktTv.php @@ -20,9 +20,6 @@ class TraktTv extends TV */ public $client; - /** - * @var - */ public $time; /** @@ -68,9 +65,6 @@ class TraktTv extends TV * Main processing director function for scrapers * Calls work query function and initiates processing. * - * @param $groupID - * @param $guidChar - * @param $process * @param bool $local */ public function processSite($groupID, $guidChar, $process, $local = false): void @@ -98,6 +92,7 @@ class TraktTv extends TV $this->colorCli->header(' already failed lookup for this site. Skipping.', true); } $this->setVideoNotFound(parent::PROCESS_IMDB, $row['id']); + continue; } @@ -112,7 +107,6 @@ class TraktTv extends TV } if ($videoId === false && $lookupSetting) { - // If it doesn't exist locally and lookups are allowed lets try to get it. if ($this->echooutput) { $this->colorCli->primaryOver('Checking Trakt for previously failed title: '). @@ -148,6 +142,7 @@ class TraktTv extends TV // Set the video ID and leave episode 0 $this->setVideoIdFound($videoId, $row['id'], 0); $this->colorCli->primary('Found TRAKT Match for Full Season!', true); + continue; } @@ -194,10 +189,6 @@ class TraktTv extends TV /** * Fetch banner from site. - * - * @param $videoId - * @param $siteID - * @return bool */ public function getBanner($videoId, $siteID): bool { @@ -237,7 +228,6 @@ class TraktTv extends TV * Retrieve poster image for TV episode from site using its API. * * @param int $videoId ID from videos table. - * @return int */ public function getPoster($videoId): int { @@ -285,7 +275,6 @@ class TraktTv extends TV if (\is_array($response)) { foreach ($response as $show) { if (! is_bool($show)) { - // Check for exact title match first and then terminate if found if ($show['show']['title'] === $name) { $highest = $show; @@ -316,9 +305,6 @@ class TraktTv extends TV /** * Assigns API show response values to a formatted array for insertion * Returns the formatted array. - * - * @param $show - * @return array */ public function formatShowInfo($show): array { @@ -328,20 +314,20 @@ class TraktTv extends TV $this->localizedTZ = $show['airs']['timezone']; return [ - 'type' => parent::TYPE_TV, - 'title' => (string) $show['title'], - 'summary' => (string) $show['overview'], - 'started' => Time::localizeAirdate($show['first_aired'], $this->localizedTZ), + 'type' => parent::TYPE_TV, + 'title' => (string) $show['title'], + 'summary' => (string) $show['overview'], + 'started' => Time::localizeAirdate($show['first_aired'], $this->localizedTZ), 'publisher' => (string) $show['network'], - 'country' => (string) $show['country'], - 'source' => parent::SOURCE_TRAKT, - 'imdb' => $imdb['imdbid'] ?? 0, - 'tvdb' => $show['ids']['tvdb'] ?? 0, - 'trakt' => (int) $show['ids']['trakt'], - 'tvrage' => $show['ids']['tvrage'] ?? 0, - 'tvmaze' => 0, - 'tmdb' => $show['ids']['tmdb'] ?? 0, - 'aliases' => isset($show['aliases']) && ! empty($show['aliases']) ? (array) $show['aliases'] : '', + 'country' => (string) $show['country'], + 'source' => parent::SOURCE_TRAKT, + 'imdb' => $imdb['imdbid'] ?? 0, + 'tvdb' => $show['ids']['tvdb'] ?? 0, + 'trakt' => (int) $show['ids']['trakt'], + 'tvrage' => $show['ids']['tvrage'] ?? 0, + 'tvmaze' => 0, + 'tmdb' => $show['ids']['tmdb'] ?? 0, + 'aliases' => isset($show['aliases']) && ! empty($show['aliases']) ? (array) $show['aliases'] : '', 'localzone' => $this->localizedTZ, ]; } @@ -349,19 +335,16 @@ class TraktTv extends TV /** * Assigns API episode response values to a formatted array for insertion * Returns the formatted array. - * - * @param $episode - * @return array */ public function formatEpisodeInfo($episode): array { return [ - 'title' => (string) $episode['title'], - 'series' => (int) $episode['season'], - 'episode' => (int) $episode['epsiode'], + 'title' => (string) $episode['title'], + 'series' => (int) $episode['season'], + 'episode' => (int) $episode['epsiode'], 'se_complete' => 'S'.sprintf('%02d', $episode['season']).'E'.sprintf('%02d', $episode['episode']), - 'firstaired' => Time::localizeAirdate($episode['first_aired'], $this->localizedTZ), - 'summary' => (string) $episode['overview'], + 'firstaired' => Time::localizeAirdate($episode['first_aired'], $this->localizedTZ), + 'summary' => (string) $episode['overview'], ]; } } diff --git a/Blacklight/utility/Time.php b/Blacklight/utility/Time.php index e1fad7ef1..17cfd43b0 100755 --- a/Blacklight/utility/Time.php +++ b/Blacklight/utility/Time.php @@ -35,7 +35,6 @@ class Time * * @param string $time * @param string $zone - * @return string */ public static function localizeAirdate($time = '', $zone = ''): string { diff --git a/Blacklight/utility/Utility.php b/Blacklight/utility/Utility.php index 6086c7f83..853e881a1 100755 --- a/Blacklight/utility/Utility.php +++ b/Blacklight/utility/Utility.php @@ -20,9 +20,6 @@ class Utility } } - /** - * @return array - */ public static function getThemesList(): array { $ignoredThemes = ['admin', 'shared']; @@ -41,10 +38,6 @@ class Utility /** * Detect if the command is accessible on the system. - * - * - * @param $cmd - * @return bool */ public static function hasCommand($cmd): bool { @@ -55,8 +48,6 @@ class Utility /** * Check if user is running from CLI. - * - * @return bool */ public static function isCLI(): bool { @@ -82,7 +73,6 @@ class Utility /** * Unzip a gzip file, return the output. Return false on error / empty. * - * @param string $filePath * @return bool|string */ public static function unzipGzipFile(string $filePath) @@ -106,9 +96,6 @@ class Utility return $string === '' ? false : $string; } - /** - * @param $path - */ public static function setCoversConstant($path): void { if (! \defined('NN_COVERS')) { @@ -131,21 +118,21 @@ class Utility * when connecting to a tls or ssl connection when using stream functions (fopen/file_get_contents/etc). * * @param bool $forceIgnore Force ignoring of verification. - * @return array + * * @static */ public static function streamSslContextOptions(bool $forceIgnore = false): array { if (config('nntmux_ssl.ssl_cafile') === '' && config('nntmux_ssl.ssl_capath') === '') { $options = [ - 'verify_peer' => false, - 'verify_peer_name' => false, + 'verify_peer' => false, + 'verify_peer_name' => false, 'allow_self_signed' => true, ]; } else { $options = [ - 'verify_peer' => $forceIgnore ? false : config('nntmux_ssl.ssl_verify_peer'), - 'verify_peer_name' => $forceIgnore ? false : config('nntmux_ssl.ssl_verify_host'), + 'verify_peer' => $forceIgnore ? false : config('nntmux_ssl.ssl_verify_peer'), + 'verify_peer_name' => $forceIgnore ? false : config('nntmux_ssl.ssl_verify_host'), 'allow_self_signed' => $forceIgnore ? true : config('nntmux_ssl.ssl_allow_self_signed'), ]; if (config('nntmux_ssl.ssl_cafile') !== '') { @@ -161,16 +148,12 @@ class Utility return ['tls' => $options, 'ssl' => $options]; } - /** - * @param array $options - * @return string - */ public static function getCoverURL(array $options = []): string { $defaults = [ - 'id' => null, + 'id' => null, 'suffix' => '-cover.jpg', - 'type' => '', + 'type' => '', ]; $options += $defaults; $fileSpecTemplate = '%s/%s%s'; @@ -180,7 +163,7 @@ class Utility $options['type'], ['anime', 'audio', 'audiosample', 'book', 'console', 'games', 'movies', 'music', 'preview', 'sample', 'tvrage', 'video', 'xxx'], false - ) + ) ) { $fileSpec = sprintf($fileSpecTemplate, $options['type'], $options['id'], $options['suffix']); $fileSpec = file_exists(NN_COVERS.$fileSpec) ? $fileSpec : @@ -196,7 +179,6 @@ class Utility * @author Tamlyn from Outlandish.com * * @param \SimpleXMLElement $xml The SimpleXML parsed XML string data - * @param array $options * @return array The associate array of the XML namespaced file */ public static function xmlToArray(\SimpleXMLElement $xml, array $options = []): array @@ -311,9 +293,6 @@ class Utility /** * Convert Code page 437 chars to UTF. - * - * @param string $string - * @return string */ public static function cp437toUTF(string $string): string { @@ -322,9 +301,6 @@ class Utility /** * Fetches an embeddable video to a IMDB trailer from http://www.traileraddict.com. - * - * @param $imdbID - * @return string */ public static function imdb_trailers($imdbID): string { @@ -338,9 +314,6 @@ class Utility /** * Display error/error code. - * - * @param int $errorCode - * @param string $errorText */ public static function showApiError(int $errorCode = 900, string $errorText = ''): void { @@ -431,19 +404,12 @@ class Utility /** * Simple function to reduce duplication in html string formatting. - * - * @param $string - * @return string */ public static function htmlfmt($string): string { return htmlspecialchars($string, ENT_QUOTES, 'utf-8'); } - /** - * @param $tableName - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - */ public static function getRange($tableName): LengthAwarePaginator { $range = DB::table($tableName); @@ -454,10 +420,6 @@ class Utility return $range->orderByDesc('created_at')->paginate(config('nntmux.items_per_page')); } - /** - * @param $tableName - * @return int - */ public static function getCount($tableName): int { $res = DB::table($tableName)->count('id'); diff --git a/app/Console/Commands/FixturesDown.php b/app/Console/Commands/FixturesDown.php index fc301455f..8edb63544 100644 --- a/app/Console/Commands/FixturesDown.php +++ b/app/Console/Commands/FixturesDown.php @@ -22,6 +22,7 @@ class FixturesDown extends Command 'release_naming_regexes', 'settings', ]; + /** * The name and signature of the console command. * diff --git a/app/Console/Commands/FixturesUp.php b/app/Console/Commands/FixturesUp.php index a795c437b..072ddf3d7 100644 --- a/app/Console/Commands/FixturesUp.php +++ b/app/Console/Commands/FixturesUp.php @@ -21,6 +21,7 @@ class FixturesUp extends Command 'release_naming_regexes', 'settings', ]; + /** * The name and signature of the console command. * diff --git a/app/Console/Commands/InstallNntmux.php b/app/Console/Commands/InstallNntmux.php index fed271a0a..304597a95 100644 --- a/app/Console/Commands/InstallNntmux.php +++ b/app/Console/Commands/InstallNntmux.php @@ -133,9 +133,6 @@ class InstallNntmux extends Command ]; } - /** - * @return bool - */ private function addAdminUser(): bool { if (config('nntmux.admin_username') === '' || config('nntmux.admin_password') === '' || config('nntmux.admin_email') === '') { diff --git a/app/Console/Commands/NntmuxResetDb.php b/app/Console/Commands/NntmuxResetDb.php index 90b9e21f4..5db6de8d4 100644 --- a/app/Console/Commands/NntmuxResetDb.php +++ b/app/Console/Commands/NntmuxResetDb.php @@ -93,7 +93,7 @@ class NntmuxResetDb extends Command } $releases_index = [ 'index' => 'releases', - 'body' => [ + 'body' => [ 'settings' => [ 'number_of_shards' => 2, 'number_of_replicas' => 0, @@ -137,7 +137,7 @@ class NntmuxResetDb extends Command } $predb_index = [ 'index' => 'predb', - 'body' => [ + 'body' => [ 'settings' => [ 'number_of_shards' => 2, 'number_of_replicas' => 0, diff --git a/app/Console/Commands/NntmuxResetPostProcessing.php b/app/Console/Commands/NntmuxResetPostProcessing.php index 27a273c27..bdcef3350 100644 --- a/app/Console/Commands/NntmuxResetPostProcessing.php +++ b/app/Console/Commands/NntmuxResetPostProcessing.php @@ -23,6 +23,7 @@ class NntmuxResetPostProcessing extends Command 'book', 'misc', ]; + /** * The name and signature of the console command. * @@ -36,6 +37,7 @@ class NntmuxResetPostProcessing extends Command * @var string */ protected $description = 'Reset all, multiple or single release category postprocessing'; + /** * @var ColorCLI */ diff --git a/app/Console/Commands/TmuxUIStart.php b/app/Console/Commands/TmuxUIStart.php index 769d6ec38..7a09fd47a 100644 --- a/app/Console/Commands/TmuxUIStart.php +++ b/app/Console/Commands/TmuxUIStart.php @@ -3,7 +3,6 @@ namespace App\Console\Commands; use App\Models\Settings; -use Blacklight\ColorCLI; use Blacklight\Tmux; use Illuminate\Console\Command; use Illuminate\Support\Facades\Process; diff --git a/app/Console/Commands/UpdateNNTmux.php b/app/Console/Commands/UpdateNNTmux.php index 25ea967f2..99c2d118e 100644 --- a/app/Console/Commands/UpdateNNTmux.php +++ b/app/Console/Commands/UpdateNNTmux.php @@ -80,9 +80,6 @@ class UpdateNNTmux extends Command } } - /** - * @return bool - */ private function appDown(): bool { if (App::isDownForMaintenance() === false) { @@ -94,9 +91,6 @@ class UpdateNNTmux extends Command return false; } - /** - * @return bool - */ private function stopTmux(): bool { if ((new Tmux())->isRunning() === true) { diff --git a/app/Console/Commands/UpdateNNTmuxComposer.php b/app/Console/Commands/UpdateNNTmuxComposer.php index 89bbd5a0c..f0de87211 100644 --- a/app/Console/Commands/UpdateNNTmuxComposer.php +++ b/app/Console/Commands/UpdateNNTmuxComposer.php @@ -29,17 +29,11 @@ class UpdateNNTmuxComposer extends Command parent::__construct(); } - /** - * @return void - */ public function handle(): void { $this->composer(); } - /** - * @return void - */ protected function composer(): void { $this->output->writeln('Running composer install process...'); diff --git a/app/Console/Commands/UpdateNNTmuxGit.php b/app/Console/Commands/UpdateNNTmuxGit.php index c1811d93b..1d30591cc 100644 --- a/app/Console/Commands/UpdateNNTmuxGit.php +++ b/app/Console/Commands/UpdateNNTmuxGit.php @@ -30,12 +30,8 @@ class UpdateNNTmuxGit extends Command parent::__construct(); } - /** - * @return void - */ public function handle(): void { - $wasRunning = false; if ((new Tmux())->isRunning() === true) { diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index d8c568590..5deca06f2 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -20,7 +20,6 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. * - * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) diff --git a/app/Events/UserAccessedApi.php b/app/Events/UserAccessedApi.php index db930770e..c72bd95e5 100644 --- a/app/Events/UserAccessedApi.php +++ b/app/Events/UserAccessedApi.php @@ -17,8 +17,6 @@ class UserAccessedApi /** * Create a new event instance. - * - * @param $user */ public function __construct($user) { diff --git a/app/Events/UserLoggedIn.php b/app/Events/UserLoggedIn.php index 520cd8eda..0c540c642 100644 --- a/app/Events/UserLoggedIn.php +++ b/app/Events/UserLoggedIn.php @@ -15,16 +15,10 @@ class UserLoggedIn */ public $user; - /** - * @var - */ public $ip; /** * Create a new event instance. - * - * @param $user - * @param $ip */ public function __construct($user, $ip = '') { diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 96065e679..2fdc1d932 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -56,7 +56,6 @@ class Handler extends ExceptionHandler /** * @param \Illuminate\Http\Request $request - * @param \Throwable $exception * @return \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\Response * * @throws \Throwable diff --git a/app/Extensions/helper/helpers.php b/app/Extensions/helper/helpers.php index 45ee13efb..d853e450c 100644 --- a/app/Extensions/helper/helpers.php +++ b/app/Extensions/helper/helpers.php @@ -15,9 +15,7 @@ use Symfony\Component\Process\Process; use Zip as ZipStream; if (! function_exists('getRawHtml')) { - /** - * @param $url * @param bool $cookie * @return bool|mixed|string */ @@ -52,11 +50,7 @@ if (! function_exists('getRawHtml')) { } if (! function_exists('makeFieldLinks')) { - /** - * @param $data - * @param $field - * @param $type * @return string * * @throws \Exception @@ -88,7 +82,6 @@ if (! function_exists('makeFieldLinks')) { if (! function_exists('getUserBrowseOrder')) { /** * @param string $orderBy - * @return array */ function getUserBrowseOrder($orderBy): array { @@ -134,9 +127,6 @@ if (! function_exists('getUserBrowseOrder')) { if (! function_exists('getUserBrowseOrdering')) { - /** - * @return array - */ function getUserBrowseOrdering(): array { return [ @@ -168,8 +158,6 @@ if (! function_exists('getUserBrowseOrdering')) { if (! function_exists('createGUID')) { /** - * @return string - * * @throws \Exception */ function createGUID(): string @@ -185,7 +173,6 @@ if (! function_exists('createGUID')) { if (! function_exists('getSimilarName')) { /** * @param string $name - * @return string */ function getSimilarName($name): string { @@ -196,7 +183,6 @@ if (! function_exists('getSimilarName')) { if (! function_exists('color')) { /** * @param string $string - * @return \Colors\Color */ function color($string = ''): Color { @@ -205,11 +191,8 @@ if (! function_exists('color')) { } if (! function_exists('human_filesize')) { - /** - * @param $bytes * @param int $decimals - * @return string */ function human_filesize($bytes, $decimals = 0): string { @@ -221,9 +204,7 @@ if (! function_exists('human_filesize')) { } if (! function_exists('bcdechex')) { - /** - * @param $dec * @return string */ function bcdechex($dec) @@ -268,9 +249,7 @@ if (! function_exists('runCmd')) { } if (! function_exists('escapeString')) { - /** - * @param $string * @return string */ function escapeString($string) @@ -280,9 +259,7 @@ if (! function_exists('escapeString')) { } if (! function_exists('realDuration')) { - /** - * @param $milliseconds * @return string */ function realDuration($milliseconds) @@ -294,7 +271,6 @@ if (! function_exists('realDuration')) { } if (! function_exists('is_it_json')) { - /** * @param array|string $isIt * @return bool @@ -311,12 +287,11 @@ if (! function_exists('is_it_json')) { } /** - * @param array $guids * @return \STS\ZipStream\ZipStream * * @throws \Exception */ -function getStreamingZip(array $guids = []): \STS\ZipStream\ZipStream +function getStreamingZip(array $guids = []): STS\ZipStream\ZipStream { $nzb = new NZB(); $zipped = ZipStream::create(now()->format('Ymdhis').'.zip'); diff --git a/app/Extensions/util/Git.php b/app/Extensions/util/Git.php index 30f47d566..979cd0e19 100644 --- a/app/Extensions/util/Git.php +++ b/app/Extensions/util/Git.php @@ -25,30 +25,17 @@ use Symfony\Component\Process\Process; class Git { - /** - * @var \CzProject\GitPhp\GitRepository - */ protected GitRepository $repo; - /** - * @var array - */ public array $_config; - /** - * @var - */ protected $gitTagLatest; - /** - * @var string - */ private string $branch; /** * Git constructor. * - * @param array $config * * @throws \CzProject\GitPhp\GitException */ @@ -77,7 +64,6 @@ class Git } /** - * @param $options * @return string[] * * @throws \CzProject\GitPhp\GitException @@ -136,7 +122,6 @@ class Git /** * Determine if the supplied object is commited to the repository or not. * - * @param $gitObject * @return bool * * @throws \Exception @@ -163,7 +148,6 @@ class Git } /** - * @param $branch * @return bool */ public function isStable($branch) @@ -197,7 +181,6 @@ class Git } /** - * @param array $options * @return string[] * * @throws \CzProject\GitPhp\GitException @@ -205,8 +188,8 @@ class Git public function gitPull(array $options = []) { $default = [ - 'branch' => $this->getBranch(), - 'remote' => 'origin', + 'branch' => $this->getBranch(), + 'remote' => 'origin', ]; $options += $default; diff --git a/app/Extensions/util/PhpYenc.php b/app/Extensions/util/PhpYenc.php index a7fba062d..2cb7415ca 100644 --- a/app/Extensions/util/PhpYenc.php +++ b/app/Extensions/util/PhpYenc.php @@ -26,9 +26,7 @@ namespace App\Extensions\util; class PhpYenc { /** - * @param $text * @param bool $ignore - * @return bool|string */ public static function decode(&$text, $ignore = false): bool|string { @@ -127,21 +125,11 @@ class PhpYenc return $text; } - /** - * @return bool - */ public static function enabled(): bool { return true; } - /** - * @param $data - * @param $filename - * @param int $lineLength - * @param bool $crc32 - * @return string - */ public static function encode($data, $filename, int $lineLength = 128, bool $crc32 = true): string { // yEnc 1.3 draft doesn't allow line lengths of more than 254 bytes. diff --git a/app/Http/Controllers/Admin/AdminAjaxController.php b/app/Http/Controllers/Admin/AdminAjaxController.php index 220887b44..d6b59b421 100644 --- a/app/Http/Controllers/Admin/AdminAjaxController.php +++ b/app/Http/Controllers/Admin/AdminAjaxController.php @@ -14,8 +14,6 @@ use Illuminate\Http\Request; class AdminAjaxController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Throwable */ public function ajaxAction(Request $request): void diff --git a/app/Http/Controllers/Admin/AdminAnidbController.php b/app/Http/Controllers/Admin/AdminAnidbController.php index 3a1c5d3ea..27e5665f6 100644 --- a/app/Http/Controllers/Admin/AdminAnidbController.php +++ b/app/Http/Controllers/Admin/AdminAnidbController.php @@ -36,9 +36,6 @@ class AdminAnidbController extends BasePageController } /** - * @param int $id - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(int $id): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse @@ -94,7 +91,6 @@ class AdminAnidbController extends BasePageController /** * Remove the specified resource from storage. * - * @param int $id * * @throws \Exception */ diff --git a/app/Http/Controllers/Admin/AdminBlacklistController.php b/app/Http/Controllers/Admin/AdminBlacklistController.php index dcf2e8efb..87ff799b2 100644 --- a/app/Http/Controllers/Admin/AdminBlacklistController.php +++ b/app/Http/Controllers/Admin/AdminBlacklistController.php @@ -28,9 +28,6 @@ class AdminBlacklistController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse @@ -66,9 +63,9 @@ class AdminBlacklistController extends BasePageController if ($request->has('regex') && $request->has('groupname')) { $regex += [ 'groupname' => $request->input('groupname'), - 'regex' => $request->input('regex'), - 'ordinal' => 1, - 'status' => 1, + 'regex' => $request->input('regex'), + 'ordinal' => 1, + 'status' => 1, ]; } break; @@ -91,13 +88,13 @@ class AdminBlacklistController extends BasePageController $this->smarty->assign( [ - 'error' => $error, - 'regex' => $regex, - 'status_ids' => [Category::STATUS_ACTIVE, Category::STATUS_INACTIVE], + 'error' => $error, + 'regex' => $regex, + 'status_ids' => [Category::STATUS_ACTIVE, Category::STATUS_INACTIVE], 'status_names' => ['Yes', 'No'], - 'optype_ids' => [1, 2], + 'optype_ids' => [1, 2], 'optype_names' => ['Black', 'White'], - 'msgcol_ids' => [ + 'msgcol_ids' => [ Binaries::BLACKLIST_FIELD_SUBJECT, Binaries::BLACKLIST_FIELD_FROM, Binaries::BLACKLIST_FIELD_MESSAGEID, diff --git a/app/Http/Controllers/Admin/AdminBookController.php b/app/Http/Controllers/Admin/AdminBookController.php index 4e3121716..1256bc9b4 100644 --- a/app/Http/Controllers/Admin/AdminBookController.php +++ b/app/Http/Controllers/Admin/AdminBookController.php @@ -31,9 +31,6 @@ class AdminBookController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/Admin/AdminCategoryController.php b/app/Http/Controllers/Admin/AdminCategoryController.php index 738083c00..72f5f464d 100644 --- a/app/Http/Controllers/Admin/AdminCategoryController.php +++ b/app/Http/Controllers/Admin/AdminCategoryController.php @@ -27,9 +27,6 @@ class AdminCategoryController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/Admin/AdminCategoryRegexesController.php b/app/Http/Controllers/Admin/AdminCategoryRegexesController.php index 771786ac2..0b2ca2392 100644 --- a/app/Http/Controllers/Admin/AdminCategoryRegexesController.php +++ b/app/Http/Controllers/Admin/AdminCategoryRegexesController.php @@ -10,14 +10,12 @@ use Illuminate\Http\Request; class AdminCategoryRegexesController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function index(Request $request): void { $this->setAdminPrefs(); - $regexes = new Regexes(['Settings' =>null, 'Table_Name' => 'category_regexes']); + $regexes = new Regexes(['Settings' => null, 'Table_Name' => 'category_regexes']); $meta_title = $title = 'Category Regex List'; @@ -39,7 +37,6 @@ class AdminCategoryRegexesController extends BasePageController } /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception diff --git a/app/Http/Controllers/Admin/AdminCollectionRegexesController.php b/app/Http/Controllers/Admin/AdminCollectionRegexesController.php index 1e1d5505e..cdb7c768e 100644 --- a/app/Http/Controllers/Admin/AdminCollectionRegexesController.php +++ b/app/Http/Controllers/Admin/AdminCollectionRegexesController.php @@ -10,8 +10,6 @@ use Illuminate\Http\Request; class AdminCollectionRegexesController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function index(Request $request): void @@ -33,9 +31,6 @@ class AdminCollectionRegexesController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse @@ -100,8 +95,6 @@ class AdminCollectionRegexesController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function testRegex(Request $request): void diff --git a/app/Http/Controllers/Admin/AdminCommentsController.php b/app/Http/Controllers/Admin/AdminCommentsController.php index eacf66a0a..bf253de41 100644 --- a/app/Http/Controllers/Admin/AdminCommentsController.php +++ b/app/Http/Controllers/Admin/AdminCommentsController.php @@ -24,10 +24,6 @@ class AdminCommentsController extends BasePageController $this->adminrender(); } - /** - * @param int $id - * @return \Illuminate\Http\RedirectResponse - */ public function destroy(int $id): \Illuminate\Http\RedirectResponse { if ($id) { diff --git a/app/Http/Controllers/Admin/AdminConsoleController.php b/app/Http/Controllers/Admin/AdminConsoleController.php index 6b7da38f2..571efad79 100644 --- a/app/Http/Controllers/Admin/AdminConsoleController.php +++ b/app/Http/Controllers/Admin/AdminConsoleController.php @@ -31,9 +31,6 @@ class AdminConsoleController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/Admin/AdminContentController.php b/app/Http/Controllers/Admin/AdminContentController.php index 42b9492a4..da16403c4 100644 --- a/app/Http/Controllers/Admin/AdminContentController.php +++ b/app/Http/Controllers/Admin/AdminContentController.php @@ -28,7 +28,6 @@ class AdminContentController extends BasePageController } /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception @@ -109,10 +108,6 @@ class AdminContentController extends BasePageController $this->adminrender(); } - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - */ public function destroy(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application { if ($request->has('id')) { diff --git a/app/Http/Controllers/Admin/AdminGameController.php b/app/Http/Controllers/Admin/AdminGameController.php index fb37b95c4..095e63dc1 100644 --- a/app/Http/Controllers/Admin/AdminGameController.php +++ b/app/Http/Controllers/Admin/AdminGameController.php @@ -32,9 +32,6 @@ class AdminGameController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/Admin/AdminGroupController.php b/app/Http/Controllers/Admin/AdminGroupController.php index 8bacca84b..7d3241c9a 100644 --- a/app/Http/Controllers/Admin/AdminGroupController.php +++ b/app/Http/Controllers/Admin/AdminGroupController.php @@ -9,8 +9,6 @@ use Illuminate\Http\Request; class AdminGroupController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function index(Request $request): void @@ -35,8 +33,6 @@ class AdminGroupController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function createBulk(Request $request): void @@ -67,7 +63,6 @@ class AdminGroupController extends BasePageController } /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception @@ -80,16 +75,16 @@ class AdminGroupController extends BasePageController $action = $request->input('action') ?? 'view'; $group = [ - 'id' => '', - 'name' => '', - 'description' => '', + 'id' => '', + 'name' => '', + 'description' => '', 'minfilestoformrelease' => 0, - 'active' => 0, - 'backfill' => 0, - 'minsizetoformrelease' => 0, - 'first_record' => 0, - 'last_record' => 0, - 'backfill_target' => 0, + 'active' => 0, + 'backfill' => 0, + 'minsizetoformrelease' => 0, + 'first_record' => 0, + 'last_record' => 0, + 'backfill_target' => 0, ]; switch ($action) { @@ -134,8 +129,6 @@ class AdminGroupController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function active(Request $request): void @@ -164,8 +157,6 @@ class AdminGroupController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function inactive(Request $request): void diff --git a/app/Http/Controllers/Admin/AdminMovieController.php b/app/Http/Controllers/Admin/AdminMovieController.php index 8d593f280..e6c144902 100644 --- a/app/Http/Controllers/Admin/AdminMovieController.php +++ b/app/Http/Controllers/Admin/AdminMovieController.php @@ -31,7 +31,6 @@ class AdminMovieController extends BasePageController } /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception @@ -79,9 +78,6 @@ class AdminMovieController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse @@ -127,18 +123,18 @@ class AdminMovieController extends BasePageController $request->merge(['backdrop' => file_exists($backdropLoc) ? 1 : 0]); $movie->update([ - 'actors' => $request->input('actors'), + 'actors' => $request->input('actors'), 'backdrop' => $request->input('backdrop'), - 'cover' => $request->input('cover'), + 'cover' => $request->input('cover'), 'director' => $request->input('director'), - 'genre' => $request->input('genre'), - 'imdbid' => $id, + 'genre' => $request->input('genre'), + 'imdbid' => $id, 'language' => $request->input('language'), - 'plot' => $request->input('plot'), - 'rating' => $request->input('rating'), - 'tagline' => $request->input('tagline'), - 'title' => $request->input('title'), - 'year' => $request->input('year'), + 'plot' => $request->input('plot'), + 'rating' => $request->input('rating'), + 'tagline' => $request->input('tagline'), + 'title' => $request->input('title'), + 'year' => $request->input('year'), ]); $movieInfo = MovieInfo::query()->where('imdbid', $id)->first(['id']); diff --git a/app/Http/Controllers/Admin/AdminMusicController.php b/app/Http/Controllers/Admin/AdminMusicController.php index aebd7a259..ab199500f 100644 --- a/app/Http/Controllers/Admin/AdminMusicController.php +++ b/app/Http/Controllers/Admin/AdminMusicController.php @@ -29,9 +29,6 @@ class AdminMusicController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/Admin/AdminNzbController.php b/app/Http/Controllers/Admin/AdminNzbController.php index a10158dfe..a39c11d5d 100644 --- a/app/Http/Controllers/Admin/AdminNzbController.php +++ b/app/Http/Controllers/Admin/AdminNzbController.php @@ -12,8 +12,6 @@ use Illuminate\Http\Request; class AdminNzbController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function import(Request $request): void @@ -34,7 +32,6 @@ class AdminNzbController extends BasePageController } } } else { - // Check if the user wants to use the file name as the release name. $useNzbName = ($request->has('usefilename') && $request->input('usefilename') === 'on'); @@ -52,7 +49,6 @@ class AdminNzbController extends BasePageController } if (\count($filesToProcess) > 0) { - // Create a new instance of NZBImport and send it the file locations. $NZBImport = new NZBImport(['Browser' => true, 'Settings' => null]); @@ -70,8 +66,6 @@ class AdminNzbController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function export(Request $request): void @@ -93,7 +87,7 @@ class AdminNzbController extends BasePageController if ($path !== '') { $NE = new NZBExport([ - 'Browser' => true, 'Settings' => null, + 'Browser' => true, 'Settings' => null, 'Releases' => $rel, ]); $retVal = $NE->beginExport( @@ -111,19 +105,19 @@ class AdminNzbController extends BasePageController $this->smarty->assign( [ - 'folder' => $path, - 'output' => $retVal, + 'folder' => $path, + 'output' => $retVal, 'fromdate' => $postFrom, - 'todate' => $postTo, - 'group' => $request->input('group'), - 'gzip' => $request->input('gzip'), + 'todate' => $postTo, + 'group' => $request->input('group'), + 'gzip' => $request->input('gzip'), ] ); } else { $this->smarty->assign( [ 'fromdate' => $rel->getEarliestUsenetPostDate(), - 'todate' => $rel->getLatestUsenetPostDate(), + 'todate' => $rel->getLatestUsenetPostDate(), ] ); } @@ -131,7 +125,7 @@ class AdminNzbController extends BasePageController $meta_title = $title = 'Export Nzbs'; $this->smarty->assign( [ - 'gziplist' => [1 => 'True', 0 => 'False'], + 'gziplist' => [1 => 'True', 0 => 'False'], 'grouplist' => $rel->getReleasedGroupsForSelect(true), ] ); diff --git a/app/Http/Controllers/Admin/AdminPredbController.php b/app/Http/Controllers/Admin/AdminPredbController.php index 74fe338f2..fc6d7a3d9 100644 --- a/app/Http/Controllers/Admin/AdminPredbController.php +++ b/app/Http/Controllers/Admin/AdminPredbController.php @@ -9,8 +9,6 @@ use Illuminate\Http\Request; class AdminPredbController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function index(Request $request): void diff --git a/app/Http/Controllers/Admin/AdminReleaseNamingRegexesController.php b/app/Http/Controllers/Admin/AdminReleaseNamingRegexesController.php index 63660d3c1..22499fec6 100644 --- a/app/Http/Controllers/Admin/AdminReleaseNamingRegexesController.php +++ b/app/Http/Controllers/Admin/AdminReleaseNamingRegexesController.php @@ -10,8 +10,6 @@ use Illuminate\Http\Request; class AdminReleaseNamingRegexesController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function index(Request $request): void @@ -34,9 +32,6 @@ class AdminReleaseNamingRegexesController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function edit(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse @@ -102,8 +97,6 @@ class AdminReleaseNamingRegexesController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function testRegex(Request $request): void diff --git a/app/Http/Controllers/Admin/AdminReleasesController.php b/app/Http/Controllers/Admin/AdminReleasesController.php index 19ee22c68..d414b49da 100644 --- a/app/Http/Controllers/Admin/AdminReleasesController.php +++ b/app/Http/Controllers/Admin/AdminReleasesController.php @@ -30,7 +30,6 @@ class AdminReleasesController extends BasePageController } /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception @@ -88,9 +87,6 @@ class AdminReleasesController extends BasePageController } /** - * @param $id - * @return \Illuminate\Http\RedirectResponse - * * @throws \Exception */ public function destroy($id): \Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/Admin/AdminRoleController.php b/app/Http/Controllers/Admin/AdminRoleController.php index b5ab23e2e..c27995347 100644 --- a/app/Http/Controllers/Admin/AdminRoleController.php +++ b/app/Http/Controllers/Admin/AdminRoleController.php @@ -30,8 +30,6 @@ class AdminRoleController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function create(Request $request): void @@ -41,67 +39,67 @@ class AdminRoleController extends BasePageController switch ($request->input('action') ?? 'view') { case 'submit': $meta_title = $title = 'Add User Role'; - $role = Role::create([ - 'name' => $request->input('name'), - 'apirequests' => $request->input('apirequests'), - 'downloadrequests' => $request->input('downloadrequests'), - 'defaultinvites' => $request->input('defaultinvites'), - 'donation' => $request->input('donation') ?? 0, - 'addyears' => $request->input('addyears') ?? 0, - 'rate_limit' => $request->input('rate_limit'), - ]); - if ((int) $request->input('canpreview') === 1) { - $role->givePermissionTo('preview'); - } + $role = Role::create([ + 'name' => $request->input('name'), + 'apirequests' => $request->input('apirequests'), + 'downloadrequests' => $request->input('downloadrequests'), + 'defaultinvites' => $request->input('defaultinvites'), + 'donation' => $request->input('donation') ?? 0, + 'addyears' => $request->input('addyears') ?? 0, + 'rate_limit' => $request->input('rate_limit'), + ]); + if ((int) $request->input('canpreview') === 1) { + $role->givePermissionTo('preview'); + } - if ((int) $request->input('hideads') === 1) { - $role->givePermissionTo('hideads'); - } + if ((int) $request->input('hideads') === 1) { + $role->givePermissionTo('hideads'); + } - if ((int) $request->input('editrelease') === 1) { - $role->givePermissionTo('edit release'); - } + if ((int) $request->input('editrelease') === 1) { + $role->givePermissionTo('edit release'); + } - if ((int) $request->input('viewconsole') === 1) { - $role->givePermissionTo('view console'); - } + if ((int) $request->input('viewconsole') === 1) { + $role->givePermissionTo('view console'); + } - if ((int) $request->input('viewmovies') === 1) { - $role->givePermissionTo('view movies'); - } + if ((int) $request->input('viewmovies') === 1) { + $role->givePermissionTo('view movies'); + } - if ((int) $request->input('viewaudio') === 1) { - $role->givePermissionTo('view audio'); - } + if ((int) $request->input('viewaudio') === 1) { + $role->givePermissionTo('view audio'); + } - if ((int) $request->input('viewpc') === 1) { - $role->givePermissionTo('view pc'); - } + if ((int) $request->input('viewpc') === 1) { + $role->givePermissionTo('view pc'); + } - if ((int) $request->input('viewtv') === 1) { - $role->givePermissionTo('view tv'); - } + if ((int) $request->input('viewtv') === 1) { + $role->givePermissionTo('view tv'); + } - if ((int) $request->input('viewadult') === 1) { - $role->givePermissionTo('view adult'); - } + if ((int) $request->input('viewadult') === 1) { + $role->givePermissionTo('view adult'); + } - if ((int) $request->input('viewbooks') === 1) { - $role->givePermissionTo('view books'); - } + if ((int) $request->input('viewbooks') === 1) { + $role->givePermissionTo('view books'); + } - if ((int) $request->input('viewother') === 1) { - $role->givePermissionTo('view other'); - } + if ((int) $request->input('viewother') === 1) { + $role->givePermissionTo('view other'); + } redirect()->to('admin/role-list')->sendHeaders(); break; case 'view': default: - $meta_title = $title = 'Add User Role'; - $role = [ - ]; + $meta_title = $title = 'Add User Role'; + $role = [ + ]; - break; + break; } $this->smarty->assign('yesno_ids', [1, 0]); @@ -115,8 +113,6 @@ class AdminRoleController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function edit(Request $request): void @@ -134,84 +130,84 @@ class AdminRoleController extends BasePageController switch ($request->input('action') ?? 'view') { case 'submit': - $meta_title = $title = 'Update User Role'; - $role = Role::find($request->input('id')); - $role->update([ - 'name' => $request->input('name'), - 'apirequests' => $request->input('apirequests'), - 'downloadrequests' => $request->input('downloadrequests'), - 'defaultinvites' => $request->input('defaultinvites'), - 'isdefault' => $request->input('isdefault'), - 'donation' => $request->input('donation'), - 'addyears' => $request->input('addyears'), - 'rate_limit' => $request->input('rate_limit'), - ]); + $meta_title = $title = 'Update User Role'; + $role = Role::find($request->input('id')); + $role->update([ + 'name' => $request->input('name'), + 'apirequests' => $request->input('apirequests'), + 'downloadrequests' => $request->input('downloadrequests'), + 'defaultinvites' => $request->input('defaultinvites'), + 'isdefault' => $request->input('isdefault'), + 'donation' => $request->input('donation'), + 'addyears' => $request->input('addyears'), + 'rate_limit' => $request->input('rate_limit'), + ]); - if ((int) $request->input('canpreview') === 1 && $role->hasPermissionTo('preview') === false) { - $role->givePermissionTo('preview'); - } elseif ((int) $request->input('canpreview') === 0 && $role->hasPermissionTo('preview') === true) { - $role->revokePermissionTo('preview'); - } + if ((int) $request->input('canpreview') === 1 && $role->hasPermissionTo('preview') === false) { + $role->givePermissionTo('preview'); + } elseif ((int) $request->input('canpreview') === 0 && $role->hasPermissionTo('preview') === true) { + $role->revokePermissionTo('preview'); + } - if ((int) $request->input('hideads') === 1 && $role->hasPermissionTo('hideads') === false) { - $role->givePermissionTo('hideads'); - } elseif ((int) $request->input('hideads') === 0 && $role->hasPermissionTo('hideads') === true) { - $role->revokePermissionTo('hideads'); - } + if ((int) $request->input('hideads') === 1 && $role->hasPermissionTo('hideads') === false) { + $role->givePermissionTo('hideads'); + } elseif ((int) $request->input('hideads') === 0 && $role->hasPermissionTo('hideads') === true) { + $role->revokePermissionTo('hideads'); + } - if ((int) $request->input('editrelease') === 1 && $role->hasPermissionTo('edit release') === false) { - $role->givePermissionTo('edit release'); - } elseif ((int) $request->input('editrelease') === 0 && $role->hasPermissionTo('edit release') === true) { - $role->revokePermissionTo('edit release'); - } + if ((int) $request->input('editrelease') === 1 && $role->hasPermissionTo('edit release') === false) { + $role->givePermissionTo('edit release'); + } elseif ((int) $request->input('editrelease') === 0 && $role->hasPermissionTo('edit release') === true) { + $role->revokePermissionTo('edit release'); + } - if ((int) $request->input('viewconsole') === 1 && $role->hasPermissionTo('view console') === false) { - $role->givePermissionTo('view console'); - } elseif ((int) $request->input('viewconsole') === 0 && $role->hasPermissionTo('view console') === true) { - $role->revokePermissionTo('view console'); - } + if ((int) $request->input('viewconsole') === 1 && $role->hasPermissionTo('view console') === false) { + $role->givePermissionTo('view console'); + } elseif ((int) $request->input('viewconsole') === 0 && $role->hasPermissionTo('view console') === true) { + $role->revokePermissionTo('view console'); + } - if ((int) $request->input('viewmovies') === 1 && $role->hasPermissionTo('view movies') === false) { - $role->givePermissionTo('view movies'); - } elseif ((int) $request->input('viewmovies') === 0 && $role->hasPermissionTo('view movies') === true) { - $role->revokePermissionTo('view movies'); - } + if ((int) $request->input('viewmovies') === 1 && $role->hasPermissionTo('view movies') === false) { + $role->givePermissionTo('view movies'); + } elseif ((int) $request->input('viewmovies') === 0 && $role->hasPermissionTo('view movies') === true) { + $role->revokePermissionTo('view movies'); + } - if ((int) $request->input('viewaudio') === 1 && $role->hasPermissionTo('view audio') === false) { - $role->givePermissionTo('view audio'); - } elseif ((int) $request->input('viewaudio') === 0 && $role->hasPermissionTo('view audio') === true) { - $role->revokePermissionTo('view audio'); - } + if ((int) $request->input('viewaudio') === 1 && $role->hasPermissionTo('view audio') === false) { + $role->givePermissionTo('view audio'); + } elseif ((int) $request->input('viewaudio') === 0 && $role->hasPermissionTo('view audio') === true) { + $role->revokePermissionTo('view audio'); + } - if ((int) $request->input('viewpc') === 1 && $role->hasPermissionTo('view pc') === false) { - $role->givePermissionTo('view pc'); - } elseif ((int) $request->input('viewpc') === 0 && $role->hasPermissionTo('view pc') === true) { - $role->revokePermissionTo('view pc'); - } + if ((int) $request->input('viewpc') === 1 && $role->hasPermissionTo('view pc') === false) { + $role->givePermissionTo('view pc'); + } elseif ((int) $request->input('viewpc') === 0 && $role->hasPermissionTo('view pc') === true) { + $role->revokePermissionTo('view pc'); + } - if ((int) $request->input('viewtv') === 1 && $role->hasPermissionTo('view tv') === false) { - $role->givePermissionTo('view tv'); - } elseif ((int) $request->input('viewtv') === 0 && $role->hasPermissionTo('view tv') === true) { - $role->revokePermissionTo('view tv'); - } + if ((int) $request->input('viewtv') === 1 && $role->hasPermissionTo('view tv') === false) { + $role->givePermissionTo('view tv'); + } elseif ((int) $request->input('viewtv') === 0 && $role->hasPermissionTo('view tv') === true) { + $role->revokePermissionTo('view tv'); + } - if ((int) $request->input('viewadult') === 1 && $role->hasPermissionTo('view adult') === false) { - $role->givePermissionTo('view adult'); - } elseif ((int) $request->input('viewadult') === 0 && $role->hasPermissionTo('view adult') === true) { - $role->revokePermissionTo('view adult'); - } + if ((int) $request->input('viewadult') === 1 && $role->hasPermissionTo('view adult') === false) { + $role->givePermissionTo('view adult'); + } elseif ((int) $request->input('viewadult') === 0 && $role->hasPermissionTo('view adult') === true) { + $role->revokePermissionTo('view adult'); + } - if ((int) $request->input('viewbooks') === 1 && $role->hasPermissionTo('view books') === false) { - $role->givePermissionTo('view books'); - } elseif ((int) $request->input('viewbooks') === 0 && $role->hasPermissionTo('view books') === true) { - $role->revokePermissionTo('view books'); - } + if ((int) $request->input('viewbooks') === 1 && $role->hasPermissionTo('view books') === false) { + $role->givePermissionTo('view books'); + } elseif ((int) $request->input('viewbooks') === 0 && $role->hasPermissionTo('view books') === true) { + $role->revokePermissionTo('view books'); + } - if ((int) $request->input('viewother') === 1 && $role->hasPermissionTo('view other') === false) { - $role->givePermissionTo('view other'); - } elseif ((int) $request->input('viewother') === 0 && $role->hasPermissionTo('view other') === true) { - $role->revokePermissionTo('view other'); - } + if ((int) $request->input('viewother') === 1 && $role->hasPermissionTo('view other') === false) { + $role->givePermissionTo('view other'); + } elseif ((int) $request->input('viewother') === 0 && $role->hasPermissionTo('view other') === true) { + $role->revokePermissionTo('view other'); + } $this->smarty->assign('role', $role); redirect()->to('admin/role-list')->sendHeaders(); @@ -237,10 +233,6 @@ class AdminRoleController extends BasePageController $this->adminrender(); } - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - */ public function destroy(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse { if ($request->has('id')) { diff --git a/app/Http/Controllers/Admin/AdminSharingController.php b/app/Http/Controllers/Admin/AdminSharingController.php index c962e74d5..3c05740f1 100644 --- a/app/Http/Controllers/Admin/AdminSharingController.php +++ b/app/Http/Controllers/Admin/AdminSharingController.php @@ -10,8 +10,6 @@ use Illuminate\Http\Request; class AdminSharingController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function index(Request $request): void diff --git a/app/Http/Controllers/Admin/AdminShowsController.php b/app/Http/Controllers/Admin/AdminShowsController.php index eab69e8e0..c4f97b419 100644 --- a/app/Http/Controllers/Admin/AdminShowsController.php +++ b/app/Http/Controllers/Admin/AdminShowsController.php @@ -10,8 +10,6 @@ use Illuminate\Http\Request; class AdminShowsController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function index(Request $request): void @@ -24,8 +22,8 @@ class AdminShowsController extends BasePageController $this->smarty->assign( [ - 'showname' => $tvshowname, - 'tvshowlist' => Video::getRange($tvshowname), + 'showname' => $tvshowname, + 'tvshowlist' => Video::getRange($tvshowname), ] ); @@ -35,8 +33,6 @@ class AdminShowsController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function edit(Request $request): void @@ -71,8 +67,6 @@ class AdminShowsController extends BasePageController } /** - * @param $id - * * @throws \Exception */ public function destroy($id): void diff --git a/app/Http/Controllers/Admin/AdminSiteController.php b/app/Http/Controllers/Admin/AdminSiteController.php index 5857a3e5d..80d137899 100644 --- a/app/Http/Controllers/Admin/AdminSiteController.php +++ b/app/Http/Controllers/Admin/AdminSiteController.php @@ -15,7 +15,6 @@ use Spatie\Permission\Models\Role; class AdminSiteController extends BasePageController { /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception diff --git a/app/Http/Controllers/Admin/AdminTmuxController.php b/app/Http/Controllers/Admin/AdminTmuxController.php index 397dfe70e..cf80b69c5 100644 --- a/app/Http/Controllers/Admin/AdminTmuxController.php +++ b/app/Http/Controllers/Admin/AdminTmuxController.php @@ -9,8 +9,6 @@ use Illuminate\Http\Request; class AdminTmuxController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function edit(Request $request): void diff --git a/app/Http/Controllers/Admin/AdminUserController.php b/app/Http/Controllers/Admin/AdminUserController.php index c755dee30..76feeaa3d 100644 --- a/app/Http/Controllers/Admin/AdminUserController.php +++ b/app/Http/Controllers/Admin/AdminUserController.php @@ -13,9 +13,6 @@ use Spatie\Permission\Models\Role; class AdminUserController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @return void - * * @throws \Throwable */ public function index(Request $request): void @@ -57,13 +54,13 @@ class AdminUserController extends BasePageController $this->smarty->assign( [ - 'username' => $variables['username'], - 'email' => $variables['email'], - 'host' => $variables['host'], - 'role' => $variables['role'], - 'role_ids' => array_keys($roles), - 'role_names' => $roles, - 'userlist' => $results, + 'username' => $variables['username'], + 'email' => $variables['email'], + 'host' => $variables['host'], + 'role' => $variables['role'], + 'role_ids' => array_keys($roles), + 'role_names' => $roles, + 'userlist' => $results, ] ); @@ -78,7 +75,6 @@ class AdminUserController extends BasePageController } /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception @@ -118,15 +114,15 @@ class AdminUserController extends BasePageController switch ($action) { case 'add': $user += [ - 'role' => $defaultRole, - 'notes' => '', - 'invites' => $defaultInvites, - 'movieview' => 0, - 'xxxview' => 0, - 'musicview' => 0, + 'role' => $defaultRole, + 'notes' => '', + 'invites' => $defaultInvites, + 'movieview' => 0, + 'xxxview' => 0, + 'musicview' => 0, 'consoleview' => 0, - 'gameview' => 0, - 'bookview' => 0, + 'gameview' => 0, + 'bookview' => 0, ]; $this->smarty->assign('user', $user); break; @@ -180,11 +176,11 @@ class AdminUserController extends BasePageController break; } $user += [ - 'id' => $request->input('id'), - 'username' => $request->input('username'), - 'email' => $request->input('email'), - 'role' => $request->input('role'), - 'notes' => $request->input('notes'), + 'id' => $request->input('id'), + 'username' => $request->input('username'), + 'email' => $request->input('email'), + 'role' => $request->input('role'), + 'notes' => $request->input('notes'), ]; $this->smarty->assign('user', $user); break; @@ -215,10 +211,6 @@ class AdminUserController extends BasePageController $this->adminrender(); } - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - */ public function destroy(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application { if ($request->has('id')) { @@ -237,9 +229,6 @@ class AdminUserController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse - * * @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException */ public function resendVerification(Request $request): \Illuminate\Http\RedirectResponse @@ -256,10 +245,6 @@ class AdminUserController extends BasePageController return redirect()->back()->with('error', 'User is invalid'); } - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse - */ public function verify(Request $request): \Illuminate\Http\RedirectResponse { if ($request->has('id')) { diff --git a/app/Http/Controllers/AdultController.php b/app/Http/Controllers/AdultController.php index 072fa5441..ce6481865 100644 --- a/app/Http/Controllers/AdultController.php +++ b/app/Http/Controllers/AdultController.php @@ -10,9 +10,6 @@ use Illuminate\Support\Arr; class AdultController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @param string $id - * * @throws \Exception */ public function show(Request $request, string $id = ''): void @@ -93,7 +90,7 @@ class AdultController extends BasePageController $this->smarty->assign( [ - 'resultsadd'=> $movies, + 'resultsadd' => $movies, 'results' => $results, 'covgroup' => 'xxx', ] diff --git a/app/Http/Controllers/AjaxController.php b/app/Http/Controllers/AjaxController.php index 4f7832573..6bedffc11 100644 --- a/app/Http/Controllers/AjaxController.php +++ b/app/Http/Controllers/AjaxController.php @@ -8,8 +8,6 @@ use Illuminate\Http\Request; class AjaxController extends BasePageController { /** - * @param Request $request - * * @throws \Exception */ public function profile(Request $request): void diff --git a/app/Http/Controllers/AnimeController.php b/app/Http/Controllers/AnimeController.php index 7c255844f..3d6146eca 100644 --- a/app/Http/Controllers/AnimeController.php +++ b/app/Http/Controllers/AnimeController.php @@ -32,8 +32,6 @@ class AnimeController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function showAnime(Request $request): void @@ -41,7 +39,6 @@ class AnimeController extends BasePageController $this->setPrefs(); if ($request->has('id') && ctype_digit($request->input('id'))) { - // force the category to TV_ANIME as it should be for anime, as $catarray was NULL and we know the category for sure for anime $aniDbReleases = $this->releases->animeSearch($request->input('id'), 0, 1000, '', [Category::TV_ANIME], -1); $aniDbInfo = $this->aniDb->getAnimeInfo($request->input('id')); @@ -83,8 +80,6 @@ class AnimeController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function showList(Request $request): void diff --git a/app/Http/Controllers/Api/API.php b/app/Http/Controllers/Api/API.php index 4089b9806..e9dec0409 100644 --- a/app/Http/Controllers/Api/API.php +++ b/app/Http/Controllers/Api/API.php @@ -39,8 +39,6 @@ class API extends Capabilities public mixed $getRequest; /** - * @param array $options - * * @throws \Exception */ public function __construct(array $options = []) @@ -48,7 +46,7 @@ class API extends Capabilities parent::__construct($options); $defaults = [ 'Settings' => null, - 'Request' => null, + 'Request' => null, ]; $options += $defaults; @@ -57,8 +55,6 @@ class API extends Capabilities /** * Add language from media info XML to release search names (Used by API). - * - * @param array $releases */ public function addLanguage(array &$releases): void { @@ -97,8 +93,6 @@ class API extends Capabilities /** * Verify cat parameter. - * - * @return array */ public function categoryID(): array { @@ -118,7 +112,6 @@ class API extends Capabilities /** * Verify groupName parameter. * - * @return string|int|bool * * @throws \Exception */ @@ -137,8 +130,6 @@ class API extends Capabilities /** * Verify limit parameter. - * - * @return int */ public function limit(): int { @@ -152,8 +143,6 @@ class API extends Capabilities /** * Verify offset parameter. - * - * @return int */ public function offset(): int { @@ -167,8 +156,6 @@ class API extends Capabilities /** * Check if a parameter is empty. - * - * @param string $parameter */ public function verifyEmptyParameter(string $parameter): void { @@ -177,10 +164,6 @@ class API extends Capabilities } } - /** - * @param $releases - * @param callable $getCoverURL - */ public function addCoverURL(&$releases, callable $getCoverURL): void { if ($releases && \count($releases)) { diff --git a/app/Http/Controllers/Api/ApiController.php b/app/Http/Controllers/Api/ApiController.php index f58e2031e..5a8714aef 100644 --- a/app/Http/Controllers/Api/ApiController.php +++ b/app/Http/Controllers/Api/ApiController.php @@ -18,9 +18,6 @@ use Illuminate\Support\Str; class ApiController extends BasePageController { /** - * @param Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Symfony\Component\HttpFoundation\StreamedResponse - * * @throws \Throwable */ public function api(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse|\Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse @@ -29,39 +26,39 @@ class ApiController extends BasePageController $function = 's'; if ($request->has('t')) { switch ($request->input('t')) { - case 'd': - case 'details': - $function = 'd'; - break; - case 'g': - case 'get': - $function = 'g'; - break; - case 's': - case 'search': - $function = 's'; - break; - case 'c': - case 'caps': - $function = 'c'; - break; - case 'tv': - case 'tvsearch': - $function = 'tv'; - break; - case 'm': - case 'movie': - $function = 'm'; - break; - case 'gn': - case 'n': - case 'nfo': - case 'info': - $function = 'n'; - break; - default: - Utility::showApiError(202, 'No such function ('.$request->input('t').')'); - } + case 'd': + case 'details': + $function = 'd'; + break; + case 'g': + case 'get': + $function = 'g'; + break; + case 's': + case 'search': + $function = 's'; + break; + case 'c': + case 'caps': + $function = 'c'; + break; + case 'tv': + case 'tvsearch': + $function = 'tv'; + break; + case 'm': + case 'movie': + $function = 'm'; + break; + case 'gn': + case 'n': + case 'nfo': + case 'info': + $function = 'n'; + break; + default: + Utility::showApiError(202, 'No such function ('.$request->input('t').')'); + } } else { Utility::showApiError(200, 'Missing parameter (t)'); } @@ -128,193 +125,193 @@ class ApiController extends BasePageController $params['oldestgrab'] = $oldestGrabTime; switch ($function) { - // Search releases. - case 's': - $api->verifyEmptyParameter('q'); - $maxAge = $api->maxAge(); - $groupName = $api->group(); - UserRequest::addApiRequest($apiKey, $request->getRequestUri()); - $categoryID = $api->categoryID(); - $limit = $api->limit(); - $searchArr = [ - 'searchname' => $request->input('q') ?? -1, - 'name' => -1, - 'fromname' => -1, - 'filename' => -1, - ]; + // Search releases. + case 's': + $api->verifyEmptyParameter('q'); + $maxAge = $api->maxAge(); + $groupName = $api->group(); + UserRequest::addApiRequest($apiKey, $request->getRequestUri()); + $categoryID = $api->categoryID(); + $limit = $api->limit(); + $searchArr = [ + 'searchname' => $request->input('q') ?? -1, + 'name' => -1, + 'fromname' => -1, + 'filename' => -1, + ]; - if ($request->has('q')) { - $relData = $releases->search( - $searchArr, - $groupName, - -1, - -1, - -1, - -1, - $offset, - $limit, - '', - $maxAge, - $catExclusions, - 'basic', - $categoryID, - $minSize - ); - } else { - $relData = $releases->getBrowseRange( - 1, - $categoryID, - $offset, - $limit, - '', - $maxAge, - $catExclusions, - $groupName, - $minSize - ); - } - $api->output($relData, $params, $outputXML, $offset, 'api'); - break; - // Search tv releases. - case 'tv': - $api->verifyEmptyParameter('q'); - $api->verifyEmptyParameter('vid'); - $api->verifyEmptyParameter('tvdbid'); - $api->verifyEmptyParameter('traktid'); - $api->verifyEmptyParameter('rid'); - $api->verifyEmptyParameter('tvmazeid'); - $api->verifyEmptyParameter('imdbid'); - $api->verifyEmptyParameter('tmdbid'); - $api->verifyEmptyParameter('season'); - $api->verifyEmptyParameter('ep'); - $maxAge = $api->maxAge(); - UserRequest::addApiRequest($apiKey, $request->getRequestUri()); + if ($request->has('q')) { + $relData = $releases->search( + $searchArr, + $groupName, + -1, + -1, + -1, + -1, + $offset, + $limit, + '', + $maxAge, + $catExclusions, + 'basic', + $categoryID, + $minSize + ); + } else { + $relData = $releases->getBrowseRange( + 1, + $categoryID, + $offset, + $limit, + '', + $maxAge, + $catExclusions, + $groupName, + $minSize + ); + } + $api->output($relData, $params, $outputXML, $offset, 'api'); + break; + // Search tv releases. + case 'tv': + $api->verifyEmptyParameter('q'); + $api->verifyEmptyParameter('vid'); + $api->verifyEmptyParameter('tvdbid'); + $api->verifyEmptyParameter('traktid'); + $api->verifyEmptyParameter('rid'); + $api->verifyEmptyParameter('tvmazeid'); + $api->verifyEmptyParameter('imdbid'); + $api->verifyEmptyParameter('tmdbid'); + $api->verifyEmptyParameter('season'); + $api->verifyEmptyParameter('ep'); + $maxAge = $api->maxAge(); + UserRequest::addApiRequest($apiKey, $request->getRequestUri()); - $siteIdArr = [ - 'id' => $request->input('vid') ?? '0', - 'tvdb' => $request->input('tvdbid') ?? '0', - 'trakt' => $request->input('traktid') ?? '0', - 'tvrage' => $request->input('rid') ?? '0', - 'tvmaze' => $request->input('tvmazeid') ?? '0', - 'imdb' => Str::replace('tt', '', $request->input('imdbid')) ?? '0', - 'tmdb' => $request->input('tmdbid') ?? '0', - ]; + $siteIdArr = [ + 'id' => $request->input('vid') ?? '0', + 'tvdb' => $request->input('tvdbid') ?? '0', + 'trakt' => $request->input('traktid') ?? '0', + 'tvrage' => $request->input('rid') ?? '0', + 'tvmaze' => $request->input('tvmazeid') ?? '0', + 'imdb' => Str::replace('tt', '', $request->input('imdbid')) ?? '0', + 'tmdb' => $request->input('tmdbid') ?? '0', + ]; - // Process season only queries or Season and Episode/Airdate queries + // Process season only queries or Season and Episode/Airdate queries - $series = $request->input('season') ?? ''; - $episode = $request->input('ep') ?? ''; + $series = $request->input('season') ?? ''; + $episode = $request->input('ep') ?? ''; - if (preg_match('#^(19|20)\d{2}$#', $series, $year) && str_contains($episode, '/')) { - $airDate = str_replace('/', '-', $year[0].'-'.$episode); - } + if (preg_match('#^(19|20)\d{2}$#', $series, $year) && str_contains($episode, '/')) { + $airDate = str_replace('/', '-', $year[0].'-'.$episode); + } - $relData = $releases->tvSearch( - $siteIdArr, - $series, - $episode, - $airDate ?? '', - $api->offset(), - $api->limit(), - $request->input('q') ?? '', - $api->categoryID(), - $maxAge, - $minSize, - $catExclusions - ); + $relData = $releases->tvSearch( + $siteIdArr, + $series, + $episode, + $airDate ?? '', + $api->offset(), + $api->limit(), + $request->input('q') ?? '', + $api->categoryID(), + $maxAge, + $minSize, + $catExclusions + ); - $api->output($relData, $params, $outputXML, $offset, 'api'); - break; + $api->output($relData, $params, $outputXML, $offset, 'api'); + break; - // Search movie releases. - case 'm': - $api->verifyEmptyParameter('q'); - $api->verifyEmptyParameter('imdbid'); - $maxAge = $api->maxAge(); - UserRequest::addApiRequest($apiKey, $request->getRequestUri()); + // Search movie releases. + case 'm': + $api->verifyEmptyParameter('q'); + $api->verifyEmptyParameter('imdbid'); + $maxAge = $api->maxAge(); + UserRequest::addApiRequest($apiKey, $request->getRequestUri()); - $imdbId = $request->has('imdbid') && $request->filled('imdbid') ? (int) $request->input('imdbid') : -1; - $tmdbId = $request->has('tmdbid') && $request->filled('tmdbid') ? (int) $request->input('tmdbid') : -1; - $traktId = $request->has('traktid') && $request->filled('traktid') ? (int) $request->input('traktid') : -1; + $imdbId = $request->has('imdbid') && $request->filled('imdbid') ? (int) $request->input('imdbid') : -1; + $tmdbId = $request->has('tmdbid') && $request->filled('tmdbid') ? (int) $request->input('tmdbid') : -1; + $traktId = $request->has('traktid') && $request->filled('traktid') ? (int) $request->input('traktid') : -1; - $relData = $releases->moviesSearch( - $imdbId, - $tmdbId, - $traktId, - $api->offset(), - $api->limit(), - $request->input('q') ?? '', - $api->categoryID(), - $maxAge, - $minSize, - $catExclusions - ); + $relData = $releases->moviesSearch( + $imdbId, + $tmdbId, + $traktId, + $api->offset(), + $api->limit(), + $request->input('q') ?? '', + $api->categoryID(), + $maxAge, + $minSize, + $catExclusions + ); - $api->addCoverURL( - $relData, - function ($release) { - return Utility::getCoverURL(['type' => 'movies', 'id' => $release->imdbid]); - } - ); + $api->addCoverURL( + $relData, + function ($release) { + return Utility::getCoverURL(['type' => 'movies', 'id' => $release->imdbid]); + } + ); - $api->output($relData, $params, $outputXML, $offset, 'api'); - break; + $api->output($relData, $params, $outputXML, $offset, 'api'); + break; - // Get NZB. - case 'g': - $api->verifyEmptyParameter('g'); - UserRequest::addApiRequest($apiKey, $request->getRequestUri()); - $relData = Release::checkGuidForApi($request->input('id')); - if ($relData) { - return redirect(url('/getnzb?r='.$apiKey.'&id='.$request->input('id').(($request->has('del') && $request->input('del') === '1') ? '&del=1' : ''))); - } + // Get NZB. + case 'g': + $api->verifyEmptyParameter('g'); + UserRequest::addApiRequest($apiKey, $request->getRequestUri()); + $relData = Release::checkGuidForApi($request->input('id')); + if ($relData) { + return redirect(url('/getnzb?r='.$apiKey.'&id='.$request->input('id').(($request->has('del') && $request->input('del') === '1') ? '&del=1' : ''))); + } - Utility::showApiError(300, 'No such item (the guid you provided has no release in our database)'); - break; + Utility::showApiError(300, 'No such item (the guid you provided has no release in our database)'); + break; - // Get individual NZB details. - case 'd': - if ($request->missing('id')) { - Utility::showApiError(200, 'Missing parameter (guid is required for single release details)'); - } + // Get individual NZB details. + case 'd': + if ($request->missing('id')) { + Utility::showApiError(200, 'Missing parameter (guid is required for single release details)'); + } - UserRequest::addApiRequest($apiKey, $request->getRequestUri()); - $data = Release::getByGuid($request->input('id')); + UserRequest::addApiRequest($apiKey, $request->getRequestUri()); + $data = Release::getByGuid($request->input('id')); - $api->output($data, $params, $outputXML, $offset, 'api'); - break; + $api->output($data, $params, $outputXML, $offset, 'api'); + break; - // Get an NFO file for an individual release. - case 'n': - if ($request->missing('id')) { - Utility::showApiError(200, 'Missing parameter (id is required for retrieving an NFO)'); - } + // Get an NFO file for an individual release. + case 'n': + if ($request->missing('id')) { + Utility::showApiError(200, 'Missing parameter (id is required for retrieving an NFO)'); + } - UserRequest::addApiRequest($apiKey, $request->getRequestUri()); - $rel = Release::query()->where('guid', $request->input('id'))->first(['id', 'searchname']); - $data = ReleaseNfo::getReleaseNfo($rel['id']); + UserRequest::addApiRequest($apiKey, $request->getRequestUri()); + $rel = Release::query()->where('guid', $request->input('id'))->first(['id', 'searchname']); + $data = ReleaseNfo::getReleaseNfo($rel['id']); - if ($rel !== null) { - if ($data !== null) { - if ($request->has('o') && $request->input('o') === 'file') { - return response()->streamDownload(function () use ($data) { - echo $data['nfo']; - }, $rel['searchname'].'.nfo', ['Content-type:' => 'application/octet-stream']); - } + if ($rel !== null) { + if ($data !== null) { + if ($request->has('o') && $request->input('o') === 'file') { + return response()->streamDownload(function () use ($data) { + echo $data['nfo']; + }, $rel['searchname'].'.nfo', ['Content-type:' => 'application/octet-stream']); + } - echo nl2br(Utility::cp437toUTF($data['nfo'])); - } else { - Utility::showApiError(300, 'Release does not have an NFO file associated.'); - } - } else { - Utility::showApiError(300, 'Release does not exist.'); - } - break; + echo nl2br(Utility::cp437toUTF($data['nfo'])); + } else { + Utility::showApiError(300, 'Release does not have an NFO file associated.'); + } + } else { + Utility::showApiError(300, 'Release does not exist.'); + } + break; - // Capabilities request. - case 'c': - $api->output([], $params, $outputXML, $offset, 'caps'); - break; - } + // Capabilities request. + case 'c': + $api->output([], $params, $outputXML, $offset, 'caps'); + break; + } } } diff --git a/app/Http/Controllers/Api/ApiInformController.php b/app/Http/Controllers/Api/ApiInformController.php index b58abab8e..b5c288af6 100644 --- a/app/Http/Controllers/Api/ApiInformController.php +++ b/app/Http/Controllers/Api/ApiInformController.php @@ -14,8 +14,6 @@ class ApiInformController extends Controller /** * http://sitename/api/inform/release?api_token=xxxxx&relo=xxx&relp=xxx. * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse * * @throws \Exception */ diff --git a/app/Http/Controllers/Api/ApiV2Controller.php b/app/Http/Controllers/Api/ApiV2Controller.php index 4545ad0a3..8676bb39c 100644 --- a/app/Http/Controllers/Api/ApiV2Controller.php +++ b/app/Http/Controllers/Api/ApiV2Controller.php @@ -21,31 +21,28 @@ use Illuminate\Support\Carbon; class ApiV2Controller extends BasePageController { - /** - * @return \Illuminate\Http\JsonResponse - */ public function capabilities(): JsonResponse { $category = Category::getForApi(); $capabilities = [ 'server' => [ - 'title' => config('app.name'), - 'strapline' => Settings::settingValue('site.main.strapline'), - 'email' => config('mail.from.address'), - 'url' => url('/'), + 'title' => config('app.name'), + 'strapline' => Settings::settingValue('site.main.strapline'), + 'email' => config('mail.from.address'), + 'url' => url('/'), ], 'limits' => [ - 'max' => 100, + 'max' => 100, 'default' => 100, ], 'registration' => [ 'available' => 'no', - 'open' => (int) Settings::settingValue('..registerstatus') === 0 ? 'yes' : 'no', + 'open' => (int) Settings::settingValue('..registerstatus') === 0 ? 'yes' : 'no', ], 'searching' => [ - 'search' => ['available' => 'yes', 'supportedParams' => 'id'], - 'tv-search' => ['available' => 'yes', 'supportedParams' => 'id,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'], + 'search' => ['available' => 'yes', 'supportedParams' => 'id'], + 'tv-search' => ['available' => 'yes', 'supportedParams' => 'id,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'], 'movie-search' => ['available' => 'yes', 'supportedParams' => 'id, imdbid, tmdbid, traktid'], 'audio-search' => ['available' => 'no', 'supportedParams' => ''], ], @@ -56,9 +53,6 @@ class ApiV2Controller extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Foolz\SphinxQL\Exception\ConnectionException * @throws \Foolz\SphinxQL\Exception\DatabaseException * @throws \Foolz\SphinxQL\Exception\SphinxQLException @@ -114,9 +108,6 @@ class ApiV2Controller extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Exception * @throws \Throwable */ @@ -183,9 +174,6 @@ class ApiV2Controller extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Exception * @throws \Throwable */ @@ -212,13 +200,13 @@ class ApiV2Controller extends BasePageController event(new UserAccessedApi($user)); $siteIdArr = [ - 'id' => $request->input('vid') ?? '0', - 'tvdb' => $request->input('tvdbid') ?? '0', - 'trakt' => $request->input('traktid') ?? '0', + 'id' => $request->input('vid') ?? '0', + 'tvdb' => $request->input('tvdbid') ?? '0', + 'trakt' => $request->input('traktid') ?? '0', 'tvrage' => $request->input('rid') ?? '0', 'tvmaze' => $request->input('tvmazeid') ?? '0', - 'imdb' => $request->input('imdbid') ?? '0', - 'tmdb' => $request->input('tmdbid') ?? '0', + 'imdb' => $request->input('imdbid') ?? '0', + 'tmdb' => $request->input('tmdbid') ?? '0', ]; // Process season only queries or Season and Episode/Airdate queries @@ -265,7 +253,6 @@ class ApiV2Controller extends BasePageController } /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void */ public function getNzb(Request $request) @@ -281,10 +268,6 @@ class ApiV2Controller extends BasePageController Utility::showApiError(300, 'No such item (the guid you provided has no release in our database)'); } - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - */ public function details(Request $request): JsonResponse { if ($request->missing('id')) { diff --git a/app/Http/Controllers/Api/Capabilities.php b/app/Http/Controllers/Api/Capabilities.php index 5f742233b..34ec2912f 100644 --- a/app/Http/Controllers/Api/Capabilities.php +++ b/app/Http/Controllers/Api/Capabilities.php @@ -31,9 +31,6 @@ use Blacklight\utility\Utility; */ abstract class Capabilities { - /** - * @var \PDO - */ public \PDO $pdo; /** @@ -57,25 +54,18 @@ abstract class Capabilities } /** - * @param $data - * @param array $params - * @param bool $xml - * @param int $offset - * @param string $type - * @return void - * * @throws \Exception */ - public function output($data, array $params, bool $xml = true, int $offset, string $type = ''): void + public function output($data, array $params, bool $xml, int $offset, string $type = ''): void { $this->type = $type; $options = [ 'Parameters' => $params, - 'Data' => $data, - 'Server' => $this->getForMenu(), - 'Offset' => $offset, - 'Type' => $type, + 'Data' => $data, + 'Server' => $this->getForMenu(), + 'Offset' => $offset, + 'Type' => $type, ]; // Generate the XML Response @@ -100,40 +90,39 @@ abstract class Capabilities /** * Collect and return various capability information for usage in API. * - * @return array * * @throws \Exception */ public function getForMenu(): array - { - $serverroot = url('/'); + { + $serverroot = url('/'); - return [ - 'server' => [ - 'title' => config('app.name'), - 'strapline' => Settings::settingValue('site.main.strapline'), - 'email' => config('mail.from.address'), - 'meta' => Settings::settingValue('site.main.metakeywords'), - 'url' => $serverroot, - 'image' => $serverroot.'/assets/images/tmux_logo.png', - ], - 'limits' => [ - 'max' => 100, - 'default' => 100, - ], - 'registration' => [ - 'available' => 'yes', - 'open' => (int) Settings::settingValue('..registerstatus') === 0 ? 'yes' : 'no', - ], - 'searching' => [ - 'search' => ['available' => 'yes', 'supportedParams' => 'q'], - 'tv-search' => ['available' => 'yes', 'supportedParams' => 'q,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'], - 'movie-search' => ['available' => 'yes', 'supportedParams' => 'q,imdbid, tmdbid, traktid'], - 'audio-search' => ['available' => 'no', 'supportedParams' => ''], - ], - 'categories' => $this->type === 'caps' - ? Category::getForMenu() - : null, - ]; - } + return [ + 'server' => [ + 'title' => config('app.name'), + 'strapline' => Settings::settingValue('site.main.strapline'), + 'email' => config('mail.from.address'), + 'meta' => Settings::settingValue('site.main.metakeywords'), + 'url' => $serverroot, + 'image' => $serverroot.'/assets/images/tmux_logo.png', + ], + 'limits' => [ + 'max' => 100, + 'default' => 100, + ], + 'registration' => [ + 'available' => 'yes', + 'open' => (int) Settings::settingValue('..registerstatus') === 0 ? 'yes' : 'no', + ], + 'searching' => [ + 'search' => ['available' => 'yes', 'supportedParams' => 'q'], + 'tv-search' => ['available' => 'yes', 'supportedParams' => 'q,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'], + 'movie-search' => ['available' => 'yes', 'supportedParams' => 'q,imdbid, tmdbid, traktid'], + 'audio-search' => ['available' => 'no', 'supportedParams' => ''], + ], + 'categories' => $this->type === 'caps' + ? Category::getForMenu() + : null, + ]; + } } diff --git a/app/Http/Controllers/Api/RSS.php b/app/Http/Controllers/Api/RSS.php index 0dc654199..2ebb551d6 100644 --- a/app/Http/Controllers/Api/RSS.php +++ b/app/Http/Controllers/Api/RSS.php @@ -22,8 +22,6 @@ class RSS extends Capabilities public $releases; /** - * @param array $options - * * @throws \Exception */ public function __construct(array $options = []) @@ -42,13 +40,8 @@ class RSS extends Capabilities * Get releases for RSS. * * - * @param $cat - * @param int $offset - * @param $videosId - * @param $aniDbID * @param int $userID * @param int $airDate - * @param int $limit * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Query\Builder[]|\Illuminate\Support\Collection|mixed */ public function getRss($cat, $videosId, $aniDbID, $userID = 0, $airDate = -1, int $limit = 100, int $offset = 0) @@ -119,7 +112,6 @@ class RSS extends Capabilities /** * @param int $limit * @param int $userID - * @param array $excludedCats * @param int $airDate * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection * @@ -182,7 +174,6 @@ class RSS extends Capabilities * * @param int $limit * @param int $userID - * @param array $excludedCats * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|mixed * * @throws \Exception @@ -238,9 +229,6 @@ class RSS extends Capabilities } /** - * @param $column - * @param $table - * @param $order * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Query\Builder|null */ public function getFirstInstance($column, $table, $order) diff --git a/app/Http/Controllers/Api/XML_Response.php b/app/Http/Controllers/Api/XML_Response.php index 86ef6a355..d5b586913 100644 --- a/app/Http/Controllers/Api/XML_Response.php +++ b/app/Http/Controllers/Api/XML_Response.php @@ -38,71 +38,52 @@ class XML_Response /** * The RSS namespace used for the output. - * - * @var string */ protected string $namespace; /** * The trailing URL parameters on the request. - * - * @var mixed */ protected mixed $parameters; /** * The release we are adding to the stream. - * - * @var mixed */ protected mixed $release; /** * The retrieved releases we are returning from the API call. - * - * @var mixed */ protected mixed $releases; /** * The various server variables and active categories. - * - * @var mixed */ protected mixed $server; /** * The XML formatting operation we are returning. - * - * @var mixed */ protected mixed $type; /** * The XMLWriter Class. - * - * @var \XMLWriter */ protected \XMLWriter $xml; - /** - * @var mixed - */ protected mixed $offset; /** * XMLReturn constructor. - * - * @param array $options */ public function __construct(array $options = []) { $defaults = [ 'Parameters' => null, - 'Data' => null, - 'Server' => null, - 'Offset' => null, - 'Type' => null, + 'Data' => null, + 'Server' => null, + 'Offset' => null, + 'Type' => null, ]; $options += $defaults; @@ -117,9 +98,6 @@ class XML_Response $this->xml->setIndent(true); } - /** - * @return bool|string - */ public function returnXML(): bool|string { if ($this->xml) { diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index c6b98fa69..25be84066 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -36,8 +36,6 @@ class ForgotPasswordController extends Controller } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function showLinkRequestForm(Request $request): void @@ -91,9 +89,9 @@ class ForgotPasswordController extends Controller 'meta_title' => $meta_title, 'meta_keywords' => $meta_keywords, 'meta_description' => $meta_description, - 'email' => $email, - 'apikey' => $rssToken, - 'sent' => $sent, + 'email' => $email, + 'apikey' => $rssToken, + 'sent' => $sent, ] ); app('smarty.view')->display($theme.'/basepage.tpl'); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 1dd3118b7..c59d49f29 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -28,20 +28,12 @@ class LoginController extends Controller use AuthenticatesUsers; - /** - * @var int - */ protected int $maxAttempts = 3; // Default is 5 - /** - * @var int - */ protected int $decayMinutes = 2; // Default is 1 /** * Where to redirect users after login. - * - * @var string */ protected string $redirectTo = '/'; @@ -56,7 +48,6 @@ class LoginController extends Controller } /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse|null * * @throws \Illuminate\Auth\AuthenticationException @@ -129,9 +120,6 @@ class LoginController extends Controller return $this->showLoginForm(); } - /** - * @return void - */ public function showLoginForm(): void { $theme = Settings::settingValue('site.main.style'); @@ -144,10 +132,6 @@ class LoginController extends Controller app('smarty.view')->display($theme.'/basepage.tpl'); } - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - */ public function logout(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse { $this->guard()->logout(); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 05c2a9ac9..d326e1a29 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -39,14 +39,9 @@ class RegisterController extends Controller /** * Where to redirect users after registration. - * - * @var string */ protected string $redirectTo = '/'; - /** - * @var string - */ private string $inviteCodeQuery = ''; /** @@ -59,10 +54,6 @@ class RegisterController extends Controller $this->middleware('guest', ['except' => ['getVerification', 'getVerificationError']]); } - /** - * @param array $data - * @return \App\Models\User - */ protected function create(array $data): User { $user = User::create([ @@ -118,7 +109,6 @@ class RegisterController extends Controller } /** - * @param Request $request * @return RedirectResponse|Redirector|void * * @throws ValidationException @@ -193,28 +183,22 @@ class RegisterController extends Controller $showRegister = 1; } break; - } app('smarty.view')->assign( [ - 'username' => Utility::htmlfmt($userName), - 'password' => Utility::htmlfmt($password), - 'password_confirmation' => Utility::htmlfmt($confirmPassword), - 'email' => Utility::htmlfmt($email), - 'invitecode' => Utility::htmlfmt($inviteCode), + 'username' => Utility::htmlfmt($userName), + 'password' => Utility::htmlfmt($password), + 'password_confirmation' => Utility::htmlfmt($confirmPassword), + 'email' => Utility::htmlfmt($email), + 'invitecode' => Utility::htmlfmt($inviteCode), 'invite_code_query' => Utility::htmlfmt($this->inviteCodeQuery), - 'showregister' => $showRegister, + 'showregister' => $showRegister, ] ); return $this->showRegistrationForm($request, $error, $showRegister); } - /** - * @param Request $request - * @param string $error - * @param int $showRegister - */ public function showRegistrationForm(Request $request, string $error = '', int $showRegister = 0): void { $inviteCode = ''; diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 1931caec1..5ed4d84dd 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -26,8 +26,6 @@ class ResetPasswordController extends Controller /** * Where to redirect users after resetting their password. - * - * @var string */ protected string $redirectTo = '/'; @@ -42,8 +40,6 @@ class ResetPasswordController extends Controller } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function reset(Request $request): void @@ -60,7 +56,6 @@ class ResetPasswordController extends Controller if ($ret === null) { $error = 'Bad reset code provided.'; } else { - // // reset the password, inform the user, send out the email // diff --git a/app/Http/Controllers/BasePageController.php b/app/Http/Controllers/BasePageController.php index 0f1a02c98..ec63a4a77 100644 --- a/app/Http/Controllers/BasePageController.php +++ b/app/Http/Controllers/BasePageController.php @@ -15,57 +15,29 @@ use Illuminate\Support\Facades\Auth; class BasePageController extends Controller { - /** - * @var \App\Models\Settings - */ public Settings $settings; - /** - * @var string - */ public string $title = ''; - /** - * @var string - */ public string $content = ''; - /** - * @var string - */ public string $meta_keywords = ''; - /** - * @var string - */ public string $meta_title = ''; - /** - * @var string - */ public string $meta_description = ''; /** * Current page the user is browsing. ie browse. - * - * @var string */ public string $page = ''; - /** - * @var string - */ public string $page_template = ''; - /** - * @var User - */ public User $userdata; /** * User's theme. - * - * @var string */ protected string $theme = 'Gentele'; @@ -94,15 +66,6 @@ class BasePageController extends Controller $this->smarty->assign('serverroot', url('/')); } - /** - * @param $query - * @param $totalCount - * @param $items - * @param $page - * @param $path - * @param $reqQuery - * @return \Illuminate\Pagination\LengthAwarePaginator - */ public function paginate($query, $totalCount, $items, $page, $path, $reqQuery): LengthAwarePaginator { return new LengthAwarePaginator($query, $totalCount, $items, $page, ['path' => $path, 'query' => $reqQuery]); @@ -139,15 +102,12 @@ class BasePageController extends Controller $this->smarty->assign( [ - 'theme'=> $this->theme, + 'theme' => $this->theme, 'site' => $this->settings, ] ); } - /** - * @return bool - */ public function isPostBack(): bool { return \request()->isMethod('POST'); @@ -156,7 +116,6 @@ class BasePageController extends Controller /** * Show 404 page. * - * @param $message * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function show404($message = null) @@ -312,9 +271,9 @@ class BasePageController extends Controller // Tell Smarty which directories to use for templates $this->smarty->setTemplateDir( [ - 'admin' => config('ytake-laravel-smarty.template_path').'/admin', - 'shared' => config('ytake-laravel-smarty.template_path').'/shared', - 'default' => config('ytake-laravel-smarty.template_path').'/admin', + 'admin' => config('ytake-laravel-smarty.template_path').'/admin', + 'shared' => config('ytake-laravel-smarty.template_path').'/shared', + 'default' => config('ytake-laravel-smarty.template_path').'/admin', ] ); diff --git a/app/Http/Controllers/BooksController.php b/app/Http/Controllers/BooksController.php index afe70f017..b68003107 100644 --- a/app/Http/Controllers/BooksController.php +++ b/app/Http/Controllers/BooksController.php @@ -10,9 +10,6 @@ use Illuminate\Support\Arr; class BooksController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @param string $id - * * @throws \Exception */ public function index(Request $request, string $id = ''): void @@ -91,7 +88,7 @@ class BooksController extends BasePageController $this->smarty->assign( [ - 'resultsadd'=> $books, + 'resultsadd' => $books, 'results' => $results, 'covgroup' => 'books', ] diff --git a/app/Http/Controllers/BrowseController.php b/app/Http/Controllers/BrowseController.php index 03bbdaa9a..8353b53cb 100644 --- a/app/Http/Controllers/BrowseController.php +++ b/app/Http/Controllers/BrowseController.php @@ -57,9 +57,6 @@ class BrowseController extends BasePageController } /** - * @param string $parentCategory - * @param string $id - * * @throws \Exception */ public function show(string $parentCategory, string $id = 'All'): void @@ -154,8 +151,6 @@ class BrowseController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function group(Request $request): void @@ -195,8 +190,6 @@ class BrowseController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function tags(Request $request): void diff --git a/app/Http/Controllers/BtcPaymentController.php b/app/Http/Controllers/BtcPaymentController.php index 9090699f7..5a80c2010 100644 --- a/app/Http/Controllers/BtcPaymentController.php +++ b/app/Http/Controllers/BtcPaymentController.php @@ -10,9 +10,6 @@ use Spatie\Permission\Models\Role; class BtcPaymentController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function show(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/CartController.php b/app/Http/Controllers/CartController.php index 67f7f45b7..fff8af95e 100644 --- a/app/Http/Controllers/CartController.php +++ b/app/Http/Controllers/CartController.php @@ -28,9 +28,6 @@ class CartController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function store(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse @@ -55,9 +52,6 @@ class CartController extends BasePageController } /** - * @param array|string $id - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function destroy(array|string $id): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/ConsoleController.php b/app/Http/Controllers/ConsoleController.php index b8bd10431..aeea740ab 100644 --- a/app/Http/Controllers/ConsoleController.php +++ b/app/Http/Controllers/ConsoleController.php @@ -11,10 +11,6 @@ use Illuminate\Support\Arr; class ConsoleController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @param string $id - * @return \Illuminate\Http\JsonResponse - * * @throws \Exception */ public function show(Request $request, string $id = ''): \Illuminate\Http\JsonResponse @@ -100,7 +96,7 @@ class ConsoleController extends BasePageController $this->smarty->assign( [ - 'resultsadd'=> $consoles, + 'resultsadd' => $consoles, 'results' => $results, 'covgroup' => 'console', ] diff --git a/app/Http/Controllers/ContactUsController.php b/app/Http/Controllers/ContactUsController.php index 1cc507fb6..5b9ea04e0 100644 --- a/app/Http/Controllers/ContactUsController.php +++ b/app/Http/Controllers/ContactUsController.php @@ -8,9 +8,6 @@ use Illuminate\Http\Request; class ContactUsController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|null - * * @throws \Illuminate\Validation\ValidationException */ public function contact(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|null @@ -50,8 +47,6 @@ class ContactUsController extends BasePageController } /** - * @param string $msg - * * @throws \Exception */ public function showContactForm(string $msg = ''): void diff --git a/app/Http/Controllers/ContentController.php b/app/Http/Controllers/ContentController.php index 0771d5a7e..53bdaa3c2 100644 --- a/app/Http/Controllers/ContentController.php +++ b/app/Http/Controllers/ContentController.php @@ -8,7 +8,6 @@ use Illuminate\Http\Request; class ContentController extends BasePageController { /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse|void * * @throws \Exception diff --git a/app/Http/Controllers/DetailsController.php b/app/Http/Controllers/DetailsController.php index fbb09f4f2..27d193902 100644 --- a/app/Http/Controllers/DetailsController.php +++ b/app/Http/Controllers/DetailsController.php @@ -27,7 +27,6 @@ use Illuminate\Support\Facades\Auth; class DetailsController extends BasePageController { /** - * @param string $guid * @return \Illuminate\Http\RedirectResponse|void * * @throws \Foolz\SphinxQL\Exception\ConnectionException diff --git a/app/Http/Controllers/FailedReleasesController.php b/app/Http/Controllers/FailedReleasesController.php index 9d15df9de..b168d590b 100644 --- a/app/Http/Controllers/FailedReleasesController.php +++ b/app/Http/Controllers/FailedReleasesController.php @@ -9,9 +9,6 @@ use Illuminate\Http\Request; class FailedReleasesController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Contracts\Foundation\Application|\Illuminate\Http\Response - * * @throws \Exception */ public function failed(Request $request): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Contracts\Foundation\Application|\Illuminate\Http\Response diff --git a/app/Http/Controllers/FileListController.php b/app/Http/Controllers/FileListController.php index 2d8e4441b..7bc26ddd9 100644 --- a/app/Http/Controllers/FileListController.php +++ b/app/Http/Controllers/FileListController.php @@ -8,8 +8,6 @@ use Blacklight\NZB; class FileListController extends BasePageController { /** - * @param string $guid - * * @throws \Exception */ public function show(string $guid): void @@ -47,7 +45,7 @@ class FileListController extends BasePageController $this->smarty->assign( compact('title', 'content', 'meta_title', 'meta_keywords', 'meta_description') - ); + ); $this->pagerender(); } } diff --git a/app/Http/Controllers/ForumController.php b/app/Http/Controllers/ForumController.php index 92ec4768c..932cadb22 100644 --- a/app/Http/Controllers/ForumController.php +++ b/app/Http/Controllers/ForumController.php @@ -10,7 +10,6 @@ use Illuminate\Support\Facades\Auth; class ForumController extends BasePageController { /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception @@ -65,8 +64,6 @@ class ForumController extends BasePageController } /** - * @param $id - * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception @@ -106,10 +103,6 @@ class ForumController extends BasePageController $this->pagerender(); } - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - */ public function deleteTopic(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application { $id = $request->input('id') + 0; @@ -124,8 +117,6 @@ class ForumController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function edit(Request $request): void @@ -158,9 +149,6 @@ class ForumController extends BasePageController } /** - * @param $id - * @return \Illuminate\Http\RedirectResponse - * * @throws \Exception */ public function destroy($id): \Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/GamesController.php b/app/Http/Controllers/GamesController.php index 913acd695..d7353e464 100644 --- a/app/Http/Controllers/GamesController.php +++ b/app/Http/Controllers/GamesController.php @@ -10,8 +10,6 @@ use Illuminate\Http\Request; class GamesController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function show(Request $request): void diff --git a/app/Http/Controllers/GetNzbController.php b/app/Http/Controllers/GetNzbController.php index 0a38244f3..d2e55eed5 100644 --- a/app/Http/Controllers/GetNzbController.php +++ b/app/Http/Controllers/GetNzbController.php @@ -17,9 +17,6 @@ use Symfony\Component\HttpFoundation\StreamedResponse; class GetNzbController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse|\STS\ZipStream\ZipStream|\Symfony\Component\HttpFoundation\StreamedResponse - * * @throws \Exception */ public function getNzb(Request $request): \STS\ZipStream\ZipStream|StreamedResponse|JsonResponse diff --git a/app/Http/Controllers/MovieController.php b/app/Http/Controllers/MovieController.php index 5e8b3e4b6..7b19978d8 100644 --- a/app/Http/Controllers/MovieController.php +++ b/app/Http/Controllers/MovieController.php @@ -10,9 +10,6 @@ use Illuminate\Support\Arr; class MovieController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @param string $id - * * @throws \Exception */ public function showMovies(Request $request, string $id = ''): void @@ -33,7 +30,7 @@ class MovieController extends BasePageController $category = $request->has('imdb') ? -1 : ($request->has('t') ? $request->input('t') : Category::MOVIE_ROOT); if ($id && \in_array($id, Arr::pluck($mtmp, 'title'), false)) { $cat = Category::query() - ->where(['title'=> $id, 'root_categories_id' => Category::MOVIE_ROOT]) + ->where(['title' => $id, 'root_categories_id' => Category::MOVIE_ROOT]) ->first(['id']); $category = $cat !== null ? $cat['id'] : Category::MOVIE_ROOT; } @@ -107,7 +104,7 @@ class MovieController extends BasePageController $this->smarty->assign( [ - 'resultsadd'=> $movies, + 'resultsadd' => $movies, 'results' => $results, 'covgroup' => 'movies', ] @@ -128,9 +125,6 @@ class MovieController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - * * @throws \Exception */ public function showTrailer(Request $request): \Illuminate\Http\JsonResponse diff --git a/app/Http/Controllers/MusicController.php b/app/Http/Controllers/MusicController.php index 6f8db08ad..f6227e965 100644 --- a/app/Http/Controllers/MusicController.php +++ b/app/Http/Controllers/MusicController.php @@ -11,9 +11,6 @@ use Illuminate\Support\Arr; class MusicController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @param string $id - * * @throws \Exception */ public function show(Request $request, string $id = ''): void @@ -98,7 +95,7 @@ class MusicController extends BasePageController $this->smarty->assign( [ - 'resultsadd'=> $musics, + 'resultsadd' => $musics, 'results' => $results, 'covgroup' => 'music', ] diff --git a/app/Http/Controllers/MyMoviesController.php b/app/Http/Controllers/MyMoviesController.php index 6c59b8ba7..f01749f63 100644 --- a/app/Http/Controllers/MyMoviesController.php +++ b/app/Http/Controllers/MyMoviesController.php @@ -12,9 +12,6 @@ use Illuminate\Http\Request; class MyMoviesController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function show(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse @@ -67,25 +64,25 @@ class MyMoviesController extends BasePageController return redirect('/mymovies'); } - $tmpcats = Category::getChildren(Category::MOVIE_ROOT); - $categories = []; - foreach ($tmpcats as $c) { - // If MOVIE WEB-DL categorization is disabled, don't include it as an option - if ((int) $c['id'] === Category::MOVIE_WEBDL && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) { - continue; + $tmpcats = Category::getChildren(Category::MOVIE_ROOT); + $categories = []; + foreach ($tmpcats as $c) { + // If MOVIE WEB-DL categorization is disabled, don't include it as an option + if ((int) $c['id'] === Category::MOVIE_WEBDL && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) { + continue; + } + $categories[$c['id']] = $c['title']; } - $categories[$c['id']] = $c['title']; - } - $this->smarty->assign('type', 'add'); - $this->smarty->assign('cat_ids', array_keys($categories)); - $this->smarty->assign('cat_names', $categories); - $this->smarty->assign('cat_selected', []); - $this->smarty->assign('imdbid', $imdbid); - $this->smarty->assign('movie', $movie); - $content = $this->smarty->fetch('mymovies-add.tpl'); - $this->smarty->assign('content', $content); - $this->pagerender(); - break; + $this->smarty->assign('type', 'add'); + $this->smarty->assign('cat_ids', array_keys($categories)); + $this->smarty->assign('cat_names', $categories); + $this->smarty->assign('cat_selected', []); + $this->smarty->assign('imdbid', $imdbid); + $this->smarty->assign('movie', $movie); + $content = $this->smarty->fetch('mymovies-add.tpl'); + $this->smarty->assign('content', $content); + $this->pagerender(); + break; case 'edit': case 'doedit': $movie = UserMovie::getMovie($this->userdata->id, $imdbid); @@ -104,22 +101,22 @@ class MyMoviesController extends BasePageController return redirect('mymovies'); } - $tmpcats = Category::getChildren(Category::MOVIE_ROOT); - $categories = []; - foreach ($tmpcats as $c) { - $categories[$c['id']] = $c['title']; - } + $tmpcats = Category::getChildren(Category::MOVIE_ROOT); + $categories = []; + foreach ($tmpcats as $c) { + $categories[$c['id']] = $c['title']; + } - $this->smarty->assign('type', 'edit'); - $this->smarty->assign('cat_ids', array_keys($categories)); - $this->smarty->assign('cat_names', $categories); - $this->smarty->assign('cat_selected', explode('|', $movie['categories'])); - $this->smarty->assign('imdbid', $imdbid); - $this->smarty->assign('movie', $movie); - $content = $this->smarty->fetch('mymovies-add.tpl'); - $this->smarty->assign('content', $content); - $this->pagerender(); - break; + $this->smarty->assign('type', 'edit'); + $this->smarty->assign('cat_ids', array_keys($categories)); + $this->smarty->assign('cat_names', $categories); + $this->smarty->assign('cat_selected', explode('|', $movie['categories'])); + $this->smarty->assign('imdbid', $imdbid); + $this->smarty->assign('movie', $movie); + $content = $this->smarty->fetch('mymovies-add.tpl'); + $this->smarty->assign('content', $content); + $this->pagerender(); + break; case 'browse': $title = 'Browse My Movies'; diff --git a/app/Http/Controllers/MyShowsController.php b/app/Http/Controllers/MyShowsController.php index 9ee0bc641..15598a8a7 100644 --- a/app/Http/Controllers/MyShowsController.php +++ b/app/Http/Controllers/MyShowsController.php @@ -12,9 +12,6 @@ use Illuminate\Http\Request; class MyShowsController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \Exception */ public function show(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse @@ -66,27 +63,27 @@ class MyShowsController extends BasePageController return redirect('myshows'); } - $tmpcats = Category::getChildren(Category::TV_ROOT); - $categories = []; - foreach ($tmpcats as $c) { - // If TV WEB-DL categorization is disabled, don't include it as an option - if ((int) $c['id'] === Category::TV_WEBDL && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) { - continue; + $tmpcats = Category::getChildren(Category::TV_ROOT); + $categories = []; + foreach ($tmpcats as $c) { + // If TV WEB-DL categorization is disabled, don't include it as an option + if ((int) $c['id'] === Category::TV_WEBDL && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) { + continue; + } + $categories[$c['id']] = $c['title']; } - $categories[$c['id']] = $c['title']; - } - $this->smarty->assign('type', 'add'); - $this->smarty->assign('cat_ids', array_keys($categories)); - $this->smarty->assign('cat_names', $categories); - $this->smarty->assign('cat_selected', []); - $this->smarty->assign('video', $videoId); - $this->smarty->assign('show', $show); - $content = $this->smarty->fetch('myshows-add.tpl'); - $this->smarty->assign([ - 'content' => $content, - ]); - $this->pagerender(); - break; + $this->smarty->assign('type', 'add'); + $this->smarty->assign('cat_ids', array_keys($categories)); + $this->smarty->assign('cat_names', $categories); + $this->smarty->assign('cat_selected', []); + $this->smarty->assign('video', $videoId); + $this->smarty->assign('show', $show); + $content = $this->smarty->fetch('myshows-add.tpl'); + $this->smarty->assign([ + 'content' => $content, + ]); + $this->pagerender(); + break; case 'edit': case 'doedit': $show = UserSerie::getShow($this->userdata->id, $videoId); @@ -105,24 +102,24 @@ class MyShowsController extends BasePageController return redirect('myshows'); } - $tmpcats = Category::getChildren(Category::TV_ROOT); - $categories = []; - foreach ($tmpcats as $c) { - $categories[$c['id']] = $c['title']; - } + $tmpcats = Category::getChildren(Category::TV_ROOT); + $categories = []; + foreach ($tmpcats as $c) { + $categories[$c['id']] = $c['title']; + } - $this->smarty->assign('type', 'edit'); - $this->smarty->assign('cat_ids', array_keys($categories)); - $this->smarty->assign('cat_names', $categories); - $this->smarty->assign('cat_selected', explode('|', $show['categories'])); - $this->smarty->assign('video', $videoId); - $this->smarty->assign('show', $show); - $content = $this->smarty->fetch('myshows-add.tpl'); - $this->smarty->assign([ - 'content' => $content, - ]); - $this->pagerender(); - break; + $this->smarty->assign('type', 'edit'); + $this->smarty->assign('cat_ids', array_keys($categories)); + $this->smarty->assign('cat_names', $categories); + $this->smarty->assign('cat_selected', explode('|', $show['categories'])); + $this->smarty->assign('video', $videoId); + $this->smarty->assign('show', $show); + $content = $this->smarty->fetch('myshows-add.tpl'); + $this->smarty->assign([ + 'content' => $content, + ]); + $this->pagerender(); + break; default: $title = 'My Shows'; @@ -164,8 +161,6 @@ class MyShowsController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function browse(Request $request): void diff --git a/app/Http/Controllers/NfoController.php b/app/Http/Controllers/NfoController.php index 0009eed6d..af634c7a5 100644 --- a/app/Http/Controllers/NfoController.php +++ b/app/Http/Controllers/NfoController.php @@ -10,9 +10,6 @@ use Illuminate\Http\Request; class NfoController extends BasePageController { /** - * @param string $id - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function showNfo(Request $request, string $id = ''): void diff --git a/app/Http/Controllers/PasswordSecurityController.php b/app/Http/Controllers/PasswordSecurityController.php index 1db422289..46e8f9c62 100644 --- a/app/Http/Controllers/PasswordSecurityController.php +++ b/app/Http/Controllers/PasswordSecurityController.php @@ -9,10 +9,6 @@ use Illuminate\Support\Facades\Hash; class PasswordSecurityController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View - */ public function show2faForm(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application { $user = Auth::user(); @@ -34,9 +30,6 @@ class PasswordSecurityController extends Controller } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException * @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException * @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException @@ -58,9 +51,6 @@ class PasswordSecurityController extends Controller } /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - * * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException * @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException * @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException @@ -80,10 +70,6 @@ class PasswordSecurityController extends Controller return redirect('2fa')->with('error', 'Invalid Verification Code, Please try again.'); } - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector - */ public function disable2fa(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application { if (! (Hash::check($request->get('current-password'), Auth::user()->password))) { diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index f78dffece..2ed7ed668 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -21,8 +21,6 @@ use Jrean\UserVerification\Facades\UserVerification; class ProfileController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Throwable */ public function show(Request $request) @@ -70,13 +68,13 @@ class ProfileController extends BasePageController } $this->smarty->assign( [ - 'apirequests' => UserRequest::getApiRequests($userID), - 'grabstoday' => UserDownload::getDownloadRequests($userID), - 'userinvitedby' => $this->userdata->invitedby !== '' ? User::find($this->userdata->invitedby) : '', - 'user' => $this->userdata, - 'privateprofiles' => $privateProfiles, - 'publicview' => $publicView, - 'privileged' => $privileged, + 'apirequests' => UserRequest::getApiRequests($userID), + 'grabstoday' => UserDownload::getDownloadRequests($userID), + 'userinvitedby' => $this->userdata->invitedby !== '' ? User::find($this->userdata->invitedby) : '', + 'user' => $this->userdata, + 'privateprofiles' => $privateProfiles, + 'publicview' => $publicView, + 'privileged' => $privileged, ] ); @@ -85,7 +83,7 @@ class ProfileController extends BasePageController SABnzbd::API_TYPE_FULL => 'Full Api Key', ]; $sabPriorities = [ - SABnzbd::PRIORITY_FORCE => 'Force', SABnzbd::PRIORITY_HIGH => 'High', + SABnzbd::PRIORITY_FORCE => 'Force', SABnzbd::PRIORITY_HIGH => 'High', SABnzbd::PRIORITY_NORMAL => 'Normal', SABnzbd::PRIORITY_LOW => 'Low', ]; $sabSettings = [1 => 'Site', 2 => 'Cookie']; @@ -93,12 +91,12 @@ class ProfileController extends BasePageController // Pager must be fetched after the variables are assigned to smarty. $this->smarty->assign( [ - 'commentslist' => ReleaseComment::getCommentsForUserRange($userID), - 'saburl' => $sab->url, - 'sabapikey' => $sab->apikey, + 'commentslist' => ReleaseComment::getCommentsForUserRange($userID), + 'saburl' => $sab->url, + 'sabapikey' => $sab->apikey, 'sabapikeytype' => $sab->apikeytype !== '' ? $sabApiKeyTypes[$sab->apikeytype] : '', - 'sabpriority' => $sab->priority !== '' ? $sabPriorities[$sab->priority] : '', - 'sabsetting' => $sabSettings[$sab->checkCookie() ? 2 : 1], + 'sabpriority' => $sab->priority !== '' ? $sabPriorities[$sab->priority] : '', + 'sabsetting' => $sabSettings[$sab->checkCookie() ? 2 : 1], ] ); @@ -120,7 +118,6 @@ class ProfileController extends BasePageController } /** - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void * * @throws \Exception @@ -331,7 +328,7 @@ class ProfileController extends BasePageController $this->smarty->assign( [ - 'queuetypes' => $queueTypes, + 'queuetypes' => $queueTypes, 'queuetypeids' => $queueTypeIDs, ] ); @@ -352,9 +349,6 @@ class ProfileController extends BasePageController } /** - * @param Request $request - * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View - * * @throws \Exception */ public function destroy(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\Routing\Redirector|\Illuminate\View\View|\Illuminate\Http\RedirectResponse diff --git a/app/Http/Controllers/QueueController.php b/app/Http/Controllers/QueueController.php index cb164b033..757392b31 100644 --- a/app/Http/Controllers/QueueController.php +++ b/app/Http/Controllers/QueueController.php @@ -11,8 +11,6 @@ use Illuminate\Http\Request; class QueueController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function index(Request $request): void diff --git a/app/Http/Controllers/RssController.php b/app/Http/Controllers/RssController.php index a59301a92..fd521db73 100644 --- a/app/Http/Controllers/RssController.php +++ b/app/Http/Controllers/RssController.php @@ -14,9 +14,6 @@ use Illuminate\Support\Carbon; class RssController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function myMoviesRss(Request $request): \Illuminate\Http\JsonResponse|array @@ -40,9 +37,6 @@ class RssController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function myShowsRss(Request $request): \Illuminate\Http\JsonResponse|array @@ -62,9 +56,6 @@ class RssController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function fullFeedRss(Request $request): \Illuminate\Http\JsonResponse|array @@ -121,7 +112,7 @@ class RssController extends BasePageController $this->smarty->assign( [ - 'categorylist' => Category::getCategories(true, $catExclusions), + 'categorylist' => Category::getCategories(true, $catExclusions), 'parentcategorylist' => Category::getForMenu($catExclusions), ] ); @@ -134,9 +125,6 @@ class RssController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function cartRss(Request $request): \Illuminate\Http\JsonResponse|array @@ -164,9 +152,6 @@ class RssController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Http\JsonResponse - * * @throws \Throwable */ public function categoryFeedRss(Request $request): \Illuminate\Http\JsonResponse|array @@ -198,9 +183,6 @@ class RssController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Http\JsonResponse - * * @throws \Throwable */ private function userCheck(Request $request): \Illuminate\Http\JsonResponse|array @@ -236,12 +218,12 @@ class RssController extends BasePageController } $params = [ - 'dl' => $request->has('dl') && $request->input('dl') === '1' ? '1' : '0', - 'del' => $request->has('del') && $request->input('del') === '1' ? '1' : '0', + 'dl' => $request->has('dl') && $request->input('dl') === '1' ? '1' : '0', + 'del' => $request->has('del') && $request->input('del') === '1' ? '1' : '0', 'extended' => 1, - 'uid' => $uid, - 'token' => $rssToken, - 'apilimit' => $maxRequests, + 'uid' => $uid, + 'token' => $rssToken, + 'apilimit' => $maxRequests, 'requests' => $usedRequests, 'downloadlimit' => $maxDownloads, 'grabs' => UserDownload::getDownloadRequests($uid), diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index a6c6e81a0..65dcdf0f2 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -10,8 +10,6 @@ use Illuminate\Http\Request; class SearchController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function search(Request $request): void @@ -139,7 +137,7 @@ class SearchController extends BasePageController $this->smarty->assign( 'orderby'.$orderType, url('/search?'.$orderByString.'&search_type=adv&ob='.$orderType - )); + )); } $searchArr = [ @@ -177,8 +175,8 @@ class SearchController extends BasePageController $this->smarty->assign( [ 'sizelist' => [ - -1 => '--Select--', 1 => '100MB', 2 => '250MB', 3 => '500MB', 4 => '1GB', 5 => '2GB', - 6 => '3GB', 7 => '4GB', 8 => '8GB', 9 => '16GB', 10 => '32GB', 11 => '64GB', + -1 => '--Select--', 1 => '100MB', 2 => '250MB', 3 => '500MB', 4 => '1GB', 5 => '2GB', + 6 => '3GB', 7 => '4GB', 8 => '8GB', 9 => '16GB', 10 => '32GB', 11 => '64GB', ], 'results' => $results, 'sadvanced' => $searchType !== 'basic', diff --git a/app/Http/Controllers/SendReleaseController.php b/app/Http/Controllers/SendReleaseController.php index c3b027db0..cc210de2a 100644 --- a/app/Http/Controllers/SendReleaseController.php +++ b/app/Http/Controllers/SendReleaseController.php @@ -12,8 +12,6 @@ use Illuminate\Support\Facades\Auth; class SendReleaseController extends BasePageController { /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function couchPotato(Request $request): void @@ -37,8 +35,6 @@ class SendReleaseController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function sabNzbd(Request $request) @@ -64,8 +60,6 @@ class SendReleaseController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function nzbGet(Request $request): void @@ -95,8 +89,6 @@ class SendReleaseController extends BasePageController } /** - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function queue(Request $request): void diff --git a/app/Http/Controllers/SeriesController.php b/app/Http/Controllers/SeriesController.php index cd0422cc1..019102921 100644 --- a/app/Http/Controllers/SeriesController.php +++ b/app/Http/Controllers/SeriesController.php @@ -11,9 +11,6 @@ use Illuminate\Support\Arr; class SeriesController extends BasePageController { /** - * @param string $id - * @param \Illuminate\Http\Request $request - * * @throws \Exception */ public function index(Request $request, string $id = ''): void diff --git a/app/Http/Middleware/ClearanceMiddleware.php b/app/Http/Middleware/ClearanceMiddleware.php index be09d2336..8fc5dbe55 100644 --- a/app/Http/Middleware/ClearanceMiddleware.php +++ b/app/Http/Middleware/ClearanceMiddleware.php @@ -11,7 +11,6 @@ class ClearanceMiddleware * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed * * @throws \Exception diff --git a/app/Http/Middleware/Google2FAMiddleware.php b/app/Http/Middleware/Google2FAMiddleware.php index 1bb273cd4..64da0ad2b 100644 --- a/app/Http/Middleware/Google2FAMiddleware.php +++ b/app/Http/Middleware/Google2FAMiddleware.php @@ -11,7 +11,6 @@ class Google2FAMiddleware * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index e27860e24..870c7c78e 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -11,7 +11,6 @@ class RedirectIfAuthenticated * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next * @param string|null $guard * @return mixed */ diff --git a/app/Jobs/SendContactUsEmail.php b/app/Jobs/SendContactUsEmail.php index e8c434b49..07aa35749 100644 --- a/app/Jobs/SendContactUsEmail.php +++ b/app/Jobs/SendContactUsEmail.php @@ -22,10 +22,6 @@ class SendContactUsEmail implements ShouldQueue /** * SendContactUsEmail constructor. - * - * @param $email - * @param $mailTo - * @param $mailBody */ public function __construct($email, $mailTo, $mailBody) { diff --git a/app/Jobs/SendInviteEmail.php b/app/Jobs/SendInviteEmail.php index 8efe3f934..9a1bc40ce 100644 --- a/app/Jobs/SendInviteEmail.php +++ b/app/Jobs/SendInviteEmail.php @@ -27,10 +27,6 @@ class SendInviteEmail implements ShouldQueue /** * SendInviteEmail constructor. - * - * @param $email - * @param $user - * @param $url */ public function __construct($email, $user, $url) { diff --git a/app/Jobs/SendPasswordForgottenEmail.php b/app/Jobs/SendPasswordForgottenEmail.php index fa2b76459..459e3c75e 100644 --- a/app/Jobs/SendPasswordForgottenEmail.php +++ b/app/Jobs/SendPasswordForgottenEmail.php @@ -25,7 +25,6 @@ class SendPasswordForgottenEmail implements ShouldQueue * Create a new job instance. * * @param \App\Models\User $user - * @param $resetLink */ public function __construct($user, $resetLink) { diff --git a/app/Listeners/UpdateUserAccessedApi.php b/app/Listeners/UpdateUserAccessedApi.php index e86829bdf..2175db2d4 100644 --- a/app/Listeners/UpdateUserAccessedApi.php +++ b/app/Listeners/UpdateUserAccessedApi.php @@ -20,7 +20,6 @@ class UpdateUserAccessedApi /** * Handle the event. * - * @param UserAccessedApi $event * @return void */ public function handle(UserAccessedApi $event) diff --git a/app/Listeners/UpdateUserLoggedIn.php b/app/Listeners/UpdateUserLoggedIn.php index 1e5fef359..1235a54ee 100644 --- a/app/Listeners/UpdateUserLoggedIn.php +++ b/app/Listeners/UpdateUserLoggedIn.php @@ -20,7 +20,6 @@ class UpdateUserLoggedIn /** * Handle the event. * - * @param UserLoggedIn $event * @return void */ public function handle(UserLoggedIn $event) diff --git a/app/Mail/AccountDeleted.php b/app/Mail/AccountDeleted.php index 7e5b44cc1..7f79ced8e 100644 --- a/app/Mail/AccountDeleted.php +++ b/app/Mail/AccountDeleted.php @@ -27,8 +27,6 @@ class AccountDeleted extends Mailable /** * Create a new message instance. - * - * @param $user */ public function __construct($user) { diff --git a/app/Mail/AccountExpired.php b/app/Mail/AccountExpired.php index 6b16713f1..fea7aed6f 100644 --- a/app/Mail/AccountExpired.php +++ b/app/Mail/AccountExpired.php @@ -11,13 +11,13 @@ class AccountExpired extends Mailable use Queueable, SerializesModels; public $user; + private $siteEmail; + private $siteTitle; /** * Create a new message instance. - * - * @param $user */ public function __construct($user) { diff --git a/app/Mail/ContactUs.php b/app/Mail/ContactUs.php index 74cddbb7c..cb30b11d2 100644 --- a/app/Mail/ContactUs.php +++ b/app/Mail/ContactUs.php @@ -16,9 +16,6 @@ class ContactUs extends Mailable /** * Create a new message instance. - * - * @param $mailFrom - * @param $mailBody */ public function __construct($mailFrom, $mailBody) { diff --git a/app/Mail/ForgottenPassword.php b/app/Mail/ForgottenPassword.php index bed1166e3..3e29cc325 100644 --- a/app/Mail/ForgottenPassword.php +++ b/app/Mail/ForgottenPassword.php @@ -26,8 +26,6 @@ class ForgottenPassword extends Mailable /** * Create a new message instance. - * - * @param $resetLink */ public function __construct($resetLink) { diff --git a/app/Mail/PasswordReset.php b/app/Mail/PasswordReset.php index 4a6d7a64a..b2a474821 100644 --- a/app/Mail/PasswordReset.php +++ b/app/Mail/PasswordReset.php @@ -34,7 +34,6 @@ class PasswordReset extends Mailable * PasswordReset constructor. * * @param \App\Models\User $user - * @param $newPass */ public function __construct($user, $newPass) { diff --git a/app/Mail/SendInvite.php b/app/Mail/SendInvite.php index 95af78340..c5790bf28 100644 --- a/app/Mail/SendInvite.php +++ b/app/Mail/SendInvite.php @@ -34,7 +34,6 @@ class SendInvite extends Mailable * SendInvite constructor. * * @param \App\Models\User $user - * @param $invite */ public function __construct($user, $invite) { diff --git a/app/Models/AnidbEpisode.php b/app/Models/AnidbEpisode.php index 6755dd1b6..e2eebbf76 100644 --- a/app/Models/AnidbEpisode.php +++ b/app/Models/AnidbEpisode.php @@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnidbEpisode whereEpisodeNo($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnidbEpisode whereEpisodeTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnidbEpisode whereEpisodeid($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnidbEpisode newModelQuery() diff --git a/app/Models/AnidbInfo.php b/app/Models/AnidbInfo.php index 53727be14..47e89ef38 100644 --- a/app/Models/AnidbInfo.php +++ b/app/Models/AnidbInfo.php @@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Model; * * @property-read \App\Models\AnidbEpisode $episode * @property-read \App\Models\AnidbTitle $title + * * @mixin \Eloquent * * @property int $anidbid ID of title from AniDB diff --git a/app/Models/AnidbTitle.php b/app/Models/AnidbTitle.php index 7acb35377..94677909f 100644 --- a/app/Models/AnidbTitle.php +++ b/app/Models/AnidbTitle.php @@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnidbTitle whereLang($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnidbTitle whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnidbTitle whereType($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AnidbTitle newModelQuery() diff --git a/app/Models/AudioData.php b/app/Models/AudioData.php index cec494e45..af55465c9 100644 --- a/app/Models/AudioData.php +++ b/app/Models/AudioData.php @@ -32,6 +32,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AudioData whereAudiotitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AudioData whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AudioData whereReleasesId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AudioData newModelQuery() diff --git a/app/Models/Binary.php b/app/Models/Binary.php index 6473814b5..f54fcf78a 100644 --- a/app/Models/Binary.php +++ b/app/Models/Binary.php @@ -26,6 +26,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Binary wherePartcheck($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Binary wherePartsize($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Binary whereTotalparts($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Binary newModelQuery() diff --git a/app/Models/BinaryBlacklist.php b/app/Models/BinaryBlacklist.php index 06f791c9c..4806e2a89 100644 --- a/app/Models/BinaryBlacklist.php +++ b/app/Models/BinaryBlacklist.php @@ -24,6 +24,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BinaryBlacklist whereOptype($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BinaryBlacklist whereRegex($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BinaryBlacklist whereStatus($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BinaryBlacklist newModelQuery() diff --git a/app/Models/BookInfo.php b/app/Models/BookInfo.php index 15cc9f258..b6ad7e1f6 100644 --- a/app/Models/BookInfo.php +++ b/app/Models/BookInfo.php @@ -41,6 +41,7 @@ use Laravel\Scout\Searchable; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookInfo whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookInfo whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookInfo whereUrl($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookInfo newModelQuery() @@ -50,6 +51,7 @@ use Laravel\Scout\Searchable; class BookInfo extends Model { use Searchable; + /** * @var string */ @@ -79,7 +81,7 @@ class BookInfo extends Model public function toSearchableArray() { return [ - 'author'=> $this->author, + 'author' => $this->author, 'title' => $this->title, ]; } diff --git a/app/Models/Category.php b/app/Models/Category.php index 7e9514b1b..67a6c7a69 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -31,6 +31,7 @@ use Illuminate\Support\Facades\DB; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereParentid($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereStatus($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereTitle($value) + * * @mixin \Eloquent * * @property int|null $root_categories_id @@ -47,83 +48,161 @@ class Category extends Model * Do NOT use the values, as they may change, always use the constant - that's what it's for. */ public const OTHER_MISC = 10; + public const OTHER_HASHED = 20; + public const GAME_NDS = 1010; + public const GAME_PSP = 1020; + public const GAME_WII = 1030; + public const GAME_XBOX = 1040; + public const GAME_XBOX360 = 1050; + public const GAME_WIIWARE = 1060; + public const GAME_XBOX360DLC = 1070; + public const GAME_PS3 = 1080; + public const GAME_OTHER = 1999; + public const GAME_3DS = 1110; + public const GAME_PSVITA = 1120; + public const GAME_WIIU = 1130; + public const GAME_XBOXONE = 1140; + public const GAME_PS4 = 1180; + public const MOVIE_FOREIGN = 2010; + public const MOVIE_OTHER = 2999; + public const MOVIE_SD = 2030; + public const MOVIE_HD = 2040; + public const MOVIE_UHD = 2045; + public const MOVIE_3D = 2050; + public const MOVIE_BLURAY = 2060; + public const MOVIE_DVD = 2070; + public const MOVIE_WEBDL = 2080; + public const MOVIE_X265 = 2090; + public const MUSIC_MP3 = 3010; + public const MUSIC_VIDEO = 3020; + public const MUSIC_AUDIOBOOK = 3030; + public const MUSIC_LOSSLESS = 3040; + public const MUSIC_PODCAST = 3050; + public const MUSIC_OTHER = 3999; + public const MUSIC_FOREIGN = 3060; + public const PC_0DAY = 4010; + public const PC_ISO = 4020; + public const PC_MAC = 4030; + public const PC_PHONE_OTHER = 4040; + public const PC_GAMES = 4050; + public const PC_PHONE_IOS = 4060; + public const PC_PHONE_ANDROID = 4070; + public const TV_WEBDL = 5010; + public const TV_FOREIGN = 5020; + public const TV_SD = 5030; + public const TV_HD = 5040; + public const TV_UHD = 5045; + public const TV_OTHER = 5999; + public const TV_SPORT = 5060; + public const TV_ANIME = 5070; + public const TV_DOCU = 5080; + public const TV_X265 = 5090; + public const XXX_DVD = 6010; + public const XXX_WMV = 6020; + public const XXX_XVID = 6030; + public const XXX_X264 = 6040; + public const XXX_CLIPHD = 6041; + public const XXX_CLIPSD = 6042; + public const XXX_UHD = 6045; + public const XXX_PACK = 6050; + public const XXX_IMAGESET = 6060; + public const XXX_OTHER = 6999; + public const XXX_SD = 6080; + public const XXX_WEBDL = 6090; + public const BOOKS_MAGAZINES = 7010; + public const BOOKS_EBOOK = 7020; + public const BOOKS_COMICS = 7030; + public const BOOKS_TECHNICAL = 7040; + public const BOOKS_FOREIGN = 7060; + public const BOOKS_UNKNOWN = 7999; + public const OTHER_ROOT = 1; + public const GAME_ROOT = 1000; + public const MOVIE_ROOT = 2000; + public const MUSIC_ROOT = 3000; + public const PC_ROOT = 4000; + public const TV_ROOT = 5000; + public const XXX_ROOT = 6000; + public const BOOKS_ROOT = 7000; + public const STATUS_INACTIVE = 0; + public const STATUS_ACTIVE = 1; + public const STATUS_DISABLED = 2; public const OTHERS_GROUP = @@ -231,7 +310,6 @@ class Category extends Model } /** - * @param array $cat * @return string */ public static function getCategorySearch(array $cat = []) @@ -260,16 +338,16 @@ class Category extends Model switch ($catCount) { //No category constraint case 0: - $catsrch = 'AND 1=1'; + $catsrch = 'AND 1=1'; break; - // One category constraint + // One category constraint case 1: - $catsrch = $categories[0] !== -1 ? ' AND r.categories_id = '.$categories[0] : ''; + $catsrch = $categories[0] !== -1 ? ' AND r.categories_id = '.$categories[0] : ''; break; - // Multiple category constraints + // Multiple category constraints default: - $catsrch = ' AND r.categories_id IN ('.implode(', ', $categories).') '; + $catsrch = ' AND r.categories_id IN ('.implode(', ', $categories).') '; break; } @@ -278,8 +356,6 @@ class Category extends Model /** * Returns a concatenated list of other categories. - * - * @return string */ public static function getCategoryOthersGroup(): string { @@ -290,7 +366,6 @@ class Category extends Model } /** - * @param $category * @return mixed */ public static function getCategoryValue($category) @@ -300,9 +375,6 @@ class Category extends Model /** * Check if category is parent. - * - * @param $cid - * @return bool */ public static function isParent($cid): bool { @@ -323,7 +395,6 @@ class Category extends Model * Get children of a parent category. * * - * @param $categoryId * @return mixed */ public static function getChildren($categoryId) @@ -366,7 +437,6 @@ class Category extends Model /** * Get multiple categories. * - * @param $ids * @return bool|\Illuminate\Database\Eloquent\Collection|static[] */ public static function getByIds($ids) @@ -389,10 +459,6 @@ class Category extends Model /** * Return the parent and category name from the supplied categoryID. - * - * - * @param $categoryId - * @return string */ public static function getNameByID($categoryId): string { @@ -402,8 +468,6 @@ class Category extends Model } /** - * @param $title - * @param $parent * @return bool|mixed */ public static function getIdByName($title, $parent) @@ -415,15 +479,6 @@ class Category extends Model /** * Update a category. - * - * - * @param $id - * @param $status - * @param $desc - * @param $disablepreview - * @param $minsize - * @param $maxsize - * @return int */ public static function updateCategory($id, $status, $desc, $disablepreview, $minsize, $maxsize): int { @@ -438,14 +493,10 @@ class Category extends Model ); } - /** - * @param array $excludedCats - * @return array - */ public static function getForMenu(array $excludedCats = []): array { $categoriesResult = []; - $categoriesArray = RootCategory::query()->with(['categories' =>function ($query) use ($excludedCats) { + $categoriesArray = RootCategory::query()->with(['categories' => function ($query) use ($excludedCats) { if (! empty($excludedCats)) { $query->whereNotIn('id', $excludedCats); } @@ -481,9 +532,6 @@ class Category extends Model /** * Return a list of categories for use in a dropdown. - * - * @param bool $blnIncludeNoneSelected - * @return array */ public static function getForSelect(bool $blnIncludeNoneSelected = true): array { @@ -501,8 +549,6 @@ class Category extends Model } /** - * @param bool $activeOnly - * @param array $excludedCats * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection */ public static function getCategories(bool $activeOnly = false, array $excludedCats = []): \Illuminate\Database\Eloquent\Collection|array diff --git a/app/Models/CategoryRegex.php b/app/Models/CategoryRegex.php index f2828c476..01039d470 100644 --- a/app/Models/CategoryRegex.php +++ b/app/Models/CategoryRegex.php @@ -22,6 +22,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CategoryRegex whereOrdinal($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CategoryRegex whereRegex($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CategoryRegex whereStatus($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CategoryRegex newModelQuery() diff --git a/app/Models/Collection.php b/app/Models/Collection.php index 2e8ad559e..e0ae9ef18 100644 --- a/app/Models/Collection.php +++ b/app/Models/Collection.php @@ -38,6 +38,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Collection whereSubject($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Collection whereTotalfiles($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Collection whereXref($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Collection newModelQuery() diff --git a/app/Models/CollectionRegex.php b/app/Models/CollectionRegex.php index b933d758c..ad2d919d8 100644 --- a/app/Models/CollectionRegex.php +++ b/app/Models/CollectionRegex.php @@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CollectionRegex whereOrdinal($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CollectionRegex whereRegex($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CollectionRegex whereStatus($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CollectionRegex newModelQuery() diff --git a/app/Models/ConsoleInfo.php b/app/Models/ConsoleInfo.php index 2c8ed192a..8face73e3 100644 --- a/app/Models/ConsoleInfo.php +++ b/app/Models/ConsoleInfo.php @@ -37,6 +37,7 @@ use Laravel\Scout\Searchable; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ConsoleInfo whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ConsoleInfo whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ConsoleInfo whereUrl($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ConsoleInfo newModelQuery() @@ -46,6 +47,7 @@ use Laravel\Scout\Searchable; class ConsoleInfo extends Model { use Searchable; + /** * @var string */ @@ -61,21 +63,15 @@ class ConsoleInfo extends Model */ protected $guarded = []; - /** - * @return string - */ public function searchableAs(): string { return 'ix_consoleinfo_title_platform_ft'; } - /** - * @return array - */ public function toSearchableArray(): array { return [ - 'title'=> $this->title, + 'title' => $this->title, 'platform' => $this->platform, ]; } diff --git a/app/Models/Content.php b/app/Models/Content.php index e6668e27a..1bf4b33dd 100644 --- a/app/Models/Content.php +++ b/app/Models/Content.php @@ -30,6 +30,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereStatus($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereUrl($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content newModelQuery() diff --git a/app/Models/Country.php b/app/Models/Country.php index 727c9c1f6..871c794e4 100644 --- a/app/Models/Country.php +++ b/app/Models/Country.php @@ -44,6 +44,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereRegionCode($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereSubRegionCode($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country newModelQuery() diff --git a/app/Models/DnzbFailure.php b/app/Models/DnzbFailure.php index 0a7ba9e46..bf51f3a2b 100644 --- a/app/Models/DnzbFailure.php +++ b/app/Models/DnzbFailure.php @@ -16,6 +16,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DnzbFailure whereFailed($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DnzbFailure whereReleaseId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DnzbFailure whereUsersId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DnzbFailure newModelQuery() @@ -63,7 +64,6 @@ class DnzbFailure extends Model * Read failed downloads count for requested release_id. * * - * @param $relId * @return bool|mixed */ public static function getFailedCount($relId) @@ -76,9 +76,6 @@ class DnzbFailure extends Model return false; } - /** - * @return int - */ public static function getCount(): int { return self::query()->count('release_id'); diff --git a/app/Models/Forumpost.php b/app/Models/Forumpost.php index 047f5710f..5eda05984 100644 --- a/app/Models/Forumpost.php +++ b/app/Models/Forumpost.php @@ -30,6 +30,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Forumpost whereSubject($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Forumpost whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Forumpost whereUsersId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Forumpost newModelQuery() @@ -54,14 +55,9 @@ class Forumpost extends Model protected $guarded = []; /** - * @param $parentId - * @param $userid - * @param $subject - * @param $message * @param int $locked * @param int $sticky * @param int $replies - * @return int */ public static function add($parentId, $userid, $subject, $message, $locked = 0, $sticky = 0, $replies = 0): int { @@ -96,7 +92,6 @@ class Forumpost extends Model * Get parent of the forum post. * * - * @param $parent * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getParent($parent) @@ -112,7 +107,6 @@ class Forumpost extends Model * Get forum posts for a parent category. * * - * @param $parent * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|static[] */ public static function getPosts($parent) @@ -132,7 +126,6 @@ class Forumpost extends Model * Get post from forum. * * - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getPost($id) @@ -160,8 +153,6 @@ class Forumpost extends Model /** * Delete parent category from forum. - * - * @param $parent */ public static function deleteParent($parent): void { @@ -170,8 +161,6 @@ class Forumpost extends Model /** * Delete post from forum. - * - * @param $id */ public static function deletePost($id): void { @@ -187,18 +176,12 @@ class Forumpost extends Model /** * Delete user from forum. - * - * @param $id */ public static function deleteUser($id): void { self::query()->where('users_id', $id)->delete(); } - /** - * @param $uid - * @return int - */ public static function getCountForUser($uid): int { $res = self::query()->where('users_id', $uid)->count('id'); @@ -210,9 +193,6 @@ class Forumpost extends Model * Get range of posts for user. * * - * @param $uid - * @param $start - * @param $num * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|static[] */ public static function getForUserRange($uid, $start, $num) @@ -231,10 +211,6 @@ class Forumpost extends Model /** * Edit forum post for user. - * - * @param $id - * @param $message - * @param $uid */ public static function editPost($id, $message, $uid): void { @@ -246,9 +222,6 @@ class Forumpost extends Model /** * Lock forum topic. - * - * @param $id - * @param $lock */ public static function lockUnlockTopic($id, $lock): void { diff --git a/app/Models/GamesInfo.php b/app/Models/GamesInfo.php index 9062b2adb..58148a76e 100644 --- a/app/Models/GamesInfo.php +++ b/app/Models/GamesInfo.php @@ -39,6 +39,7 @@ use Laravel\Scout\Searchable; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\GamesInfo whereTrailer($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\GamesInfo whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\GamesInfo whereUrl($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\GamesInfo newModelQuery() diff --git a/app/Models/Genre.php b/app/Models/Genre.php index 96316858f..503d5a265 100644 --- a/app/Models/Genre.php +++ b/app/Models/Genre.php @@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Genre whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Genre whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Genre whereType($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Genre newModelQuery() @@ -29,6 +30,7 @@ class Genre extends Model * @var bool */ protected $dateFormat = false; + /** * @var bool */ diff --git a/app/Models/Invitation.php b/app/Models/Invitation.php index 1cc6e33f0..f7593696b 100644 --- a/app/Models/Invitation.php +++ b/app/Models/Invitation.php @@ -19,6 +19,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invitation whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invitation whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invitation whereUsersId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invitation newModelQuery() @@ -28,6 +29,7 @@ use Illuminate\Database\Eloquent\Model; class Invitation extends Model { public const DEFAULT_INVITES = 1; + public const DEFAULT_INVITE_EXPIRY_DAYS = 7; /** @@ -50,17 +52,12 @@ class Invitation extends Model return $this->belongsTo(User::class, 'users_id'); } - /** - * @param int $uid - * @param string $inviteToken - */ public static function addInvite(int $uid, string $inviteToken) { self::create(['guid' => $inviteToken, 'users_id' => $uid]); } /** - * @param $inviteToken * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getInvite($inviteToken) @@ -73,9 +70,6 @@ class Invitation extends Model return self::query()->where('guid', $inviteToken)->first(); } - /** - * @param $inviteToken - */ public static function deleteInvite(string $inviteToken): void { self::query()->where('guid', $inviteToken)->delete(); diff --git a/app/Models/MissedPart.php b/app/Models/MissedPart.php index 39771968d..ab2316d1a 100644 --- a/app/Models/MissedPart.php +++ b/app/Models/MissedPart.php @@ -16,6 +16,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MissedPart whereGroupsId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MissedPart whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MissedPart whereNumberid($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MissedPart newModelQuery() diff --git a/app/Models/MovieInfo.php b/app/Models/MovieInfo.php index 51053a4a7..d480e7ba1 100644 --- a/app/Models/MovieInfo.php +++ b/app/Models/MovieInfo.php @@ -46,6 +46,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MovieInfo whereType($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MovieInfo whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MovieInfo whereYear($value) + * * @mixin \Eloquent * * @property int $traktid diff --git a/app/Models/MusicInfo.php b/app/Models/MusicInfo.php index 77d3a4b22..744fe4019 100644 --- a/app/Models/MusicInfo.php +++ b/app/Models/MusicInfo.php @@ -40,6 +40,7 @@ use Laravel\Scout\Searchable; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MusicInfo whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MusicInfo whereUrl($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MusicInfo whereYear($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\MusicInfo newModelQuery() @@ -49,10 +50,12 @@ use Laravel\Scout\Searchable; class MusicInfo extends Model { use Searchable; + /** * @var string */ protected $table = 'musicinfo'; + /** * @var bool */ @@ -87,7 +90,7 @@ class MusicInfo extends Model public function toSearchableArray() { return [ - 'artist'=> $this->artist, + 'artist' => $this->artist, 'title' => $this->title, ]; } diff --git a/app/Models/ParHash.php b/app/Models/ParHash.php index 9ad8387ea..739313f31 100644 --- a/app/Models/ParHash.php +++ b/app/Models/ParHash.php @@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Model; * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ParHash whereHash($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ParHash whereReleasesId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ParHash newModelQuery() diff --git a/app/Models/Part.php b/app/Models/Part.php index ee23fea68..078312775 100644 --- a/app/Models/Part.php +++ b/app/Models/Part.php @@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Part whereNumber($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Part wherePartnumber($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Part whereSize($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Part newModelQuery() diff --git a/app/Models/PasswordSecurity.php b/app/Models/PasswordSecurity.php index ea1b9c8ab..d8e11d419 100644 --- a/app/Models/PasswordSecurity.php +++ b/app/Models/PasswordSecurity.php @@ -15,9 +15,6 @@ class PasswordSecurity extends Model */ protected $guarded = []; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ public function user(): BelongsTo { return $this->belongsTo(User::class); diff --git a/app/Models/Predb.php b/app/Models/Predb.php index 022cb4320..d8c6c8296 100644 --- a/app/Models/Predb.php +++ b/app/Models/Predb.php @@ -45,6 +45,7 @@ use Laravel\Scout\Searchable; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Predb whereSize($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Predb whereSource($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Predb whereTitle($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Predb newModelQuery() @@ -57,10 +58,15 @@ class Predb extends Model // Nuke status. public const PRE_NONUKE = 0; // Pre is not nuked. + public const PRE_UNNUKED = 1; // Pre was un nuked. + public const PRE_NUKED = 2; // Pre is nuked. + public const PRE_MODNUKE = 3; // Nuke reason was modified. + public const PRE_RENUKED = 4; // Pre was re nuked. + public const PRE_OLDNUKE = 5; // Pre is nuked for being old. /** @@ -129,7 +135,7 @@ class Predb extends Model if (config('nntmux.echocli')) { $consoleTools->overWritePrimary( 'Matching up preDB titles with release searchnames: '.$consoleTools->percentString(++$updated, $total) - ); + ); } } if (config('nntmux.echocli')) { @@ -212,7 +218,6 @@ class Predb extends Model * Get all PRE's for a release. * * - * @param $preID * @return \Illuminate\Database\Eloquent\Collection|static[] */ public static function getForRelease($preID) @@ -224,7 +229,6 @@ class Predb extends Model * Return a single PRE for a release. * * - * @param $preID * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getOne($preID) diff --git a/app/Models/PredbHash.php b/app/Models/PredbHash.php index 69bbc0caf..f837bcccc 100644 --- a/app/Models/PredbHash.php +++ b/app/Models/PredbHash.php @@ -13,6 +13,7 @@ use Illuminate\Database\Eloquent\Model; * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PredbHash whereHash($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PredbHash wherePredbId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PredbHash newModelQuery() diff --git a/app/Models/PredbImport.php b/app/Models/PredbImport.php index 99b22bc10..f1c4b258a 100644 --- a/app/Models/PredbImport.php +++ b/app/Models/PredbImport.php @@ -36,6 +36,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PredbImport whereSize($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PredbImport whereSource($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PredbImport whereTitle($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PredbImport newModelQuery() diff --git a/app/Models/Release.php b/app/Models/Release.php index 35c620413..7ddbe9f41 100644 --- a/app/Models/Release.php +++ b/app/Models/Release.php @@ -128,6 +128,7 @@ use Illuminate\Support\Facades\DB; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Release whereVideosId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Release whereVideostatus($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Release whereXxxinfoId($value) + * * @mixin \Eloquent * * @property int|null $movieinfo_id FK to movieinfo.id @@ -312,20 +313,6 @@ class Release extends Model /** * Used for release edit page on site. * - * @param int $id - * @param string $name - * @param string $searchName - * @param string $fromName - * @param int $categoryId - * @param int $parts - * @param int $grabs - * @param int $size - * @param string $postedDate - * @param string $addedDate - * @param $videoId - * @param $episodeId - * @param int $imDbId - * @param int $aniDbId * @param string $tags * * @throws \Exception @@ -376,7 +363,6 @@ class Release extends Model } /** - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getCatByRelId($id) @@ -384,19 +370,11 @@ class Release extends Model return self::whereId($id)->first(['categories_id']); } - /** - * @param $videoId - * @return int - */ public static function removeVideoIdFromReleases($videoId): int { return self::whereVideosId($videoId)->update(['videos_id' => 0, 'tv_episodes_id' => 0]); } - /** - * @param $anidbID - * @return int - */ public static function removeAnidbIdFromReleases($anidbID): int { return self::whereAnidbid($anidbID)->update(['anidbid' => -1]); @@ -493,21 +471,21 @@ class Release extends Model $releases = self::query() ->where('nzbstatus', '=', NZB::NZB_ADDED) ->select( - [ - 'releases.id', - 'releases.name', - 'releases.searchname', - 'releases.size', - 'releases.guid', - 'releases.totalpart', - 'releases.postdate', - 'releases.adddate', - 'releases.grabs', - 'cp.title as parent_category', - 'c.title as sub_category', - DB::raw('CONCAT(cp.title, ' > ', c.title) AS category_name'), - ] - ) + [ + 'releases.id', + 'releases.name', + 'releases.searchname', + 'releases.size', + 'releases.guid', + 'releases.totalpart', + 'releases.postdate', + 'releases.adddate', + 'releases.grabs', + 'cp.title as parent_category', + 'c.title as sub_category', + DB::raw('CONCAT(cp.title, ' > ', c.title) AS category_name'), + ] + ) ->leftJoin('categories as c', 'c.id', '=', 'releases.categories_id') ->leftJoin('root_categories as cp', 'cp.id', '=', 'c.root_categories_id') ->orderByDesc('releases.postdate') @@ -519,7 +497,6 @@ class Release extends Model } /** - * @param $guid * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|\Illuminate\Support\Collection|null|static|static[] */ public static function getByGuid($guid) @@ -589,8 +566,6 @@ class Release extends Model /** * Retrieve alternate release with same or similar searchname. * - * @param $guid - * @param $userid * @return false|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|\Illuminate\Database\Query\Builder|object|null * * @throws \Foolz\SphinxQL\Exception\ConnectionException @@ -627,10 +602,6 @@ class Release extends Model return false; } - /** - * @param $guid - * @return bool - */ public static function checkGuidForApi($guid): bool { $check = self::whereGuid($guid)->first(); diff --git a/app/Models/ReleaseComment.php b/app/Models/ReleaseComment.php index fb593c2f9..0693412fe 100644 --- a/app/Models/ReleaseComment.php +++ b/app/Models/ReleaseComment.php @@ -46,6 +46,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseComment whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseComment whereUsername($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseComment whereUsersId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseComment newModelQuery() @@ -84,7 +85,6 @@ class ReleaseComment extends Model * Get a comment by id. * * - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getCommentById($id) @@ -93,7 +93,6 @@ class ReleaseComment extends Model } /** - * @param $id * @return array */ public static function getComments($id) @@ -101,9 +100,6 @@ class ReleaseComment extends Model return self::query()->where('releases_id', $id)->orderBy('created_at', 'desc')->get()->toArray(); } - /** - * @return int - */ public static function getCommentCount(): int { return self::query()->count(['id']); @@ -111,8 +107,6 @@ class ReleaseComment extends Model /** * Delete single comment on the site. - * - * @param $id */ public static function deleteComment($id): void { @@ -127,12 +121,6 @@ class ReleaseComment extends Model * Add a release_comments row. * * - * @param $id - * @param $gid - * @param $text - * @param $userid - * @param $host - * @return int * * @throws \Exception */ @@ -181,8 +169,6 @@ class ReleaseComment extends Model /** * Update the denormalised count of comments for a release. - * - * @param $gid */ public static function updateReleaseCommentCount($gid): void { @@ -192,9 +178,6 @@ class ReleaseComment extends Model /** * Get a count of all comments for a user. - * - * @param $uid - * @return int */ public static function getCommentCountForUser($uid): int { @@ -204,7 +187,6 @@ class ReleaseComment extends Model } /** - * @param $uid * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ public static function getCommentsForUserRange($uid) diff --git a/app/Models/ReleaseExtraFull.php b/app/Models/ReleaseExtraFull.php index 642349ccb..75c471a30 100644 --- a/app/Models/ReleaseExtraFull.php +++ b/app/Models/ReleaseExtraFull.php @@ -13,6 +13,7 @@ use Illuminate\Database\Eloquent\Model; * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseExtraFull whereMediainfo($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseExtraFull whereReleasesId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseExtraFull newModelQuery() @@ -51,9 +52,6 @@ class ReleaseExtraFull extends Model */ protected $primaryKey = 'releases_id'; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ public function release(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Release::class, 'releases_id'); diff --git a/app/Models/ReleaseFile.php b/app/Models/ReleaseFile.php index c3791028f..b44a87702 100644 --- a/app/Models/ReleaseFile.php +++ b/app/Models/ReleaseFile.php @@ -27,6 +27,7 @@ use Illuminate\Support\Facades\Log; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseFile whereReleasesId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseFile whereSize($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseFile whereUpdatedAt($value) + * * @mixin \Eloquent * * @property string $crc32 @@ -53,9 +54,6 @@ class ReleaseFile extends Model */ protected $primaryKey = 'releases_id'; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ public function release(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Release::class, 'releases_id'); @@ -65,7 +63,6 @@ class ReleaseFile extends Model * Get releasefiles row by id. * * - * @param $id * @return \Illuminate\Database\Eloquent\Collection|static[] */ public static function getReleaseFiles($id) @@ -74,7 +71,6 @@ class ReleaseFile extends Model } /** - * @param $guid * @return \Illuminate\Database\Eloquent\Collection|static[] */ public static function getByGuid($guid) @@ -89,14 +85,8 @@ class ReleaseFile extends Model * Add new files for a release ID. * * - * @param $id - * @param $name - * @param $size - * @param $createdTime - * @param $hasPassword * @param string $hash * @param string $crc - * @return int * * @throws \Exception */ diff --git a/app/Models/ReleaseNamingRegex.php b/app/Models/ReleaseNamingRegex.php index 0c56d1fe3..6f903e960 100644 --- a/app/Models/ReleaseNamingRegex.php +++ b/app/Models/ReleaseNamingRegex.php @@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseNamingRegex whereOrdinal($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseNamingRegex whereRegex($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseNamingRegex whereStatus($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseNamingRegex newModelQuery() diff --git a/app/Models/ReleaseNfo.php b/app/Models/ReleaseNfo.php index 9c7c43c02..d17c3f721 100644 --- a/app/Models/ReleaseNfo.php +++ b/app/Models/ReleaseNfo.php @@ -13,6 +13,7 @@ use Illuminate\Database\Eloquent\Model; * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseNfo whereNfo($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseNfo whereReleasesId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseNfo newModelQuery() @@ -44,7 +45,6 @@ class ReleaseNfo extends Model } /** - * @param $id * @param bool $getNfoString * @return \Illuminate\Database\Eloquent\Model|null|static */ diff --git a/app/Models/ReleaseRegex.php b/app/Models/ReleaseRegex.php index be9f38b1e..5aa508be9 100644 --- a/app/Models/ReleaseRegex.php +++ b/app/Models/ReleaseRegex.php @@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseRegex whereCollectionRegexId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseRegex whereNamingRegexId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseRegex whereReleasesId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseRegex newModelQuery() diff --git a/app/Models/ReleaseSubtitle.php b/app/Models/ReleaseSubtitle.php index bf866a632..0e7876c14 100644 --- a/app/Models/ReleaseSubtitle.php +++ b/app/Models/ReleaseSubtitle.php @@ -16,6 +16,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseSubtitle whereReleasesId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseSubtitle whereSubsid($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseSubtitle whereSubslanguage($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseSubtitle newModelQuery() diff --git a/app/Models/ReleaseUnique.php b/app/Models/ReleaseUnique.php index 0f4f7186d..c32c1025a 100644 --- a/app/Models/ReleaseUnique.php +++ b/app/Models/ReleaseUnique.php @@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Model; * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseUnique whereReleasesId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseUnique whereUniqueid($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseUnique newModelQuery() diff --git a/app/Models/ReleasesGroup.php b/app/Models/ReleasesGroup.php index 565186ebc..cbd33f830 100644 --- a/app/Models/ReleasesGroup.php +++ b/app/Models/ReleasesGroup.php @@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Model; * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleasesGroup whereGroupsId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleasesGroup whereReleasesId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleasesGroup newModelQuery() diff --git a/app/Models/ReleasesGroups.php b/app/Models/ReleasesGroups.php index 6c2150f45..f53505c5e 100644 --- a/app/Models/ReleasesGroups.php +++ b/app/Models/ReleasesGroups.php @@ -31,6 +31,7 @@ use Illuminate\Database\Eloquent\Model; * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleasesGroups whereGroupsId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleasesGroups whereReleasesId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleasesGroups newModelQuery() diff --git a/app/Models/RoleExpirationEmail.php b/app/Models/RoleExpirationEmail.php index fc1f7544b..ab54d64a2 100644 --- a/app/Models/RoleExpirationEmail.php +++ b/app/Models/RoleExpirationEmail.php @@ -26,13 +26,11 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RoleExpirationEmail whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RoleExpirationEmail whereUsersId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RoleExpirationEmail whereWeek($value) + * * @mixin \Eloquent */ class RoleExpirationEmail extends Model { - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'users_id'); diff --git a/app/Models/RootCategory.php b/app/Models/RootCategory.php index 7dbc9d47d..feece883e 100644 --- a/app/Models/RootCategory.php +++ b/app/Models/RootCategory.php @@ -24,15 +24,13 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RootCategory whereStatus($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RootCategory whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RootCategory whereUpdatedAt($value) + * * @mixin \Eloquent */ class RootCategory extends Model { protected $guarded = []; - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ public function categories(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(Category::class, 'root_categories_id'); diff --git a/app/Models/Settings.php b/app/Models/Settings.php index c6300da64..2756791eb 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -41,6 +41,7 @@ use Illuminate\Support\Facades\DB; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Settings whereSetting($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Settings whereSubsection($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Settings whereValue($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Settings newModelQuery() @@ -83,6 +84,7 @@ class Settings extends Model * @var Command */ protected $console; + /** * @var array */ @@ -140,7 +142,6 @@ class Settings extends Model * * @param bool $excludeUnsectioned If rows with empty 'section' field should be excluded. * Note this doesn't prevent empty 'subsection' fields. - * @return array * * @throws \RuntimeException */ @@ -166,7 +167,6 @@ class Settings extends Model } /** - * @param $setting * @return mixed */ public static function settingValue($setting) @@ -185,8 +185,6 @@ class Settings extends Model /** * Returns the stored Db version string. - * - * @return string */ public function getDbVersion(): string { @@ -221,9 +219,6 @@ class Settings extends Model } } - /** - * @param array $data - */ public static function settingsUpdate(array $data = []) { foreach ($data as $key => $value) { diff --git a/app/Models/Sharing.php b/app/Models/Sharing.php index a4defe2c9..15f00f3a8 100644 --- a/app/Models/Sharing.php +++ b/app/Models/Sharing.php @@ -34,6 +34,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sharing whereSiteName($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sharing whereStartPosition($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sharing whereUsername($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sharing newModelQuery() diff --git a/app/Models/SharingSite.php b/app/Models/SharingSite.php index 7ce60bd02..aea58ff77 100644 --- a/app/Models/SharingSite.php +++ b/app/Models/SharingSite.php @@ -22,6 +22,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SharingSite whereLastTime($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SharingSite whereSiteGuid($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SharingSite whereSiteName($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SharingSite newModelQuery() diff --git a/app/Models/ShortGroup.php b/app/Models/ShortGroup.php index 7c812f604..afc8db171 100644 --- a/app/Models/ShortGroup.php +++ b/app/Models/ShortGroup.php @@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShortGroup whereLastRecord($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShortGroup whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShortGroup whereUpdated($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShortGroup newModelQuery() diff --git a/app/Models/SteamApp.php b/app/Models/SteamApp.php index bdc42d209..811ff970a 100644 --- a/app/Models/SteamApp.php +++ b/app/Models/SteamApp.php @@ -13,6 +13,7 @@ use Laravel\Scout\Searchable; * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SteamApp whereAppid($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SteamApp whereName($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SteamApp newModelQuery() @@ -22,6 +23,7 @@ use Laravel\Scout\Searchable; class SteamApp extends Model { use Searchable; + /** * @var bool */ diff --git a/app/Models/TvEpisode.php b/app/Models/TvEpisode.php index 537fa0936..0b9076be9 100644 --- a/app/Models/TvEpisode.php +++ b/app/Models/TvEpisode.php @@ -26,6 +26,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TvEpisode whereSummary($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TvEpisode whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TvEpisode whereVideosId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TvEpisode newModelQuery() diff --git a/app/Models/TvInfo.php b/app/Models/TvInfo.php index be2239451..156b0c466 100644 --- a/app/Models/TvInfo.php +++ b/app/Models/TvInfo.php @@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TvInfo wherePublisher($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TvInfo whereSummary($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TvInfo whereVideosId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TvInfo newModelQuery() diff --git a/app/Models/UsenetGroup.php b/app/Models/UsenetGroup.php index 16578af4f..6fc6216c8 100644 --- a/app/Models/UsenetGroup.php +++ b/app/Models/UsenetGroup.php @@ -41,6 +41,7 @@ use Illuminate\Support\Facades\DB; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UsenetGroup whereMinfilestoformrelease($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UsenetGroup whereMinsizetoformrelease($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UsenetGroup whereName($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UsenetGroup newModelQuery() @@ -100,9 +101,6 @@ class UsenetGroup extends Model /** * Returns an associative array of groups for list selection. - * - * - * @return array */ public static function getGroupsForSelect(): array { @@ -122,7 +120,6 @@ class UsenetGroup extends Model * Get all properties of a single group by its ID. * * - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getGroupByID($id) @@ -142,7 +139,6 @@ class UsenetGroup extends Model * Get active backfill groups ordered by name ascending. * * - * @param $order * @return array|\Illuminate\Database\Eloquent\Collection|static[] */ public static function getActiveBackfill($order) @@ -175,7 +171,6 @@ class UsenetGroup extends Model * Get all group columns by Name. * * - * @param $grp * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getByName($grp) @@ -257,7 +252,6 @@ class UsenetGroup extends Model * Update an existing group. * * - * @param $group * @return int */ public static function updateGroup($group) @@ -297,7 +291,6 @@ class UsenetGroup extends Model * Add a new group. * * - * @param $group * @return int|mixed */ public static function addGroup($group) @@ -324,7 +317,6 @@ class UsenetGroup extends Model * Delete a group. * * @param int|string $id ID of the group. - * @return bool * * @throws \Exception */ @@ -339,7 +331,6 @@ class UsenetGroup extends Model * Reset a group. * * @param string|int $id The group ID. - * @return bool * * @throws \Exception */ @@ -364,8 +355,6 @@ class UsenetGroup extends Model /** * Reset all groups. - * - * @return bool */ public static function resetall(): bool { @@ -422,7 +411,7 @@ class UsenetGroup extends Model ], $nzb, $releaseImage - ); + ); } } @@ -462,9 +451,9 @@ class UsenetGroup extends Model if ($res === false) { self::addGroup( [ - 'name' => $group['group'], - 'active' => $active, - 'backfill' => $backfill, + 'name' => $group['group'], + 'active' => $active, + 'backfill' => $backfill, 'description' => 'Added by bulkAdd', ] ); @@ -487,7 +476,6 @@ class UsenetGroup extends Model * @param int $id Which group ID * @param string $column Which column active/backfill * @param int $status Which status we are setting - * @return string */ public static function updateGroupStatus($id, $column, $status = 0): string { diff --git a/app/Models/User.php b/app/Models/User.php index fd8c1f916..3cb308c6e 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -118,6 +118,7 @@ use Spatie\Permission\Traits\HasRoles; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereXxxview($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereVerified($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereApiToken($value) + * * @mixin \Eloquent * * @property int $roles_id FK to roles.id @@ -148,24 +149,36 @@ class User extends Authenticatable use Notifiable, UserVerification, HasRoles, InviteTrait; public const ERR_SIGNUP_BADUNAME = -1; + public const ERR_SIGNUP_BADPASS = -2; + public const ERR_SIGNUP_BADEMAIL = -3; + public const ERR_SIGNUP_UNAMEINUSE = -4; + public const ERR_SIGNUP_EMAILINUSE = -5; + public const ERR_SIGNUP_BADINVITECODE = -6; + public const ERR_SIGNUP_BADCAPTCHA = -7; + public const SUCCESS = 1; public const ROLE_USER = 1; + public const ROLE_ADMIN = 2; + public const ROLE_DISABLED = 3; + public const ROLE_MODERATOR = 4; /** * Users SELECT queue type. */ public const QUEUE_NONE = 0; + public const QUEUE_SABNZBD = 1; + public const QUEUE_NZBGET = 2; /** @@ -253,8 +266,6 @@ class User extends Authenticatable } /** - * @param $id - * * @throws \Exception */ public static function deleteUser($id): void @@ -267,7 +278,6 @@ class User extends Authenticatable * @param string $username * @param string $host * @param string $email - * @return int */ public static function getCount($role = '', $username = '', $host = '', $email = ''): int { @@ -319,7 +329,6 @@ class User extends Authenticatable * @param bool $cp_url * @param bool $cp_api * @param string $style - * @return int * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException */ @@ -342,7 +351,7 @@ class User extends Authenticatable 'consoleview' => $consoleview, 'bookview' => $bookview, 'style' => $style, - 'queuetype' => $queueType, + 'queuetype' => $queueType, 'nzbgeturl' => $nzbgetURL, 'nzbgetusername' => $nzbgetUsername, 'nzbgetpassword' => $nzbgetPassword, @@ -370,7 +379,6 @@ class User extends Authenticatable } /** - * @param string $userName * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getByUsername(string $userName) @@ -379,7 +387,6 @@ class User extends Authenticatable } /** - * @param string $email * @return \Illuminate\Database\Eloquent\Model|static * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException @@ -390,8 +397,6 @@ class User extends Authenticatable } /** - * @param int $uid - * @param int $role * @return bool */ public static function updateUserRole(int $uid, int $role) @@ -407,7 +412,6 @@ class User extends Authenticatable /** * @param int $uid - * @param $date * @param int $addYear */ public static function updateUserRoleChangeDate($uid, $date = '', $addYear = 0): void @@ -446,9 +450,6 @@ class User extends Authenticatable } /** - * @param $start - * @param $offset - * @param $orderBy * @param string $userName * @param string $email * @param string $host @@ -498,7 +499,6 @@ class User extends Authenticatable /** * Get sort types for sorting users on the web page user list. * - * @param $orderBy * @return string[] */ public static function getBrowseOrder($orderBy): array @@ -550,7 +550,6 @@ class User extends Authenticatable * @param string $password Password to check against hash. * @param string|bool $hash Hash to check against password. * @param int $userID ID of the user. - * @return bool */ public static function checkPassword($password, $hash, $userID = -1): bool { @@ -570,10 +569,6 @@ class User extends Authenticatable return true; } - /** - * @param $uid - * @return int - */ public static function updateRssKey($uid): int { self::find($uid)->update(['api_token' => md5(Password::getRepository()->createNewToken())]); @@ -581,11 +576,6 @@ class User extends Authenticatable return self::SUCCESS; } - /** - * @param $id - * @param $guid - * @return int - */ public static function updatePassResetGuid($id, $guid): int { self::find($id)->update(['resetguid' => $guid]); @@ -593,11 +583,6 @@ class User extends Authenticatable return self::SUCCESS; } - /** - * @param int $id - * @param string $password - * @return int - */ public static function updatePassword(int $id, string $password): int { self::find($id)->update(['password' => self::hashPassword($password), 'userseed' => md5(Str::uuid()->toString())]); @@ -606,7 +591,6 @@ class User extends Authenticatable } /** - * @param $password * @return mixed */ public static function hashPassword($password) @@ -615,7 +599,6 @@ class User extends Authenticatable } /** - * @param $guid * @return \Illuminate\Database\Eloquent\Model|static * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException @@ -626,7 +609,6 @@ class User extends Authenticatable } /** - * @param $id * @param int $num */ public static function incrementGrabs(int $id, $num = 1): void @@ -638,8 +620,6 @@ class User extends Authenticatable * Check if the user is in the database, and if their API key is good, return user data if so. * * - * @param $userID - * @param $rssToken * @return bool|\Illuminate\Database\Eloquent\Model|null|static */ public static function getByIdAndRssToken($userID, $rssToken) @@ -653,7 +633,6 @@ class User extends Authenticatable } /** - * @param string $rssToken * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getByRssToken(string $rssToken) @@ -661,10 +640,6 @@ class User extends Authenticatable return self::whereApiToken($rssToken)->first(); } - /** - * @param $url - * @return bool - */ public static function isValidUrl($url): bool { return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; @@ -672,9 +647,6 @@ class User extends Authenticatable /** * Generate a random username. - * - * - * @return string */ public static function generateUsername(): string { @@ -683,7 +655,6 @@ class User extends Authenticatable /** * @param int $length - * @return string * * @throws \Exception */ @@ -695,11 +666,6 @@ class User extends Authenticatable /** * Register a new user. * - * @param $userName - * @param $password - * @param $email - * @param $host - * @param $notes * @param int $invites * @param string $inviteCode * @param bool $forceInviteMode @@ -749,9 +715,6 @@ class User extends Authenticatable /** * If a invite is used, decrement the person who invited's invite count. - * - * @param string $inviteCode - * @return int */ public static function checkAndUseInvite(string $inviteCode): int { @@ -810,7 +773,6 @@ class User extends Authenticatable * Get the list of categories the user has excluded. * * @param int $userID ID of the user. - * @return array * * @throws \Exception */ @@ -833,28 +795,34 @@ class User extends Authenticatable switch ($cat) { case 'view console': $ret[] = 1000; + continue 2; case 'view movies': $ret[] = 2000; + continue 2; case 'view audio': $ret[] = 3000; + continue 2; case 'view pc': $ret[] = 4000; + continue 2; case 'view tv': $ret[] = 5000; + continue 2; case 'view adult': $ret[] = 6000; + continue 2; case 'view books': $ret[] = 7000; + continue 2; case 'view other': $ret[] = 1; - } } } @@ -866,9 +834,6 @@ class User extends Authenticatable } /** - * @param \Illuminate\Http\Request $request - * @return array - * * @throws \Exception */ public static function getCategoryExclusionForApi(Request $request): array @@ -896,11 +861,6 @@ class User extends Authenticatable } /** - * @param $serverUrl - * @param $uid - * @param $emailTo - * @return string - * * @throws \Exception */ public static function sendInvite($serverUrl, $uid, $emailTo): string @@ -944,9 +904,6 @@ class User extends Authenticatable static::whereVerified(0)->where('created_at', '<', now()->subDays(3))->delete(); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasOne - */ public function passwordSecurity(): \Illuminate\Database\Eloquent\Relations\HasOne { return $this->hasOne(PasswordSecurity::class); diff --git a/app/Models/UserDownload.php b/app/Models/UserDownload.php index 32113761a..5d275620f 100644 --- a/app/Models/UserDownload.php +++ b/app/Models/UserDownload.php @@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserDownload whereReleasesId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserDownload whereTimestamp($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserDownload whereUsersId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserDownload newModelQuery() @@ -63,7 +64,6 @@ class UserDownload extends Model * Get the COUNT of how many NZB's the user has downloaded in the past day. * * @param int $userID - * @return int * * @throws \Exception */ @@ -77,7 +77,6 @@ class UserDownload extends Model } /** - * @param $userID * @return \Illuminate\Database\Eloquent\Collection|static[] */ public static function getDownloadRequestsForUser($userID) @@ -89,8 +88,6 @@ class UserDownload extends Model * If a user downloads a NZB, log it. * * - * @param $userID - * @param $releaseID * @return int|\Illuminate\Database\Eloquent\Builder */ public static function addDownloadRequest($userID, $releaseID) @@ -106,7 +103,6 @@ class UserDownload extends Model } /** - * @param int $releaseID * @return mixed * * @throws \Exception @@ -117,8 +113,6 @@ class UserDownload extends Model } /** - * @param $userID - * * @throws \Exception */ public static function delDownloadRequests($userID): void diff --git a/app/Models/UserMovie.php b/app/Models/UserMovie.php index 7f27a0219..f5654a7ff 100644 --- a/app/Models/UserMovie.php +++ b/app/Models/UserMovie.php @@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMovie whereImdbid($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMovie whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMovie whereUsersId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMovie newModelQuery() @@ -39,9 +40,6 @@ class UserMovie extends Model protected $dateFormat = false; /** - * @param $uid - * @param $imdbid - * @param array $catID * @return int|\Illuminate\Database\Eloquent\Builder */ public static function addMovie($uid, $imdbid, array $catID = []) @@ -57,10 +55,6 @@ class UserMovie extends Model ); } - /** - * @param $uid - * @return array - */ public static function getMovies($uid): array { return self::query() @@ -72,8 +66,6 @@ class UserMovie extends Model } /** - * @param $uid - * @param $imdbid * @return mixed */ public static function delMovie($uid, $imdbid) @@ -81,11 +73,6 @@ class UserMovie extends Model return self::query()->where(['users_id' => $uid, 'imdbid' => $imdbid])->delete(); } - /** - * @param $uid - * @param $imdbid - * @return array - */ public static function getMovie($uid, $imdbid): array { return self::query() @@ -95,19 +82,11 @@ class UserMovie extends Model ->toArray(); } - /** - * @param $uid - */ public static function delMovieForUser($uid) { self::query()->where('users_id', $uid)->delete(); } - /** - * @param $uid - * @param $imdbid - * @param array $catID - */ public static function updateMovie($uid, $imdbid, array $catID = []) { self::query() diff --git a/app/Models/UserRequest.php b/app/Models/UserRequest.php index 35edd7382..0408e6010 100644 --- a/app/Models/UserRequest.php +++ b/app/Models/UserRequest.php @@ -20,6 +20,7 @@ use Illuminate\Support\Facades\DB; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserRequest whereRequest($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserRequest whereTimestamp($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserRequest whereUsersId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserRequest newModelQuery() @@ -57,8 +58,6 @@ class UserRequest extends Model } /** - * @param $userID - * * @throws \Throwable */ public static function delApiRequests($userID): void @@ -72,7 +71,6 @@ class UserRequest extends Model * Get the quantity of API requests in the last day for the users_id. * * @param int $userID - * @return int * * @throws \Exception * @throws \Throwable @@ -95,7 +93,7 @@ class UserRequest extends Model public static function addApiRequest($token, $request): void { $userID = User::query()->select(['id'])->where('api_token', $token)->value('id'); - self::query()->insert(['users_id' => $userID, 'request' => $request, 'timestamp'=> now()]); + self::query()->insert(['users_id' => $userID, 'request' => $request, 'timestamp' => now()]); } /** @@ -104,7 +102,6 @@ class UserRequest extends Model * @param int|bool $userID * int The users ID. * bool false do all user ID's.. - * @return void * * @throws \Exception * @throws \Throwable diff --git a/app/Models/UserSerie.php b/app/Models/UserSerie.php index 2ad5bcfd0..b5c3723b1 100644 --- a/app/Models/UserSerie.php +++ b/app/Models/UserSerie.php @@ -21,6 +21,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserSerie whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserSerie whereUsersId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserSerie whereVideosId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserSerie newModelQuery() @@ -51,9 +52,6 @@ class UserSerie extends Model * When a user wants to add a show to "my shows" insert it into the user series table. * * - * @param $userId - * @param $videoId - * @param array $catID * @return int|\Illuminate\Database\Eloquent\Builder */ public static function addShow($userId, $videoId, array $catID = []) @@ -74,7 +72,6 @@ class UserSerie extends Model * Get all the user's "my shows". * * - * @param $userId * @return \Illuminate\Database\Eloquent\Collection|static[] */ public static function getShows($userId) @@ -89,9 +86,6 @@ class UserSerie extends Model /** * Delete a tv show from the user's "my shows". - * - * @param $users_id - * @param $videos_id */ public static function delShow($users_id, $videos_id): void { @@ -102,8 +96,6 @@ class UserSerie extends Model * Get tv show information for a user. * * - * @param $userId - * @param $videoId * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getShow($userId, $videoId) @@ -116,9 +108,6 @@ class UserSerie extends Model /** * Delete all shows from the user's "my shows". - * - * - * @param $userId */ public static function delShowForUser($userId): void { @@ -127,9 +116,6 @@ class UserSerie extends Model /** * Delete TV shows from all user's "my shows" that match a TV id. - * - * - * @param $videoId */ public static function delShowForSeries($videoId): void { @@ -139,12 +125,10 @@ class UserSerie extends Model /** * Update a TV show category ID for a user's "my show" TV show. * - * @param $users_id - * @param $videos_id * @param array $catID List of category ID's. */ public static function updateShow($users_id, $videos_id, array $catID = []): void { - self::query()->where(compact('users_id', 'videos_id'))->update(['categories' => ! empty($catID) ? implode('|', $catID) : 'NULL']); + self::query()->where(compact('users_id', 'videos_id'))->update(['categories' => ! empty($catID) ? implode('|', $catID) : 'NULL']); } } diff --git a/app/Models/UsersRelease.php b/app/Models/UsersRelease.php index 1c51a7712..b4cfe9dd1 100644 --- a/app/Models/UsersRelease.php +++ b/app/Models/UsersRelease.php @@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UsersRelease whereReleasesId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UsersRelease whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UsersRelease whereUsersId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UsersRelease newModelQuery() @@ -48,17 +49,12 @@ class UsersRelease extends Model return $this->belongsTo(Release::class, 'releases_id'); } - /** - * @param $uid - */ public static function delCartForUser($uid): void { self::query()->where('users_id', $uid)->delete(); } /** - * @param $uid - * @param $releaseid * @return int|\Illuminate\Database\Eloquent\Builder */ public static function addCart($uid, $releaseid) @@ -74,7 +70,6 @@ class UsersRelease extends Model } /** - * @param $uid * @return \Illuminate\Database\Eloquent\Collection|static[] */ public static function getCart($uid) @@ -83,8 +78,6 @@ class UsersRelease extends Model } /** - * @param $guids - * @param $userID * @return bool|mixed */ public static function delCartByGuid($guids, $userID) @@ -104,10 +97,6 @@ class UsersRelease extends Model return self::query()->whereIn('releases_id', $del)->where('users_id', $userID)->delete() === 1; } - /** - * @param $guid - * @param $uid - */ public static function delCartByUserAndRelease($guid, $uid): void { $rel = Release::query()->where('guid', $guid)->first(['id']); @@ -116,9 +105,6 @@ class UsersRelease extends Model } } - /** - * @param $rid - */ public static function delCartForRelease($rid): void { self::query()->where('releases_id', $rid)->delete(); diff --git a/app/Models/Video.php b/app/Models/Video.php index b5eba1ea7..588552f08 100644 --- a/app/Models/Video.php +++ b/app/Models/Video.php @@ -37,6 +37,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Video whereTvmaze($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Video whereTvrage($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Video whereType($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Video newModelQuery() @@ -88,7 +89,6 @@ class Video extends Model * Get info from tables for the provided ID. * * - * @param $id * @return \Illuminate\Database\Eloquent\Model|null|static */ public static function getByVideoID($id) @@ -125,7 +125,6 @@ class Video extends Model * * * @param string $showname - * @return int */ public static function getCount($showname = ''): int { @@ -141,10 +140,8 @@ class Video extends Model /** * Retrieves and returns a list of shows with eligible releases. * - * @param $uid * @param string $letter * @param string $showname - * @return array */ public static function getSeriesList($uid, $letter = '', $showname = ''): array { diff --git a/app/Models/VideoAlias.php b/app/Models/VideoAlias.php index af34a2516..be4263339 100644 --- a/app/Models/VideoAlias.php +++ b/app/Models/VideoAlias.php @@ -13,6 +13,7 @@ use Illuminate\Database\Eloquent\Model; * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\VideoAlias whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\VideoAlias whereVideosId($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\VideoAlias newModelQuery() diff --git a/app/Models/VideoData.php b/app/Models/VideoData.php index 033fd60f4..930ca845f 100644 --- a/app/Models/VideoData.php +++ b/app/Models/VideoData.php @@ -30,6 +30,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\VideoData whereVideoheight($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\VideoData whereVideolibrary($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\VideoData whereVideowidth($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\VideoData newModelQuery() diff --git a/app/Models/XxxInfo.php b/app/Models/XxxInfo.php index 607129d9a..1951f987e 100644 --- a/app/Models/XxxInfo.php +++ b/app/Models/XxxInfo.php @@ -40,6 +40,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\XxxInfo whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\XxxInfo whereTrailers($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\XxxInfo whereUpdatedAt($value) + * * @mixin \Eloquent * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\XxxInfo newModelQuery() diff --git a/app/Observers/UserServiceObserver.php b/app/Observers/UserServiceObserver.php index 773551d33..80b5409ce 100644 --- a/app/Observers/UserServiceObserver.php +++ b/app/Observers/UserServiceObserver.php @@ -16,7 +16,6 @@ class UserServiceObserver /** * Handle the user "created" event. * - * @param \App\Models\User $user * @return void * * @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException diff --git a/app/Support/Google2FAAuthenticator.php b/app/Support/Google2FAAuthenticator.php index bf39aa75a..c72876050 100644 --- a/app/Support/Google2FAAuthenticator.php +++ b/app/Support/Google2FAAuthenticator.php @@ -7,9 +7,6 @@ use PragmaRX\Google2FALaravel\Support\Authenticator; class Google2FAAuthenticator extends Authenticator { - /** - * @return bool - */ protected function canPassWithoutCheckingOTP(): bool { if (! $this->getUser()->passwordSecurity) { diff --git a/app/Transformers/ApiTransformer.php b/app/Transformers/ApiTransformer.php index 17a44e5fa..20e6d7cfe 100644 --- a/app/Transformers/ApiTransformer.php +++ b/app/Transformers/ApiTransformer.php @@ -13,18 +13,12 @@ class ApiTransformer extends TransformerAbstract /** * ApiTransformer constructor. - * - * @param $user */ public function __construct($user) { $this->user = $user; } - /** - * @param \App\Models\Release $releases - * @return array - */ public function transform(Release $releases): array { if (\in_array($releases->categories_id, Category::MOVIES_GROUP, false)) { @@ -65,7 +59,7 @@ class ApiTransformer extends TransformerAbstract 'episode_title' => $releases->title ?? $this->null(), 'season' => $releases->series ?? $this->null(), 'episode' => $releases->episode ?? $this->null(), - 'tvairdate' =>$releases->firstaired ?? $this->null(), + 'tvairdate' => $releases->firstaired ?? $this->null(), 'tvdbid' => $releases->tvdb !== null && $releases->tvdb !== 0 ? $releases->tvdb : $this->null(), 'traktid' => $releases->trakt !== null && $releases->trakt !== 0 ? $releases->trakt : $this->null(), 'tvrageid' => $releases->tvrage !== null && $releases->tvrage !== 0 ? $releases->tvrage : $this->null(), diff --git a/app/Transformers/CategoryTransformer.php b/app/Transformers/CategoryTransformer.php index 2b120d70b..79ff50edf 100644 --- a/app/Transformers/CategoryTransformer.php +++ b/app/Transformers/CategoryTransformer.php @@ -9,9 +9,6 @@ class CategoryTransformer extends TransformerAbstract { /** * A Fractal transformer. - * - * @param \App\Models\RootCategory $category - * @return array */ public function transform(RootCategory $category): array { diff --git a/app/Transformers/DetailsTransformer.php b/app/Transformers/DetailsTransformer.php index 938bd7be2..c9a456a5b 100644 --- a/app/Transformers/DetailsTransformer.php +++ b/app/Transformers/DetailsTransformer.php @@ -13,8 +13,6 @@ class DetailsTransformer extends TransformerAbstract /** * ApiTransformer constructor. - * - * @param $user */ public function __construct($user) { @@ -23,9 +21,6 @@ class DetailsTransformer extends TransformerAbstract /** * A Fractal transformer. - * - * @param \App\Models\Release $releases - * @return array */ public function transform(Release $releases): array { diff --git a/app/Transformers/TagsTransformer.php b/app/Transformers/TagsTransformer.php index 42f15c27d..a2de29dad 100644 --- a/app/Transformers/TagsTransformer.php +++ b/app/Transformers/TagsTransformer.php @@ -9,8 +9,6 @@ class TagsTransformer extends TransformerAbstract { /** * A Fractal transformer. - * - * @return array */ public function transform(Tagged $tagged): array { diff --git a/cli/data/populate_anidb.php b/cli/data/populate_anidb.php index d0e8037b7..3e15070f9 100755 --- a/cli/data/populate_anidb.php +++ b/cli/data/populate_anidb.php @@ -19,10 +19,10 @@ if ($argc > 1 && $argv[1] === 'true' && isset($argv[2])) { } } else { (new ColorCLI())->error( - 'To execute this script you must provide a boolean argument.'.PHP_EOL. - 'Argument1: true|false to run this script or not'.PHP_EOL. - 'Argument2: full|info for what type of data to populate.'.PHP_EOL. - 'Argument3 (optional) anidbid to fetch info for'.PHP_EOL. - 'WARNING: Argument "info" without third argument will get you banned from AniDB almost instantly' + 'To execute this script you must provide a boolean argument.'.PHP_EOL. + 'Argument1: true|false to run this script or not'.PHP_EOL. + 'Argument2: full|info for what type of data to populate.'.PHP_EOL. + 'Argument3 (optional) anidbid to fetch info for'.PHP_EOL. + 'WARNING: Argument "info" without third argument will get you banned from AniDB almost instantly' ); } diff --git a/cli/data/predb_import_daily_batch.php b/cli/data/predb_import_daily_batch.php index ecc88ef28..6d5ac1a9f 100755 --- a/cli/data/predb_import_daily_batch.php +++ b/cli/data/predb_import_daily_batch.php @@ -95,6 +95,7 @@ foreach ($data as $dir => $files) { ', as your minimum unix time argument is '. $timeMatch.PHP_EOL; $total--; + continue; } @@ -105,12 +106,14 @@ foreach ($data as $dir => $files) { if (! $dump) { echo "Error downloading dump {$hit[2]} you can try manually importing it.". PHP_EOL; + continue; } // Make sure we didn't get an HTML page. if (strpos($dump, '') !== false) { echo "The dump file {$hit[2]} might be missing from GitHub.".PHP_EOL; + continue; } @@ -119,6 +122,7 @@ foreach ($data as $dir => $files) { if (! $dump) { echo "Error decompressing dump {$hit[2]}.".PHP_EOL; + continue; } @@ -128,6 +132,7 @@ foreach ($data as $dir => $files) { if (! $fetched) { echo "Error storing dump file {$hit[2]} in (".NN_RES.').'. PHP_EOL; + continue; } diff --git a/config/database.php b/config/database.php index 3d3df9803..a37a86584 100644 --- a/config/database.php +++ b/config/database.php @@ -36,25 +36,25 @@ return [ 'connections' => [ 'sqlite' => [ - 'driver' => 'sqlite', - 'url' => env('DATABASE_URL'), + 'driver' => 'sqlite', + 'url' => env('DATABASE_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'prefix' => '', + 'prefix' => '', ], 'mysql' => [ - 'driver' => 'mysql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'nntmux'), - 'username' => env('DB_USERNAME', 'nntmux'), - 'password' => env('DB_PASSWORD', ''), + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'nntmux'), + 'username' => env('DB_USERNAME', 'nntmux'), + 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'strict' => false, - 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'strict' => false, + 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), PDO::MYSQL_ATTR_LOCAL_INFILE => true, @@ -62,38 +62,38 @@ return [ ], 'pgsql' => [ - 'driver' => 'pgsql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), + 'driver' => 'pgsql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), 'database' => env('DB_DATABASE', 'nntmux'), 'username' => env('DB_USERNAME', 'nntmux'), 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'schema' => 'public', - 'sslmode' => 'prefer', + 'charset' => 'utf8', + 'prefix' => '', + 'schema' => 'public', + 'sslmode' => 'prefer', ], 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '1433'), + 'driver' => 'sqlsrv', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), 'database' => env('DB_DATABASE', 'nntmux'), 'username' => env('DB_USERNAME', 'nntmux'), 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', + 'charset' => 'utf8', + 'prefix' => '', ], 'sphinx' => [ - 'driver' => 'mysql', - 'host' => env('SPHINX_HOST', '127.0.0.1'), - 'port' => env('SPHINX_PORT', 9306), - 'database' => '', + 'driver' => 'mysql', + 'host' => env('SPHINX_HOST', '127.0.0.1'), + 'port' => env('SPHINX_PORT', 9306), + 'database' => '', 'unix_socket' => '', - 'charset' => 'utf8', + 'charset' => 'utf8', ], ], @@ -129,7 +129,7 @@ return [ 'prefix' => Str::slug(env('APP_NAME', 'laravel'), '_').'_database_', ], 'default' => [ - 'url' => env('REDIS_URL'), + 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), diff --git a/config/elasticsearch.php b/config/elasticsearch.php index 2a1a40fd2..4fd62a2aa 100644 --- a/config/elasticsearch.php +++ b/config/elasticsearch.php @@ -45,8 +45,8 @@ return [ ], 'cloud_api' => [ // Alternatively, you can log in via API keys - 'api_id' => env('ELASTICSEARCH_API_ID', null), - 'api_key' => env('ELASTICSEARCH_API_KEY', null), + 'api_id' => env('ELASTICSEARCH_API_ID', null), + 'api_key' => env('ELASTICSEARCH_API_KEY', null), ], /* diff --git a/config/geoip.php b/config/geoip.php index 4663143a3..be9296a57 100644 --- a/config/geoip.php +++ b/config/geoip.php @@ -82,14 +82,14 @@ return [ ], 'ipdata' => [ - 'class' => \Torann\GeoIP\Services\IPData::class, - 'key' => env('IPDATA_API_KEY'), + 'class' => \Torann\GeoIP\Services\IPData::class, + 'key' => env('IPDATA_API_KEY'), 'secure' => true, ], 'ipfinder' => [ - 'class' => \Torann\GeoIP\Services\IPFinder::class, - 'key' => env('IPFINDER_API_KEY'), + 'class' => \Torann\GeoIP\Services\IPFinder::class, + 'key' => env('IPFINDER_API_KEY'), 'secure' => true, 'locales' => ['en'], ], diff --git a/config/google2fa.php b/config/google2fa.php index 3ca58bfa8..ee256cbae 100644 --- a/config/google2fa.php +++ b/config/google2fa.php @@ -64,9 +64,9 @@ return [ * One Time Password error message. */ 'error_messages' => [ - 'wrong_otp' => "The 'One Time Password' typed was wrong.", + 'wrong_otp' => "The 'One Time Password' typed was wrong.", 'cannot_be_empty' => 'One Time Password cannot be empty.', - 'unknown' => 'An unknown error has occurred. Please try again.', + 'unknown' => 'An unknown error has occurred. Please try again.', ], /* diff --git a/config/ide-helper.php b/config/ide-helper.php index d27b0b9fd..ac66dc2c3 100644 --- a/config/ide-helper.php +++ b/config/ide-helper.php @@ -11,8 +11,8 @@ return [ | */ - 'filename' => '_ide_helper', - 'format' => 'php', + 'filename' => '_ide_helper', + 'format' => 'php', 'meta_filename' => '.phpstorm.meta.php', @@ -84,13 +84,13 @@ return [ 'magic' => [ 'Log' => [ - 'debug' => 'Monolog\Logger::addDebug', - 'info' => 'Monolog\Logger::addInfo', - 'notice' => 'Monolog\Logger::addNotice', - 'warning' => 'Monolog\Logger::addWarning', - 'error' => 'Monolog\Logger::addError', - 'critical' => 'Monolog\Logger::addCritical', - 'alert' => 'Monolog\Logger::addAlert', + 'debug' => 'Monolog\Logger::addDebug', + 'info' => 'Monolog\Logger::addInfo', + 'notice' => 'Monolog\Logger::addNotice', + 'warning' => 'Monolog\Logger::addWarning', + 'error' => 'Monolog\Logger::addError', + 'critical' => 'Monolog\Logger::addCritical', + 'alert' => 'Monolog\Logger::addAlert', 'emergency' => 'Monolog\Logger::addEmergency', ], ], diff --git a/config/irc_settings.php b/config/irc_settings.php index 72558321c..7fbaa948f 100644 --- a/config/irc_settings.php +++ b/config/irc_settings.php @@ -30,12 +30,12 @@ return [ /*********************************************************************************************************************** * This is the nick name visible in IRC channels. **********************************************************************************************************************/ - 'scrape_irc_nickname'=> env('SCRAPE_IRC_USERNAME', ''), + 'scrape_irc_nickname' => env('SCRAPE_IRC_USERNAME', ''), /*********************************************************************************************************************** * This is a name that is visible to others when they type /whois nickname. **********************************************************************************************************************/ - 'scrape_irc_realname'=> env('SCRAPE_IRC_USERNAME', ''), + 'scrape_irc_realname' => env('SCRAPE_IRC_USERNAME', ''), /*********************************************************************************************************************** * This is used as part of your "ident" when connecting to IRC. @@ -75,8 +75,8 @@ return [ 'scrape_irc_channels' => serialize( [ //'#Channel' => 'Password', - '#PreNNTmux' => null, - '#nZEDbPRE' => null, + '#PreNNTmux' => null, + '#nZEDbPRE' => null, ] ), @@ -87,26 +87,26 @@ return [ 'scrape_irc_source_ignore' => serialize( [ - '#a.b.cd.image' => false, - '#a.b.console.ps3' => false, - '#a.b.dvd' => false, - '#a.b.erotica' => false, - '#a.b.flac' => false, - '#a.b.foreign' => false, - '#a.b.games.nintendods' => false, - '#a.b.inner-sanctum' => false, - '#a.b.moovee' => false, - '#a.b.movies.divx' => false, - '#a.b.sony.psp' => false, + '#a.b.cd.image' => false, + '#a.b.console.ps3' => false, + '#a.b.dvd' => false, + '#a.b.erotica' => false, + '#a.b.flac' => false, + '#a.b.foreign' => false, + '#a.b.games.nintendods' => false, + '#a.b.inner-sanctum' => false, + '#a.b.moovee' => false, + '#a.b.movies.divx' => false, + '#a.b.sony.psp' => false, '#a.b.sounds.mp3.complete_cd' => false, - '#a.b.teevee' => false, - '#a.b.games.wii' => false, - '#a.b.warez' => false, - '#a.b.games.xbox360' => false, - '#pre@corrupt' => false, - '#scnzb' => false, - '#tvnzb' => false, - 'srrdb' => false, + '#a.b.teevee' => false, + '#a.b.games.wii' => false, + '#a.b.warez' => false, + '#a.b.games.xbox360' => false, + '#pre@corrupt' => false, + '#scnzb' => false, + '#tvnzb' => false, + 'srrdb' => false, ] ), ]; diff --git a/config/lodash.php b/config/lodash.php index 89e8a9bcd..c48655378 100644 --- a/config/lodash.php +++ b/config/lodash.php @@ -28,9 +28,9 @@ return [ ], 'xss' => [ - 'exclude_uris' => [], // Excluded URI's for Xss middleware - 'x_frame_options' => 'DENY', // X-Frame-Options header value + 'exclude_uris' => [], // Excluded URI's for Xss middleware + 'x_frame_options' => 'DENY', // X-Frame-Options header value 'x_content_type_options' => 'nosniff', // X-Content-Type-Options header value - 'x_xss_protection' => '1; mode=block', // X-XSS-Protection header value + 'x_xss_protection' => '1; mode=block', // X-XSS-Protection header value ], ]; diff --git a/config/logging.php b/config/logging.php index 79278ee2e..30fefa731 100644 --- a/config/logging.php +++ b/config/logging.php @@ -63,7 +63,7 @@ return [ 'level' => 'critical', ], 'papertrail' => [ - 'driver' => 'monolog', + 'driver' => 'monolog', 'level' => 'debug', 'handler' => SyslogUdpHandler::class, 'handler_with' => [ diff --git a/config/nntmux.php b/config/nntmux.php index 422f08fed..c2549fa20 100644 --- a/config/nntmux.php +++ b/config/nntmux.php @@ -12,7 +12,7 @@ return [ 'rename_par2' => env('RENAME_PAR2', true), 'rename_music_mediainfo' => env('RENAME_MUSIC_MEDIAINFO', true), 'cache_expiry_short' => env('CACHE_EXPIRY_SHORT', 5), - 'cache_expiry_medium' =>env('CACHE_EXPIRY_MEDIUM', 10), + 'cache_expiry_medium' => env('CACHE_EXPIRY_MEDIUM', 10), 'cache_expiry_long' => env('CACHE_EXPIRY_LONG', 15), 'admin_username' => env('ADMIN_USER', 'admin'), 'admin_password' => env('ADMIN_PASS', 'admin'), diff --git a/config/sphinxsearch.php b/config/sphinxsearch.php index 31ec9837a..4c4edb180 100644 --- a/config/sphinxsearch.php +++ b/config/sphinxsearch.php @@ -1,9 +1,9 @@ env('SPHINX_HOST', '127.0.0.1'), - 'port' => env('SPHINX_PORT', 9306), - 'indexes' => [ + 'host' => env('SPHINX_HOST', '127.0.0.1'), + 'port' => env('SPHINX_PORT', 9306), + 'indexes' => [ 'releases' => 'releases_rt', 'predb' => 'predb_rt', ], diff --git a/config/tagging.php b/config/tagging.php index afaee444c..403c07cdf 100644 --- a/config/tagging.php +++ b/config/tagging.php @@ -18,10 +18,10 @@ return [ 'untag_on_delete' => true, // Auto-delete unused tags from the 'tags' database table (when they are used zero times) - 'delete_unused_tags'=>true, + 'delete_unused_tags' => true, // Model to use to store the tags in the database - 'tag_model'=>'\Conner\Tagging\Model\Tag', + 'tag_model' => '\Conner\Tagging\Model\Tag', // Delimiter used within tags 'delimiter' => '-', diff --git a/config/ytake-laravel-smarty.php b/config/ytake-laravel-smarty.php index dd089bc1f..f48d7cabb 100644 --- a/config/ytake-laravel-smarty.php +++ b/config/ytake-laravel-smarty.php @@ -22,43 +22,43 @@ return [ // smarty file extension - 'extension' => 'tpl', + 'extension' => 'tpl', // - 'debugging' => env('SMARTY_DEBUG', false), + 'debugging' => env('SMARTY_DEBUG', false), // use cache - 'caching' => env('SMARTY_CACHING', false), + 'caching' => env('SMARTY_CACHING', false), // - 'cache_lifetime' => env('SMARTY_CACHE_LIFE', 120), + 'cache_lifetime' => env('SMARTY_CACHE_LIFE', 120), // - 'compile_check' => env('SMARTY_COMPILE_CHECK', false), + 'compile_check' => env('SMARTY_COMPILE_CHECK', false), // delimiters // default "{$smarty}" - 'left_delimiter' => '{', - 'right_delimiter' => '}', + 'left_delimiter' => '{', + 'right_delimiter' => '}', // path info - 'template_path' => base_path().'/resources/views/themes', + 'template_path' => base_path().'/resources/views/themes', // smarty cache directory - 'cache_path' => storage_path().'/framework/smarty/cache', + 'cache_path' => storage_path().'/framework/smarty/cache', // smarty template compiler - 'compile_path' => storage_path().'/framework/smarty/templates_c', + 'compile_path' => storage_path().'/framework/smarty/templates_c', // smarty plugins - 'plugins_paths' => [ + 'plugins_paths' => [ base_path().'/vendor/smarty/libs/plugins/', base_path().'/resources/smarty/plugins/', ], // smarty configure - 'config_paths' => [ + 'config_paths' => [ base_path().'/resources/smarty/config', ], @@ -66,25 +66,25 @@ return [ * for develop true * for production false */ - 'force_compile' => env('SMARTY_FORCE_COMPILE', false), + 'force_compile' => env('SMARTY_FORCE_COMPILE', false), // smarty cache driver "file", "memcached", "redis" - 'cache_driver' => env('SMARTY_CACHE_DRIVER', 'file'), + 'cache_driver' => env('SMARTY_CACHE_DRIVER', 'file'), // memcached servers - 'memcached' => [ + 'memcached' => [ [ - 'host' => '127.0.0.1', - 'port' => 11211, + 'host' => '127.0.0.1', + 'port' => 11211, 'weight' => 100, ], ], // redis configure - 'redis' => [ + 'redis' => [ [ - 'host' => env('REDIS_HOST', '127.0.0.1'), - 'port' => env('REDIS_PORT', '6379'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'port' => env('REDIS_PORT', '6379'), 'database' => 0, ], ], diff --git a/misc/elasticsearch/create_es_indexes.php b/misc/elasticsearch/create_es_indexes.php index 057870297..2e9656c93 100644 --- a/misc/elasticsearch/create_es_indexes.php +++ b/misc/elasticsearch/create_es_indexes.php @@ -7,7 +7,7 @@ if (\Elasticsearch::indices()->exists(['index' => 'releases'])) { } $releases_index = [ 'index' => 'releases', - 'body' => [ + 'body' => [ 'settings' => [ 'number_of_shards' => 2, 'number_of_replicas' => 0, @@ -65,7 +65,7 @@ if (\Elasticsearch::indices()->exists(['index' => 'predb'])) { } $predb_index = [ 'index' => 'predb', - 'body' => [ + 'body' => [ 'settings' => [ 'number_of_shards' => 2, 'number_of_replicas' => 0, diff --git a/misc/elasticsearch/populate_es_indexes.php b/misc/elasticsearch/populate_es_indexes.php index 0050de4c9..aafffa5f0 100644 --- a/misc/elasticsearch/populate_es_indexes.php +++ b/misc/elasticsearch/populate_es_indexes.php @@ -8,8 +8,8 @@ use Illuminate\Support\Facades\DB; if (! isset($argv[1])) { exit( - "Argument 1 is the index name, releases and predb are the only supported ones currently.\n". - "Argument 2 is optional, max number of rows to send to ES at a time, 10,000 is the default if not set.\n" + "Argument 1 is the index name, releases and predb are the only supported ones currently.\n". + "Argument 2 is optional, max number of rows to send to ES at a time, 10,000 is the default if not set.\n" ); } diff --git a/misc/manticoresearch/populate_rt_indexes.php b/misc/manticoresearch/populate_rt_indexes.php index d98893846..ab26393de 100644 --- a/misc/manticoresearch/populate_rt_indexes.php +++ b/misc/manticoresearch/populate_rt_indexes.php @@ -10,12 +10,12 @@ use Illuminate\Support\Facades\DB; if (! isset($argv[1])) { exit( - "Argument 1 is the index name, releases_rt and predb_rt are the only supported ones currently.\n". - "Argument 2 is optional, max number of rows to send to sphinx at a time, 10,000 is the default if not set.\n". - " The value of 10,000 is good for the default sphinx.conf max_packet_size of 8M, if you want\n". - " to raise this higher than 10,000, raise the sphinx.conf max_packet_size higher than 8M.\n". - " If you have many releases, raise the sphinx.conf max_packet_size to 128M (the maximum), restart sphinx and\n". - " and set Argument 2 to 250,000. This will speed up the script tremendously.\n" + "Argument 1 is the index name, releases_rt and predb_rt are the only supported ones currently.\n". + "Argument 2 is optional, max number of rows to send to sphinx at a time, 10,000 is the default if not set.\n". + " The value of 10,000 is good for the default sphinx.conf max_packet_size of 8M, if you want\n". + " to raise this higher than 10,000, raise the sphinx.conf max_packet_size higher than 8M.\n". + " If you have many releases, raise the sphinx.conf max_packet_size to 128M (the maximum), restart sphinx and\n". + " and set Argument 2 to 250,000. This will speed up the script tremendously.\n" ); } diff --git a/misc/testing/DB/move_tmux_to_settings.php b/misc/testing/DB/move_tmux_to_settings.php index a574d874b..c5af85976 100644 --- a/misc/testing/DB/move_tmux_to_settings.php +++ b/misc/testing/DB/move_tmux_to_settings.php @@ -7,12 +7,12 @@ $tmux = \Illuminate\Support\Facades\DB::table('tmux')->get(); foreach ($tmux as $item) { echo 'Inserting '.$item->setting.' into settings table'.PHP_EOL; \App\Models\Settings::insertOrIgnore( - [ - 'section' => 'site', - 'subsection' => 'tmux', - 'name' => $item->setting, - 'value' => $item->value, - 'setting'=> $item->setting, - ] - ); + [ + 'section' => 'site', + 'subsection' => 'tmux', + 'name' => $item->setting, + 'value' => $item->value, + 'setting' => $item->setting, + ] + ); } diff --git a/misc/testing/DB/reset_postprocessing.php b/misc/testing/DB/reset_postprocessing.php index 7feef4fcc..d7ccf97b4 100755 --- a/misc/testing/DB/reset_postprocessing.php +++ b/misc/testing/DB/reset_postprocessing.php @@ -39,15 +39,15 @@ if (isset($argv[1]) && $argv[1] === 'all' && isset($argv[2]) && $argv[2] === 'tr foreach ($qry as $releases) { DB::update( sprintf( - ' + ' UPDATE releases SET consoleinfo_id = NULL, gamesinfo_id = 0, imdbid = NULL, musicinfo_id = NULL, bookinfo_id = NULL, videos_id = 0, tv_episodes_id = 0, xxxinfo_id = 0, passwordstatus = -1, haspreview = -1, jpgstatus = 0, videostatus = 0, audiostatus = 0, nfostatus = -1 WHERE id = %d', - $releases->id - ) - ); + $releases->id + ) + ); $consoletools->overWritePrimary('Resetting Releases: '.$consoletools->percentString(++$affected, $total)); } } @@ -276,7 +276,7 @@ if (isset($argv[1]) && ($argv[1] === 'xxx' || $argv[1] === 'all')) { $consoletools->overWritePrimary('Resetting XXX Releases: '.$consoletools->percentString( ++$concount, $total - )); + )); } $colorCli->header(PHP_EOL.number_format($concount).' xxxinfo_IDs reset.'); } @@ -321,7 +321,7 @@ if ($ran === false) { .'php reset_postprocessing.php xxx true ...: To reset all xxx.'.PHP_EOL .'php reset_postprocessing.php nfos true ...: To reset all nfos.'.PHP_EOL .'php reset_postprocessing.php all true ...: To reset everything.'.PHP_EOL - ); + ); exit(); } echo PHP_EOL; diff --git a/misc/testing/Dev/clean_nzbs.php b/misc/testing/Dev/clean_nzbs.php index dbb3f449f..fd284229a 100644 --- a/misc/testing/Dev/clean_nzbs.php +++ b/misc/testing/Dev/clean_nzbs.php @@ -62,16 +62,16 @@ $colorCli->header("Checked / releases deleted\n"); $checked = $deleted = 0; $res = Release::query()->select(['id', 'guid', 'nzbstatus'])->get(); - foreach ($res as $row) { - $nzbpath = $nzb->getNZBPath($row->guid); - if (! File::isFile($nzbpath)) { - $deleted++; - $releases->deleteSingle(['g' => $row->guid, 'i' => $row->id], $nzb, $releaseImage); - } elseif ($row->nzbstatus !== 1) { - Release::where('id', $row->id)->update(['nzbstatus' => 1]); - } - $checked++; - echo "$checked / $deleted\r"; +foreach ($res as $row) { + $nzbpath = $nzb->getNZBPath($row->guid); + if (! File::isFile($nzbpath)) { + $deleted++; + $releases->deleteSingle(['g' => $row->guid, 'i' => $row->id], $nzb, $releaseImage); + } elseif ($row->nzbstatus !== 1) { + Release::where('id', $row->id)->update(['nzbstatus' => 1]); } + $checked++; + echo "$checked / $deleted\r"; +} $colorCli->header("\n".number_format($checked).' releases checked, '.number_format($deleted).' releases deleted.'); $colorCli->header("Script started at [$timestart], finished at [".now()->toRfc2822String().']'); diff --git a/misc/testing/Dev/test_hash_algorithms.php b/misc/testing/Dev/test_hash_algorithms.php index ee431393b..f121c498b 100644 --- a/misc/testing/Dev/test_hash_algorithms.php +++ b/misc/testing/Dev/test_hash_algorithms.php @@ -165,12 +165,12 @@ class HashAlgorithms protected function _hashesToArray($string) { $strings = [ - 'input' => $string, - 'lower' => strtolower($string), + 'input' => $string, + 'lower' => strtolower($string), 'lower_reverse' => strtolower(strrev($string)), 'upper_reverse' => strtoupper(strrev($string)), - 'upper' => strtoupper($string), - 'reverse' => strrev($string), + 'upper' => strtoupper($string), + 'reverse' => strrev($string), 'reverse_upper' => strrev(strtoupper($string)), 'reverse_lower' => strrev(strtolower($string)), ]; diff --git a/misc/testing/NZB/nzb-reorg.php b/misc/testing/NZB/nzb-reorg.php index 813022b85..0283fa6fe 100755 --- a/misc/testing/NZB/nzb-reorg.php +++ b/misc/testing/NZB/nzb-reorg.php @@ -31,8 +31,8 @@ foreach ($objects as $filestoprocess => $nzbFile) { $newFileName = $nzb->getNZBPath( str_replace('.nzb.gz', '', $nzbFile->getBasename()), - $newLevel, - true + $newLevel, + true ); if ($newFileName != $nzbFile) { rename($nzbFile, $newFileName); diff --git a/misc/testing/PostProc/getXXXCovers.php b/misc/testing/PostProc/getXXXCovers.php index 8c0d1d343..c78e58417 100644 --- a/misc/testing/PostProc/getXXXCovers.php +++ b/misc/testing/PostProc/getXXXCovers.php @@ -11,16 +11,16 @@ $c = new ColorCLI(); $movies = DB::select('SELECT title FROM xxxinfo WHERE cover = 0'); - echo $c->primary('Updating '.number_format(\count($movies)).' XXX movie covers.'); - foreach ($movies as $mov) { - $starttime = now()->timestamp; - $mov = $movie->updateXXXInfo($mov->title); +echo $c->primary('Updating '.number_format(\count($movies)).' XXX movie covers.'); +foreach ($movies as $mov) { + $starttime = now()->timestamp; + $mov = $movie->updateXXXInfo($mov->title); - // sleep so that it's not ddos' the site - $diff = floor((now()->timestamp - $starttime) * 1000000); - if (333333 - $diff > 0) { - echo "\nsleeping\n"; - usleep(333333 - $diff); - } + // sleep so that it's not ddos' the site + $diff = floor((now()->timestamp - $starttime) * 1000000); + if (333333 - $diff > 0) { + echo "\nsleeping\n"; + usleep(333333 - $diff); } - echo "\n"; +} +echo "\n"; diff --git a/misc/testing/PostProc/updateBookImages.php b/misc/testing/PostProc/updateBookImages.php index b90488d70..d64a34b5e 100644 --- a/misc/testing/PostProc/updateBookImages.php +++ b/misc/testing/PostProc/updateBookImages.php @@ -35,12 +35,12 @@ foreach ($itr as $filePath) { } $qry = BookInfo::query()->where('cover', '=', 1)->select(['id'])->get(); - foreach ($qry as $rows) { - if (! is_file($path2covers.$rows['id'].'.jpg')) { - BookInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]); - $colorCli->info($path2covers.$rows['id'].'.jpg does not exist.'); - $deleted++; - } +foreach ($qry as $rows) { + if (! is_file($path2covers.$rows['id'].'.jpg')) { + BookInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]); + $colorCli->info($path2covers.$rows['id'].'.jpg does not exist.'); + $deleted++; } +} $colorCli->header($covers.' covers set.'); $colorCli->header($deleted.' books unset.'); diff --git a/misc/testing/PostProc/updateConsoleImages.php b/misc/testing/PostProc/updateConsoleImages.php index 2a707fb51..994fa0776 100644 --- a/misc/testing/PostProc/updateConsoleImages.php +++ b/misc/testing/PostProc/updateConsoleImages.php @@ -40,17 +40,17 @@ foreach ($itr as $filePath) { } $qry = ConsoleInfo::query()->where('cover', '=', 1)->value('id'); - foreach ($qry as $rows) { - if (! is_file($path2covers.$rows['id'].'.jpg')) { - ConsoleInfo::query()->where( - [ - ['cover' => 1], - ['id' => $rows['id']], - ] - )->update(['cover' => 0]); - $colorCli->info($path2covers.$rows['id'].'.jpg does not exist.'); - $deleted++; - } +foreach ($qry as $rows) { + if (! is_file($path2covers.$rows['id'].'.jpg')) { + ConsoleInfo::query()->where( + [ + ['cover' => 1], + ['id' => $rows['id']], + ] + )->update(['cover' => 0]); + $colorCli->info($path2covers.$rows['id'].'.jpg does not exist.'); + $deleted++; } +} $colorCli->header($covers.' covers set.'); $colorCli->header($deleted.' consoles unset.'); diff --git a/misc/testing/PostProc/updateGamesImages.php b/misc/testing/PostProc/updateGamesImages.php index 7be83c00b..6789a4bb2 100644 --- a/misc/testing/PostProc/updateGamesImages.php +++ b/misc/testing/PostProc/updateGamesImages.php @@ -48,12 +48,12 @@ foreach ($itr as $filePath) { } $qry = GamesInfo::query()->where('cover', '=', 1)->select(['id'])->get(); - foreach ($qry as $rows) { - if (! is_file($path2covers.$rows['id'].'.jpg')) { - GamesInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]); - $colorCli->info($path2covers.$rows['id'].'.jpg does not exist.'); - $deleted++; - } +foreach ($qry as $rows) { + if (! is_file($path2covers.$rows['id'].'.jpg')) { + GamesInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]); + $colorCli->info($path2covers.$rows['id'].'.jpg does not exist.'); + $deleted++; } +} $colorCli->header($covers.' covers set.'); $colorCli->header($deleted.' games unset.'); diff --git a/misc/testing/PostProc/updateMovieImages.php b/misc/testing/PostProc/updateMovieImages.php index 7f88b683d..790a5ab12 100644 --- a/misc/testing/PostProc/updateMovieImages.php +++ b/misc/testing/PostProc/updateMovieImages.php @@ -57,21 +57,21 @@ foreach ($itr as $filePath) { } $qry = MovieInfo::query()->where('cover', '=', 1)->select(['imdbid'])->get(); - foreach ($qry as $rows) { - if (! is_file($path2covers.$rows['imdbid'].'-cover.jpg')) { - MovieInfo::query()->where('cover', '=', 1)->where('imdbid', $rows['imdbid'])->update(['cover' => 0]); - $colorCli->info($path2covers.$rows['imdbid'].'-cover.jpg does not exist.'); - $deleted++; - } +foreach ($qry as $rows) { + if (! is_file($path2covers.$rows['imdbid'].'-cover.jpg')) { + MovieInfo::query()->where('cover', '=', 1)->where('imdbid', $rows['imdbid'])->update(['cover' => 0]); + $colorCli->info($path2covers.$rows['imdbid'].'-cover.jpg does not exist.'); + $deleted++; } - $qry1 = MovieInfo::query()->where('backdrop', '=', 1)->select(['imdbid'])->get(); - foreach ($qry1 as $rows) { - if (! is_file($path2covers.$rows['imdbid'].'-backdrop.jpg')) { - MovieInfo::query()->where('backdrop', '=', 1)->where('imdbid', $rows['imdbid'])->update(['backdrop' => 0]); - $colorCli->info($path2covers.$rows['imdbid'].'-backdrop.jpg does not exist.'); - $deleted++; - } +} +$qry1 = MovieInfo::query()->where('backdrop', '=', 1)->select(['imdbid'])->get(); +foreach ($qry1 as $rows) { + if (! is_file($path2covers.$rows['imdbid'].'-backdrop.jpg')) { + MovieInfo::query()->where('backdrop', '=', 1)->where('imdbid', $rows['imdbid'])->update(['backdrop' => 0]); + $colorCli->info($path2covers.$rows['imdbid'].'-backdrop.jpg does not exist.'); + $deleted++; } +} $colorCli->header($covers.' covers set.'); $colorCli->header($updated.' backdrops set.'); $colorCli->header($deleted.' movies unset.'); diff --git a/misc/testing/PostProc/updateXXXImages.php b/misc/testing/PostProc/updateXXXImages.php index 19e116361..5eb74864b 100644 --- a/misc/testing/PostProc/updateXXXImages.php +++ b/misc/testing/PostProc/updateXXXImages.php @@ -49,21 +49,21 @@ foreach ($itr as $filePath) { } $qry = XxxInfo::query()->where('cover', '=', 1)->select(['id'])->get(); - foreach ($qry as $rows) { - if (! is_file($path2covers.$rows['id'].'-cover.jpg')) { - XxxInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]); - $colorCli->info($path2covers.$rows['id'].'-cover.jpg does not exist.'); - $deleted++; - } +foreach ($qry as $rows) { + if (! is_file($path2covers.$rows['id'].'-cover.jpg')) { + XxxInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]); + $colorCli->info($path2covers.$rows['id'].'-cover.jpg does not exist.'); + $deleted++; } +} $qry1 = XxxInfo::query()->where('backdrop', '=', 1)->select(['id'])->get(); - foreach ($qry1 as $rows) { - if (! is_file($path2covers.$rows['id'].'-backdrop.jpg')) { - XxxInfo::query()->where(['backdrop' => 1, 'id' => $rows['id']])->update(['backdrop' => 0]); - $colorCli->info($path2covers.$rows['id'].'-backdrop.jpg does not exist.'); - $deleted++; - } +foreach ($qry1 as $rows) { + if (! is_file($path2covers.$rows['id'].'-backdrop.jpg')) { + XxxInfo::query()->where(['backdrop' => 1, 'id' => $rows['id']])->update(['backdrop' => 0]); + $colorCli->info($path2covers.$rows['id'].'-backdrop.jpg does not exist.'); + $deleted++; } +} $colorCli->header($covers.' covers set.'); $colorCli->header($updated.' backdrops set.'); $colorCli->header($deleted.' movies unset.'); diff --git a/misc/testing/Tests/test_fanarttv_API.php b/misc/testing/Tests/test_fanarttv_API.php index 03e4936fc..7e3a575a0 100644 --- a/misc/testing/Tests/test_fanarttv_API.php +++ b/misc/testing/Tests/test_fanarttv_API.php @@ -9,7 +9,6 @@ $fanart = new FanartTV(config('nntmux_api.fanarttv_api_key')); $colorCli = new ColorCLI(); if (! empty($argv[1])) { - // Test if you can fetch Fanart.TV images // Search for a movie/tv diff --git a/misc/testing/Tests/test_omdb_API.php b/misc/testing/Tests/test_omdb_API.php index eb0da660b..567c7dbba 100644 --- a/misc/testing/Tests/test_omdb_API.php +++ b/misc/testing/Tests/test_omdb_API.php @@ -9,7 +9,6 @@ $omdb = new OMDbAPI(config('nntmux_api.omdb_api_key')); $colorCli = new ColorCLI(); if (! empty($argv[1]) && ! empty($argv[2]) && ($argv[2] !== 'series' || $argv[2] !== 'movie')) { - // Test if your OMDb API key and configuration are working // If it works you should get a printed array of the show entered diff --git a/misc/testing/Tests/test_tmdb_API.php b/misc/testing/Tests/test_tmdb_API.php index 6c2c46a17..6c6b48bf2 100755 --- a/misc/testing/Tests/test_tmdb_API.php +++ b/misc/testing/Tests/test_tmdb_API.php @@ -8,7 +8,6 @@ use Tmdb\Laravel\Facades\Tmdb; $colorCli = new ColorCLI(); if (! empty($argv[1]) && is_numeric($argv[2]) && is_numeric($argv[3])) { - // Test if your TMDB API configuration is working // If it works you should get a var dumped array of the show/season/episode entered diff --git a/misc/testing/Tests/test_trakt_API.php b/misc/testing/Tests/test_trakt_API.php index cb31c7a76..1123cb69e 100755 --- a/misc/testing/Tests/test_trakt_API.php +++ b/misc/testing/Tests/test_trakt_API.php @@ -8,7 +8,6 @@ $c = new Blacklight\ColorCLI(); $trakt = new TraktTv(); if (! empty($argv[1]) && is_numeric($argv[2]) && is_numeric($argv[3])) { - // Test if your Trakt API key and configuration are working // If it works you should get a printed array of the show/season/episode entered diff --git a/misc/testing/Tests/test_tvdb_API.php b/misc/testing/Tests/test_tvdb_API.php index 85a069f0e..e9d74782d 100755 --- a/misc/testing/Tests/test_tvdb_API.php +++ b/misc/testing/Tests/test_tvdb_API.php @@ -8,7 +8,6 @@ $c = new Blacklight\ColorCLI(); $tvDB = new TVDB(); if (! empty($argv[1]) && isset($argv[2], $argv[3]) && is_numeric($argv[2]) && is_numeric($argv[3])) { - // Test if your TvDB API key and configuration are working // If it works you should get a var dumped array of the show/season/episode entered diff --git a/misc/testing/Tests/test_tvmaze_API.php b/misc/testing/Tests/test_tvmaze_API.php index b5e26d732..c9e7f6120 100755 --- a/misc/testing/Tests/test_tvmaze_API.php +++ b/misc/testing/Tests/test_tvmaze_API.php @@ -8,7 +8,6 @@ $c = new Blacklight\ColorCLI(); $tvmaze = new TVMaze(); if (! empty($argv[1]) && is_numeric($argv[2]) && is_numeric($argv[3])) { - // Test if your TVMaze API configuration is working // If it works you should get a var dumped array of the show/season/episode entered diff --git a/misc/update/match_prefiles.php b/misc/update/match_prefiles.php index ec973da82..d4b3b7c14 100755 --- a/misc/update/match_prefiles.php +++ b/misc/update/match_prefiles.php @@ -7,7 +7,7 @@ use Blacklight\NameFixer; if (! isset($argv[1]) && ($argv[1] !== 'full' || ! is_numeric($argv[1]))) { exit( - (new ColorCLI())->error( + (new ColorCLI())->error( PHP_EOL .'This script tries to match release filenames to PreDB filenames.'.PHP_EOL .'To display the changes, use "show" as the second argument. The optional third argument will limit the amount of filenames to attempt to match.'.PHP_EOL.PHP_EOL diff --git a/misc/update/postprocess.php b/misc/update/postprocess.php index 1384693d1..ea4a079eb 100644 --- a/misc/update/postprocess.php +++ b/misc/update/postprocess.php @@ -12,21 +12,21 @@ use Blacklight\processing\PostProcess; **/ $args = [ 'additional' => true, - 'all' => true, - 'allinf' => true, - 'amazon' => false, - 'anime' => false, - 'book' => false, - 'console' => false, - 'games' => false, - 'movies' => false, - 'music' => false, - 'nfo' => true, - 'pre' => true, - 'sharing' => true, - 'tv' => false, - 'tvdb' => false, - 'xxx' => false, + 'all' => true, + 'allinf' => true, + 'amazon' => false, + 'anime' => false, + 'book' => false, + 'console' => false, + 'games' => false, + 'movies' => false, + 'music' => false, + 'nfo' => true, + 'pre' => true, + 'sharing' => true, + 'tv' => false, + 'tvdb' => false, + 'xxx' => false, ]; $bool = [ @@ -36,25 +36,25 @@ $bool = [ if (! isset($argv[1], $argv[2]) || ! in_array($argv[1], $args, false) || ! in_array($argv[2], $bool, false)) { exit( - (new \Blacklight\ColorCLI())->error( - "\nIncorrect arguments.\n" - ."The second argument (true/false) determines wether to echo or not.\n\n" - ."php postprocess.php all true ...: Does all the types of post processing.\n" - ."php postprocess.php pre true ...: Processes all Predb sites.\n" - ."php postprocess.php nfo true ...: Processes NFO files.\n" - ."php postprocess.php movies true ...: Processes movies.\n" - ."php postprocess.php music true ...: Processes music.\n" - ."php postprocess.php console true ...: Processes console games.\n" - ."php postprocess.php games true ...: Processes games.\n" - ."php postprocess.php book true ...: Processes books.\n" - ."php postprocess.php anime true ...: Processes anime.\n" - ."php postprocess.php tv true ...: Processes tv.\n" - ."php postprocess.php xxx true ...: Processes xxx.\n" - ."php postprocess.php additional true ...: Processes previews/mediainfo/etc...\n" - ."php postprocess.php sharing true ...: Processes uploading/downloading comments.\n" - ."php postprocess.php allinf true ...: Does all the types of post processing on a loop, sleeping 15 seconds between.\n" - ."php postprocess.php amazon true ...: Does all the amazon (books/console/games/music/xxx).\n" - ) + (new \Blacklight\ColorCLI())->error( + "\nIncorrect arguments.\n" + ."The second argument (true/false) determines wether to echo or not.\n\n" + ."php postprocess.php all true ...: Does all the types of post processing.\n" + ."php postprocess.php pre true ...: Processes all Predb sites.\n" + ."php postprocess.php nfo true ...: Processes NFO files.\n" + ."php postprocess.php movies true ...: Processes movies.\n" + ."php postprocess.php music true ...: Processes music.\n" + ."php postprocess.php console true ...: Processes console games.\n" + ."php postprocess.php games true ...: Processes games.\n" + ."php postprocess.php book true ...: Processes books.\n" + ."php postprocess.php anime true ...: Processes anime.\n" + ."php postprocess.php tv true ...: Processes tv.\n" + ."php postprocess.php xxx true ...: Processes xxx.\n" + ."php postprocess.php additional true ...: Processes previews/mediainfo/etc...\n" + ."php postprocess.php sharing true ...: Processes uploading/downloading comments.\n" + ."php postprocess.php allinf true ...: Does all the types of post processing on a loop, sleeping 15 seconds between.\n" + ."php postprocess.php amazon true ...: Does all the amazon (books/console/games/music/xxx).\n" + ) ); } @@ -72,7 +72,6 @@ $postProcess = new PostProcess(['Echo' => $argv[2] === 'true']); $charArray = ['a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; switch ($argv[1]) { - case 'all': $postProcess->processAll($nntp); break; diff --git a/misc/update/tmux/bin/groupfixrelnames.php b/misc/update/tmux/bin/groupfixrelnames.php index b3be586a8..89e6ae55f 100644 --- a/misc/update/tmux/bin/groupfixrelnames.php +++ b/misc/update/tmux/bin/groupfixrelnames.php @@ -24,7 +24,6 @@ $nameFixer = new NameFixer(); [$type, $guidChar, $maxPerRun, $thread] = explode(' ', $argv[1]); switch (true) { - case $type === 'standard' && $guidChar !== null && $maxPerRun !== null && is_numeric($maxPerRun): // Allow for larger filename return sets diff --git a/misc/update/tmux/monitor.php b/misc/update/tmux/monitor.php index 9bb01eb09..d4a83cd56 100644 --- a/misc/update/tmux/monitor.php +++ b/misc/update/tmux/monitor.php @@ -217,7 +217,7 @@ while ($runVar['counts']['iterations'] > 0) { $runVar['counts']['now']['binaries_table'] += getTableRowCount($psTableRowCount, $tbl); break; - // This case must come before the 'parts_' one. + // This case must come before the 'parts_' one. case str_contains($tbl, 'missed_parts'): $runVar['counts']['now']['missed_parts_table'] += getTableRowCount($psTableRowCount, $tbl); @@ -276,7 +276,6 @@ while ($runVar['counts']['iterations'] > 0) { } foreach ($runVar['counts']['now'] as $key => $proc) { - //if key is a process type, add it to total_work if (str_starts_with($key, 'process')) { $runVar['counts']['now']['total_work'] += $proc; @@ -309,7 +308,6 @@ while ($runVar['counts']['iterations'] > 0) { //begin pane run execution if ($runVar['settings']['is_running'] === '1') { - //run main updating function(s) try { $tRun->runPane('main', $runVar); @@ -347,7 +345,6 @@ while ($runVar['counts']['iterations'] > 0) { //run these if complete sequential not set if ((int) $runVar['constants']['sequential'] !== 2) { - //fix names try { $tRun->runPane('fixnames', $runVar); @@ -408,10 +405,9 @@ function errorOnSQL() /** * @param \PDOStatement $ps - * @param $table * @return bool|int|string */ -function getTableRowCount(\PDOStatement $ps, $table) +function getTableRowCount(PDOStatement $ps, $table) { if ($ps->execute([':table' => $table])) { $result = $ps->fetch(); diff --git a/rector.php b/rector.php index 4b7736548..9d29ff6f6 100644 --- a/rector.php +++ b/rector.php @@ -4,29 +4,28 @@ declare(strict_types=1); use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; use RectorLaravel\Set\LaravelSetList; return static function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ - __DIR__ . '/Blacklight', - __DIR__ . '/app', - __DIR__ . '/bootstrap', - __DIR__ . '/cli', - __DIR__ . '/config', - __DIR__ . '/misc', - __DIR__ . '/public', - __DIR__ . '/resources', - __DIR__ . '/routes', - __DIR__ . '/tests', + __DIR__.'/Blacklight', + __DIR__.'/app', + __DIR__.'/bootstrap', + __DIR__.'/cli', + __DIR__.'/config', + __DIR__.'/misc', + __DIR__.'/public', + __DIR__.'/resources', + __DIR__.'/routes', + __DIR__.'/tests', ]); // register a single rule //$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); // define sets of rules - $rectorConfig->sets([ - LaravelSetList::LARAVEL_100, - \Rector\Set\ValueObject\SetList::PHP_82 - ]); + $rectorConfig->sets([ + LaravelSetList::LARAVEL_100, + \Rector\Set\ValueObject\SetList::PHP_82, + ]); }; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index edc036dd0..b59ca31d6 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -13,80 +13,80 @@ return [ | */ - 'accepted' => 'The :attribute must be accepted.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ + 'accepted' => 'The :attribute must be accepted.', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'before' => 'The :attribute must be a date before :date.', + 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', + 'between' => [ 'numeric' => 'The :attribute must be between :min and :max.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'string' => 'The :attribute must be between :min and :max characters.', - 'array' => 'The :attribute must have between :min and :max items.', + 'file' => 'The :attribute must be between :min and :max kilobytes.', + 'string' => 'The :attribute must be between :min and :max characters.', + 'array' => 'The :attribute must have between :min and :max items.', ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'The :attribute must be a valid email address.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field must have a value.', - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'max' => [ + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'dimensions' => 'The :attribute has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'email' => 'The :attribute must be a valid email address.', + 'exists' => 'The selected :attribute is invalid.', + 'file' => 'The :attribute must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field does not exist in :other.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'ipv4' => 'The :attribute must be a valid IPv4 address.', + 'ipv6' => 'The :attribute must be a valid IPv6 address.', + 'json' => 'The :attribute must be a valid JSON string.', + 'max' => [ 'numeric' => 'The :attribute may not be greater than :max.', - 'file' => 'The :attribute may not be greater than :max kilobytes.', - 'string' => 'The :attribute may not be greater than :max characters.', - 'array' => 'The :attribute may not have more than :max items.', + 'file' => 'The :attribute may not be greater than :max kilobytes.', + 'string' => 'The :attribute may not be greater than :max characters.', + 'array' => 'The :attribute may not have more than :max items.', ], - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ + 'mimes' => 'The :attribute must be a file of type: :values.', + 'mimetypes' => 'The :attribute must be a file of type: :values.', + 'min' => [ 'numeric' => 'The :attribute must be at least :min.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'string' => 'The :attribute must be at least :min characters.', - 'array' => 'The :attribute must have at least :min items.', + 'file' => 'The :attribute must be at least :min kilobytes.', + 'string' => 'The :attribute must be at least :min characters.', + 'array' => 'The :attribute must have at least :min items.', ], - 'not_in' => 'The selected :attribute is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'present' => 'The :attribute field must be present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values is present.', - 'required_without' => 'The :attribute field is required when :values is not present.', + 'not_in' => 'The selected :attribute is invalid.', + 'numeric' => 'The :attribute must be a number.', + 'present' => 'The :attribute field must be present.', + 'regex' => 'The :attribute format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values is present.', + 'required_without' => 'The :attribute field is required when :values is not present.', 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ + 'same' => 'The :attribute and :other must match.', + 'size' => [ 'numeric' => 'The :attribute must be :size.', - 'file' => 'The :attribute must be :size kilobytes.', - 'string' => 'The :attribute must be :size characters.', - 'array' => 'The :attribute must contain :size items.', + 'file' => 'The :attribute must be :size kilobytes.', + 'string' => 'The :attribute must be :size characters.', + 'array' => 'The :attribute must contain :size items.', ], - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute format is invalid.', + 'string' => 'The :attribute must be a string.', + 'timezone' => 'The :attribute must be a valid zone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'url' => 'The :attribute format is invalid.', /* |-------------------------------------------------------------------------- diff --git a/resources/smarty/plugins/block.php.php b/resources/smarty/plugins/block.php.php index b0c7ce457..76c054af0 100755 --- a/resources/smarty/plugins/block.php.php +++ b/resources/smarty/plugins/block.php.php @@ -7,8 +7,8 @@ /** * Smarty {php}{/php} block plugin. * - * @param string $content contents of the block - * @param object $template template object + * @param string $content contents of the block + * @param object $template template object * @param bool $ &$repeat repeat flag * @return string content re-formatted */ diff --git a/resources/smarty/plugins/function.getcatval.php b/resources/smarty/plugins/function.getcatval.php index 6a2b543fe..4021c60f6 100755 --- a/resources/smarty/plugins/function.getcatval.php +++ b/resources/smarty/plugins/function.getcatval.php @@ -13,6 +13,7 @@ * not, see:. * * @link . + * * @author niel * @copyright 2016 nZEDb */ @@ -20,10 +21,10 @@ use App\Models\Category; /** * Returns the value of the specified Category constant. + * * @usage {getcatval category=BOOKS_COMICS} * - *@param string $params Name of constant whose value to return. - * + *@param string $params Name of constant whose value to return. *@return Value of the specified Category constant. */ function smarty_function_getcatval($params) diff --git a/resources/smarty/plugins/function.html_options_multiple.php b/resources/smarty/plugins/function.html_options_multiple.php index 9b5de737b..6ddc49d32 100755 --- a/resources/smarty/plugins/function.html_options_multiple.php +++ b/resources/smarty/plugins/function.html_options_multiple.php @@ -27,11 +27,14 @@ require_once 'load_plugin_dependency.php'; * * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image} * (Smarty online manual) + * * @author Monte Ohrt * @author Ralf Strehle (minor optimization) - * @param array $params parameters - * @param Smarty_Internal_Template $template template object + * + * @param array $params parameters + * @param Smarty_Internal_Template $template template object * @return string + * * @uses smarty_function_escape_special_chars() */ function smarty_function_html_options_multiple($params, $template) @@ -68,6 +71,7 @@ function smarty_function_html_options_multiple($params, $template) $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); } else { trigger_error("html_options_multiple: selected attribute contains an object of class '".get_class($_sel)."' without __toString() method", E_USER_NOTICE); + continue; } } else { @@ -97,8 +101,8 @@ function smarty_function_html_options_multiple($params, $template) } break; } - // omit break; to fall through! - // no break + // omit break; to fall through! + // no break default: if (! is_array($_val)) { $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; diff --git a/resources/smarty/plugins/modifier.daysago.php b/resources/smarty/plugins/modifier.daysago.php index 4a8653d5f..2cf50b862 100755 --- a/resources/smarty/plugins/modifier.daysago.php +++ b/resources/smarty/plugins/modifier.daysago.php @@ -7,7 +7,9 @@ * Purpose: converts unix timestamps or datetime strings to words * Type: modifier
* Name: daysAgo
. + * * @author Stephan Otto + * * @param string * @return string */ diff --git a/resources/smarty/plugins/modifier.filesize.php b/resources/smarty/plugins/modifier.filesize.php index 6d26c8af4..9d7e599ca 100644 --- a/resources/smarty/plugins/modifier.filesize.php +++ b/resources/smarty/plugins/modifier.filesize.php @@ -1,8 +1,6 @@ 0 ? floor(log($size, 1024)) : 0; - return number_format($size / (1024 ** $power), 2, '.', ',') . $units[$power]; -} \ No newline at end of file + + return number_format($size / (1024 ** $power), 2, '.', ',').$units[$power]; +} diff --git a/resources/smarty/plugins/modifier.magicurl.php b/resources/smarty/plugins/modifier.magicurl.php index 9feb397ae..8666007ef 100755 --- a/resources/smarty/plugins/modifier.magicurl.php +++ b/resources/smarty/plugins/modifier.magicurl.php @@ -8,7 +8,9 @@ * Type: modifier
* Name: magicurl
* Purpose: turn www addresses into hyperlinks + * * @author bb + * * @param string * @return string */ diff --git a/resources/smarty/plugins/modifier.nl2br.php b/resources/smarty/plugins/modifier.nl2br.php index 24ef525f6..0503272e6 100755 --- a/resources/smarty/plugins/modifier.nl2br.php +++ b/resources/smarty/plugins/modifier.nl2br.php @@ -14,10 +14,14 @@ * - preceed_test = if true, includes preceeding break tags * in replacement * Example: {$text|nl2br} + * * @link http://smarty.php.net/manual/en/language.modifier.nl2br.php * nl2br (Smarty online manual) + * * @version 1.0 + * * @author Monte Ohrt + * * @param string * @return string */ diff --git a/resources/smarty/plugins/modifier.phpdate_format.php b/resources/smarty/plugins/modifier.phpdate_format.php index a4f1f3859..a2f6c8822 100755 --- a/resources/smarty/plugins/modifier.phpdate_format.php +++ b/resources/smarty/plugins/modifier.phpdate_format.php @@ -47,12 +47,15 @@ require_once $plugins_dir.'shared.make_timestamp.php'; * - string: input date string * - format: strftime format for output * - default_date: default date if $string is empty + * * @link http://smarty.php.net/manual/en/language.modifier.date.format.php * date_format (Smarty online manual) + * * @param string * @param string * @param string * @return string|void + * * @uses smarty_make_timestamp() */ function smarty_modifier_phpdate_format($string, $format = 'Y/m/d H:i:s', $default_date = null) @@ -64,17 +67,28 @@ function smarty_modifier_phpdate_format($string, $format = 'Y/m/d H:i:s', $defau }*/ if (substr($format, 0, 5) == 'DATE_') { switch ($format) { - case 'DATE_ATOM': $nformat = DATE_ATOM; break; - case 'DATE_COOKIE': $nformat = DATE_COOKIE; break; - case 'DATE_ISO8601': $nformat = DATE_ISO8601; break; - case 'DATE_RFC822': $nformat = 'D, d M y H:i:s O'; break; //The php constant is not quite right - as the time-zone comes out with invalid values like "UTC"... - case 'DATE_RFC850': $nformat = DATE_RFC850; break; - case 'DATE_RFC1036': $nformat = DATE_RFC1036; break; - case 'DATE_RFC1123': $nformat = DATE_RFC1123; break; - case 'DATE_RFC2822': $nformat = DATE_RFC2822; break; - case 'DATE_RFC3339': $nformat = DATE_RFC3339; break; - case 'DATE_RSS': $nformat = 'D, d M Y H:i:s O'; break; //as rfc822 ... - case 'DATE_W3C': $nformat = DATE_W3C; break; + case 'DATE_ATOM': $nformat = DATE_ATOM; + break; + case 'DATE_COOKIE': $nformat = DATE_COOKIE; + break; + case 'DATE_ISO8601': $nformat = DATE_ISO8601; + break; + case 'DATE_RFC822': $nformat = 'D, d M y H:i:s O'; + break; //The php constant is not quite right - as the time-zone comes out with invalid values like "UTC"... + case 'DATE_RFC850': $nformat = DATE_RFC850; + break; + case 'DATE_RFC1036': $nformat = DATE_RFC1036; + break; + case 'DATE_RFC1123': $nformat = DATE_RFC1123; + break; + case 'DATE_RFC2822': $nformat = DATE_RFC2822; + break; + case 'DATE_RFC3339': $nformat = DATE_RFC3339; + break; + case 'DATE_RSS': $nformat = 'D, d M Y H:i:s O'; + break; //as rfc822 ... + case 'DATE_W3C': $nformat = DATE_W3C; + break; } } else { $nformat = $format; diff --git a/resources/smarty/plugins/modifier.timeago.php b/resources/smarty/plugins/modifier.timeago.php index c39d74397..88cfa572e 100755 --- a/resources/smarty/plugins/modifier.timeago.php +++ b/resources/smarty/plugins/modifier.timeago.php @@ -7,7 +7,9 @@ * Purpose: converts unix timestamps or datetime strings to words * Type: modifier
* Name: timeAgo
. + * * @author Stephan Otto + * * @param string * @return string */ @@ -17,10 +19,10 @@ function smarty_modifier_timeAgo($date) return 'n/a'; } $timeStrings = ['now', // 0 - 'Sec', 'Secs', // 1,1 - 'Min', 'Mins', // 3,3 - 'Hour', 'Hrs', // 5,5 - 'Day', 'Days', ]; + 'Sec', 'Secs', // 1,1 + 'Min', 'Mins', // 3,3 + 'Hour', 'Hrs', // 5,5 + 'Day', 'Days', ]; $sec = time() - ((! is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); if ($sec <= 0) { return $timeStrings[0]; diff --git a/resources/smarty/plugins/shared.make_timestamp.php b/resources/smarty/plugins/shared.make_timestamp.php index da0a1f95a..af75c1204 100644 --- a/resources/smarty/plugins/shared.make_timestamp.php +++ b/resources/smarty/plugins/shared.make_timestamp.php @@ -9,8 +9,7 @@ * * @author Monte Ohrt * - * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime() - * + * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime() * @return int */ function smarty_make_timestamp($string) @@ -26,7 +25,7 @@ function smarty_make_timestamp($string) substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), - substr($string, 4, 2), + substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4) );