@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | $rssToken = $page->userdata['rsstoken']; |
| 58 | 58 | $maxRequests = $page->userdata['apirequests']; |
| 59 | 59 | $downloadLimit = $page->userdata['downloadrequests']; |
| 60 | - $apiRequests = $page->users->getApiRequests($uid); |
|
| 61 | - $grabs = $page->userdata['grabs']; |
|
| 60 | + $apiRequests = $page->users->getApiRequests($uid); |
|
| 61 | + $grabs = $page->userdata['grabs']; |
|
| 62 | 62 | } else { |
| 63 | 63 | if (Settings::value('..registerstatus') == Settings::REGISTER_STATUS_API_ONLY) { |
| 64 | 64 | $res = $page->users->getById(0); |
@@ -114,10 +114,10 @@ discard block |
||
| 114 | 114 | 'extended' => 1, |
| 115 | 115 | 'uid' => $uid, |
| 116 | 116 | 'token' => $rssToken, |
| 117 | - 'apilimit' => $maxRequests, |
|
| 118 | - 'apirequests' => $apiRequests, |
|
| 119 | - 'downloadlimit' => $downloadLimit, |
|
| 120 | - 'grabs' => $grabs, |
|
| 117 | + 'apilimit' => $maxRequests, |
|
| 118 | + 'apirequests' => $apiRequests, |
|
| 119 | + 'downloadlimit' => $downloadLimit, |
|
| 120 | + 'grabs' => $grabs, |
|
| 121 | 121 | ]; |
| 122 | 122 | |
| 123 | 123 | if ($userCat == -3) { |
@@ -372,15 +372,15 @@ |
||
| 372 | 372 | $this->xml->endElement(); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - public function includeLimits(): void |
|
| 376 | - { |
|
| 377 | - $this->xml->startElement($this->namespace.':apilimits'); |
|
| 378 | - $this->xml->writeAttribute('apiCurrent', $this->parameters['apirequests']); |
|
| 379 | - $this->xml->writeAttribute('apiMax', $this->parameters['apilimit']); |
|
| 380 | - $this->xml->writeAttribute('grabCurrent', $this->parameters['grabs']); |
|
| 381 | - $this->xml->writeAttribute('grabMax', $this->parameters['downloadlimit']); |
|
| 382 | - $this->xml->endElement(); |
|
| 383 | - } |
|
| 375 | + public function includeLimits(): void |
|
| 376 | + { |
|
| 377 | + $this->xml->startElement($this->namespace.':apilimits'); |
|
| 378 | + $this->xml->writeAttribute('apiCurrent', $this->parameters['apirequests']); |
|
| 379 | + $this->xml->writeAttribute('apiMax', $this->parameters['apilimit']); |
|
| 380 | + $this->xml->writeAttribute('grabCurrent', $this->parameters['grabs']); |
|
| 381 | + $this->xml->writeAttribute('grabMax', $this->parameters['downloadlimit']); |
|
| 382 | + $this->xml->endElement(); |
|
| 383 | + } |
|
| 384 | 384 | |
| 385 | 385 | /** |
| 386 | 386 | * Loop through the releases and add their info to the XML stream |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | protected function returnCaps(): string |
| 149 | 149 | { |
| 150 | - $w =& $this->xml; |
|
| 150 | + $w = & $this->xml; |
|
| 151 | 151 | $s = $this->server; |
| 152 | 152 | |
| 153 | 153 | $w->startDocument('1.0', 'UTF-8'); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | protected function returnApiRss(): string |
| 172 | 172 | { |
| 173 | - $w =& $this->xml; |
|
| 173 | + $w = & $this->xml; |
|
| 174 | 174 | $w->startDocument('1.0', 'UTF-8'); |
| 175 | 175 | $this->includeRssAtom(); // Open RSS |
| 176 | 176 | $w->startElement('channel'); // Open channel |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | protected function addNode(array $element): void |
| 214 | 214 | { |
| 215 | 215 | $this->xml->startElement($element['name']); |
| 216 | - foreach($element['data'] AS $attr => $val) { |
|
| 216 | + foreach ($element['data'] AS $attr => $val) { |
|
| 217 | 217 | $this->xml->writeAttribute($attr, $val); |
| 218 | 218 | } |
| 219 | 219 | $this->xml->endElement(); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | protected function addNodes($element): void |
| 230 | 230 | { |
| 231 | 231 | $this->xml->startElement($element['name']); |
| 232 | - foreach($element['data'] AS $elem => $value) { |
|
| 232 | + foreach ($element['data'] AS $elem => $value) { |
|
| 233 | 233 | $subelement['name'] = $elem; |
| 234 | 234 | $subelement['data'] = $value; |
| 235 | 235 | $this->addNode($subelement); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $this->xml->writeAttribute('description', html_entity_decode($p['description'])); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - foreach($p['subcatlist'] AS $c) |
|
| 258 | + foreach ($p['subcatlist'] AS $c) |
|
| 259 | 259 | { |
| 260 | 260 | $this->xml->startElement('subcat'); |
| 261 | 261 | $this->xml->writeAttribute('id', $c['id']); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | protected function includeRssAtom(): void |
| 278 | 278 | { |
| 279 | - switch($this->namespace) { |
|
| 279 | + switch ($this->namespace) { |
|
| 280 | 280 | case 'newznab': |
| 281 | 281 | $url = 'http://www.newznab.com/DTD/2010/feeds/attributes/'; |
| 282 | 282 | break; |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | { |
| 320 | 320 | $server = $this->server['server']; |
| 321 | 321 | |
| 322 | - switch($this->namespace) { |
|
| 322 | + switch ($this->namespace) { |
|
| 323 | 323 | case 'newznab': |
| 324 | 324 | $path = 'apihelp/'; |
| 325 | 325 | $tag = 'API'; |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | */ |
| 367 | 367 | public function includeTotalRows(): void |
| 368 | 368 | { |
| 369 | - $this->xml->startElement($this->namespace.":response"); |
|
| 369 | + $this->xml->startElement($this->namespace . ":response"); |
|
| 370 | 370 | $this->xml->writeAttribute('offset', $this->offset); |
| 371 | 371 | $this->xml->writeAttribute('total', isset($this->releases[0]['_totalrows']) ? $this->releases[0]['_totalrows'] : 0); |
| 372 | 372 | $this->xml->endElement(); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | public function includeLimits(): void |
| 376 | 376 | { |
| 377 | - $this->xml->startElement($this->namespace.':apilimits'); |
|
| 377 | + $this->xml->startElement($this->namespace . ':apilimits'); |
|
| 378 | 378 | $this->xml->writeAttribute('apiCurrent', $this->parameters['apirequests']); |
| 379 | 379 | $this->xml->writeAttribute('apiMax', $this->parameters['apilimit']); |
| 380 | 380 | $this->xml->writeAttribute('grabCurrent', $this->parameters['grabs']); |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | public function includeReleases(): void |
| 391 | 391 | { |
| 392 | - if(is_array($this->releases) && !empty($this->releases)) { |
|
| 392 | + if (is_array($this->releases) && !empty($this->releases)) { |
|
| 393 | 393 | foreach ($this->releases AS $this->release) { |
| 394 | 394 | $this->xml->startElement('item'); |
| 395 | 395 | $this->includeReleaseMain(); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | } else { |
| 426 | 426 | $this->writeRssCdata(); |
| 427 | 427 | } |
| 428 | - if((isset($this->parameters['dl']) && $this->parameters['dl'] == 1) || !isset($this->parameters['dl'])) { |
|
| 428 | + if ((isset($this->parameters['dl']) && $this->parameters['dl'] == 1) || !isset($this->parameters['dl'])) { |
|
| 429 | 429 | $this->xml->startElement('enclosure'); |
| 430 | 430 | $this->xml->writeAttribute( |
| 431 | 431 | 'url', |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | if ($this->parameters['extended'] == 1) { |
| 459 | 459 | $this->writeZedAttr('files', $this->release['totalpart']); |
| 460 | 460 | $this->writeZedAttr('poster', $this->release['fromname']); |
| 461 | - if(($this->release['videos_id'] > 0 || $this->release['tv_episodes_id'] > 0) && $this->namespace === 'newznab') { |
|
| 461 | + if (($this->release['videos_id'] > 0 || $this->release['tv_episodes_id'] > 0) && $this->namespace === 'newznab') { |
|
| 462 | 462 | $this->setTvAttr(); |
| 463 | 463 | } |
| 464 | 464 | |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | $p = $this->parameters; |
| 569 | 569 | |
| 570 | 570 | $this->cdata = "\n\t<div>\n"; |
| 571 | - switch(true) { |
|
| 571 | + switch (true) { |
|
| 572 | 572 | case !empty($r['cover']): |
| 573 | 573 | $dir = 'movies'; |
| 574 | 574 | $column = 'imdbid'; |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | $cData = $this->buildCdata($musicCol); |
| 678 | 678 | |
| 679 | - if ($r['mu_url'] !== '' ) { |
|
| 679 | + if ($r['mu_url'] !== '') { |
|
| 680 | 680 | $cDataUrl = "<li>Amazon: <a href=\"{$r['mu_url']}\">{$r['mu_title']}</a></li>"; |
| 681 | 681 | } |
| 682 | 682 | |
@@ -246,8 +246,7 @@ discard block |
||
| 246 | 246 | { |
| 247 | 247 | $this->xml->startElement('categories'); |
| 248 | 248 | |
| 249 | - foreach ($this->server['categories'] AS $p) |
|
| 250 | - { |
|
| 249 | + foreach ($this->server['categories'] AS $p) { |
|
| 251 | 250 | $this->xml->startElement('category'); |
| 252 | 251 | $this->xml->writeAttribute('id', $p['id']); |
| 253 | 252 | $this->xml->writeAttribute('name', html_entity_decode($p['title'])); |
@@ -255,8 +254,7 @@ discard block |
||
| 255 | 254 | $this->xml->writeAttribute('description', html_entity_decode($p['description'])); |
| 256 | 255 | } |
| 257 | 256 | |
| 258 | - foreach($p['subcatlist'] AS $c) |
|
| 259 | - { |
|
| 257 | + foreach($p['subcatlist'] AS $c) { |
|
| 260 | 258 | $this->xml->startElement('subcat'); |
| 261 | 259 | $this->xml->writeAttribute('id', $c['id']); |
| 262 | 260 | $this->xml->writeAttribute('name', html_entity_decode($c['title'])); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | protected function addNode(array $element): void |
| 214 | 214 | { |
| 215 | 215 | $this->xml->startElement($element['name']); |
| 216 | - foreach($element['data'] AS $attr => $val) { |
|
| 216 | + foreach($element['data'] as $attr => $val) { |
|
| 217 | 217 | $this->xml->writeAttribute($attr, $val); |
| 218 | 218 | } |
| 219 | 219 | $this->xml->endElement(); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | protected function addNodes($element): void |
| 230 | 230 | { |
| 231 | 231 | $this->xml->startElement($element['name']); |
| 232 | - foreach($element['data'] AS $elem => $value) { |
|
| 232 | + foreach($element['data'] as $elem => $value) { |
|
| 233 | 233 | $subelement['name'] = $elem; |
| 234 | 234 | $subelement['data'] = $value; |
| 235 | 235 | $this->addNode($subelement); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | { |
| 247 | 247 | $this->xml->startElement('categories'); |
| 248 | 248 | |
| 249 | - foreach ($this->server['categories'] AS $p) |
|
| 249 | + foreach ($this->server['categories'] as $p) |
|
| 250 | 250 | { |
| 251 | 251 | $this->xml->startElement('category'); |
| 252 | 252 | $this->xml->writeAttribute('id', $p['id']); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $this->xml->writeAttribute('description', html_entity_decode($p['description'])); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - foreach($p['subcatlist'] AS $c) |
|
| 258 | + foreach($p['subcatlist'] as $c) |
|
| 259 | 259 | { |
| 260 | 260 | $this->xml->startElement('subcat'); |
| 261 | 261 | $this->xml->writeAttribute('id', $c['id']); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | public function includeReleases(): void |
| 391 | 391 | { |
| 392 | 392 | if(is_array($this->releases) && !empty($this->releases)) { |
| 393 | - foreach ($this->releases AS $this->release) { |
|
| 393 | + foreach ($this->releases as $this->release) { |
|
| 394 | 394 | $this->xml->startElement('item'); |
| 395 | 395 | $this->includeReleaseMain(); |
| 396 | 396 | $this->setZedAttributes(); |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | if ($r['mu_tracks'] != '') { |
| 691 | 691 | $tracks = explode('|', $r['mu_tracks']); |
| 692 | 692 | if (count($tracks) > 0) { |
| 693 | - foreach ($tracks AS $track) { |
|
| 693 | + foreach ($tracks as $track) { |
|
| 694 | 694 | $track = trim($track); |
| 695 | 695 | $tData .= "<li>{$track}</li>"; |
| 696 | 696 | } |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | |
| 739 | 739 | $cData = ''; |
| 740 | 740 | |
| 741 | - foreach ($columns AS $info) { |
|
| 741 | + foreach ($columns as $info) { |
|
| 742 | 742 | if (!empty($r[$info])) { |
| 743 | 743 | if ($info == 'mu_releasedate') { |
| 744 | 744 | $ucInfo = 'Released'; |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | public function __construct(array $options = []) |
| 105 | 105 | { |
| 106 | 106 | $defaults = [ |
| 107 | - 'Browser' => false, // Was this started from the browser? |
|
| 108 | - 'Echo' => true, // Echo to CLI? |
|
| 107 | + 'Browser' => false, // Was this started from the browser? |
|
| 108 | + 'Echo' => true, // Echo to CLI? |
|
| 109 | 109 | 'Binaries' => null, |
| 110 | 110 | 'Categorize' => null, |
| 111 | 111 | 'NZB' => null, |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // Make a fake message array to use to check the blacklist. |
| 295 | - $msg = ["Subject" => (string)$file->attributes()->subject, "From" => (string) $file->attributes()->poster, "'Message-ID'" => ""]; |
|
| 295 | + $msg = ["Subject" => (string)$file->attributes()->subject, "From" => (string)$file->attributes()->poster, "'Message-ID'" => ""]; |
|
| 296 | 296 | |
| 297 | 297 | // Get the group names, groups_id, check if it's blacklisted. |
| 298 | 298 | $groupArr = []; |
@@ -109,15 +109,16 @@ discard block |
||
| 109 | 109 | $sql = 'LOAD DATA ' . $local . 'INFILE "%s" IGNORE INTO TABLE `%s` FIELDS TERMINATED BY "\t" ' . |
| 110 | 110 | $enclosedby . ' LINES TERMINATED BY "\r\n" IGNORE 1 LINES (%s)'; |
| 111 | 111 | foreach ($files as $file) { |
| 112 | - if ($show === true) |
|
| 113 | - { |
|
| 112 | + if ($show === true) { |
|
| 114 | 113 | echo "File: $file\n"; |
| 115 | 114 | } |
| 116 | 115 | |
| 117 | 116 | $fileTarget = '/tmp/' . pathinfo($file, PATHINFO_BASENAME); |
| 118 | - if (\copy($file, $fileTarget)) // Copy to a directory accessible to all (for mysql user) |
|
| 117 | + if (\copy($file, $fileTarget)) { |
|
| 118 | + // Copy to a directory accessible to all (for mysql user) |
|
| 119 | 119 | { |
| 120 | 120 | $file = $fileTarget; |
| 121 | + } |
|
| 121 | 122 | \chmod($file, 0775); |
| 122 | 123 | } else { |
| 123 | 124 | echo 'Failed to copy file: ' . $file . '</br>' . \PHP_EOL; |
@@ -125,28 +126,23 @@ discard block |
||
| 125 | 126 | } |
| 126 | 127 | |
| 127 | 128 | if (is_readable($file)) { |
| 128 | - if (preg_match($options['regex'], $file, $matches)) |
|
| 129 | - { |
|
| 129 | + if (preg_match($options['regex'], $file, $matches)) { |
|
| 130 | 130 | $table = $matches['table']; |
| 131 | 131 | // Get the first line of the file which holds the columns used. |
| 132 | 132 | $handle = @fopen($file, 'r'); |
| 133 | - if (is_resource($handle)) |
|
| 134 | - { |
|
| 133 | + if (is_resource($handle)) { |
|
| 135 | 134 | $line = fgets($handle); |
| 136 | 135 | fclose($handle); |
| 137 | - if ($line === false) |
|
| 138 | - { |
|
| 136 | + if ($line === false) { |
|
| 139 | 137 | echo "FAILED reading first line of '$file'\n"; |
| 140 | 138 | continue; |
| 141 | 139 | } |
| 142 | 140 | $fields = trim($line); |
| 143 | 141 | |
| 144 | - if ($show === true) |
|
| 145 | - { |
|
| 142 | + if ($show === true) { |
|
| 146 | 143 | echo "Inserting data into table: '$table'\n"; |
| 147 | 144 | } |
| 148 | - if (Misc::isWin()) |
|
| 149 | - { |
|
| 145 | + if (Misc::isWin()) { |
|
| 150 | 146 | $file = str_replace("\\", '\/', $file); |
| 151 | 147 | } |
| 152 | 148 | $this->pdo->exec(sprintf($sql, $file, $table, $fields)); |
@@ -743,12 +743,12 @@ discard block |
||
| 743 | 743 | $mov['backdrop'] = $this->releaseImage->saveImage($imdb->getIdPadded() . '-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024); |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - $mov['title'] = $this->setTmdbImdbTraktVar($imdb['title'], $tmdb['title'], $trakt['title']); |
|
| 747 | - $mov['rating'] = $this->setTmdbImdbTraktVar($imdb['rating'], $tmdb['rating'], $trakt['rating']); |
|
| 748 | - $mov['plot'] = $this->setTmdbImdbTraktVar($imdb['plot'], $tmdb['plot'], $trakt['overview']); |
|
| 746 | + $mov['title'] = $this->setTmdbImdbTraktVar($imdb['title'], $tmdb['title'], $trakt['title']); |
|
| 747 | + $mov['rating'] = $this->setTmdbImdbTraktVar($imdb['rating'], $tmdb['rating'], $trakt['rating']); |
|
| 748 | + $mov['plot'] = $this->setTmdbImdbTraktVar($imdb['plot'], $tmdb['plot'], $trakt['overview']); |
|
| 749 | 749 | $mov['tagline'] = $this->setTmdbImdbTraktVar($imdb['tagline'], $tmdb['tagline'], $trakt['tagline']); |
| 750 | - $mov['year'] = $this->setTmdbImdbTraktVar($imdb['year'], $tmdb['year'], $trakt['year']); |
|
| 751 | - $mov['genre'] = $this->setTmdbImdbTraktVar($imdb['genre'], $tmdb['genre'], $trakt['genres']); |
|
| 750 | + $mov['year'] = $this->setTmdbImdbTraktVar($imdb['year'], $tmdb['year'], $trakt['year']); |
|
| 751 | + $mov['genre'] = $this->setTmdbImdbTraktVar($imdb['genre'], $tmdb['genre'], $trakt['genres']); |
|
| 752 | 752 | |
| 753 | 753 | if ($this->checkVariable($imdb['type'])) { |
| 754 | 754 | $mov['type'] = $imdb['type']; |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $mov['type'] = implode(', ', array_unique($mov['type'])); |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | - $mov['title'] = html_entity_decode($mov['title'] , ENT_QUOTES, 'UTF-8'); |
|
| 777 | + $mov['title'] = html_entity_decode($mov['title'], ENT_QUOTES, 'UTF-8'); |
|
| 778 | 778 | |
| 779 | 779 | $mov['title'] = str_replace(['/', '\\'], '', $mov['title']); |
| 780 | 780 | $movieID = $this->update([ |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | * |
| 89 | 89 | * @return void |
| 90 | 90 | */ |
| 91 | - public function setId(int $id ): void |
|
| 91 | + public function setId(int $id): void |
|
| 92 | 92 | { |
| 93 | 93 | $this->id = $id; |
| 94 | 94 | } |