@@ -1150,7 +1150,7 @@ |
||
1150 | 1150 | * |
1151 | 1151 | * @param int $attribute |
1152 | 1152 | * |
1153 | - * @return bool|mixed |
|
1153 | + * @return string |
|
1154 | 1154 | */ |
1155 | 1155 | public function getAttribute($attribute) |
1156 | 1156 | { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $this->pdo = null; |
181 | 181 | } |
182 | 182 | |
183 | - public function checkDbExists ($name = null) |
|
183 | + public function checkDbExists($name = null) |
|
184 | 184 | { |
185 | 185 | if (empty($name)) { |
186 | 186 | $name = $this->opts['dbname']; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - public function getTableList () |
|
256 | + public function getTableList() |
|
257 | 257 | { |
258 | 258 | $query = ($this->opts['dbtype'] === 'mysql' ? 'SHOW DATABASES' : 'SELECT datname AS Database FROM pg_database'); |
259 | 259 | $result = $this->pdo->query($query); |
@@ -412,12 +412,12 @@ discard block |
||
412 | 412 | * |
413 | 413 | * @return string |
414 | 414 | */ |
415 | - public function likeString($str, $left=true, $right=true) |
|
415 | + public function likeString($str, $left = true, $right = true) |
|
416 | 416 | { |
417 | 417 | return ( |
418 | 418 | 'LIKE ' . |
419 | 419 | $this->escapeString( |
420 | - ($left ? '%' : '') . |
|
420 | + ($left ? '%' : '') . |
|
421 | 421 | $str . |
422 | 422 | ($right ? '%' : '') |
423 | 423 | ) |
@@ -453,13 +453,13 @@ discard block |
||
453 | 453 | |
454 | 454 | $i = 2; |
455 | 455 | $error = ''; |
456 | - while($i < 11) { |
|
456 | + while ($i < 11) { |
|
457 | 457 | $result = $this->queryExecHelper($query, true); |
458 | 458 | if (is_array($result) && isset($result['deadlock'])) { |
459 | 459 | $error = $result['message']; |
460 | 460 | if ($result['deadlock'] === true) { |
461 | - $this->echoError("A Deadlock or lock wait timeout has occurred, sleeping.(" . ($i-1) . ")", 'queryInsert', 4); |
|
462 | - $this->ct->showsleep($i * ($i/2)); |
|
461 | + $this->echoError("A Deadlock or lock wait timeout has occurred, sleeping.(" . ($i - 1) . ")", 'queryInsert', 4); |
|
462 | + $this->ct->showsleep($i * ($i / 2)); |
|
463 | 463 | $i++; |
464 | 464 | } else { |
465 | 465 | break; |
@@ -498,13 +498,13 @@ discard block |
||
498 | 498 | |
499 | 499 | $i = 2; |
500 | 500 | $error = ''; |
501 | - while($i < 11) { |
|
501 | + while ($i < 11) { |
|
502 | 502 | $result = $this->queryExecHelper($query); |
503 | 503 | if (is_array($result) && isset($result['deadlock'])) { |
504 | 504 | $error = $result['message']; |
505 | 505 | if ($result['deadlock'] === true) { |
506 | - $this->echoError("A Deadlock or lock wait timeout has occurred, sleeping.(" . ($i-1) . ")", 'queryExec', 4); |
|
507 | - $this->ct->showsleep($i * ($i/2)); |
|
506 | + $this->echoError("A Deadlock or lock wait timeout has occurred, sleeping.(" . ($i - 1) . ")", 'queryExec', 4); |
|
507 | + $this->ct->showsleep($i * ($i / 2)); |
|
508 | 508 | $i++; |
509 | 509 | } else { |
510 | 510 | break; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | protected function queryExecHelper($query, $insert = false) |
535 | 535 | { |
536 | 536 | try { |
537 | - if ($insert === false ) { |
|
537 | + if ($insert === false) { |
|
538 | 538 | $run = $this->pdo->prepare($query); |
539 | 539 | $run->execute(); |
540 | 540 | return $run; |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | // Remove LIMIT and OFFSET from query to allow queryCalc usage with browse |
688 | 688 | $query = preg_replace('#(\s+LIMIT\s+\d+)?\s+OFFSET\s+\d+\s*$#i', '', $query); |
689 | 689 | |
690 | - if ($cache === true && $this->cacheEnabled === true ) { |
|
690 | + if ($cache === true && $this->cacheEnabled === true) { |
|
691 | 691 | try { |
692 | 692 | $count = $this->cacheServer->get($this->cacheServer->createKey($query . 'count')); |
693 | 693 | if ($count !== false) { |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | public function ping($restart = false) |
1110 | 1110 | { |
1111 | 1111 | try { |
1112 | - return (bool) $this->pdo->query('SELECT 1+1'); |
|
1112 | + return (bool)$this->pdo->query('SELECT 1+1'); |
|
1113 | 1113 | } catch (\PDOException $e) { |
1114 | 1114 | if ($restart == true) { |
1115 | 1115 | $this->initialiseDatabase(); |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | * |
1176 | 1176 | * @return string |
1177 | 1177 | */ |
1178 | - public function getDbVersion () |
|
1178 | + public function getDbVersion() |
|
1179 | 1179 | { |
1180 | 1180 | return $this->dbVersion; |
1181 | 1181 | } |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | * @return bool|null TRUE if Db version is greater than or eaqual to $requiredVersion, |
1187 | 1187 | * false if not, and null if the version isn't available to check against. |
1188 | 1188 | */ |
1189 | - public function isDbVersionAtLeast ($requiredVersion) |
|
1189 | + public function isDbVersionAtLeast($requiredVersion) |
|
1190 | 1190 | { |
1191 | 1191 | if (empty($this->dbVersion)) { |
1192 | 1192 | return null; |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | /** |
1198 | 1198 | * Performs the fetch from the Db server and stores the resulting Major.Minor.Version number. |
1199 | 1199 | */ |
1200 | - private function fetchDbVersion () |
|
1200 | + private function fetchDbVersion() |
|
1201 | 1201 | { |
1202 | 1202 | $result = $this->queryOneRow("SELECT VERSION() AS version"); |
1203 | 1203 | if (!empty($result)) { |
@@ -880,7 +880,8 @@ |
||
880 | 880 | if (preg_match('#\s+LIMIT\s+(?P<lower>\d+)(,\s+(?P<upper>\d+))?(;)?$#i', $query, $matches)) { |
881 | 881 | If (!isset($matches['upper']) && isset($matches['lower']) && $matches['lower'] == 1) { |
882 | 882 | // good it's already correctly set. |
883 | - } else { // We have a limit, but it's not for a single row |
|
883 | + } else { |
|
884 | +// We have a limit, but it's not for a single row |
|
884 | 885 | return false; |
885 | 886 | } |
886 | 887 |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
341 | - $this->pdo->query("USE {$this->opts['dbname']}"); |
|
341 | + $this->pdo->query("use {$this->opts['dbname']}"); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | // In case PDO is not set to produce exceptions (PHP's default behaviour). |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | // Force the query to only return 1 row, so queryArray doesn't potentially run out of memory on a large data set. |
879 | 879 | // First check if query already contains a LIMIT clause. |
880 | 880 | if (preg_match('#\s+LIMIT\s+(?P<lower>\d+)(,\s+(?P<upper>\d+))?(;)?$#i', $query, $matches)) { |
881 | - If (!isset($matches['upper']) && isset($matches['lower']) && $matches['lower'] == 1) { |
|
881 | + if (!isset($matches['upper']) && isset($matches['lower']) && $matches['lower'] == 1) { |
|
882 | 882 | // good it's already correctly set. |
883 | 883 | } else { // We have a limit, but it's not for a single row |
884 | 884 | return false; |
@@ -157,7 +157,7 @@ |
||
157 | 157 | * |
158 | 158 | * @param $relid |
159 | 159 | * @param $gid |
160 | - * @param $uid |
|
160 | + * @param string $uid |
|
161 | 161 | */ |
162 | 162 | public function postComment($relid, $gid, $uid) |
163 | 163 | { |
@@ -175,7 +175,7 @@ |
||
175 | 175 | ); |
176 | 176 | |
177 | 177 | if ($check instanceof \Traversable) { |
178 | - foreach ($check AS $dbl) { |
|
178 | + foreach ($check as $dbl) { |
|
179 | 179 | if ($dbl['text'] == $text) { |
180 | 180 | $dupe = 1; |
181 | 181 | break; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | /** |
145 | 145 | * Get all group columns by Name |
146 | 146 | * |
147 | - * @param $grp |
|
147 | + * @param string $grp |
|
148 | 148 | * |
149 | 149 | * @return array|bool |
150 | 150 | */ |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @param string $groupName The full name of the usenet group being evaluated |
316 | 316 | * |
317 | - * @return string|bool The name of the group replacing shorthand prefix or false if groupname was malformed |
|
317 | + * @return string|false The name of the group replacing shorthand prefix or false if groupname was malformed |
|
318 | 318 | */ |
319 | 319 | public function isValidGroup($groupName) |
320 | 320 | { |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | WHERE mp.group_id = {$id}" |
424 | 424 | ); |
425 | 425 | |
426 | - foreach ($this->cbpm AS $tablePrefix) { |
|
426 | + foreach ($this->cbpm as $tablePrefix) { |
|
427 | 427 | $this->pdo->queryExec( |
428 | 428 | "DROP TABLE IF EXISTS {$tablePrefix}_{$id}" |
429 | 429 | ); |
@@ -445,15 +445,15 @@ discard block |
||
445 | 445 | */ |
446 | 446 | public function resetall() |
447 | 447 | { |
448 | - foreach ($this->cbpm AS $tablePrefix) { |
|
448 | + foreach ($this->cbpm as $tablePrefix) { |
|
449 | 449 | $this->pdo->queryExec("TRUNCATE TABLE {$tablePrefix}"); |
450 | 450 | } |
451 | 451 | |
452 | 452 | $groups = $this->pdo->queryDirect("SELECT id FROM groups"); |
453 | 453 | |
454 | 454 | if ($groups instanceof \Traversable) { |
455 | - foreach ($groups AS $group) { |
|
456 | - foreach ($this->cbpm AS $tablePrefix) { |
|
455 | + foreach ($groups as $group) { |
|
456 | + foreach ($this->cbpm as $tablePrefix) { |
|
457 | 457 | $this->pdo->queryExec("DROP TABLE IF EXISTS {$tablePrefix}_{$group['id']}"); |
458 | 458 | } |
459 | 459 | } |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $releases = new Releases(['Settings' => $this->pdo, 'Groups' => $this]); |
493 | 493 | $nzb = new NZB($this->pdo); |
494 | 494 | $releaseImage = new ReleaseImage($this->pdo); |
495 | - foreach ($res AS $row) { |
|
495 | + foreach ($res as $row) { |
|
496 | 496 | $releases->deleteSingle( |
497 | 497 | [ |
498 | 498 | 'g' => $row['guid'], |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | WHERE id = {$id}" |
577 | 577 | ); |
578 | 578 | |
579 | - return "Group {$id}: {$column} has been " . (($status == 0) ? 'deactivated' : 'activated') . '.'; |
|
579 | + return "group {$id}: {$column} has been " . (($status == 0) ? 'deactivated' : 'activated') . '.'; |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
115 | - * @return bool|void |
|
115 | + * @return string|false |
|
116 | 116 | */ |
117 | 117 | public function returnXML() |
118 | 118 | { |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | /** |
669 | 669 | * Accepts an array of values to loop through to build cData from the release info |
670 | 670 | * |
671 | - * @param array $columns The columns in the release we need to insert |
|
671 | + * @param string[] $columns The columns in the release we need to insert |
|
672 | 672 | * |
673 | 673 | * @return string The HTML format cData |
674 | 674 | */ |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | protected function addNode($element) |
207 | 207 | { |
208 | 208 | $this->xml->startElement($element['name']); |
209 | - foreach($element['data'] AS $attr => $val) { |
|
209 | + foreach ($element['data'] AS $attr => $val) { |
|
210 | 210 | $this->xml->writeAttribute($attr, $val); |
211 | 211 | } |
212 | 212 | $this->xml->endElement(); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | protected function addNodes($element) |
220 | 220 | { |
221 | 221 | $this->xml->startElement($element['name']); |
222 | - foreach($element['data'] AS $elem => $value) { |
|
222 | + foreach ($element['data'] AS $elem => $value) { |
|
223 | 223 | $subelement['name'] = $elem; |
224 | 224 | $subelement['data'] = $value; |
225 | 225 | $this->addNode($subelement); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | if ($p['description'] != '') { |
241 | 241 | $this->xml->writeAttribute('description', html_entity_decode($p['description'])); |
242 | 242 | } |
243 | - foreach($p['subcatlist'] AS $c) { |
|
243 | + foreach ($p['subcatlist'] AS $c) { |
|
244 | 244 | $this->xml->startElement('subcat'); |
245 | 245 | $this->xml->writeAttribute('id', $c['id']); |
246 | 246 | $this->xml->writeAttribute('name', html_entity_decode($c['title'])); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | protected function includeRssAtom() |
261 | 261 | { |
262 | - switch($this->namespace) { |
|
262 | + switch ($this->namespace) { |
|
263 | 263 | case 'newznab': |
264 | 264 | $url = 'http://www.newznab.com/DTD/2010/feeds/attributes/'; |
265 | 265 | break; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | { |
301 | 301 | $server = $this->server['server']; |
302 | 302 | |
303 | - switch($this->namespace) { |
|
303 | + switch ($this->namespace) { |
|
304 | 304 | case 'newznab': |
305 | 305 | $path = 'apihelp/'; |
306 | 306 | $tag = 'API'; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | |
341 | 341 | public function includeTotalRows() |
342 | 342 | { |
343 | - $this->xml->startElement($this->namespace.":response"); |
|
343 | + $this->xml->startElement($this->namespace . ":response"); |
|
344 | 344 | $this->xml->writeAttribute('offset', $this->offset); |
345 | 345 | $this->xml->writeAttribute('total', isset($this->releases[0]['_totalrows']) ? $this->releases[0]['_totalrows'] : 0); |
346 | 346 | $this->xml->endElement(); |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public function includeReleases() |
353 | 353 | { |
354 | - if(is_array($this->releases) && !empty($this->releases)) { |
|
354 | + if (is_array($this->releases) && !empty($this->releases)) { |
|
355 | 355 | foreach ($this->releases AS $this->release) { |
356 | 356 | $this->xml->startElement('item'); |
357 | 357 | $this->includeReleaseMain(); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } else { |
386 | 386 | $this->writeRssCdata(); |
387 | 387 | } |
388 | - if((isset($this->parameters['dl']) && $this->parameters['dl'] == 1) || !isset($this->parameters['dl'])) { |
|
388 | + if ((isset($this->parameters['dl']) && $this->parameters['dl'] == 1) || !isset($this->parameters['dl'])) { |
|
389 | 389 | $this->xml->startElement('enclosure'); |
390 | 390 | $this->xml->writeAttribute( |
391 | 391 | 'url', |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | if ($this->parameters['extended'] == 1) { |
417 | 417 | $this->writeZedAttr('files', $this->release['totalpart']); |
418 | 418 | $this->writeZedAttr('poster', $this->release['fromname']); |
419 | - if(($this->release['videos_id'] > 0 || $this->release['tv_episodes_id'] > 0) && $this->namespace === 'newznab') { |
|
419 | + if (($this->release['videos_id'] > 0 || $this->release['tv_episodes_id'] > 0) && $this->namespace === 'newznab') { |
|
420 | 420 | $this->setTvAttr(); |
421 | 421 | } |
422 | 422 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | protected function setTvAttr() |
454 | 454 | { |
455 | - switch(true) { |
|
455 | + switch (true) { |
|
456 | 456 | case !empty($this->release['title']): |
457 | 457 | $this->writeZedAttr('title', $this->release['title']); |
458 | 458 | break; |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | $p = $this->parameters; |
515 | 515 | |
516 | 516 | $this->cdata = "\n\t<div>\n"; |
517 | - switch(1) { |
|
517 | + switch (1) { |
|
518 | 518 | case !empty($r['cover']): |
519 | 519 | $dir = 'movies'; |
520 | 520 | $column = 'imdbid'; |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | |
619 | 619 | $cData = $this->buildCdata($musicCol); |
620 | 620 | |
621 | - if ($r['mu_url'] !== '' ) { |
|
621 | + if ($r['mu_url'] !== '') { |
|
622 | 622 | $cDataUrl = "<li>Amazon: <a href=\"{$r['mu_url']}\">{$r['mu_title']}</a></li>"; |
623 | 623 | } |
624 | 624 | |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | $cData = ''; |
680 | 680 | |
681 | 681 | foreach ($columns AS $info) { |
682 | - if (!empty($r[$info])) { |
|
682 | + if (!empty($r[$info])) { |
|
683 | 683 | if ($info == 'mu_releasedate') { |
684 | 684 | $ucInfo = 'Released'; |
685 | 685 | $rDate = date('Y-m-d', strtotime($r[$info])); |
@@ -90,7 +90,8 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param array $options |
92 | 92 | */ |
93 | - public function __construct($options = []) { |
|
93 | + public function __construct($options = []) |
|
94 | + { |
|
94 | 95 | $defaults = [ |
95 | 96 | 'Parameters' => null, |
96 | 97 | 'Data' => null, |
@@ -679,7 +680,7 @@ discard block |
||
679 | 680 | $cData = ''; |
680 | 681 | |
681 | 682 | foreach ($columns AS $info) { |
682 | - if (!empty($r[$info])) { |
|
683 | + if (!empty($r[$info])) { |
|
683 | 684 | if ($info == 'mu_releasedate') { |
684 | 685 | $ucInfo = 'Released'; |
685 | 686 | $rDate = date('Y-m-d', strtotime($r[$info])); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | protected function addNode($element) |
207 | 207 | { |
208 | 208 | $this->xml->startElement($element['name']); |
209 | - foreach($element['data'] AS $attr => $val) { |
|
209 | + foreach($element['data'] as $attr => $val) { |
|
210 | 210 | $this->xml->writeAttribute($attr, $val); |
211 | 211 | } |
212 | 212 | $this->xml->endElement(); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | protected function addNodes($element) |
220 | 220 | { |
221 | 221 | $this->xml->startElement($element['name']); |
222 | - foreach($element['data'] AS $elem => $value) { |
|
222 | + foreach($element['data'] as $elem => $value) { |
|
223 | 223 | $subelement['name'] = $elem; |
224 | 224 | $subelement['data'] = $value; |
225 | 225 | $this->addNode($subelement); |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | protected function writeCategoryListing() |
234 | 234 | { |
235 | 235 | $this->xml->startElement('categories'); |
236 | - foreach ($this->server['categories'] AS $p) { |
|
236 | + foreach ($this->server['categories'] as $p) { |
|
237 | 237 | $this->xml->startElement('category'); |
238 | 238 | $this->xml->writeAttribute('id', $p['id']); |
239 | 239 | $this->xml->writeAttribute('name', html_entity_decode($p['title'])); |
240 | 240 | if ($p['description'] != '') { |
241 | 241 | $this->xml->writeAttribute('description', html_entity_decode($p['description'])); |
242 | 242 | } |
243 | - foreach($p['subcatlist'] AS $c) { |
|
243 | + foreach($p['subcatlist'] as $c) { |
|
244 | 244 | $this->xml->startElement('subcat'); |
245 | 245 | $this->xml->writeAttribute('id', $c['id']); |
246 | 246 | $this->xml->writeAttribute('name', html_entity_decode($c['title'])); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | public function includeReleases() |
353 | 353 | { |
354 | 354 | if(is_array($this->releases) && !empty($this->releases)) { |
355 | - foreach ($this->releases AS $this->release) { |
|
355 | + foreach ($this->releases as $this->release) { |
|
356 | 356 | $this->xml->startElement('item'); |
357 | 357 | $this->includeReleaseMain(); |
358 | 358 | $this->setZedAttributes(); |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | if ($r['mu_tracks'] != '') { |
633 | 633 | $tracks = explode('|', $r['mu_tracks']); |
634 | 634 | if (count($tracks) > 0) { |
635 | - foreach ($tracks AS $track) { |
|
635 | + foreach ($tracks as $track) { |
|
636 | 636 | $track = trim($track); |
637 | 637 | $tData .= "<li>{$track}</li>"; |
638 | 638 | } |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | |
679 | 679 | $cData = ''; |
680 | 680 | |
681 | - foreach ($columns AS $info) { |
|
681 | + foreach ($columns as $info) { |
|
682 | 682 | if (!empty($r[$info])) { |
683 | 683 | if ($info == 'mu_releasedate') { |
684 | 684 | $ucInfo = 'Released'; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @param string $nickName The nick name - visible in the channel. |
330 | 330 | * @param string $userName The user name - visible in the host name. |
331 | 331 | * @param string $realName The real name - visible in the WhoIs. |
332 | - * @param null $password The password - some servers require a password. |
|
332 | + * @param string|false $password The password - some servers require a password. |
|
333 | 333 | * |
334 | 334 | * @return bool |
335 | 335 | * |
@@ -641,6 +641,7 @@ discard block |
||
641 | 641 | * Write a single character to the socket. |
642 | 642 | * |
643 | 643 | * @param string (char) $character A single character. |
644 | + * @param string $character |
|
644 | 645 | * |
645 | 646 | * @return int|bool Number of bytes written or false. |
646 | 647 | */ |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
279 | 279 | |
280 | 280 | /** |
281 | - * @return int |
|
281 | + * @return string|null |
|
282 | 282 | */ |
283 | 283 | private function backfillMainMethod() |
284 | 284 | { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
307 | - * @return int |
|
307 | + * @return string|null |
|
308 | 308 | */ |
309 | 309 | private function safeBackfillMainMethod() |
310 | 310 | { |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
425 | - * @return int |
|
425 | + * @return string|null |
|
426 | 426 | */ |
427 | 427 | private function safeBinariesMainMethod() |
428 | 428 | { |
@@ -504,7 +504,7 @@ |
||
504 | 504 | $threads = 1; |
505 | 505 | } |
506 | 506 | |
507 | - $leftguids = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']; |
|
507 | + $leftguids = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; |
|
508 | 508 | |
509 | 509 | // Prevent PreDB FT from always running |
510 | 510 | if ($this->workTypeOptions[0] === 'predbft') { |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | /** |
304 | 304 | * Get resource usage string. |
305 | 305 | * |
306 | - * @return bool|string |
|
306 | + * @return string|false |
|
307 | 307 | * |
308 | 308 | * @access public |
309 | 309 | */ |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | /** |
325 | 325 | * Get system load. |
326 | 326 | * |
327 | - * @return string|bool |
|
327 | + * @return string|false |
|
328 | 328 | * |
329 | 329 | * @access public |
330 | 330 | */ |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public function showMemUsage($oldUsage = 0, $realUsage = false, $peak = false) |
268 | 268 | { |
269 | - $currentUsage = ($peak ? memory_get_peak_usage($realUsage) : memory_get_usage($realUsage)); |
|
269 | + $currentUsage = ($peak ? memory_get_peak_usage($realUsage) : memory_get_usage($realUsage)); |
|
270 | 270 | $actualUsage = ($oldUsage > 0 ? $currentUsage - $oldUsage : $currentUsage); |
271 | 271 | |
272 | 272 | $units = [ |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $usage = getrusage(); |
314 | 314 | |
315 | 315 | return |
316 | - 'USR: ' . $this->formatTimeString($usage['ru_utime.tv_sec']) . |
|
316 | + 'USR: ' . $this->formatTimeString($usage['ru_utime.tv_sec']) . |
|
317 | 317 | ' SYS: ' . $this->formatTimeString($usage['ru_stime.tv_sec']) . |
318 | 318 | ' FAULTS: ' . $usage['ru_majflt'] . |
319 | 319 | ' SWAPS: ' . $usage['ru_nswap']; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | if (!$this->isWindows) { |
334 | 334 | $string = ''; |
335 | 335 | // Fix for single digits (2) or single float (2.1). |
336 | - foreach(sys_getloadavg() as $load) { |
|
336 | + foreach (sys_getloadavg() as $load) { |
|
337 | 337 | $strLen = strlen($load); |
338 | 338 | if ($strLen === 1) { |
339 | 339 | $string .= $load . '.00,'; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | asort($logs); |
605 | 605 | |
606 | 606 | // Remove all new logs from array (all elements under the last 51 elements of the array). |
607 | - array_splice($logs, -$this->maxLogs+1); |
|
607 | + array_splice($logs, -$this->maxLogs + 1); |
|
608 | 608 | |
609 | 609 | // Delete all the logs left in the array. |
610 | 610 | array_map('unlink', $logs); |
@@ -697,11 +697,11 @@ discard block |
||
697 | 697 | $time .= '00H:'; |
698 | 698 | } |
699 | 699 | if ($seconds > 60) { |
700 | - $time .= str_pad(round((($seconds % 3600) / 60)), 2 , '0', STR_PAD_LEFT) . 'M:'; |
|
700 | + $time .= str_pad(round((($seconds % 3600) / 60)), 2, '0', STR_PAD_LEFT) . 'M:'; |
|
701 | 701 | } else { |
702 | 702 | $time .= '00M:'; |
703 | 703 | } |
704 | - $time .= str_pad($seconds % 60, 2 , '0', STR_PAD_LEFT) . 'S'; |
|
704 | + $time .= str_pad($seconds % 60, 2, '0', STR_PAD_LEFT) . 'S'; |
|
705 | 705 | return $time; |
706 | 706 | } |
707 | 707 |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | /** |
385 | 385 | * Order types for movies page. |
386 | 386 | * |
387 | - * @return array |
|
387 | + * @return string[] |
|
388 | 388 | */ |
389 | 389 | public function getMovieOrdering() |
390 | 390 | { |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | |
557 | 557 | /** |
558 | 558 | * Get array of column keys, for inserting / updating. |
559 | - * @return array |
|
559 | + * @return string[] |
|
560 | 560 | */ |
561 | 561 | public function getColumnKeys() |
562 | 562 | { |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | * |
613 | 613 | * @param $variable |
614 | 614 | * |
615 | - * @return string |
|
615 | + * @return boolean |
|
616 | 616 | */ |
617 | 617 | protected function checkVariable(&$variable) |
618 | 618 | { |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | /** |
647 | 647 | * Fetch IMDB/TMDB/TRAKT info for the movie. |
648 | 648 | * |
649 | - * @param $imdbId |
|
649 | + * @param string $imdbId |
|
650 | 650 | * |
651 | 651 | * @return bool |
652 | 652 | */ |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | /** |
1454 | 1454 | * Get IMDB genres. |
1455 | 1455 | * |
1456 | - * @return array |
|
1456 | + * @return string[] |
|
1457 | 1457 | */ |
1458 | 1458 | public function getGenres() |
1459 | 1459 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * Current year of parsed search name. |
32 | 32 | * @var string |
33 | 33 | */ |
34 | - protected $currentYear = ''; |
|
34 | + protected $currentYear = ''; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Current release id of parsed search name. |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | { |
515 | 515 | if (is_array($value) && !empty($value)) { |
516 | 516 | $temp = ''; |
517 | - foreach($value as $val) { |
|
517 | + foreach ($value as $val) { |
|
518 | 518 | if (!is_array($val) && !is_object($val)) { |
519 | 519 | $temp .= (string)$val; |
520 | 520 | } |
@@ -561,8 +561,8 @@ discard block |
||
561 | 561 | public function getColumnKeys() |
562 | 562 | { |
563 | 563 | return [ |
564 | - 'actors','backdrop','cover','director','genre','imdbid','language', |
|
565 | - 'plot','rating','tagline','title','tmdbid', 'trailer','type','year' |
|
564 | + 'actors', 'backdrop', 'cover', 'director', 'genre', 'imdbid', 'language', |
|
565 | + 'plot', 'rating', 'tagline', 'title', 'tmdbid', 'trailer', 'type', 'year' |
|
566 | 566 | ]; |
567 | 567 | } |
568 | 568 | |
@@ -701,12 +701,12 @@ discard block |
||
701 | 701 | if ($this->checkVariable($fanart['banner'])) { |
702 | 702 | $mov['banner'] = $this->releaseImage->saveImage($imdbId . '-banner', $fanart['banner'], $this->imgSavePath); |
703 | 703 | } |
704 | - $mov['title'] = $this->setTmdbImdbTraktVar($imdb['title'] , $tmdb['title'], $trakt['title']); |
|
705 | - $mov['rating'] = $this->setTmdbImdbTraktVar($imdb['rating'] , $tmdb['rating'], $trakt['rating']); |
|
706 | - $mov['plot'] = $this->setTmdbImdbTraktVar($imdb['plot'] , $tmdb['plot'], $trakt['overview']); |
|
704 | + $mov['title'] = $this->setTmdbImdbTraktVar($imdb['title'], $tmdb['title'], $trakt['title']); |
|
705 | + $mov['rating'] = $this->setTmdbImdbTraktVar($imdb['rating'], $tmdb['rating'], $trakt['rating']); |
|
706 | + $mov['plot'] = $this->setTmdbImdbTraktVar($imdb['plot'], $tmdb['plot'], $trakt['overview']); |
|
707 | 707 | $mov['tagline'] = $this->setTmdbImdbTraktVar($imdb['tagline'], $tmdb['tagline'], $trakt['tagline']); |
708 | - $mov['year'] = $this->setTmdbImdbTraktVar($imdb['year'] , $tmdb['year'], $trakt['year']); |
|
709 | - $mov['genre'] = $this->setTmdbImdbTraktVar($imdb['genre'] , $tmdb['genre'], $trakt['genres']); |
|
708 | + $mov['year'] = $this->setTmdbImdbTraktVar($imdb['year'], $tmdb['year'], $trakt['year']); |
|
709 | + $mov['genre'] = $this->setTmdbImdbTraktVar($imdb['genre'], $tmdb['genre'], $trakt['genres']); |
|
710 | 710 | |
711 | 711 | if ($this->checkVariable($imdb['type'])) { |
712 | 712 | $mov['type'] = $imdb['type']; |
@@ -732,20 +732,20 @@ discard block |
||
732 | 732 | $mov['type'] = implode(', ', array_unique($mov['type'])); |
733 | 733 | } |
734 | 734 | |
735 | - $mov['title'] = html_entity_decode($mov['title'] , ENT_QUOTES, 'UTF-8'); |
|
735 | + $mov['title'] = html_entity_decode($mov['title'], ENT_QUOTES, 'UTF-8'); |
|
736 | 736 | |
737 | 737 | $mov['title'] = str_replace(['/', '\\'], '', $mov['title']); |
738 | 738 | $movieID = $this->update([ |
739 | - 'actors' => html_entity_decode($mov['actors'] , ENT_QUOTES, 'UTF-8'), |
|
739 | + 'actors' => html_entity_decode($mov['actors'], ENT_QUOTES, 'UTF-8'), |
|
740 | 740 | 'backdrop' => $mov['backdrop'], |
741 | 741 | 'cover' => $mov['cover'], |
742 | 742 | 'director' => html_entity_decode($mov['director'], ENT_QUOTES, 'UTF-8'), |
743 | - 'genre' => html_entity_decode($mov['genre'] , ENT_QUOTES, 'UTF-8'), |
|
743 | + 'genre' => html_entity_decode($mov['genre'], ENT_QUOTES, 'UTF-8'), |
|
744 | 744 | 'imdbid' => $mov['imdbid'], |
745 | 745 | 'language' => html_entity_decode($mov['language'], ENT_QUOTES, 'UTF-8'), |
746 | 746 | 'plot' => html_entity_decode(preg_replace('/\s+See full summary »/', ' ', $mov['plot']), ENT_QUOTES, 'UTF-8'), |
747 | 747 | 'rating' => round($mov['rating'], 1), |
748 | - 'tagline' => html_entity_decode($mov['tagline'] , ENT_QUOTES, 'UTF-8'), |
|
748 | + 'tagline' => html_entity_decode($mov['tagline'], ENT_QUOTES, 'UTF-8'), |
|
749 | 749 | 'title' => $mov['title'], |
750 | 750 | 'tmdbid' => $mov['tmdbid'], |
751 | 751 | 'type' => html_entity_decode(ucwords(preg_replace('/[\.\_]/', ' ', $mov['type'])), ENT_QUOTES, 'UTF-8'), |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | { |
779 | 779 | if ($this->fanartapikey != '') |
780 | 780 | { |
781 | - $buffer = Utility::getUrl(['url' => 'https://webservice.fanart.tv/v3/movies/' . 'tt' . $imdbId . '?api_key=' . $this->fanartapikey , 'verifycert' => false]); |
|
781 | + $buffer = Utility::getUrl(['url' => 'https://webservice.fanart.tv/v3/movies/' . 'tt' . $imdbId . '?api_key=' . $this->fanartapikey, 'verifycert' => false]); |
|
782 | 782 | if ($buffer !== false) { |
783 | 783 | $art = json_decode($buffer, true); |
784 | 784 | if (isset($art['status']) && $art['status'] === 'error') { |
@@ -1196,8 +1196,8 @@ discard block |
||
1196 | 1196 | |
1197 | 1197 | //If we found a year, try looking in a 4 year range. |
1198 | 1198 | if ($this->currentYear !== false) { |
1199 | - $start = (int) $this->currentYear - 2; |
|
1200 | - $end = (int) $this->currentYear + 2; |
|
1199 | + $start = (int)$this->currentYear - 2; |
|
1200 | + $end = (int)$this->currentYear + 2; |
|
1201 | 1201 | $andYearIn = 'AND year IN ('; |
1202 | 1202 | while ($start < $end) { |
1203 | 1203 | $andYearIn .= $start . ','; |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | */ |
1296 | 1296 | protected function googleSearch() |
1297 | 1297 | { |
1298 | - $buffer =Utility::getUrl([ |
|
1298 | + $buffer = Utility::getUrl([ |
|
1299 | 1299 | 'url' => |
1300 | 1300 | 'https://www.google.com/search?hl=en&as_q=&as_epq=' . |
1301 | 1301 | urlencode( |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * @return mixed|void |
468 | 468 | */ |
469 | 469 | public function parseTraktTv(&$data) |
470 | - { |
|
470 | + { |
|
471 | 471 | if (!isset($data['ids']['imdb']) || empty($data['ids']['imdb'])) { |
472 | 472 | return false; |
473 | 473 | } |
@@ -572,7 +572,8 @@ discard block |
||
572 | 572 | * @param array $values Array of keys/values to update. See $validKeys |
573 | 573 | * @return int|bool |
574 | 574 | */ |
575 | - public function update(array $values) { |
|
575 | + public function update(array $values) |
|
576 | + { |
|
576 | 577 | if (!count($values)) { |
577 | 578 | return false; |
578 | 579 | } |
@@ -776,8 +777,7 @@ discard block |
||
776 | 777 | */ |
777 | 778 | protected function fetchFanartTVProperties($imdbId) |
778 | 779 | { |
779 | - if ($this->fanartapikey != '') |
|
780 | - { |
|
780 | + if ($this->fanartapikey != '') { |
|
781 | 781 | $buffer = Utility::getUrl(['url' => 'https://webservice.fanart.tv/v3/movies/' . 'tt' . $imdbId . '?api_key=' . $this->fanartapikey , 'verifycert' => false]); |
782 | 782 | if ($buffer !== false) { |
783 | 783 | $art = json_decode($buffer, true); |
@@ -302,7 +302,7 @@ |
||
302 | 302 | $movieIDs = $releaseIDs = false; |
303 | 303 | |
304 | 304 | if (is_array($movies['result'])) { |
305 | - foreach ($movies['result'] AS $movie => $id) { |
|
305 | + foreach ($movies['result'] as $movie => $id) { |
|
306 | 306 | $movieIDs[] = $id['imdbid']; |
307 | 307 | $releaseIDs[] = $id['grp_release_id']; |
308 | 308 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @param string $nfo The nfo. |
194 | 194 | * @param array $release The SQL row for this release. |
195 | - * @param object $nntp Instance of class NNTP. |
|
195 | + * @param NNTP $nntp Instance of class NNTP. |
|
196 | 196 | * |
197 | 197 | * @return bool True on success, False on failure. |
198 | 198 | * |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | /** |
276 | 276 | * Attempt to find NFO files inside the NZB's of releases. |
277 | 277 | * |
278 | - * @param object $nntp Instance of class NNTP. |
|
278 | + * @param NNTP $nntp Instance of class NNTP. |
|
279 | 279 | * @param string $groupID (optional) Group ID. |
280 | 280 | * @param string $guidChar (optional) First character of the release GUID (used for multi-processing). |
281 | 281 | * @param int $processImdb (optional) Attempt to find IMDB id's in the NZB? |
@@ -64,8 +64,8 @@ |
||
64 | 64 | |
65 | 65 | const NFO_FAILED = -9; // We failed to get a NFO after admin set max retries. |
66 | 66 | const NFO_UNPROC = -1; // Release has not been processed yet. |
67 | - const NFO_NONFO = 0; // Release has no NFO. |
|
68 | - const NFO_FOUND = 1; // Release has an NFO. |
|
67 | + const NFO_NONFO = 0; // Release has no NFO. |
|
68 | + const NFO_FOUND = 1; // Release has an NFO. |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Default constructor. |
@@ -130,7 +130,8 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @access public |
132 | 132 | */ |
133 | - public function isNFO(&$possibleNFO, $guid) { |
|
133 | + public function isNFO(&$possibleNFO, $guid) |
|
134 | + { |
|
134 | 135 | if ($possibleNFO === false) { |
135 | 136 | return false; |
136 | 137 | } |
@@ -141,8 +142,7 @@ discard block |
||
141 | 142 | $size > 11 && |
142 | 143 | !preg_match( |
143 | 144 | '/\A(\s*<\?xml|=newz\[NZB\]=|RIFF|\s*[RP]AR|.{0,10}(JFIF|matroska|ftyp|ID3))|;\s*Generated\s*by.*SF\w/i' |
144 | - , $possibleNFO)) |
|
145 | - { |
|
145 | + , $possibleNFO)) { |
|
146 | 146 | // File/GetId3 work with files, so save to disk. |
147 | 147 | $tmpPath = $this->tmpPath . $guid . '.nfo'; |
148 | 148 | file_put_contents($tmpPath, $possibleNFO); |
@@ -158,8 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | // Or binary. |
160 | 160 | } else if (preg_match('/^(JPE?G|Parity|PNG|RAR|XML|(7-)?[Zz]ip)/', $result) || |
161 | - preg_match('/[\x00-\x08\x12-\x1F\x0B\x0E\x0F]/', $possibleNFO)) |
|
162 | - { |
|
161 | + preg_match('/[\x00-\x08\x12-\x1F\x0B\x0E\x0F]/', $possibleNFO)) { |
|
163 | 162 | @unlink($tmpPath); |
164 | 163 | return false; |
165 | 164 | } |