@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $studio = false; |
103 | 103 | $director = false; |
104 | - if (($ret = $this->_html->find('div.page_video_info')) && ! empty($ret->find('text'))) { |
|
104 | + if (($ret = $this->_html->find('div.page_video_info')) && !empty($ret->find('text'))) { |
|
105 | 105 | foreach ($ret->find('text') as $e) { |
106 | 106 | $e = trim($e->plaintext); |
107 | 107 | $rArray = [',', '...', ' :']; |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | } |
116 | 116 | if ($studio === true) { |
117 | 117 | if ((stripos($e, 'Custodian of Records') === false) && stripos($e, 'Description') === false) { |
118 | - if ($director === true && ! empty($e)) { |
|
118 | + if ($director === true && !empty($e)) { |
|
119 | 119 | $this->_res['director'] = $e; |
120 | 120 | $e = null; |
121 | 121 | $director = false; |
122 | 122 | } |
123 | - if (! empty($e)) { |
|
123 | + if (!empty($e)) { |
|
124 | 124 | $this->_res['productinfo'][] = $e; |
125 | 125 | } |
126 | 126 | } else { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $title = trim($ret->title); |
209 | 209 | $title = str_replace('/XXX/', '', $title); |
210 | 210 | $title = preg_replace('/\(.*?\)|[._-]/', ' ', $title); |
211 | - if (! empty($title)) { |
|
211 | + if (!empty($title)) { |
|
212 | 212 | similar_text($movie, $title, $p); |
213 | 213 | if ($p >= 90) { |
214 | 214 | $this->_title = $title; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | if ($country === true) { |
136 | 136 | if (stripos($e, 'addthis_config') === false) { |
137 | - if (! empty($e)) { |
|
137 | + if (!empty($e)) { |
|
138 | 138 | $this->_res['productinfo'][] = $e; |
139 | 139 | } |
140 | 140 | } else { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $e = null; |
158 | 158 | } |
159 | 159 | if ($features === true) { |
160 | - if (! empty($e)) { |
|
160 | + if (!empty($e)) { |
|
161 | 161 | $this->_res['extras'][] = $e; |
162 | 162 | } |
163 | 163 | } |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | $e = null; |
189 | 189 | } |
190 | 190 | |
191 | - if (($director === true) && ! empty($e)) { |
|
191 | + if (($director === true) && !empty($e)) { |
|
192 | 192 | $this->_res['director'] = $e; |
193 | 193 | $director = false; |
194 | 194 | $e = null; |
195 | 195 | } |
196 | 196 | if (stripos($e, 'Country:') === false) { |
197 | - if (! empty($e)) { |
|
197 | + if (!empty($e)) { |
|
198 | 198 | $er[] = $e; |
199 | 199 | } |
200 | 200 | } else { |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function processSite(string $movie): bool |
233 | 233 | { |
234 | - if (! empty($movie)) { |
|
234 | + if (!empty($movie)) { |
|
235 | 235 | $this->_trailUrl = self::TRAILINGSEARCH.$movie; |
236 | 236 | $this->_response = getRawHtml(self::POPURL.$this->_trailUrl, $this->cookie); |
237 | 237 | if ($this->_response !== false) { |
238 | 238 | if ($ret = $this->_html->loadHtml($this->_response)->find('div.product-info, div.title', 1)) { |
239 | - if (! empty($ret->plaintext)) { |
|
239 | + if (!empty($ret->plaintext)) { |
|
240 | 240 | $this->_title = trim($ret->plaintext); |
241 | 241 | $title = str_replace('XXX', '', $ret->plaintext); |
242 | 242 | $title = trim(preg_replace('/\(.*?\)|[._-]/i', ' ', $title)); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | foreach ($this->_html->find('h3') as $heading) { |
126 | 126 | if (trim($heading->plaintext) === 'Cast') { |
127 | 127 | foreach ($heading->nextSibling() as $next) { |
128 | - if (! $next instanceof SimpleHtmlDomNodeBlank && $next->nodeName !== 'h3') { |
|
128 | + if (!$next instanceof SimpleHtmlDomNodeBlank && $next->nodeName !== 'h3') { |
|
129 | 129 | $next = $next->nextSibling(); |
130 | 130 | } |
131 | 131 | if (preg_match_all('/search_performerid/', $next->href, $hits)) { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | public function processSite(string $movie): bool |
167 | 167 | { |
168 | 168 | $result = false; |
169 | - if (! empty($movie)) { |
|
169 | + if (!empty($movie)) { |
|
170 | 170 | $this->_trailUrl = self::TRAILINGSEARCH.urlencode($movie); |
171 | 171 | $this->_response = getRawHtml(self::ADMURL.$this->_trailUrl, $this->cookie); |
172 | 172 | if ($this->_response !== false) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | %s %s %s %s |
160 | 160 | GROUP BY xxx.id |
161 | 161 | ORDER BY %s %s", |
162 | - (! empty($xxxIDs) ? implode(',', $xxxIDs) : -1), |
|
162 | + (!empty($xxxIDs) ? implode(',', $xxxIDs) : -1), |
|
163 | 163 | $this->showPasswords, |
164 | 164 | $this->getBrowseBy(), |
165 | 165 | $catSrch, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | { |
212 | 212 | $browseBy = ' '; |
213 | 213 | foreach (['title', 'director', 'actors', 'genre', 'id'] as $bb) { |
214 | - if (! empty($_REQUEST[$bb])) { |
|
214 | + if (!empty($_REQUEST[$bb])) { |
|
215 | 215 | $bbv = stripslashes($_REQUEST[$bb]); |
216 | 216 | if ($bb === 'genre') { |
217 | 217 | $bbv = $this->getGenreID($bbv); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | string $cover = '', |
247 | 247 | string $backdrop = '' |
248 | 248 | ): void { |
249 | - if (! empty($id)) { |
|
249 | + if (!empty($id)) { |
|
250 | 250 | XxxInfo::query()->where('id', $id)->update( |
251 | 251 | [ |
252 | 252 | 'title' => $title, |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | public function getGenres(bool $activeOnly = false, $gid = null): mixed |
289 | 289 | { |
290 | 290 | if ($activeOnly) { |
291 | - return Genre::query()->where(['disabled' => 0, 'type' => Category::XXX_ROOT])->when($gid !== null, function ($query) use ($gid) { |
|
291 | + return Genre::query()->where(['disabled' => 0, 'type' => Category::XXX_ROOT])->when($gid !== null, function($query) use ($gid) { |
|
292 | 292 | return $query->where('id', $gid); |
293 | 293 | })->orderBy('title')->first(['title']); |
294 | 294 | } |
295 | 295 | |
296 | - return Genre::query()->where(['type' => Category::XXX_ROOT])->when($gid !== null, function ($query) use ($gid) { |
|
296 | + return Genre::query()->where(['type' => Category::XXX_ROOT])->when($gid !== null, function($query) use ($gid) { |
|
297 | 297 | return $query->where('id', $gid); |
298 | 298 | })->orderBy('title')->first(['title']); |
299 | 299 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | $ret = null; |
310 | 310 | |
311 | - if (! \is_array($arr)) { |
|
311 | + if (!\is_array($arr)) { |
|
312 | 312 | $res = Genre::query()->where('title', $arr)->first(['id']); |
313 | 313 | if ($res !== null) { |
314 | 314 | return $res['id']; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | public function insertSwf($whichClass, $res): string |
349 | 349 | { |
350 | 350 | $ret = ''; |
351 | - if (($whichClass === 'ade') && ! empty($res)) { |
|
351 | + if (($whichClass === 'ade') && !empty($res)) { |
|
352 | 352 | $trailers = unserialize($res, 'ade'); |
353 | 353 | $ret .= "<object width='360' height='240' type='application/x-shockwave-flash' id='EmpireFlashPlayer' name='EmpireFlashPlayer' data='".$trailers['url']."'>"; |
354 | 354 | $ret .= "<param name='flashvars' value= 'streamID=".$trailers['streamid'].'&autoPlay=false&BaseStreamingUrl='.$trailers['baseurl']."'>"; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | return $ret; |
358 | 358 | } |
359 | - if (($whichClass === 'pop') && ! empty($res)) { |
|
359 | + if (($whichClass === 'pop') && !empty($res)) { |
|
360 | 360 | $trailers = unserialize($res, 'pop'); |
361 | 361 | $ret .= "<embed id='trailer' width='480' height='360'"; |
362 | 362 | $ret .= "flashvars='".$trailers['flashvars']."' allowfullscreen='true' allowscriptaccess='always' quality='high' name='trailer' style='undefined'"; |
@@ -433,22 +433,22 @@ discard block |
||
433 | 433 | return -2; |
434 | 434 | } |
435 | 435 | |
436 | - $res['cast'] = ! empty($res['cast']) ? implode(',', $res['cast']) : ''; |
|
437 | - $res['genres'] = ! empty($res['genres']) ? $this->getGenreID($res['genres']) : ''; |
|
436 | + $res['cast'] = !empty($res['cast']) ? implode(',', $res['cast']) : ''; |
|
437 | + $res['genres'] = !empty($res['genres']) ? $this->getGenreID($res['genres']) : ''; |
|
438 | 438 | |
439 | 439 | $mov = [ |
440 | - 'trailers' => ! empty($res['trailers']) ? serialize($res['trailers']) : '', |
|
441 | - 'extras' => ! empty($res['extras']) ? serialize($res['extras']) : '', |
|
442 | - 'productinfo' => ! empty($res['productinfo']) ? serialize($res['productinfo']) : '', |
|
443 | - 'backdrop' => ! empty($res['backcover']) ? $res['backcover'] : 0, |
|
444 | - 'cover' => ! empty($res['boxcover']) ? $res['boxcover'] : 0, |
|
445 | - 'title' => ! empty($res['title']) ? html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8') : '', |
|
446 | - 'plot' => ! empty($res['synopsis']) ? html_entity_decode($res['synopsis'], ENT_QUOTES, 'UTF-8') : '', |
|
447 | - 'tagline' => ! empty($res['tagline']) ? html_entity_decode($res['tagline'], ENT_QUOTES, 'UTF-8') : '', |
|
448 | - 'genre' => ! empty($res['genres']) ? html_entity_decode($res['genres'], ENT_QUOTES, 'UTF-8') : '', |
|
449 | - 'director' => ! empty($res['director']) ? html_entity_decode($res['director'], ENT_QUOTES, 'UTF-8') : '', |
|
450 | - 'actors' => ! empty($res['cast']) ? html_entity_decode($res['cast'], ENT_QUOTES, 'UTF-8') : '', |
|
451 | - 'directurl' => ! empty($res['directurl']) ? html_entity_decode($res['directurl'], ENT_QUOTES, 'UTF-8') : '', |
|
440 | + 'trailers' => !empty($res['trailers']) ? serialize($res['trailers']) : '', |
|
441 | + 'extras' => !empty($res['extras']) ? serialize($res['extras']) : '', |
|
442 | + 'productinfo' => !empty($res['productinfo']) ? serialize($res['productinfo']) : '', |
|
443 | + 'backdrop' => !empty($res['backcover']) ? $res['backcover'] : 0, |
|
444 | + 'cover' => !empty($res['boxcover']) ? $res['boxcover'] : 0, |
|
445 | + 'title' => !empty($res['title']) ? html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8') : '', |
|
446 | + 'plot' => !empty($res['synopsis']) ? html_entity_decode($res['synopsis'], ENT_QUOTES, 'UTF-8') : '', |
|
447 | + 'tagline' => !empty($res['tagline']) ? html_entity_decode($res['tagline'], ENT_QUOTES, 'UTF-8') : '', |
|
448 | + 'genre' => !empty($res['genres']) ? html_entity_decode($res['genres'], ENT_QUOTES, 'UTF-8') : '', |
|
449 | + 'director' => !empty($res['director']) ? html_entity_decode($res['director'], ENT_QUOTES, 'UTF-8') : '', |
|
450 | + 'actors' => !empty($res['cast']) ? html_entity_decode($res['cast'], ENT_QUOTES, 'UTF-8') : '', |
|
451 | + 'directurl' => !empty($res['directurl']) ? html_entity_decode($res['directurl'], ENT_QUOTES, 'UTF-8') : '', |
|
452 | 452 | 'classused' => $this->whichClass, |
453 | 453 | ]; |
454 | 454 | |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | $xxxID = $check['id']; |
459 | 459 | |
460 | 460 | // Update BoxCover. |
461 | - if (! empty($mov['cover'])) { |
|
461 | + if (!empty($mov['cover'])) { |
|
462 | 462 | $cover = $this->releaseImage->saveImage($xxxID.'-cover', $mov['cover'], $this->imgSavePath); |
463 | 463 | } |
464 | 464 | |
465 | 465 | // BackCover. |
466 | - if (! empty($mov['backdrop'])) { |
|
466 | + if (!empty($mov['backdrop'])) { |
|
467 | 467 | $backdrop = $this->releaseImage->saveImage($xxxID.'-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024); |
468 | 468 | } |
469 | 469 | |
@@ -491,12 +491,12 @@ discard block |
||
491 | 491 | ] |
492 | 492 | ); |
493 | 493 | // Update BoxCover. |
494 | - if (! empty($mov['cover'])) { |
|
494 | + if (!empty($mov['cover'])) { |
|
495 | 495 | $cover = $this->releaseImage->saveImage($xxxID.'-cover', $mov['cover'], $this->imgSavePath); |
496 | 496 | } |
497 | 497 | |
498 | 498 | // BackCover. |
499 | - if (! empty($mov['backdrop'])) { |
|
499 | + if (!empty($mov['backdrop'])) { |
|
500 | 500 | $backdrop = $this->releaseImage->saveImage($xxxID.'-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024); |
501 | 501 | } |
502 | 502 | |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | $name = trim(preg_replace('/(brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|latin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish)$/i', '', $name)); |
610 | 610 | |
611 | 611 | // Check if the name is long enough and not just numbers and not file (d) of (d) and does not contain Episodes and any dated 00.00.00 which are site rips.. |
612 | - if (\strlen($name) > 5 && ! preg_match('/^\d+$/', $name) && ! preg_match('/( File \d+ of \d+|\d+.\d+.\d+)/', $name) && ! preg_match('/(E\d+)/', $name) && ! preg_match('/\d\d\.\d\d.\d\d/', $name)) { |
|
612 | + if (\strlen($name) > 5 && !preg_match('/^\d+$/', $name) && !preg_match('/( File \d+ of \d+|\d+.\d+.\d+)/', $name) && !preg_match('/(E\d+)/', $name) && !preg_match('/\d\d\.\d\d.\d\d/', $name)) { |
|
613 | 613 | $this->currentTitle = $name; |
614 | 614 | |
615 | 615 | return true; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $nzbSplitLevel = (int) Settings::settingValue('..nzbsplitlevel'); |
67 | 67 | $this->nzbSplitLevel = $nzbSplitLevel ?? 1; |
68 | 68 | $this->siteNzbPath = (string) Settings::settingValue('..nzbpath'); |
69 | - if (! Str::endsWith($this->siteNzbPath, '/')) { |
|
69 | + if (!Str::endsWith($this->siteNzbPath, '/')) { |
|
70 | 70 | $this->siteNzbPath .= '/'; |
71 | 71 | } |
72 | 72 | $this->_nzbCommentString = sprintf( |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $XMLWriter->startElement('head'); |
111 | 111 | $XMLWriter->startElement('meta'); |
112 | 112 | $XMLWriter->writeAttribute('type', 'category'); |
113 | - $XMLWriter->text(! empty($release->category->parent) ? $release->category->parent->title.' >'.$release->category->title : 'Other > Misc'); |
|
113 | + $XMLWriter->text(!empty($release->category->parent) ? $release->category->parent->title.' >'.$release->category->title : 'Other > Misc'); |
|
114 | 114 | $XMLWriter->endElement(); |
115 | 115 | $XMLWriter->startElement('meta'); |
116 | 116 | $XMLWriter->writeAttribute('type', 'name'); |
@@ -172,20 +172,20 @@ discard block |
||
172 | 172 | $XMLWriter->endDocument(); |
173 | 173 | $path = ($this->buildNZBPath($release->guid, $this->nzbSplitLevel, true).$release->guid.'.nzb.gz'); |
174 | 174 | $fp = gzopen($path, 'wb7'); |
175 | - if (! $fp) { |
|
175 | + if (!$fp) { |
|
176 | 176 | return false; |
177 | 177 | } |
178 | 178 | gzwrite($fp, $XMLWriter->outputMemory()); |
179 | 179 | gzclose($fp); |
180 | 180 | unset($XMLWriter); |
181 | - if (! File::isFile($path)) { |
|
181 | + if (!File::isFile($path)) { |
|
182 | 182 | echo "ERROR: $path does not exist.\n"; |
183 | 183 | |
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | // Mark release as having NZB. |
187 | 187 | $release->update(['nzbstatus' => self::NZB_ADDED]); |
188 | - if (! empty($nzb_guid)) { |
|
188 | + if (!empty($nzb_guid)) { |
|
189 | 189 | $release->update(['nzb_guid' => DB::raw('UNHEX( '.escapeString(md5($nzb_guid)).' )')]); |
190 | 190 | } |
191 | 191 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | $nzbPath = $this->siteNzbPath.$nzbPath; |
218 | 218 | |
219 | - if ($createIfNotExist && ! File::isDirectory($nzbPath) && ! File::makeDirectory($nzbPath, 0777, true) && ! File::isDirectory($nzbPath)) { |
|
219 | + if ($createIfNotExist && !File::isDirectory($nzbPath) && !File::makeDirectory($nzbPath, 0777, true) && !File::isDirectory($nzbPath)) { |
|
220 | 220 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $nzbPath)); |
221 | 221 | } |
222 | 222 | |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | $i = 0; |
276 | 276 | $result = []; |
277 | 277 | |
278 | - if (! $nzb) { |
|
278 | + if (!$nzb) { |
|
279 | 279 | return $result; |
280 | 280 | } |
281 | 281 | |
282 | 282 | $xml = @simplexml_load_string(str_replace("\x0F", '', $nzb)); |
283 | - if (! $xml || strtolower($xml->getName()) !== 'nzb') { |
|
283 | + if (!$xml || strtolower($xml->getName()) !== 'nzb') { |
|
284 | 284 | return $result; |
285 | 285 | } |
286 | 286 | |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | // Strip file / part count to get proper sorting. |
295 | 295 | $i = preg_replace('#\d+[- ._]?(/|\||[o0]f)[- ._]?\d+?(?![- ._]\d)#i', '', $i); |
296 | 296 | // Change .rar and .par2 to be sorted before .part0x.rar and .volxxx+xxx.par2 |
297 | - if (str_contains($i, '.par2') && ! preg_match('#\.vol\d+\+\d+\.par2#i', $i)) { |
|
297 | + if (str_contains($i, '.par2') && !preg_match('#\.vol\d+\+\d+\.par2#i', $i)) { |
|
298 | 298 | $i = str_replace('.par2', '.vol0.par2', $i); |
299 | - } elseif (preg_match('#\.rar[^a-z0-9]#i', $i) && ! preg_match('#\.part\d+\.rar$#i', $i)) { |
|
299 | + } elseif (preg_match('#\.rar[^a-z0-9]#i', $i) && !preg_match('#\.part\d+\.rar$#i', $i)) { |
|
300 | 300 | $i = preg_replace('#\.rar(?:[^a-z0-9])#i', '.part0.rar', $i); |
301 | 301 | } |
302 | 302 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $fileSize = $numSegments = 0; |
330 | 330 | |
331 | 331 | // Parts. |
332 | - if (! isset($result[$i]['segments'])) { |
|
332 | + if (!isset($result[$i]['segments'])) { |
|
333 | 333 | $result[$i]['segments'] = []; |
334 | 334 | } |
335 | 335 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $result[$i]['partsactual'] = $numSegments; |
349 | 349 | |
350 | 350 | // Groups. |
351 | - if (! isset($result[$i]['groups'])) { |
|
351 | + if (!isset($result[$i]['groups'])) { |
|
352 | 352 | $result[$i]['groups'] = []; |
353 | 353 | } |
354 | 354 | foreach ($file->groups->group as $g) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $channels = config('irc_settings.scrape_irc_channels') ? unserialize(config('irc_settings.scrape_irc_channels'), ['allowed_classes' => ['#PreNNTmux', '#nZEDbPRE']]) : ['#PreNNTmux' => null]; |
174 | 174 | $this->joinChannels($channels); |
175 | 175 | |
176 | - if (! $this->_silent) { |
|
176 | + if (!$this->_silent) { |
|
177 | 177 | echo '['. |
178 | 178 | date('r'). |
179 | 179 | '] [Scraping of IRC channels for ('. |
@@ -291,34 +291,34 @@ discard block |
||
291 | 291 | } else { |
292 | 292 | $indexData = $this->manticoreSearch->searchIndexes('predb_rt', $this->_curPre['title'], ['title']); |
293 | 293 | } |
294 | - if (! empty($indexData) || empty($this->_curPre['title'])) { |
|
294 | + if (!empty($indexData) || empty($this->_curPre['title'])) { |
|
295 | 295 | return; |
296 | 296 | } |
297 | 297 | |
298 | 298 | $query = 'INSERT INTO predb ('; |
299 | 299 | |
300 | - $query .= (! empty($this->_curPre['size']) ? 'size, ' : ''); |
|
301 | - $query .= (! empty($this->_curPre['category']) ? 'category, ' : ''); |
|
302 | - $query .= (! empty($this->_curPre['source']) ? 'source, ' : ''); |
|
303 | - $query .= (! empty($this->_curPre['reason']) ? 'nukereason, ' : ''); |
|
304 | - $query .= (! empty($this->_curPre['files']) ? 'files, ' : ''); |
|
305 | - $query .= (! empty($this->_curPre['reqid']) ? 'requestid, ' : ''); |
|
306 | - $query .= (! empty($this->_curPre['group_id']) ? 'groups_id, ' : ''); |
|
307 | - $query .= (! empty($this->_curPre['nuked']) ? 'nuked, ' : ''); |
|
308 | - $query .= (! empty($this->_curPre['filename']) ? 'filename, ' : ''); |
|
300 | + $query .= (!empty($this->_curPre['size']) ? 'size, ' : ''); |
|
301 | + $query .= (!empty($this->_curPre['category']) ? 'category, ' : ''); |
|
302 | + $query .= (!empty($this->_curPre['source']) ? 'source, ' : ''); |
|
303 | + $query .= (!empty($this->_curPre['reason']) ? 'nukereason, ' : ''); |
|
304 | + $query .= (!empty($this->_curPre['files']) ? 'files, ' : ''); |
|
305 | + $query .= (!empty($this->_curPre['reqid']) ? 'requestid, ' : ''); |
|
306 | + $query .= (!empty($this->_curPre['group_id']) ? 'groups_id, ' : ''); |
|
307 | + $query .= (!empty($this->_curPre['nuked']) ? 'nuked, ' : ''); |
|
308 | + $query .= (!empty($this->_curPre['filename']) ? 'filename, ' : ''); |
|
309 | 309 | |
310 | 310 | $query .= 'predate, title) VALUES ('; |
311 | 311 | |
312 | - $query .= (! empty($this->_curPre['size']) ? escapeString($this->_curPre['size']).', ' : ''); |
|
313 | - $query .= (! empty($this->_curPre['category']) ? escapeString($this->_curPre['category']).', ' : ''); |
|
314 | - $query .= (! empty($this->_curPre['source']) ? escapeString($this->_curPre['source']).', ' : ''); |
|
315 | - $query .= (! empty($this->_curPre['reason']) ? escapeString($this->_curPre['reason']).', ' : ''); |
|
316 | - $query .= (! empty($this->_curPre['files']) ? escapeString($this->_curPre['files']).', ' : ''); |
|
317 | - $query .= (! empty($this->_curPre['reqid']) ? $this->_curPre['reqid'].', ' : ''); |
|
318 | - $query .= (! empty($this->_curPre['group_id']) ? $this->_curPre['group_id'].', ' : ''); |
|
319 | - $query .= (! empty($this->_curPre['nuked']) ? $this->_curPre['nuked'].', ' : ''); |
|
320 | - $query .= (! empty($this->_curPre['filename']) ? escapeString($this->_curPre['filename']).', ' : ''); |
|
321 | - $query .= (! empty($this->_curPre['predate']) ? $this->_curPre['predate'].', ' : 'NOW(), '); |
|
312 | + $query .= (!empty($this->_curPre['size']) ? escapeString($this->_curPre['size']).', ' : ''); |
|
313 | + $query .= (!empty($this->_curPre['category']) ? escapeString($this->_curPre['category']).', ' : ''); |
|
314 | + $query .= (!empty($this->_curPre['source']) ? escapeString($this->_curPre['source']).', ' : ''); |
|
315 | + $query .= (!empty($this->_curPre['reason']) ? escapeString($this->_curPre['reason']).', ' : ''); |
|
316 | + $query .= (!empty($this->_curPre['files']) ? escapeString($this->_curPre['files']).', ' : ''); |
|
317 | + $query .= (!empty($this->_curPre['reqid']) ? $this->_curPre['reqid'].', ' : ''); |
|
318 | + $query .= (!empty($this->_curPre['group_id']) ? $this->_curPre['group_id'].', ' : ''); |
|
319 | + $query .= (!empty($this->_curPre['nuked']) ? $this->_curPre['nuked'].', ' : ''); |
|
320 | + $query .= (!empty($this->_curPre['filename']) ? escapeString($this->_curPre['filename']).', ' : ''); |
|
321 | + $query .= (!empty($this->_curPre['predate']) ? $this->_curPre['predate'].', ' : 'NOW(), '); |
|
322 | 322 | |
323 | 323 | $query .= '%s)'; |
324 | 324 | |
@@ -359,17 +359,17 @@ discard block |
||
359 | 359 | |
360 | 360 | $query = 'UPDATE predb SET '; |
361 | 361 | |
362 | - $query .= (! empty($this->_curPre['size']) ? 'size = '.escapeString($this->_curPre['size']).', ' : ''); |
|
363 | - $query .= (! empty($this->_curPre['source']) ? 'source = '.escapeString($this->_curPre['source']).', ' : ''); |
|
364 | - $query .= (! empty($this->_curPre['files']) ? 'files = '.escapeString($this->_curPre['files']).', ' : ''); |
|
365 | - $query .= (! empty($this->_curPre['reason']) ? 'nukereason = '.escapeString($this->_curPre['reason']).', ' : ''); |
|
366 | - $query .= (! empty($this->_curPre['reqid']) ? 'requestid = '.$this->_curPre['reqid'].', ' : ''); |
|
367 | - $query .= (! empty($this->_curPre['group_id']) ? 'groups_id = '.$this->_curPre['group_id'].', ' : ''); |
|
368 | - $query .= (! empty($this->_curPre['predate']) ? 'predate = '.$this->_curPre['predate'].', ' : ''); |
|
369 | - $query .= (! empty($this->_curPre['nuked']) ? 'nuked = '.$this->_curPre['nuked'].', ' : ''); |
|
370 | - $query .= (! empty($this->_curPre['filename']) ? 'filename = '.escapeString($this->_curPre['filename']).', ' : ''); |
|
362 | + $query .= (!empty($this->_curPre['size']) ? 'size = '.escapeString($this->_curPre['size']).', ' : ''); |
|
363 | + $query .= (!empty($this->_curPre['source']) ? 'source = '.escapeString($this->_curPre['source']).', ' : ''); |
|
364 | + $query .= (!empty($this->_curPre['files']) ? 'files = '.escapeString($this->_curPre['files']).', ' : ''); |
|
365 | + $query .= (!empty($this->_curPre['reason']) ? 'nukereason = '.escapeString($this->_curPre['reason']).', ' : ''); |
|
366 | + $query .= (!empty($this->_curPre['reqid']) ? 'requestid = '.$this->_curPre['reqid'].', ' : ''); |
|
367 | + $query .= (!empty($this->_curPre['group_id']) ? 'groups_id = '.$this->_curPre['group_id'].', ' : ''); |
|
368 | + $query .= (!empty($this->_curPre['predate']) ? 'predate = '.$this->_curPre['predate'].', ' : ''); |
|
369 | + $query .= (!empty($this->_curPre['nuked']) ? 'nuked = '.$this->_curPre['nuked'].', ' : ''); |
|
370 | + $query .= (!empty($this->_curPre['filename']) ? 'filename = '.escapeString($this->_curPre['filename']).', ' : ''); |
|
371 | 371 | $query .= ( |
372 | - (empty($this->_oldPre['category']) && ! empty($this->_curPre['category'])) |
|
372 | + (empty($this->_oldPre['category']) && !empty($this->_curPre['category'])) |
|
373 | 373 | ? 'category = '.escapeString($this->_curPre['category']).', ' |
374 | 374 | : '' |
375 | 375 | ); |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | protected function _doEcho(bool $new = true): void |
406 | 406 | { |
407 | - if (! $this->_silent) { |
|
407 | + if (!$this->_silent) { |
|
408 | 408 | $nukeString = ''; |
409 | 409 | if ($this->_nuked !== false) { |
410 | 410 | switch ((int) $this->_curPre['nuked']) { |
@@ -439,15 +439,15 @@ discard block |
||
439 | 439 | $this->_curPre['title']. |
440 | 440 | ']'. |
441 | 441 | ( |
442 | - ! empty($this->_curPre['category']) |
|
442 | + !empty($this->_curPre['category']) |
|
443 | 443 | ? ' ['.$this->_curPre['category'].']' |
444 | 444 | : ( |
445 | - ! empty($this->_oldPre['category']) |
|
445 | + !empty($this->_oldPre['category']) |
|
446 | 446 | ? ' ['.$this->_oldPre['category'].']' |
447 | 447 | : '' |
448 | 448 | ) |
449 | 449 | ). |
450 | - (! empty($this->_curPre['size']) ? ' ['.$this->_curPre['size'].']' : ''). |
|
450 | + (!empty($this->_curPre['size']) ? ' ['.$this->_curPre['size'].']' : ''). |
|
451 | 451 | PHP_EOL; |
452 | 452 | } |
453 | 453 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | */ |
458 | 458 | protected function _getGroupID(string $groupName): mixed |
459 | 459 | { |
460 | - if (! isset($this->_groupList[$groupName])) { |
|
460 | + if (!isset($this->_groupList[$groupName])) { |
|
461 | 461 | $group = UsenetGroup::query()->where('name', $groupName)->first(['id']); |
462 | 462 | $this->_groupList[$groupName] = $group !== null ? $group['id'] : ''; |
463 | 463 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | ]; |
152 | 152 | $primaryConnections = $this->_tmux->getUSPConnections('primary', $primaryUSP); |
153 | 153 | $alternateConnections = $this->_tmux->getUSPConnections('alternate', $alternateUSP); |
154 | - if ($this->_isConnected() && (($alternate && $this->_currentServer === config('nntmux_nntp.alternate_server') && ($this->_primaryNntpConnections < $alternateConnections['alternate']['active'])) || (! $alternate && $this->_currentServer === config('nntmux_nntp.server') && ($this->_primaryNntpConnections < $primaryConnections['primary']['active'])))) { |
|
154 | + if ($this->_isConnected() && (($alternate && $this->_currentServer === config('nntmux_nntp.alternate_server') && ($this->_primaryNntpConnections < $alternateConnections['alternate']['active'])) || (!$alternate && $this->_currentServer === config('nntmux_nntp.server') && ($this->_primaryNntpConnections < $primaryConnections['primary']['active'])))) { |
|
155 | 155 | return true; |
156 | 156 | } |
157 | 157 | |
@@ -160,20 +160,20 @@ discard block |
||
160 | 160 | $ret = $connected = $cError = $aError = false; |
161 | 161 | |
162 | 162 | // Set variables to connect based on if we are using the alternate provider or not. |
163 | - if (! $alternate) { |
|
163 | + if (!$alternate) { |
|
164 | 164 | $sslEnabled = (bool) config('nntmux_nntp.ssl'); |
165 | 165 | $this->_currentServer = config('nntmux_nntp.server'); |
166 | 166 | $this->_currentPort = config('nntmux_nntp.port'); |
167 | 167 | $userName = config('nntmux_nntp.username'); |
168 | 168 | $password = config('nntmux_nntp.password'); |
169 | - $socketTimeout = ! empty(config('nntmux_nntp.socket_timeout')) ? config('nntmux_nntp.socket_timeout') : $this->_socketTimeout; |
|
169 | + $socketTimeout = !empty(config('nntmux_nntp.socket_timeout')) ? config('nntmux_nntp.socket_timeout') : $this->_socketTimeout; |
|
170 | 170 | } else { |
171 | 171 | $sslEnabled = (bool) config('nntmux_nntp.alternate_server_ssl'); |
172 | 172 | $this->_currentServer = config('nntmux_nntp.alternate_server'); |
173 | 173 | $this->_currentPort = config('nntmux_nntp.alternate_server_port'); |
174 | 174 | $userName = config('nntmux_nntp.alternate_server_username'); |
175 | 175 | $password = config('nntmux_nntp.alternate_server_password'); |
176 | - $socketTimeout = ! empty(config('nntmux_nntp.alternate_server_socket_timeout')) ? config('nntmux_nntp.alternate_server_socket_timeout') : $this->_socketTimeout; |
|
176 | + $socketTimeout = !empty(config('nntmux_nntp.alternate_server_socket_timeout')) ? config('nntmux_nntp.alternate_server_socket_timeout') : $this->_socketTimeout; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | $enc = ($sslEnabled ? ' (ssl)' : ' (non-ssl)'); |
@@ -186,19 +186,19 @@ discard block |
||
186 | 186 | $authenticated = false; |
187 | 187 | |
188 | 188 | // If we are not connected, try to connect. |
189 | - if (! $connected) { |
|
189 | + if (!$connected) { |
|
190 | 190 | $ret = $this->connect($this->_currentServer, $sslEnabled, $this->_currentPort, 5, $socketTimeout); |
191 | 191 | } |
192 | 192 | // Check if we got an error while connecting. |
193 | 193 | $cErr = self::isError($ret); |
194 | 194 | |
195 | 195 | // If no error, we are connected. |
196 | - if (! $cErr) { |
|
196 | + if (!$cErr) { |
|
197 | 197 | // Say that we are connected so we don't retry. |
198 | 198 | $connected = true; |
199 | 199 | // When there is no error it returns bool if we are allowed to post or not. |
200 | 200 | $this->_postingAllowed = $ret; |
201 | - } elseif (! $cError) { |
|
201 | + } elseif (!$cError) { |
|
202 | 202 | $cError = $ret->getMessage(); |
203 | 203 | } |
204 | 204 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // If we have no more retries and could not connect, return an error. |
211 | - if ($retries === 0 && ! $connected) { |
|
211 | + if ($retries === 0 && !$connected) { |
|
212 | 212 | $message = |
213 | 213 | 'Cannot connect to server '. |
214 | 214 | $this->_currentServer. |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | $aErr = self::isError($ret2); |
234 | 234 | |
235 | 235 | // If there was no error, then we are authenticated. |
236 | - if (! $aErr) { |
|
236 | + if (!$aErr) { |
|
237 | 237 | $authenticated = true; |
238 | - } elseif (! $aError) { |
|
238 | + } elseif (!$aError) { |
|
239 | 239 | $aError = $ret2->getMessage(); |
240 | 240 | } |
241 | 241 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | // If we ran out of retries, return an error. |
248 | - if ($retries === 0 && ! $authenticated) { |
|
248 | + if ($retries === 0 && !$authenticated) { |
|
249 | 249 | $message = |
250 | 250 | 'Cannot authenticate to server '. |
251 | 251 | $this->_currentServer. |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | // If we are connected and authenticated, try enabling compression if we have it enabled. |
262 | 262 | if ($connected && $authenticated) { |
263 | 263 | // Check if we should use compression on the connection. |
264 | - if (! $compression || (int) Settings::settingValue('..compressedheaders') === 0) { |
|
264 | + if (!$compression || (int) Settings::settingValue('..compressedheaders') === 0) { |
|
265 | 265 | $this->_compressionSupported = false; |
266 | 266 | } |
267 | 267 | |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $message = $this->_getMessage($groupName, $wanted); |
544 | 544 | |
545 | 545 | // Append the body to $body. |
546 | - if (! self::isError($message)) { |
|
546 | + if (!self::isError($message)) { |
|
547 | 547 | $body .= $message; |
548 | 548 | |
549 | 549 | if ($messageSize === 0) { |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | |
553 | 553 | // If there is an error try the alternate provider or return the PEAR error. |
554 | 554 | } elseif ($alternate) { |
555 | - if (! $aConnected) { |
|
555 | + if (!$aConnected) { |
|
556 | 556 | // Check if the current connected server is the alternate or not. |
557 | 557 | $aConnected = $this->_currentServer === config('nntmux_nntp.server') ? $nntp->doConnect(true, true) : $nntp->doConnect(); |
558 | 558 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | } |
639 | 639 | |
640 | 640 | // Check if it's an article number or message-ID. |
641 | - if (! is_numeric($identifier)) { |
|
641 | + if (!is_numeric($identifier)) { |
|
642 | 642 | // If it's a message-ID, check if it has the required triangular brackets. |
643 | 643 | $identifier = $this->_formatMessageID($identifier); |
644 | 644 | } |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $emptyLine = false; |
659 | 659 | foreach ($article as $line) { |
660 | 660 | // If we found the empty line it means we are done reading the header and we will start reading the body. |
661 | - if (! $emptyLine) { |
|
661 | + if (!$emptyLine) { |
|
662 | 662 | if ($line === '') { |
663 | 663 | $emptyLine = true; |
664 | 664 | |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | } |
717 | 717 | |
718 | 718 | // Check if it's an article number or message-id. |
719 | - if (! is_numeric($identifier)) { |
|
719 | + if (!is_numeric($identifier)) { |
|
720 | 720 | // Verify we have the required triangular brackets if it is a message-id. |
721 | 721 | $identifier = $this->_formatMessageID($identifier); |
722 | 722 | } |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | */ |
767 | 767 | public function postArticle(array|string $groups, string $subject, \Exception|string $body, string $from, bool $yEnc = true, bool $compress = true, string $extra = ''): mixed |
768 | 768 | { |
769 | - if (! $this->_postingAllowed) { |
|
769 | + if (!$this->_postingAllowed) { |
|
770 | 770 | $message = 'You do not have the right to post articles on server '.$this->_currentServer; |
771 | 771 | |
772 | 772 | return $this->throwError($this->colorCli->climate()->error($message)); |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | if ($this->_compressionEnabled) { |
901 | 901 | return true; |
902 | 902 | } |
903 | - if (! $this->_compressionSupported) { |
|
903 | + if (!$this->_compressionSupported) { |
|
904 | 904 | return false; |
905 | 905 | } |
906 | 906 | |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | return $response; |
915 | 915 | } |
916 | 916 | if ($response !== 290) { |
917 | - if (! $secondTry) { |
|
917 | + if (!$secondTry) { |
|
918 | 918 | // Retry. |
919 | 919 | $this->cmdQuit(); |
920 | 920 | if ($this->_checkConnection()) { |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | $possibleTerm = false; |
973 | 973 | $data = null; |
974 | 974 | |
975 | - while (! feof($this->_socket)) { |
|
975 | + while (!feof($this->_socket)) { |
|
976 | 976 | // Did we find a possible ending ? (.\r\n) |
977 | 977 | if ($possibleTerm) { |
978 | 978 | // Loop, sleeping shortly, to allow the server time to upload data, if it has any. |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | stream_set_blocking($this->_socket, 1); |
988 | 988 | |
989 | 989 | // Don't sleep on last iteration. |
990 | - if (! empty($buffer)) { |
|
990 | + if (!empty($buffer)) { |
|
991 | 991 | break; |
992 | 992 | } |
993 | 993 | if ($i < 2) { |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | // Remove .\r\n from end, decompress data. |
1001 | 1001 | $deComp = @gzuncompress(mb_substr($data, 0, -3, '8bit')); |
1002 | 1002 | |
1003 | - if (! empty($deComp)) { |
|
1003 | + if (!empty($deComp)) { |
|
1004 | 1004 | $bytesReceived = \strlen($data); |
1005 | 1005 | if ($this->_echo && $bytesReceived > 10240) { |
1006 | 1006 | $this->colorCli->climate()->primaryOver( |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | // Check if the last char is >, if not add it. |
1075 | - if (! str_ends_with($messageID, '>')) { |
|
1075 | + if (!str_ends_with($messageID, '>')) { |
|
1076 | 1076 | $messageID .= '>'; |
1077 | 1077 | } |
1078 | 1078 | |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | // Check if this is an article number or message-id. |
1102 | - if (! is_numeric($identifier)) { |
|
1102 | + if (!is_numeric($identifier)) { |
|
1103 | 1103 | // It's a message-id so check if it has the triangular brackets. |
1104 | 1104 | $identifier = $this->_formatMessageID($identifier); |
1105 | 1105 | } |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | $body = ''; |
1114 | 1114 | if ($response === NET_NNTP_PROTOCOL_RESPONSECODE_BODY_FOLLOWS) { |
1115 | 1115 | // Continue until connection is lost |
1116 | - while (! feof($this->_socket)) { |
|
1116 | + while (!feof($this->_socket)) { |
|
1117 | 1117 | // Retrieve and append up to 1024 characters from the server. |
1118 | 1118 | $line = fgets($this->_socket, 1024); |
1119 | 1119 | |
@@ -1363,6 +1363,6 @@ discard block |
||
1363 | 1363 | */ |
1364 | 1364 | public function _isConnected(bool $feOf = true): bool |
1365 | 1365 | { |
1366 | - return is_resource($this->_socket) && (! $feOf || ! feof($this->_socket)); |
|
1366 | + return is_resource($this->_socket) && (!$feOf || !feof($this->_socket)); |
|
1367 | 1367 | } |
1368 | 1368 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | foreach ($hit as $val) { |
115 | 115 | $title = Predb::query()->where('title', trim($val))->first(['title', 'id']); |
116 | 116 | // don't match against ab.teevee if title is for just the season |
117 | - if (! empty($title) && $groupName === 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $hit)) { |
|
117 | + if (!empty($title) && $groupName === 'alt.binaries.teevee' && preg_match('/\.S\d\d\./', $title['title'], $hit)) { |
|
118 | 118 | $title = null; |
119 | 119 | } |
120 | 120 | if ($title !== null) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | break; |
160 | 160 | } |
161 | - if ($title === null && ! empty($reqGname)) { |
|
161 | + if ($title === null && !empty($reqGname)) { |
|
162 | 162 | $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']); |
163 | 163 | } |
164 | 164 | // don't match against ab.teevee if title is for just the season |
@@ -143,7 +143,7 @@ |
||
143 | 143 | $content['url'] = '/'.$content['url']; |
144 | 144 | } |
145 | 145 | |
146 | - if (! str_ends_with($content['url'], '/')) { |
|
146 | + if (!str_ends_with($content['url'], '/')) { |
|
147 | 147 | $content['url'] .= '/'; |
148 | 148 | } |
149 | 149 |