@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function rules(): array |
13 | 13 | { |
14 | - if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) { |
|
14 | + if (config('captcha.enabled') === true && (!empty(config('captcha.secret')) && !empty(config('captcha.sitekey')))) { |
|
15 | 15 | return [ |
16 | 16 | 'g-recaptcha-response' => [ |
17 | 17 | 'required', |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | %s |
170 | 170 | GROUP BY boo.id |
171 | 171 | ORDER BY %s %s', |
172 | - \is_array($bookIDs) && ! empty($bookIDs) ? implode(',', $bookIDs) : -1, |
|
173 | - \is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1, |
|
172 | + \is_array($bookIDs) && !empty($bookIDs) ? implode(',', $bookIDs) : -1, |
|
173 | + \is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1, |
|
174 | 174 | $catsrch, |
175 | 175 | $order[0], |
176 | 176 | $order[1] |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | $browseby = ' '; |
237 | 237 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
238 | - if (! empty($_REQUEST[$bbk])) { |
|
238 | + if (!empty($_REQUEST[$bbk])) { |
|
239 | 239 | $bbs = stripslashes($_REQUEST[$bbk]); |
240 | 240 | $browseby .= ' AND boo.'.$bbv.' '.'LIKE '.escapeString('%'.$bbs.'%'); |
241 | 241 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | return false; |
366 | 366 | } |
367 | 367 | |
368 | - if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}([abc])?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun([ e$])|Jul([ y$])|Aug( |ust|$)|Sep( |tember|$)|O([ck])t( |ober|$)|Nov( |ember|$)|De([cz])( |ember|$))/ui', $releasename) && ! preg_match('/Part \d+/i', $releasename)) { |
|
368 | + if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}([abc])?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun([ e$])|Jul([ y$])|Aug( |ust|$)|Sep( |tember|$)|O([ck])t( |ober|$)|Nov( |ember|$)|De([cz])( |ember|$))/ui', $releasename) && !preg_match('/Part \d+/i', $releasename)) { |
|
369 | 369 | if ($this->echooutput) { |
370 | 370 | $this->colorCli->headerOver('Changing category to magazines: ').$this->colorCli->primary($releasename); |
371 | 371 | } |
@@ -373,14 +373,14 @@ discard block |
||
373 | 373 | |
374 | 374 | return false; |
375 | 375 | } |
376 | - if (! empty($releasename) && ! preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
376 | + if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
377 | 377 | return $releasename; |
378 | 378 | } |
379 | 379 | |
380 | 380 | return false; |
381 | 381 | } |
382 | 382 | if ($releasetype === 'audiobook') { |
383 | - if (! empty($releasename) && ! preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
383 | + if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { |
|
384 | 384 | // we can skip category for audiobooks, since we already know it, so as long as the release name is valid return it so that it is postprocessed by amazon. In the future, determining the type of audiobook could be added (Lecture or book), since we can skip lookups on lectures, but for now handle them all the same way |
385 | 385 | return $releasename; |
386 | 386 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | $book = false; |
406 | 406 | if ($bookInfo !== '') { |
407 | - if (! $book) { |
|
407 | + if (!$book) { |
|
408 | 408 | $this->colorCli->info('Fetching data from iTunes for '.$bookInfo); |
409 | 409 | $book = $this->fetchItunesBookProperties($bookInfo); |
410 | 410 | } elseif ($amazdata !== null) { |
@@ -511,12 +511,12 @@ discard block |
||
511 | 511 | 'salesrank' => '', |
512 | 512 | 'publisher' => '', |
513 | 513 | 'pages' => '', |
514 | - 'coverurl' => ! empty($iTunesBook->getCover()) ? str_replace('100x100', '800x800', $iTunesBook->getCover()) : '', |
|
514 | + 'coverurl' => !empty($iTunesBook->getCover()) ? str_replace('100x100', '800x800', $iTunesBook->getCover()) : '', |
|
515 | 515 | 'genre' => implode(', ', $iTunesBook->getGenre()), |
516 | 516 | 'overview' => strip_tags($iTunesBook->getDescription()), |
517 | 517 | 'publishdate' => $iTunesBook->getReleaseDate()->format('Y-m-d'), |
518 | 518 | ]; |
519 | - if (! empty($book['coverurl'])) { |
|
519 | + if (!empty($book['coverurl'])) { |
|
520 | 520 | $book['cover'] = 1; |
521 | 521 | } else { |
522 | 522 | $book['cover'] = 0; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public function isTV(): bool |
101 | 101 | { |
102 | 102 | 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,4}[._ -]?[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) |
103 | - && ! preg_match('/[._ -](flac|imageset|mp3|xxx)[._ -]|[ .]exe$/i', $this->releaseName)) { |
|
103 | + && !preg_match('/[._ -](flac|imageset|mp3|xxx)[._ -]|[ .]exe$/i', $this->releaseName)) { |
|
104 | 104 | switch (true) { |
105 | 105 | case $this->isOtherTV(): |
106 | 106 | case $this->categorizeForeign && $this->isForeignTV(): |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | { |
138 | 138 | if (preg_match('/[._ -]S\d{1,3}.+(EP\d{1,3}|Extras|SUBPACK)[._ -]|News/i', $this->releaseName) |
139 | 139 | //special case for "Have.I.Got.News.For.You" tv show |
140 | - && ! preg_match('/[._ -]Got[._ -]News[._ -]For[._ -]You/i', $this->releaseName) |
|
140 | + && !preg_match('/[._ -]Got[._ -]News[._ -]For[._ -]You/i', $this->releaseName) |
|
141 | 141 | ) { |
142 | 142 | $this->tmpCat = Category::TV_OTHER; |
143 | 143 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | return true; |
226 | 226 | } |
227 | - if (! $this->catWebDL && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
|
227 | + if (!$this->catWebDL && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
|
228 | 228 | $this->tmpCat = Category::TV_HD; |
229 | 229 | |
230 | 230 | return true; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | public function isMovie(): bool |
286 | 286 | { |
287 | - if (preg_match('/[._ -]AVC|[BH][DR]RIP|(Bluray|Blu-Ray)|BD[._ -]?(25|50)?|\bBR\b|Camrip|[._ -]\d{4}[._ -].+(720p|1080p|Cam|HDTS|2160p)|DIVX|[._ -]DVD[._ -]|DVD-?(5|9|R|Rip)|Untouched|VHSRip|XVID|[._ -](DTS|TVrip|webrip|WEBDL|WEB-DL)[._ -]|\b(2160)p\b.*\b(Netflix|Amazon|NF|AMZN|Disney)\b/i', $this->releaseName) && ! preg_match('/s\d{1,3}[._ -]?[ed]\d{1,3}|auto(cad|desk)|divx[._ -]plus|[._ -]exe$|[._ -](jav|XXX)[._ -]|SWE6RUS|\wXXX(1080p|720p|DVD)|Xilisoft|\.S[0-9]\d{1,3}\./i', $this->releaseName)) { |
|
287 | + if (preg_match('/[._ -]AVC|[BH][DR]RIP|(Bluray|Blu-Ray)|BD[._ -]?(25|50)?|\bBR\b|Camrip|[._ -]\d{4}[._ -].+(720p|1080p|Cam|HDTS|2160p)|DIVX|[._ -]DVD[._ -]|DVD-?(5|9|R|Rip)|Untouched|VHSRip|XVID|[._ -](DTS|TVrip|webrip|WEBDL|WEB-DL)[._ -]|\b(2160)p\b.*\b(Netflix|Amazon|NF|AMZN|Disney)\b/i', $this->releaseName) && !preg_match('/s\d{1,3}[._ -]?[ed]\d{1,3}|auto(cad|desk)|divx[._ -]plus|[._ -]exe$|[._ -](jav|XXX)[._ -]|SWE6RUS|\wXXX(1080p|720p|DVD)|Xilisoft|\.S[0-9]\d{1,3}\./i', $this->releaseName)) { |
|
288 | 288 | return match (true) { |
289 | 289 | $this->categorizeForeign && $this->isMovieForeign(), $this->isMovieDVD(), $this->isMovieX265(), $this->isMovieUHD(), $this->catWebDL && $this->isMovieWEBDL(), $this->isMovieSD(), $this->isMovie3D(), $this->isMovieBluRay(), $this->isMovieHD(), $this->isMovieOther() => true, |
290 | 290 | default => false, |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | public function isMovieBluRay(): bool |
347 | 347 | { |
348 | 348 | if (preg_match('/bluray-|[._ -]bd?[._ -]?(25|50)|blu-ray|Bluray\s-\sUntouched|[._ -]untouched[._ -]/i', $this->releaseName) |
349 | - && ! preg_match('/SecretUsenet\.com$/i', $this->releaseName)) { |
|
349 | + && !preg_match('/SecretUsenet\.com$/i', $this->releaseName)) { |
|
350 | 350 | $this->tmpCat = Category::MOVIE_BLURAY; |
351 | 351 | |
352 | 352 | return true; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | |
374 | 374 | public function isMovieUHD(): bool |
375 | 375 | { |
376 | - if (! preg_match('/(S\d+).*(2160p).*(Netflix|Amazon).*(TrollUHD|NTb|VLAD)/i', $this->releaseName) && stripos($this->releaseName, '2160p') !== false) { |
|
376 | + if (!preg_match('/(S\d+).*(2160p).*(Netflix|Amazon).*(TrollUHD|NTb|VLAD)/i', $this->releaseName) && stripos($this->releaseName, '2160p') !== false) { |
|
377 | 377 | $this->tmpCat = Category::MOVIE_UHD; |
378 | 378 | |
379 | 379 | return true; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | public function isXxx(): bool |
503 | 503 | { |
504 | 504 | switch (true) { |
505 | - case ! preg_match('/\bXXX\b|(a\.b\.erotica|ClubSeventeen|Cum(ming|shot)|Err?oticax?|Porn(o|lation)?|Imageset|PICTURESET|JAV Uncensored|lesb(ians?|os?)|mastur(bation|e?bate)|My_Stepfather_Made_Me|nympho?|OLDER ANGELS|pictures\.erotica\.anime|sexontv|slut|Squirt|SWE6RUS|Transsexual|whore)/i', $this->releaseName): |
|
505 | + case !preg_match('/\bXXX\b|(a\.b\.erotica|ClubSeventeen|Cum(ming|shot)|Err?oticax?|Porn(o|lation)?|Imageset|PICTURESET|JAV Uncensored|lesb(ians?|os?)|mastur(bation|e?bate)|My_Stepfather_Made_Me|nympho?|OLDER ANGELS|pictures\.erotica\.anime|sexontv|slut|Squirt|SWE6RUS|Transsexual|whore)/i', $this->releaseName): |
|
506 | 506 | return false; |
507 | 507 | case $this->isXxxPack(): |
508 | 508 | case $this->isXxxClipSD(): |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | |
528 | 528 | public function isXxx264(): bool |
529 | 529 | { |
530 | - 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) { |
|
530 | + 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) { |
|
531 | 531 | $this->tmpCat = Category::XXX_X264; |
532 | 532 | |
533 | 533 | return true; |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | |
700 | 700 | public function isGame3DS(): bool |
701 | 701 | { |
702 | - 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)) { |
|
702 | + 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)) { |
|
703 | 703 | $this->tmpCat = Category::GAME_3DS; |
704 | 704 | |
705 | 705 | return true; |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | public function isMusic(): bool |
903 | 903 | { |
904 | 904 | return match (true) { |
905 | - $this->isMusicVideo(), $this->isAudiobook(), $this->isMusicLossless(), $this->isMusicMP3(), $this->isMusicPodcast(),$this->isMusicOther() => true, |
|
905 | + $this->isMusicVideo(), $this->isAudiobook(), $this->isMusicLossless(), $this->isMusicMP3(), $this->isMusicPodcast(), $this->isMusicOther() => true, |
|
906 | 906 | default => false, |
907 | 907 | }; |
908 | 908 | } |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | public function isMusicOther(): bool |
1000 | 1000 | { |
1001 | 1001 | 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)) { |
1002 | - if (! $this->isMusicForeign()) { |
|
1002 | + if (!$this->isMusicForeign()) { |
|
1003 | 1003 | $this->tmpCat = Category::MUSIC_OTHER; |
1004 | 1004 | } |
1005 | 1005 | |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | public function isComic(): bool |
1051 | 1051 | { |
1052 | 1052 | switch (true) { |
1053 | - case ! preg_match('/[\. ](cbr|cbz)|[\( ]c2c|cbr|cbz[\) ]|comix|^\(comic|[\.\-_\(\[ ]comics?[._ -]|comic.+book|covers.+digital|DC.+(Adventures|Universe)|digital.+(son|zone)|Graphic.+Novel|[\.\-_h ]manga|Total[._ -]Marvel/i', $this->releaseName): |
|
1053 | + case !preg_match('/[\. ](cbr|cbz)|[\( ]c2c|cbr|cbz[\) ]|comix|^\(comic|[\.\-_\(\[ ]comics?[._ -]|comic.+book|covers.+digital|DC.+(Adventures|Universe)|digital.+(son|zone)|Graphic.+Novel|[\.\-_h ]manga|Total[._ -]Marvel/i', $this->releaseName): |
|
1054 | 1054 | return false; |
1055 | 1055 | case $this->isBookForeign(): |
1056 | 1056 | break; |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | public function isTechnicalBook(): bool |
1066 | 1066 | { |
1067 | 1067 | switch (true) { |
1068 | - case ! preg_match('/^\(?(atz|bb|css|c ?t|Drawing|Gabler|IOS|Iphone|Lynda|Manning|Medic(al|ine)|MIT|No[._ -]Starch|Packt|Peachpit|Pragmatic|Revista|Servo|SmartBooks|Spektrum|Strata|Sybex|Syngress|Vieweg|Wiley|Woods|Wrox)[._ -]|[._ -](Ajax|CSS|DIY|Javascript|(My|Postgre)?SQL|XNA)[._ -]|3DS\.\-_ ]Max|Academic|Adobe|Algebra|Analysis|Appleworks|Archaeology|Bitdefender|Birkhauser|Britannica|[._ -]C\+\+|C[._ -](\+\+|Sharp|Plus)|Chemistry|Circuits|Cook(book|ing)|(Beginners?|Complete|Communications|Definitive|Essential|Hackers?|Practical|Professionals?)[._ -]Guide|Developer|Diagnostic|Disassembl(er|ing|y)|Debugg(er|ing)|Dreamweaver|Economics|Education|Electronics|Enc([iy])clopedia|Engineer(ing|s)|Essays|Exercizes|For.+Beginners|Focal[._ -]Press|For[._ -]Dummies|FreeBSD|Fundamentals[._ -]of[._ -]|(Galileo|Island)[._ -]Press|Geography|Grammar|Guide[._ -](For|To)|Hacking|Google|Handboo?k|How[._ -](It|To)|Intoduction[._ -]to|Iphone|jQuery|Lessons[._ -]In|Learning|LibreOffice|Linux|Manual|Marketing|Masonry|Mathematic(al|s)?|Medical|Microsoft|National[._ -]Academies|Nero[._ -]\d+|OReilly|OS[._ -]X[._ -]|Official[._ -]Guide|Open(GL|Office)|Pediatric|Periodic.+Table|Photoshop|Physics|Power(PC|Point|Shell)|Programm(ers?|ier||ing)|Raspberry.+Pi|Remedies|Service\s?Manual|SitePoint|Sketching|Statistics|Stock.+Market|Students|Theory|Training|Tutsplus|Ubuntu|Understanding[._ -](and|Of|The)|Visual[._ -]Studio|Textbook|VMWare|wii?max|Windows[._ -](8|7|Vista|XP)|^Wood[._ -]|Woodwork|WordPress|Work(book|shop)|Youtube/i', $this->releaseName): |
|
1068 | + case !preg_match('/^\(?(atz|bb|css|c ?t|Drawing|Gabler|IOS|Iphone|Lynda|Manning|Medic(al|ine)|MIT|No[._ -]Starch|Packt|Peachpit|Pragmatic|Revista|Servo|SmartBooks|Spektrum|Strata|Sybex|Syngress|Vieweg|Wiley|Woods|Wrox)[._ -]|[._ -](Ajax|CSS|DIY|Javascript|(My|Postgre)?SQL|XNA)[._ -]|3DS\.\-_ ]Max|Academic|Adobe|Algebra|Analysis|Appleworks|Archaeology|Bitdefender|Birkhauser|Britannica|[._ -]C\+\+|C[._ -](\+\+|Sharp|Plus)|Chemistry|Circuits|Cook(book|ing)|(Beginners?|Complete|Communications|Definitive|Essential|Hackers?|Practical|Professionals?)[._ -]Guide|Developer|Diagnostic|Disassembl(er|ing|y)|Debugg(er|ing)|Dreamweaver|Economics|Education|Electronics|Enc([iy])clopedia|Engineer(ing|s)|Essays|Exercizes|For.+Beginners|Focal[._ -]Press|For[._ -]Dummies|FreeBSD|Fundamentals[._ -]of[._ -]|(Galileo|Island)[._ -]Press|Geography|Grammar|Guide[._ -](For|To)|Hacking|Google|Handboo?k|How[._ -](It|To)|Intoduction[._ -]to|Iphone|jQuery|Lessons[._ -]In|Learning|LibreOffice|Linux|Manual|Marketing|Masonry|Mathematic(al|s)?|Medical|Microsoft|National[._ -]Academies|Nero[._ -]\d+|OReilly|OS[._ -]X[._ -]|Official[._ -]Guide|Open(GL|Office)|Pediatric|Periodic.+Table|Photoshop|Physics|Power(PC|Point|Shell)|Programm(ers?|ier||ing)|Raspberry.+Pi|Remedies|Service\s?Manual|SitePoint|Sketching|Statistics|Stock.+Market|Students|Theory|Training|Tutsplus|Ubuntu|Understanding[._ -](and|Of|The)|Visual[._ -]Studio|Textbook|VMWare|wii?max|Windows[._ -](8|7|Vista|XP)|^Wood[._ -]|Woodwork|WordPress|Work(book|shop)|Youtube/i', $this->releaseName): |
|
1069 | 1069 | return false; |
1070 | 1070 | case $this->isBookForeign(): |
1071 | 1071 | break; |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | public function isMagazine(): bool |
1081 | 1081 | { |
1082 | 1082 | switch (true) { |
1083 | - case ! preg_match('/[a-z\-\._ ][._ -](January|February|March|April|May|June|July|August|September|October|November|December)[._ -](\d{1,2},)?20\d\d[._ -]|^\(.+[ .]\d{1,2}[ .]20\d\d[ .].+\.scr|[._ -](Catalogue|FHM|NUTS|Pictorial|Tatler|XXX)[._ -]|^\(?(Allehanda|Club|Computer([a-z0-9]+)?|Connect \d+|Corriere|ct|Diario|Digit(al)?|Esquire|FHM|Gadgets|Galileo|Glam|GQ|Infosat|Inked|Instyle|io|Kicker|Liberation|New Scientist|NGV|Nuts|Popular|Professional|Reise|Sette(tv)?|Springer|Stuff|Studentlitteratur|Vegetarian|Vegetable|Videomarkt|Wired)[._ -]|Brady(.+)?Games|Catalog|Columbus.+Dispatch|Correspondenten|Corriere[._ -]Della[._ -]Sera|Cosmopolitan|Dagbladet|Digital[._ -]Guide|Economist|Eload ?24|ExtraTime|Fatto[._ -]Quotidiano|Flight[._ -](International|Journal)|Finanzwoche|France.+Football|Foto.+Video|Games?(Master|Markt|tar|TM)|Gardening|Gazzetta|Globe[._ -]And[._ -]Mail|Guitar|Heimkino|Hustler|La.+(Lettura|Rblica|Stampa)|Le[._ -](Monde|Temps)|Les[._ -]Echos|e?Magazin(es?)?|Mac(life|welt)|Marie.+Claire|Maxim|Men.+(Health|Fitness)|Motocross|Motorcycle|Mountain[._ -]Bike|MusikWoche|National[._ -]Geographic|New[._ -]Yorker|PC([._ -](Gamer|Welt|World)|Games|Go|Tip)|Penthouse|Photograph(er|ic)|Playboy|Posten|Quotidiano|(Golf|Readers?).+Digest|SFX[._ -]UK|Recipe(.+Guide|s)|SkyNews|Sport[._ -]?Week|Strategy.+Guide|TabletPC|Tattoo[._ -]Life|The[._ -]Guardian|Tageszeitung|Tid(bits|ning)|Top[._ -]Gear[._ -]|Total[._ -]Guitar|Travel[._ -]Guides?|Tribune[._ -]De[._ -]|US[._ -]Weekly|USA[._ -]Today|TruePDF|Vogue|Verlag|Warcraft|Web.+Designer|What[._ -]Car|Zeitung/i', $this->releaseName): |
|
1083 | + case !preg_match('/[a-z\-\._ ][._ -](January|February|March|April|May|June|July|August|September|October|November|December)[._ -](\d{1,2},)?20\d\d[._ -]|^\(.+[ .]\d{1,2}[ .]20\d\d[ .].+\.scr|[._ -](Catalogue|FHM|NUTS|Pictorial|Tatler|XXX)[._ -]|^\(?(Allehanda|Club|Computer([a-z0-9]+)?|Connect \d+|Corriere|ct|Diario|Digit(al)?|Esquire|FHM|Gadgets|Galileo|Glam|GQ|Infosat|Inked|Instyle|io|Kicker|Liberation|New Scientist|NGV|Nuts|Popular|Professional|Reise|Sette(tv)?|Springer|Stuff|Studentlitteratur|Vegetarian|Vegetable|Videomarkt|Wired)[._ -]|Brady(.+)?Games|Catalog|Columbus.+Dispatch|Correspondenten|Corriere[._ -]Della[._ -]Sera|Cosmopolitan|Dagbladet|Digital[._ -]Guide|Economist|Eload ?24|ExtraTime|Fatto[._ -]Quotidiano|Flight[._ -](International|Journal)|Finanzwoche|France.+Football|Foto.+Video|Games?(Master|Markt|tar|TM)|Gardening|Gazzetta|Globe[._ -]And[._ -]Mail|Guitar|Heimkino|Hustler|La.+(Lettura|Rblica|Stampa)|Le[._ -](Monde|Temps)|Les[._ -]Echos|e?Magazin(es?)?|Mac(life|welt)|Marie.+Claire|Maxim|Men.+(Health|Fitness)|Motocross|Motorcycle|Mountain[._ -]Bike|MusikWoche|National[._ -]Geographic|New[._ -]Yorker|PC([._ -](Gamer|Welt|World)|Games|Go|Tip)|Penthouse|Photograph(er|ic)|Playboy|Posten|Quotidiano|(Golf|Readers?).+Digest|SFX[._ -]UK|Recipe(.+Guide|s)|SkyNews|Sport[._ -]?Week|Strategy.+Guide|TabletPC|Tattoo[._ -]Life|The[._ -]Guardian|Tageszeitung|Tid(bits|ning)|Top[._ -]Gear[._ -]|Total[._ -]Guitar|Travel[._ -]Guides?|Tribune[._ -]De[._ -]|US[._ -]Weekly|USA[._ -]Today|TruePDF|Vogue|Verlag|Warcraft|Web.+Designer|What[._ -]Car|Zeitung/i', $this->releaseName): |
|
1084 | 1084 | return false; |
1085 | 1085 | case $this->isBookForeign(): |
1086 | 1086 | break; |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | public function isEBook(): bool |
1107 | 1107 | { |
1108 | 1108 | switch (true) { |
1109 | - case ! preg_match('/^ePub|[._ -](Ebook|E?\-book|\) WW|Publishing)|[\.\-_\(\[ ](azw|epub|html|mobi|pdf|rtf|tif|txt)[\.\-_\)\] ]|[\. ](azw|doc|epub|mobi|pdf)(?![\w .])|\.ebook-\w$/i', $this->releaseName): |
|
1109 | + case !preg_match('/^ePub|[._ -](Ebook|E?\-book|\) WW|Publishing)|[\.\-_\(\[ ](azw|epub|html|mobi|pdf|rtf|tif|txt)[\.\-_\)\] ]|[\. ](azw|doc|epub|mobi|pdf)(?![\w .])|\.ebook-\w$/i', $this->releaseName): |
|
1110 | 1110 | return false; |
1111 | 1111 | case $this->isBookForeign(): |
1112 | 1112 | break; |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | $this->processWork(); |
274 | 274 | $maxWork = \count($this->work); |
275 | 275 | foreach ($this->work as $group) { |
276 | - $pool->add(function () use ($group) { |
|
276 | + $pool->add(function() use ($group) { |
|
277 | 277 | return $this->_executeCommand(PHP_BINARY.' misc/update/backfill.php '.$group->name.(isset($group->max) ? (' '.$group->max) : '')); |
278 | - }, 2000000)->then(function ($output) use ($group, $maxWork) { |
|
278 | + }, 2000000)->then(function($output) use ($group, $maxWork) { |
|
279 | 279 | echo $output; |
280 | 280 | $this->colorCli->primary('Task #'.$maxWork.' Backfilled group '.$group->name); |
281 | - })->catch(function (\Throwable $exception) { |
|
281 | + })->catch(function(\Throwable $exception) { |
|
282 | 282 | echo $exception->getMessage(); |
283 | - })->catch(static function (SerializableException $serializableException) { |
|
283 | + })->catch(static function(SerializableException $serializableException) { |
|
284 | 284 | //we do nothing here just catch the error and move on |
285 | 285 | }); |
286 | 286 | $maxWork--; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | ); |
347 | 347 | |
348 | 348 | $count = 0; |
349 | - if (! empty($data) && isset($data[0]->name)) { |
|
349 | + if (!empty($data) && isset($data[0]->name)) { |
|
350 | 350 | $this->safeBackfillGroup = $data[0]->name; |
351 | 351 | |
352 | 352 | $count = ($data[0]->our_first - $data[0]->their_first); |
@@ -368,14 +368,14 @@ discard block |
||
368 | 368 | |
369 | 369 | $this->processWork(); |
370 | 370 | foreach ($queues as $queue) { |
371 | - $pool->add(function () use ($queue) { |
|
371 | + $pool->add(function() use ($queue) { |
|
372 | 372 | return $this->_executeCommand($this->dnr_path.$queue.'"'); |
373 | - }, 2000000)->then(function ($output) { |
|
373 | + }, 2000000)->then(function($output) { |
|
374 | 374 | echo $output; |
375 | 375 | $this->colorCli->primary('Backfilled group '.$this->safeBackfillGroup); |
376 | - })->catch(function (\Throwable $exception) { |
|
376 | + })->catch(function(\Throwable $exception) { |
|
377 | 377 | echo $exception->getMessage(); |
378 | - })->catch(static function (SerializableException $serializableException) { |
|
378 | + })->catch(static function(SerializableException $serializableException) { |
|
379 | 379 | //we do nothing here just catch the error and move on |
380 | 380 | }); |
381 | 381 | } |
@@ -408,14 +408,14 @@ discard block |
||
408 | 408 | |
409 | 409 | $this->processWork(); |
410 | 410 | foreach ($this->work as $group) { |
411 | - $pool->add(function () use ($group) { |
|
411 | + $pool->add(function() use ($group) { |
|
412 | 412 | return $this->_executeCommand(PHP_BINARY.' misc/update/update_binaries.php '.$group->name.' '.$group->max); |
413 | - }, 2000000)->then(function ($output) use ($group, $maxWork) { |
|
413 | + }, 2000000)->then(function($output) use ($group, $maxWork) { |
|
414 | 414 | echo $output; |
415 | 415 | $this->colorCli->primary('Task #'.$maxWork.' Updated group '.$group->name); |
416 | - })->catch(function (\Throwable $exception) { |
|
416 | + })->catch(function(\Throwable $exception) { |
|
417 | 417 | echo $exception->getMessage(); |
418 | - })->catch(static function (SerializableException $serializableException) { |
|
418 | + })->catch(static function(SerializableException $serializableException) { |
|
419 | 419 | //we do nothing here just catch the error and move on |
420 | 420 | }); |
421 | 421 | $maxWork--; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | ORDER BY a.last_record DESC' |
443 | 443 | ); |
444 | 444 | |
445 | - if (! empty($this->work)) { |
|
445 | + if (!empty($this->work)) { |
|
446 | 446 | $i = 1; |
447 | 447 | $queues = []; |
448 | 448 | foreach ($this->work as $group) { |
@@ -475,16 +475,16 @@ discard block |
||
475 | 475 | $this->processWork(); |
476 | 476 | foreach ($queues as $queue) { |
477 | 477 | preg_match('/alt\..+/i', $queue, $hit); |
478 | - $pool->add(function () use ($queue) { |
|
478 | + $pool->add(function() use ($queue) { |
|
479 | 479 | return $this->_executeCommand($this->dnr_path.$queue.'"'); |
480 | - }, 2000000)->then(function ($output) use ($hit) { |
|
481 | - if (! empty($hit)) { |
|
480 | + }, 2000000)->then(function($output) use ($hit) { |
|
481 | + if (!empty($hit)) { |
|
482 | 482 | echo $output; |
483 | 483 | $this->colorCli->primary('Updated group '.$hit[0]); |
484 | 484 | } |
485 | - })->catch(function (\Throwable $exception) { |
|
485 | + })->catch(function(\Throwable $exception) { |
|
486 | 486 | echo $exception->getMessage(); |
487 | - })->catch(static function (SerializableException $serializableException) { |
|
487 | + })->catch(static function(SerializableException $serializableException) { |
|
488 | 488 | //we do nothing here just catch the error and move on |
489 | 489 | }); |
490 | 490 | } |
@@ -547,14 +547,14 @@ discard block |
||
547 | 547 | |
548 | 548 | $this->processWork(); |
549 | 549 | foreach ($this->work as $queue) { |
550 | - $pool->add(function () use ($queue) { |
|
550 | + $pool->add(function() use ($queue) { |
|
551 | 551 | return $this->_executeCommand(PHP_BINARY.' misc/update/tmux/bin/groupfixrelnames.php "'.$queue.'"'.' true'); |
552 | - }, 2000000)->then(function ($output) use ($maxWork) { |
|
552 | + }, 2000000)->then(function($output) use ($maxWork) { |
|
553 | 553 | echo $output; |
554 | 554 | $this->colorCli->primary('Task #'.$maxWork.' Finished fixing releases names'); |
555 | - })->catch(function (\Throwable $exception) { |
|
555 | + })->catch(function(\Throwable $exception) { |
|
556 | 556 | echo $exception->getMessage(); |
557 | - })->catch(static function (SerializableException $serializableException) { |
|
557 | + })->catch(static function(SerializableException $serializableException) { |
|
558 | 558 | //we do nothing here just catch the error and move on |
559 | 559 | }); |
560 | 560 | $maxWork--; |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | foreach ($work as $group) { |
576 | 576 | try { |
577 | 577 | $query = DB::select(sprintf('SELECT id FROM collections WHERE groups_id = %d LIMIT 1', $group->id)); |
578 | - if (! empty($query)) { |
|
578 | + if (!empty($query)) { |
|
579 | 579 | $uGroups[] = ['id' => $group->id, 'name' => $group->name]; |
580 | 580 | } |
581 | 581 | } catch (\PDOException $e) { |
@@ -593,14 +593,14 @@ discard block |
||
593 | 593 | |
594 | 594 | $this->processWork(); |
595 | 595 | foreach ($uGroups as $group) { |
596 | - $pool->add(function () use ($group) { |
|
596 | + $pool->add(function() use ($group) { |
|
597 | 597 | return $this->_executeCommand($this->dnr_path.'releases '.$group['id'].'"'); |
598 | - }, 2000000)->then(function ($output) use ($maxWork) { |
|
598 | + }, 2000000)->then(function($output) use ($maxWork) { |
|
599 | 599 | echo $output; |
600 | 600 | $this->colorCli->primary('Task #'.$maxWork.' Finished performing release processing'); |
601 | - })->catch(function (\Throwable $exception) { |
|
601 | + })->catch(function(\Throwable $exception) { |
|
602 | 602 | echo $exception->getMessage(); |
603 | - })->catch(static function (SerializableException $serializableException) { |
|
603 | + })->catch(static function(SerializableException $serializableException) { |
|
604 | 604 | //we do nothing here just catch the error and move on |
605 | 605 | }); |
606 | 606 | $maxWork--; |
@@ -637,16 +637,16 @@ discard block |
||
637 | 637 | $this->processWork(); |
638 | 638 | foreach ($releases as $release) { |
639 | 639 | if ($type !== '') { |
640 | - $pool->add(function () use ($release, $type) { |
|
640 | + $pool->add(function() use ($release, $type) { |
|
641 | 641 | return $this->_executeCommand(PHP_BINARY.' misc/update/postprocess.php '.$type.$release->id); |
642 | - }, 2000000)->then(function ($output) use ($desc, $count) { |
|
642 | + }, 2000000)->then(function($output) use ($desc, $count) { |
|
643 | 643 | echo $output; |
644 | 644 | $this->colorCli->primary('Finished task #'.$count.' for '.$desc); |
645 | - })->catch(function (\Throwable $exception) { |
|
645 | + })->catch(function(\Throwable $exception) { |
|
646 | 646 | echo $exception->getMessage(); |
647 | - })->catch(static function (SerializableException $serializableException) { |
|
647 | + })->catch(static function(SerializableException $serializableException) { |
|
648 | 648 | //we do nothing here just catch the error and move on |
649 | - })->timeout(function () use ($count) { |
|
649 | + })->timeout(function() use ($count) { |
|
650 | 650 | $this->colorCli->notice('Task #'.$count.': Timeout occurred.'); |
651 | 651 | }); |
652 | 652 | $count--; |
@@ -894,15 +894,15 @@ discard block |
||
894 | 894 | $pool = Pool::create()->concurrency($maxProcess)->timeout(config('nntmux.multiprocessing_max_child_time')); |
895 | 895 | $this->processWork(); |
896 | 896 | foreach ($this->work as $group) { |
897 | - $pool->add(function () use ($group) { |
|
897 | + $pool->add(function() use ($group) { |
|
898 | 898 | return $this->_executeCommand($this->dnr_path.'update_per_group '.$group->id.'"'); |
899 | - }, 2000000)->then(function ($output) use ($group) { |
|
899 | + }, 2000000)->then(function($output) use ($group) { |
|
900 | 900 | echo $output; |
901 | 901 | $name = UsenetGroup::getNameByID($group->id); |
902 | 902 | $this->colorCli->primary('Finished updating binaries, processing releases and additional postprocessing for group:'.$name); |
903 | - })->catch(function (\Throwable $exception) { |
|
903 | + })->catch(function(\Throwable $exception) { |
|
904 | 904 | echo $exception->getMessage(); |
905 | - })->catch(static function (SerializableException $serializableException) { |
|
905 | + })->catch(static function(SerializableException $serializableException) { |
|
906 | 906 | echo $serializableException->asThrowable()->getMessage(); |
907 | 907 | }); |
908 | 908 | } |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | { |
919 | 919 | $process = Process::fromShellCommandline($command); |
920 | 920 | $process->setTimeout(1800); |
921 | - $process->run(function ($type, $buffer) { |
|
921 | + $process->run(function($type, $buffer) { |
|
922 | 922 | if ($type === Process::ERR) { |
923 | 923 | echo $buffer; |
924 | 924 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | { |
251 | 251 | $res = self::query()->where('email', '<>', '[email protected]'); |
252 | 252 | |
253 | - if (! empty($role)) { |
|
253 | + if (!empty($role)) { |
|
254 | 254 | $res->where('roles_id', $role); |
255 | 255 | } |
256 | 256 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | 'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60, |
292 | 292 | ]; |
293 | 293 | |
294 | - if (! empty($email)) { |
|
294 | + if (!empty($email)) { |
|
295 | 295 | $email = trim($email); |
296 | 296 | $sql += ['email' => $email]; |
297 | 297 | } |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | { |
337 | 337 | $user = self::find($uid); |
338 | 338 | $currRoleExp = $user->rolechangedate ?? now()->toDateTimeString(); |
339 | - if (! empty($date)) { |
|
339 | + if (!empty($date)) { |
|
340 | 340 | $user->update(['rolechangedate' => $date]); |
341 | 341 | } |
342 | - if (empty($date) && ! empty($addYear)) { |
|
342 | + if (empty($date) && !empty($addYear)) { |
|
343 | 343 | $user->update(['rolechangedate' => Carbon::createFromDate($currRoleExp)->addYears($addYear)]); |
344 | 344 | } |
345 | 345 | } |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | return self::fromQuery( |
397 | 397 | sprintf( |
398 | 398 | $query, |
399 | - ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
400 | - ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
401 | - ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
402 | - (! empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
399 | + !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
400 | + !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
401 | + !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
402 | + (!empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
403 | 403 | $order[0], |
404 | 404 | $order[1], |
405 | 405 | ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start)) |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | |
512 | 512 | public static function isValidUrl($url): bool |
513 | 513 | { |
514 | - return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
514 | + return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | /** |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up. |
549 | 549 | $invitedBy = 0; |
550 | - if (! $forceInviteMode && (int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
550 | + if (!$forceInviteMode && (int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
551 | 551 | if ($inviteCode === '') { |
552 | 552 | return self::ERR_SIGNUP_BADINVITECODE; |
553 | 553 | } |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | public static function checkAndUseInvite(string $inviteCode): int |
568 | 568 | { |
569 | 569 | $invite = Invitation::getInvite($inviteCode); |
570 | - if (! $invite) { |
|
570 | + if (!$invite) { |
|
571 | 571 | return -1; |
572 | 572 | } |
573 | 573 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0) |
584 | 584 | { |
585 | 585 | $password = self::hashPassword($password); |
586 | - if (! $password) { |
|
586 | + if (!$password) { |
|
587 | 587 | return false; |
588 | 588 | } |
589 | 589 | |
@@ -625,9 +625,9 @@ discard block |
||
625 | 625 | |
626 | 626 | $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other']; |
627 | 627 | |
628 | - if (! empty($allowed)) { |
|
628 | + if (!empty($allowed)) { |
|
629 | 629 | foreach ($cats as $cat) { |
630 | - if (! \in_array($cat, $allowed, false)) { |
|
630 | + if (!\in_array($cat, $allowed, false)) { |
|
631 | 631 | $ret[] = match ($cat) { |
632 | 632 | 'view console' => 1000, |
633 | 633 | 'view movies' => 2000, |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $this->colorCLI->header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' - no time limit.', true); |
155 | 155 | } |
156 | 156 | } else { |
157 | - if (! is_numeric($time)) { |
|
157 | + if (!is_numeric($time)) { |
|
158 | 158 | $this->error = 'Error, time must be a number or full.'; |
159 | 159 | |
160 | 160 | return $this->returnError(); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | { |
631 | 631 | $status = sprintf('AND status = %d', Binaries::BLACKLIST_ENABLED); |
632 | 632 | |
633 | - if (! empty($this->blacklistID) && $this->delete === false) { |
|
633 | + if (!empty($this->blacklistID) && $this->delete === false) { |
|
634 | 634 | $status = ''; |
635 | 635 | } |
636 | 636 | |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $searchResult = (new ElasticSearchSiteSearch())->indexSearch($regexMatch, 100); |
728 | 728 | } else { |
729 | 729 | $searchResult = (new ManticoreSearch())->searchIndexes('releases_rt', $regexMatch, ['name,searchname']); |
730 | - if (! empty($searchResult)) { |
|
730 | + if (!empty($searchResult)) { |
|
731 | 731 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
732 | 732 | } |
733 | 733 | } |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | SELECT r.guid, r.searchname, r.id |
742 | 742 | FROM releases r %s %s %s %s', |
743 | 743 | $regexSQL, |
744 | - ! empty($searchResult) ? ' WHERE r.id IN ('.implode(',', $searchResult).')' : '', |
|
744 | + !empty($searchResult) ? ' WHERE r.id IN ('.implode(',', $searchResult).')' : '', |
|
745 | 745 | $groupID, |
746 | 746 | $this->crapTime, |
747 | 747 | ); |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | } |
1108 | 1108 | break; |
1109 | 1109 | case 'size': |
1110 | - if (! is_numeric($args[2])) { |
|
1110 | + if (!is_numeric($args[2])) { |
|
1111 | 1111 | break; |
1112 | 1112 | } |
1113 | 1113 | switch ($args[1]) { |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | } |
1123 | 1123 | break; |
1124 | 1124 | case 'adddate': |
1125 | - if (! is_numeric($args[2])) { |
|
1125 | + if (!is_numeric($args[2])) { |
|
1126 | 1126 | break; |
1127 | 1127 | } |
1128 | 1128 | switch ($args[1]) { |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | break; |
1137 | 1137 | case 'postdate': |
1138 | - if (! is_numeric($args[2])) { |
|
1138 | + if (!is_numeric($args[2])) { |
|
1139 | 1139 | break; |
1140 | 1140 | } |
1141 | 1141 | switch ($args[1]) { |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | } |
1149 | 1149 | break; |
1150 | 1150 | case 'completion': |
1151 | - if (! is_numeric($args[2])) { |
|
1151 | + if (!is_numeric($args[2])) { |
|
1152 | 1152 | break; |
1153 | 1153 | } |
1154 | 1154 | if ($args[1] === 'smaller') { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $themes = scandir(base_path().'/resources/views/themes', SCANDIR_SORT_ASCENDING); |
20 | 20 | $themeList[] = 'None'; |
21 | 21 | foreach ($themes as $theme) { |
22 | - if (! str_contains($theme, '.') && ! \in_array($theme, $ignoredThemes, false) && File::isDirectory(base_path().'/resources/views/themes/'.$theme)) { |
|
22 | + if (!str_contains($theme, '.') && !\in_array($theme, $ignoredThemes, false) && File::isDirectory(base_path().'/resources/views/themes/'.$theme)) { |
|
23 | 23 | $themeList[] = $theme; |
24 | 24 | } |
25 | 25 | } |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $string = ''; |
40 | 40 | $gzFile = @gzopen($filePath, 'rb', 0); |
41 | 41 | if ($gzFile) { |
42 | - while (! gzeof($gzFile)) { |
|
42 | + while (!gzeof($gzFile)) { |
|
43 | 43 | $temp = gzread($gzFile, 1024); |
44 | 44 | // Check for empty string. |
45 | 45 | // Without this the loop would be endless and consume 100% CPU. |
46 | 46 | // Do not set $string empty here, as the data might still be good. |
47 | - if (! $temp) { |
|
47 | + if (!$temp) { |
|
48 | 48 | break; |
49 | 49 | } |
50 | 50 | $string .= $temp; |
@@ -102,15 +102,14 @@ discard block |
||
102 | 102 | $fileSpecTemplate = '%s/%s%s'; |
103 | 103 | $fileSpec = ''; |
104 | 104 | |
105 | - if (! empty($options['id']) && \in_array( |
|
105 | + if (!empty($options['id']) && \in_array( |
|
106 | 106 | $options['type'], |
107 | 107 | ['anime', 'audio', 'audiosample', 'book', 'console', 'games', 'movies', 'music', 'preview', 'sample', 'tvrage', 'video', 'xxx'], |
108 | 108 | false |
109 | 109 | ) |
110 | 110 | ) { |
111 | 111 | $fileSpec = sprintf($fileSpecTemplate, $options['type'], $options['id'], $options['suffix']); |
112 | - $fileSpec = file_exists(storage_path('covers/').$fileSpec) ? $fileSpec : |
|
113 | - sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']); |
|
112 | + $fileSpec = file_exists(storage_path('covers/').$fileSpec) ? $fileSpec : sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']); |
|
114 | 113 | } |
115 | 114 | |
116 | 115 | return $fileSpec; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | GROUP BY r.id |
275 | 275 | ORDER BY %s %s %s", |
276 | 276 | $this->uSQL($userShows, 'videos_id'), |
277 | - (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
277 | + (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
278 | 278 | NZB::NZB_ADDED, |
279 | 279 | Category::TV_ROOT, |
280 | 280 | Category::TV_OTHER, |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | { |
345 | 345 | // Delete NZB from disk. |
346 | 346 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
347 | - if (! empty($nzbPath)) { |
|
347 | + if (!empty($nzbPath)) { |
|
348 | 348 | File::delete($nzbPath); |
349 | 349 | } |
350 | 350 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | */ |
385 | 385 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
386 | 386 | { |
387 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
387 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
388 | 388 | return false; |
389 | 389 | } |
390 | 390 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | $sql = '(1=2 '; |
409 | 409 | foreach ($userQuery as $query) { |
410 | 410 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
411 | - if (! empty($query->categories)) { |
|
411 | + if (!empty($query->categories)) { |
|
412 | 412 | $catsArr = explode('|', $query->categories); |
413 | 413 | if (\count($catsArr) > 1) { |
414 | 414 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $orderBy = $this->getBrowseOrder($orderBy); |
453 | 453 | } |
454 | 454 | |
455 | - $searchFields = Arr::where($searchArr, static function ($value) { |
|
455 | + $searchFields = Arr::where($searchArr, static function($value) { |
|
456 | 456 | return $value !== -1; |
457 | 457 | }); |
458 | 458 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $searchResult = $this->elasticSearch->indexSearch($phrases, $limit); |
463 | 463 | } else { |
464 | 464 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields); |
465 | - if (! empty($searchResult)) { |
|
465 | + if (!empty($searchResult)) { |
|
466 | 466 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
467 | 467 | } |
468 | 468 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit); |
554 | 554 | } else { |
555 | 555 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']); |
556 | - if (! empty($searchResult)) { |
|
556 | + if (!empty($searchResult)) { |
|
557 | 557 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
558 | 558 | } |
559 | 559 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''), |
570 | 570 | $catQuery, |
571 | 571 | (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
572 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
572 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
573 | 573 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '') |
574 | 574 | ); |
575 | 575 | $baseSql = sprintf( |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | if ($releases !== null) { |
604 | 604 | return $releases; |
605 | 605 | } |
606 | - if ($searchName !== -1 && ! empty($searchResult)) { |
|
606 | + if ($searchName !== -1 && !empty($searchResult)) { |
|
607 | 607 | $releases = self::fromQuery($sql); |
608 | 608 | } elseif ($searchName !== -1 && empty($searchResult)) { |
609 | 609 | $releases = collect(); |
@@ -653,13 +653,13 @@ discard block |
||
653 | 653 | ($airDate !== '' ? sprintf('AND DATE(tve.firstaired) = %s', escapeString($airDate)) : '') |
654 | 654 | ); |
655 | 655 | $show = self::fromQuery($showQry); |
656 | - if (! empty($show[0]) && $show->isNotEmpty()) { |
|
657 | - if ((! empty($series) || ! empty($episode) || ! empty($airDate)) && $show[0]->episodes !== '') { |
|
656 | + if (!empty($show[0]) && $show->isNotEmpty()) { |
|
657 | + if ((!empty($series) || !empty($episode) || !empty($airDate)) && $show[0]->episodes !== '') { |
|
658 | 658 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
659 | 659 | } elseif ((int) $show[0]->video > 0) { |
660 | 660 | $showSql = 'AND r.videos_id = '.$show[0]->video; |
661 | 661 | // If $series is set but episode is not, return Season Packs only |
662 | - if (! empty($series) && empty($episode)) { |
|
662 | + if (!empty($series) && empty($episode)) { |
|
663 | 663 | $showSql .= ' AND r.tv_episodes_id = 0'; |
664 | 664 | } |
665 | 665 | } else { |
@@ -672,22 +672,22 @@ discard block |
||
672 | 672 | } |
673 | 673 | } |
674 | 674 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
675 | - if (! empty($name) && $showSql === '') { |
|
676 | - if (! empty($series) && (int) $series < 1900) { |
|
675 | + if (!empty($name) && $showSql === '') { |
|
676 | + if (!empty($series) && (int) $series < 1900) { |
|
677 | 677 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
678 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
678 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
679 | 679 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
680 | 680 | } |
681 | - } elseif (! empty($airDate)) { |
|
681 | + } elseif (!empty($airDate)) { |
|
682 | 682 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
683 | 683 | } |
684 | 684 | } |
685 | - if (! empty($name)) { |
|
685 | + if (!empty($name)) { |
|
686 | 686 | if (config('nntmux.elasticsearch_enabled') === true) { |
687 | 687 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
688 | 688 | } else { |
689 | 689 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
690 | - if (! empty($searchResult)) { |
|
690 | + if (!empty($searchResult)) { |
|
691 | 691 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
692 | 692 | } |
693 | 693 | } |
@@ -703,11 +703,11 @@ discard block |
||
703 | 703 | NZB::NZB_ADDED, |
704 | 704 | $this->showPasswords(), |
705 | 705 | $showSql, |
706 | - (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
706 | + (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
707 | 707 | (empty($searchResult)) ? Category::getCategorySearch($cat) : '', |
708 | 708 | $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '', |
709 | 709 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '', |
710 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
710 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
711 | 711 | ); |
712 | 712 | $baseSql = sprintf( |
713 | 713 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | if ($releases !== null) { |
744 | 744 | return $releases; |
745 | 745 | } |
746 | - $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
746 | + $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
747 | 747 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
748 | 748 | $releases[0]->_totalrows = $this->getPagerCount( |
749 | 749 | preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql) |
@@ -789,12 +789,12 @@ discard block |
||
789 | 789 | ); |
790 | 790 | $show = self::fromQuery($showQry); |
791 | 791 | if ($show->isNotEmpty()) { |
792 | - if ((! empty($series) || ! empty($episode) || ! empty($airDate)) && $show[0]->episodes !== '') { |
|
792 | + if ((!empty($series) || !empty($episode) || !empty($airDate)) && $show[0]->episodes !== '') { |
|
793 | 793 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
794 | 794 | } elseif ((int) $show[0]->video > 0) { |
795 | 795 | $showSql = 'AND r.videos_id = '.$show[0]->video; |
796 | 796 | // If $series is set but episode is not, return Season Packs only |
797 | - if (! empty($series) && empty($episode)) { |
|
797 | + if (!empty($series) && empty($episode)) { |
|
798 | 798 | $showSql .= ' AND r.tv_episodes_id = 0'; |
799 | 799 | } |
800 | 800 | } else { |
@@ -807,22 +807,22 @@ discard block |
||
807 | 807 | } |
808 | 808 | } |
809 | 809 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
810 | - if (! empty($name) && $showSql === '') { |
|
811 | - if (! empty($series) && (int) $series < 1900) { |
|
810 | + if (!empty($name) && $showSql === '') { |
|
811 | + if (!empty($series) && (int) $series < 1900) { |
|
812 | 812 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
813 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
813 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
814 | 814 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
815 | 815 | } |
816 | - } elseif (! empty($airDate)) { |
|
816 | + } elseif (!empty($airDate)) { |
|
817 | 817 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
818 | 818 | } |
819 | 819 | } |
820 | - if (! empty($name)) { |
|
820 | + if (!empty($name)) { |
|
821 | 821 | if (config('nntmux.elasticsearch_enabled') === true) { |
822 | 822 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
823 | 823 | } else { |
824 | 824 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
825 | - if (! empty($searchResult)) { |
|
825 | + if (!empty($searchResult)) { |
|
826 | 826 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
827 | 827 | } |
828 | 828 | } |
@@ -838,11 +838,11 @@ discard block |
||
838 | 838 | NZB::NZB_ADDED, |
839 | 839 | $this->showPasswords(), |
840 | 840 | $showSql, |
841 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
841 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
842 | 842 | Category::getCategorySearch($cat), |
843 | 843 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
844 | 844 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
845 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
845 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
846 | 846 | ); |
847 | 847 | $baseSql = sprintf( |
848 | 848 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -892,12 +892,12 @@ discard block |
||
892 | 892 | */ |
893 | 893 | public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed |
894 | 894 | { |
895 | - if (! empty($name)) { |
|
895 | + if (!empty($name)) { |
|
896 | 896 | if (config('nntmux.elasticsearch_enabled') === true) { |
897 | 897 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
898 | 898 | } else { |
899 | 899 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
900 | - if (! empty($searchResult)) { |
|
900 | + if (!empty($searchResult)) { |
|
901 | 901 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
902 | 902 | } |
903 | 903 | } |
@@ -914,8 +914,8 @@ discard block |
||
914 | 914 | $this->showPasswords(), |
915 | 915 | NZB::NZB_ADDED, |
916 | 916 | ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''), |
917 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
918 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
917 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
918 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
919 | 919 | Category::getCategorySearch($cat), |
920 | 920 | ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') |
921 | 921 | ); |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | */ |
965 | 965 | public function moviesSearch(int $imDbId = -1, int $tmDbId = -1, int $traktId = -1, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, int $minSize = 0, array $excludedCategories = []): mixed |
966 | 966 | { |
967 | - if (! empty($name)) { |
|
967 | + if (!empty($name)) { |
|
968 | 968 | if (config('nntmux.elasticsearch_enabled') === true) { |
969 | 969 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
970 | 970 | } else { |
971 | 971 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
972 | - if (! empty($searchResult)) { |
|
972 | + if (!empty($searchResult)) { |
|
973 | 973 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
974 | 974 | } |
975 | 975 | } |
@@ -986,11 +986,11 @@ discard block |
||
986 | 986 | %s %s %s %s %s %s %s', |
987 | 987 | NZB::NZB_ADDED, |
988 | 988 | $this->showPasswords(), |
989 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
989 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
990 | 990 | ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
991 | 991 | ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
992 | 992 | ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '', |
993 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
993 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
994 | 994 | Category::getCategorySearch($cat), |
995 | 995 | $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '', |
996 | 996 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '' |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $parentCat = $catRow['root_categories_id']; |
1043 | 1043 | |
1044 | 1044 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
1045 | - if (! $results) { |
|
1045 | + if (!$results) { |
|
1046 | 1046 | return $ret; |
1047 | 1047 | } |
1048 | 1048 |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | |
378 | 378 | $done = false; |
379 | 379 | // Get all the parts (in portions of $this->messageBuffer to not use too much memory). |
380 | - while (! $done) { |
|
380 | + while (!$done) { |
|
381 | 381 | // Increment last until we reach $groupLast (group newest article). |
382 | 382 | if ($total > $this->messageBuffer) { |
383 | 383 | if ((string) ($first + $this->messageBuffer) > $groupLast) { |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $scanSummary = $this->scan($groupMySQL, $first, $last); |
402 | 402 | |
403 | 403 | // Check if we fetched headers. |
404 | - if (! empty($scanSummary)) { |
|
404 | + if (!empty($scanSummary)) { |
|
405 | 405 | // If new group, update first record & postdate |
406 | 406 | if ($groupMySQL['first_record_postdate'] === null && (int) $groupMySQL['first_record'] === 0) { |
407 | 407 | $groupMySQL['first_record'] = $scanSummary['firstArticleNumber']; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | } |
426 | 426 | |
427 | 427 | $scanSummary['lastArticleDate'] = (isset($scanSummary['lastArticleDate']) ? strtotime($scanSummary['lastArticleDate']) : false); |
428 | - if (! is_numeric($scanSummary['lastArticleDate'])) { |
|
428 | + if (!is_numeric($scanSummary['lastArticleDate'])) { |
|
429 | 429 | $scanSummary['lastArticleDate'] = $this->postdate($scanSummary['lastArticleNumber'], $groupNNTP); |
430 | 430 | } |
431 | 431 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | |
575 | 575 | // If set we are running in partRepair mode. |
576 | 576 | if ($partRepair && $missingParts !== null) { |
577 | - if (! \in_array($header['Number'], $missingParts, false)) { |
|
577 | + if (!\in_array($header['Number'], $missingParts, false)) { |
|
578 | 578 | // If article isn't one that is missing skip it. |
579 | 579 | continue; |
580 | 580 | } |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | |
620 | 620 | unset($headers); // Reclaim memory now that headers are split. |
621 | 621 | |
622 | - if (! empty($this->_binaryBlacklistIdsToUpdate)) { |
|
622 | + if (!empty($this->_binaryBlacklistIdsToUpdate)) { |
|
623 | 623 | $this->updateBlacklistUsage(); |
624 | 624 | } |
625 | 625 | |
626 | - if ($this->_echoCLI && ! $partRepair) { |
|
626 | + if ($this->_echoCLI && !$partRepair) { |
|
627 | 627 | $this->outputHeaderInitial(); |
628 | 628 | } |
629 | 629 | |
630 | - if (! empty($stdHeaders)) { |
|
630 | + if (!empty($stdHeaders)) { |
|
631 | 631 | $this->storeHeaders($stdHeaders); |
632 | 632 | } |
633 | 633 | unset($stdHeaders); |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | // Loop articles, figure out files/parts. |
703 | 703 | foreach ($headers as $this->header) { |
704 | 704 | // Set up the info for inserting into parts/binaries/collections tables. |
705 | - if (! isset($articles[$this->header['matches'][1]])) { |
|
705 | + if (!isset($articles[$this->header['matches'][1]])) { |
|
706 | 706 | // Attempt to find the file count. If it is not found, set it to 0. |
707 | 707 | $fileCount = $this->getFileCount($this->header['matches'][1]); |
708 | 708 | if ($fileCount[1] === 0 && $fileCount[3] === 0) { |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | $this->header['CollectionKey'] = $collMatch['name'].$fileCount[3]; |
718 | 718 | |
719 | 719 | // If this header's collection key isn't in memory, attempt to insert the collection |
720 | - if (! isset($collectionIDs[$this->header['CollectionKey']])) { |
|
720 | + if (!isset($collectionIDs[$this->header['CollectionKey']])) { |
|
721 | 721 | /* Date from header should be a string this format: |
722 | 722 | * 31 Mar 2014 15:36:04 GMT or 6 Oct 1998 04:38:40 -0500 |
723 | 723 | * Still make sure it's not unix time, convert it to unix time if it is. |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | |
749 | 749 | $finalXrefArray = []; |
750 | 750 | foreach ($tempHeaderXrefs as $tempHeaderXref) { |
751 | - if (! in_array($tempHeaderXref, $tempXrefsData, false)) { |
|
751 | + if (!in_array($tempHeaderXref, $tempXrefsData, false)) { |
|
752 | 752 | $finalXrefArray[] = $tempHeaderXref; |
753 | 753 | } |
754 | 754 | } |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | $iterator1 = 0; |
889 | 889 | $iterator2 = $msgCount - 1; |
890 | 890 | while (true) { |
891 | - if (! isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) { |
|
891 | + if (!isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) { |
|
892 | 892 | $returnArray['firstArticleNumber'] = $headers[$iterator1]['Number']; |
893 | 893 | $returnArray['firstArticleDate'] = $headers[$iterator1]['Date']; |
894 | 894 | } |
895 | 895 | |
896 | - if (! isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) { |
|
896 | + if (!isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) { |
|
897 | 897 | $returnArray['lastArticleNumber'] = $headers[$iterator2]['Number']; |
898 | 898 | $returnArray['lastArticleDate'] = $headers[$iterator2]['Date']; |
899 | 899 | } |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | // Remove articles that we cant fetch after x attempts. |
1070 | - DB::transaction(function () use ($groupArr) { |
|
1070 | + DB::transaction(function() use ($groupArr) { |
|
1071 | 1071 | DB::delete( |
1072 | 1072 | sprintf( |
1073 | 1073 | 'DELETE FROM missed_parts WHERE attempts >= %d AND groups_id = %d', |
@@ -1106,14 +1106,14 @@ discard block |
||
1106 | 1106 | $currentPost |
1107 | 1107 | ) |
1108 | 1108 | ); |
1109 | - if (! empty($local) && \count($local) > 0) { |
|
1109 | + if (!empty($local) && \count($local) > 0) { |
|
1110 | 1110 | $date = $local[0]->date; |
1111 | 1111 | break; |
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | // If we could not find it locally, try usenet. |
1115 | 1115 | $header = $this->_nntp->getXOVER($currentPost); |
1116 | - if (! $this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') { |
|
1116 | + if (!$this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') { |
|
1117 | 1117 | $date = $header[0]['Date']; |
1118 | 1118 | break; |
1119 | 1119 | } |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | } while ($attempts++ <= 20); |
1139 | 1139 | |
1140 | 1140 | // If we didn't get a date, set it to now. |
1141 | - if (! $date) { |
|
1141 | + if (!$date) { |
|
1142 | 1142 | $date = time(); |
1143 | 1143 | } else { |
1144 | 1144 | $date = strtotime($date); |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $articleTime = $this->postdate($wantedArticle, $data); |
1202 | 1202 | |
1203 | 1203 | // Article doesn't exist, start again with something random |
1204 | - if (! $articleTime) { |
|
1204 | + if (!$articleTime) { |
|
1205 | 1205 | $wantedArticle = random_int($aMin, $aMax); |
1206 | 1206 | $articleTime = $this->postdate($wantedArticle, $data); |
1207 | 1207 | } |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | foreach ($numbers as $number) { |
1274 | 1274 | $sql .= $number.','; |
1275 | 1275 | } |
1276 | - DB::transaction(static function () use ($groupID, $sql) { |
|
1276 | + DB::transaction(static function() use ($groupID, $sql) { |
|
1277 | 1277 | DB::delete(rtrim($sql, ',').') AND groups_id = '.$groupID); |
1278 | 1278 | }, 10); |
1279 | 1279 | } |
@@ -1288,10 +1288,10 @@ discard block |
||
1288 | 1288 | */ |
1289 | 1289 | protected function _retrieveBlackList(string $groupName): void |
1290 | 1290 | { |
1291 | - if (! isset($this->blackList[$groupName])) { |
|
1291 | + if (!isset($this->blackList[$groupName])) { |
|
1292 | 1292 | $this->blackList[$groupName] = $this->getBlacklist(true, self::OPTYPE_BLACKLIST, $groupName, true); |
1293 | 1293 | } |
1294 | - if (! isset($this->whiteList[$groupName])) { |
|
1294 | + if (!isset($this->whiteList[$groupName])) { |
|
1295 | 1295 | $this->whiteList[$groupName] = $this->getBlacklist(true, self::OPTYPE_WHITELIST, $groupName, true); |
1296 | 1296 | } |
1297 | 1297 | $this->_listsFound[$groupName] = ($this->blackList[$groupName] || $this->whiteList[$groupName]); |
@@ -1305,10 +1305,10 @@ discard block |
||
1305 | 1305 | */ |
1306 | 1306 | public function isBlackListed(array $msg, string $groupName): bool |
1307 | 1307 | { |
1308 | - if (! isset($this->_listsFound[$groupName])) { |
|
1308 | + if (!isset($this->_listsFound[$groupName])) { |
|
1309 | 1309 | $this->_retrieveBlackList($groupName); |
1310 | 1310 | } |
1311 | - if (! $this->_listsFound[$groupName]) { |
|
1311 | + if (!$this->_listsFound[$groupName]) { |
|
1312 | 1312 | return false; |
1313 | 1313 | } |
1314 | 1314 | |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | |
1337 | 1337 | // Check if the field is blacklisted. |
1338 | 1338 | |
1339 | - if (! $blackListed && $this->blackList[$groupName]) { |
|
1339 | + if (!$blackListed && $this->blackList[$groupName]) { |
|
1340 | 1340 | foreach ($this->blackList[$groupName] as $blackList) { |
1341 | 1341 | if (preg_match('/'.$blackList->regex.'/i', $field[$blackList->msgcol])) { |
1342 | 1342 | $blackListed = true; |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | */ |
1447 | 1447 | public function delete(int $collectionID): void |
1448 | 1448 | { |
1449 | - DB::transaction(static function () use ($collectionID) { |
|
1449 | + DB::transaction(static function() use ($collectionID) { |
|
1450 | 1450 | DB::delete(sprintf('DELETE FROM collections WHERE id = %d', $collectionID)); |
1451 | 1451 | }, 10); |
1452 | 1452 | |
@@ -1493,7 +1493,7 @@ discard block |
||
1493 | 1493 | |
1494 | 1494 | private function getFileCount($subject): array |
1495 | 1495 | { |
1496 | - if (! preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $subject, $fileCount)) { |
|
1496 | + if (!preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $subject, $fileCount)) { |
|
1497 | 1497 | $fileCount[1] = $fileCount[3] = 0; |
1498 | 1498 | } |
1499 | 1499 |