@@ -10,26 +10,26 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | if (isset($argv[1]) && isset($argv[2]) && $argv[2] == "fmyisam") { |
| 12 | 12 | $tbl = $argv[1]; |
| 13 | - printf($cli->header("Converting $tbl")); |
|
| 13 | + printf($cli->header("converting $tbl")); |
|
| 14 | 14 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=FIXED"); |
| 15 | 15 | } else if (isset($argv[1]) && isset($argv[2]) && $argv[2] == "dmyisam") { |
| 16 | 16 | $tbl = $argv[1]; |
| 17 | - printf($cli->header("Converting $tbl")); |
|
| 17 | + printf($cli->header("converting $tbl")); |
|
| 18 | 18 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=DYNAMIC"); |
| 19 | 19 | } else if (isset($argv[1]) && isset($argv[2]) && $argv[2] == "cinnodb") { |
| 20 | 20 | $tbl = $argv[1]; |
| 21 | - printf($cli->header("Converting $tbl")); |
|
| 21 | + printf($cli->header("converting $tbl")); |
|
| 22 | 22 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 23 | 23 | } else if (isset($argv[1]) && isset($argv[2]) && $argv[2] == "dinnodb") { |
| 24 | 24 | $tbl = $argv[1]; |
| 25 | - printf($cli->header("Converting $tbl")); |
|
| 25 | + printf($cli->header("converting $tbl")); |
|
| 26 | 26 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 27 | 27 | } else if (isset($argv[1]) && $argv[1] == "fmyisam") { |
| 28 | 28 | $sql = 'SHOW TABLE STATUS WHERE (Engine != "MyIsam" OR Row_format != "FIXED") AND Engine != "SPHINX"'; |
| 29 | 29 | $tables = $pdo->query($sql); |
| 30 | 30 | foreach ($tables as $row) { |
| 31 | 31 | $tbl = $row['name']; |
| 32 | - printf($cli->header("Converting $tbl")); |
|
| 32 | + printf($cli->header("converting $tbl")); |
|
| 33 | 33 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=FIXED"); |
| 34 | 34 | } |
| 35 | 35 | } else if (isset($argv[1]) && $argv[1] == "dmyisam") { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $tables = $pdo->query($sql); |
| 38 | 38 | foreach ($tables as $row) { |
| 39 | 39 | $tbl = $row['name']; |
| 40 | - printf($cli->header("Converting $tbl")); |
|
| 40 | + printf($cli->header("converting $tbl")); |
|
| 41 | 41 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=DYNAMIC"); |
| 42 | 42 | } |
| 43 | 43 | } else if (isset($argv[1]) && $argv[1] == "dinnodb") { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $tbl !== 'consoleinfo' && |
| 51 | 51 | $tbl !== 'musicinfo' |
| 52 | 52 | ) { |
| 53 | - printf($cli->header("Converting $tbl")); |
|
| 53 | + printf($cli->header("converting $tbl")); |
|
| 54 | 54 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $tables = $pdo->query($sql); |
| 59 | 59 | foreach ($tables as $row) { |
| 60 | 60 | $tbl = $row['name']; |
| 61 | - printf($cli->header("Converting $tbl")); |
|
| 61 | + printf($cli->header("converting $tbl")); |
|
| 62 | 62 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 63 | 63 | } |
| 64 | 64 | } else if (isset($argv[1]) && $argv[1] == "cinnodb") { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $tbl !== 'consoleinfo' && |
| 73 | 73 | $tbl !== 'musicinfo' |
| 74 | 74 | ) { |
| 75 | - printf($cli->header("Converting $tbl")); |
|
| 75 | + printf($cli->header("converting $tbl")); |
|
| 76 | 76 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | $tables = $pdo->query($sql); |
| 81 | 81 | foreach ($tables as $row) { |
| 82 | 82 | $tbl = $row['name']; |
| 83 | - printf($cli->header("Converting $tbl")); |
|
| 83 | + printf($cli->header("converting $tbl")); |
|
| 84 | 84 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 85 | 85 | } |
| 86 | 86 | $sql = 'SHOW TABLE STATUS WHERE Name IN ("release_search_data", "bookinfo", "consoleinfo", "musicinfo") AND (Engine != "InnoDB" || Row_format != "Compressed")'; |
| 87 | 87 | $tables = $pdo->query($sql); |
| 88 | 88 | foreach ($tables as $row) { |
| 89 | 89 | $tbl = $row['name']; |
| 90 | - printf($cli->header("Converting $tbl")); |
|
| 90 | + printf($cli->header("converting $tbl")); |
|
| 91 | 91 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 92 | 92 | } |
| 93 | 93 | } else if (isset($argv[1]) && $argv[1] == "cinnodb-noparts") { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tbl !== 'musicinfo' && |
| 103 | 103 | !preg_match('/parts/', $tbl) |
| 104 | 104 | ) { |
| 105 | - printf($cli->header("Converting $tbl")); |
|
| 105 | + printf($cli->header("converting $tbl")); |
|
| 106 | 106 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -110,28 +110,28 @@ discard block |
||
| 110 | 110 | $tables = $pdo->query($sql); |
| 111 | 111 | foreach ($tables as $row) { |
| 112 | 112 | $tbl = $row['name']; |
| 113 | - printf($cli->header("Converting $tbl")); |
|
| 113 | + printf($cli->header("converting $tbl")); |
|
| 114 | 114 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 115 | 115 | } |
| 116 | 116 | $sql = 'SHOW TABLE STATUS WHERE Name LIKE "parts%" AND (Engine != "MyISAM" || Row_format != "Dynamic")'; |
| 117 | 117 | $tables = $pdo->query($sql); |
| 118 | 118 | foreach ($tables as $row) { |
| 119 | 119 | $tbl = $row['name']; |
| 120 | - printf($cli->header("Converting $tbl")); |
|
| 120 | + printf($cli->header("converting $tbl")); |
|
| 121 | 121 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MyISAM ROW_FORMAT=DYNAMIC"); |
| 122 | 122 | } |
| 123 | 123 | $sql = 'SHOW TABLE STATUS WHERE Name IN ("release_search_data", "bookinfo", "consoleinfo", "musicinfo") AND (Engine != "InnoDB" || Row_format != "Compressed")'; |
| 124 | 124 | $tables = $pdo->query($sql); |
| 125 | 125 | foreach ($tables as $row) { |
| 126 | 126 | $tbl = $row['name']; |
| 127 | - printf($cli->header("Converting $tbl")); |
|
| 127 | + printf($cli->header("converting $tbl")); |
|
| 128 | 128 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 129 | 129 | } |
| 130 | 130 | } else if (isset($argv[1]) && $argv[1] == "collections") { |
| 131 | 131 | $arr = ["parts", "binaries", "collections"]; |
| 132 | 132 | foreach ($arr as $row) { |
| 133 | 133 | $tbl = $row; |
| 134 | - printf($cli->header("Converting $tbl")); |
|
| 134 | + printf($cli->header("converting $tbl")); |
|
| 135 | 135 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=FIXED"); |
| 136 | 136 | } |
| 137 | 137 | } else { |
@@ -390,7 +390,7 @@ |
||
| 390 | 390 | } |
| 391 | 391 | $this->partRepair($groupMySQL); |
| 392 | 392 | $mgrPosters = $this->getMultiGroupPosters(); |
| 393 | - if ($this->allAsMgr === true || ! empty($mgrPosters)) { |
|
| 393 | + if ($this->allAsMgr === true || !empty($mgrPosters)) { |
|
| 394 | 394 | $tableNames = ProcessReleasesMultiGroup::tableNames(); |
| 395 | 395 | $this->partRepair($groupMySQL, $tableNames); |
| 396 | 396 | } |
@@ -747,7 +747,8 @@ discard block |
||
| 747 | 747 | if (!stristr($header['Subject'], 'yEnc')) { |
| 748 | 748 | $header['matches'][1] .= ' yEnc'; |
| 749 | 749 | } |
| 750 | - } else { // It failed to match, so no parts data. Log the Subject IF option is |
|
| 750 | + } else { |
|
| 751 | +// It failed to match, so no parts data. Log the Subject IF option is |
|
| 751 | 752 | // enabled AND it's not prefixed by '"Usenet Index Post' |
| 752 | 753 | if ($this->_showDroppedYEncParts === true && strpos($header['Subject'], '"Usenet Index Post') !== 0) { |
| 753 | 754 | file_put_contents( |
@@ -868,8 +869,7 @@ discard block |
||
| 868 | 869 | "INSERT IGNORE INTO {$this->tableNames['pname']} (binaries_id, number, messageid, partnumber, size) VALUES "; |
| 869 | 870 | |
| 870 | 871 | // Loop articles, figure out files/parts. |
| 871 | - foreach ($headers as $this->header) |
|
| 872 | - { |
|
| 872 | + foreach ($headers as $this->header) { |
|
| 873 | 873 | // Set up the info for inserting into parts/binaries/collections tables. |
| 874 | 874 | if (!isset($articles[$this->header['matches'][1]])) { |
| 875 | 875 | |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | if ($this->_nntp::isError($headers)) { |
| 686 | 686 | $message = ($headers->code == 0 ? 'Unknown error' : $headers->message); |
| 687 | 687 | $this->log( |
| 688 | - "Code {$headers->code}: $message\nSkipping group: {$this->groupMySQL['name']}", |
|
| 688 | + "code {$headers->code}: $message\nSkipping group: {$this->groupMySQL['name']}", |
|
| 689 | 689 | __FUNCTION__, |
| 690 | 690 | Logger::LOG_WARNING, |
| 691 | 691 | 'error' |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | |
| 712 | 712 | $headersRepaired = $rangeNotReceived = $this->headersReceived = $this->headersNotInserted = []; |
| 713 | 713 | |
| 714 | - foreach ($headers AS $header) { |
|
| 714 | + foreach ($headers as $header) { |
|
| 715 | 715 | |
| 716 | 716 | // Check if we got the article or not. |
| 717 | 717 | if (isset($header['Number'])) { |
@@ -23,7 +23,8 @@ |
||
| 23 | 23 | * For example, browsing to `/pages/about/company` will render |
| 24 | 24 | * `/views/pages/about/company.html.php`. |
| 25 | 25 | */ |
| 26 | -class PagesController extends \lithium\action\Controller { |
|
| 26 | +class PagesController extends \lithium\action\Controller |
|
| 27 | +{ |
|
| 27 | 28 | |
| 28 | 29 | public function view() |
| 29 | 30 | { |
@@ -255,7 +255,7 @@ |
||
| 255 | 255 | $this->updateRelease($anidbId['anidbid'], $release['id']); |
| 256 | 256 | |
| 257 | 257 | $this->pdo->log->doEcho( |
| 258 | - $this->pdo->log->headerOver("Matched {$type} AniDB ID: ") . |
|
| 258 | + $this->pdo->log->headerOver("matched {$type} AniDB ID: ") . |
|
| 259 | 259 | $this->pdo->log->primary($anidbId['anidbid']) . |
| 260 | 260 | $this->pdo->log->alternateOver(' Title: ') . |
| 261 | 261 | $this->pdo->log->primary($anidbId['title']) . |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Use cURL To download a web page into a string. |
|
| 193 | - * |
|
| 194 | - * @param array $options See details below. |
|
| 195 | - * |
|
| 196 | - * @return mixed|false |
|
| 197 | - * @access public |
|
| 198 | - * @static |
|
| 199 | - */ |
|
| 192 | + * Use cURL To download a web page into a string. |
|
| 193 | + * |
|
| 194 | + * @param array $options See details below. |
|
| 195 | + * |
|
| 196 | + * @return mixed|false |
|
| 197 | + * @access public |
|
| 198 | + * @static |
|
| 199 | + */ |
|
| 200 | 200 | public static function getUrl(array $options = []) |
| 201 | 201 | { |
| 202 | 202 | $defaults = [ |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | 'useragent' => '', // String ; User agent string. |
| 209 | 209 | 'cookie' => '', // String ; Cookie string. |
| 210 | 210 | 'requestheaders' => [], // Array ; List of request headers. |
| 211 | - // Example: ["Content-Type: application/json", "DNT: 1"] |
|
| 211 | + // Example: ["Content-Type: application/json", "DNT: 1"] |
|
| 212 | 212 | 'verifycert' => true, // Boolean; Verify certificate authenticity? |
| 213 | - // Since curl does not have a verify self signed certs option, |
|
| 214 | - // you should use this instead if your cert is self signed. |
|
| 213 | + // Since curl does not have a verify self signed certs option, |
|
| 214 | + // you should use this instead if your cert is self signed. |
|
| 215 | 215 | ]; |
| 216 | 216 | |
| 217 | 217 | $options += $defaults; |
@@ -200,16 +200,16 @@ discard block |
||
| 200 | 200 | public static function getUrl(array $options = []) |
| 201 | 201 | { |
| 202 | 202 | $defaults = [ |
| 203 | - 'url' => '', // String ; The URL to download. |
|
| 203 | + 'url' => '', // String ; The URL to download. |
|
| 204 | 204 | 'method' => 'get', // String ; Http method, get/post/etc.. |
| 205 | - 'postdata' => '', // String ; Data to send on post method. |
|
| 206 | - 'language' => '', // String ; Language in request header string. |
|
| 205 | + 'postdata' => '', // String ; Data to send on post method. |
|
| 206 | + 'language' => '', // String ; Language in request header string. |
|
| 207 | 207 | 'debug' => false, // Boolean; Show curl debug information. |
| 208 | - 'useragent' => '', // String ; User agent string. |
|
| 209 | - 'cookie' => '', // String ; Cookie string. |
|
| 210 | - 'requestheaders' => [], // Array ; List of request headers. |
|
| 208 | + 'useragent' => '', // String ; User agent string. |
|
| 209 | + 'cookie' => '', // String ; Cookie string. |
|
| 210 | + 'requestheaders' => [], // Array ; List of request headers. |
|
| 211 | 211 | // Example: ["Content-Type: application/json", "DNT: 1"] |
| 212 | - 'verifycert' => true, // Boolean; Verify certificate authenticity? |
|
| 212 | + 'verifycert' => true, // Boolean; Verify certificate authenticity? |
|
| 213 | 213 | // Since curl does not have a verify self signed certs option, |
| 214 | 214 | // you should use this instead if your cert is self signed. |
| 215 | 215 | ]; |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $response = $client->get($url)->getBody()->getContents(); |
| 312 | 312 | } catch (RequestException $e) { |
| 313 | 313 | if ($e->hasResponse()) { |
| 314 | - if($e->getCode() === 404) { |
|
| 314 | + if ($e->getCode() === 404) { |
|
| 315 | 315 | ColorCLI::doEcho(ColorCLI::notice('Data not available on server')); |
| 316 | 316 | } else if ($e->getCode() === 503) { |
| 317 | 317 | ColorCLI::doEcho(ColorCLI::notice('Service unavailable')); |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | public static function maintainanceCheck($outputMessage = true): ?bool |
| 690 | 690 | { |
| 691 | 691 | if (defined('MAINTENANCE_MODE_ENABLED') && MAINTENANCE_MODE_ENABLED === true) { |
| 692 | - if (!in_array($_SERVER['REMOTE_ADDR'], MAINTENANCE_MODE_IP_EXCEPTIONS) ) { |
|
| 692 | + if (!in_array($_SERVER['REMOTE_ADDR'], MAINTENANCE_MODE_IP_EXCEPTIONS)) { |
|
| 693 | 693 | $page = (isset($_GET['page']) ? $_GET['page'] : 'content'); |
| 694 | 694 | switch ($page) { |
| 695 | 695 | case 'api': |
@@ -757,13 +757,13 @@ discard block |
||
| 757 | 757 | public static function xmlToArray(\SimpleXMLElement $xml, $options = array()): array |
| 758 | 758 | { |
| 759 | 759 | $defaults = array( |
| 760 | - 'namespaceSeparator' => ':',//you may want this to be something other than a colon |
|
| 761 | - 'attributePrefix' => '@', //to distinguish between attributes and nodes with the same name |
|
| 762 | - 'alwaysArray' => array(), //array of xml tag names which should always become arrays |
|
| 763 | - 'autoArray' => true, //only create arrays for tags which appear more than once |
|
| 764 | - 'textContent' => '$', //key used for the text content of elements |
|
| 765 | - 'autoText' => true, //skip textContent key if node has no attributes or child nodes |
|
| 766 | - 'keySearch' => false, //optional search and replace on tag and attribute names |
|
| 760 | + 'namespaceSeparator' => ':', //you may want this to be something other than a colon |
|
| 761 | + 'attributePrefix' => '@', //to distinguish between attributes and nodes with the same name |
|
| 762 | + 'alwaysArray' => array(), //array of xml tag names which should always become arrays |
|
| 763 | + 'autoArray' => true, //only create arrays for tags which appear more than once |
|
| 764 | + 'textContent' => '$', //key used for the text content of elements |
|
| 765 | + 'autoText' => true, //skip textContent key if node has no attributes or child nodes |
|
| 766 | + 'keySearch' => false, //optional search and replace on tag and attribute names |
|
| 767 | 767 | 'keyReplace' => false //replace values for above search values (as passed to str_replace()) |
| 768 | 768 | ); |
| 769 | 769 | $options = array_merge($defaults, $options); |
@@ -899,8 +899,8 @@ discard block |
||
| 899 | 899 | { |
| 900 | 900 | // Check to make sure the user has their settings correct. |
| 901 | 901 | if (PHPMAILER_USE_SMTP === true) { |
| 902 | - if ((! \defined('PHPMAILER_SMTP_HOST') || PHPMAILER_SMTP_HOST === '') || |
|
| 903 | - (! \defined('PHPMAILER_SMTP_PORT') || PHPMAILER_SMTP_PORT === '') |
|
| 902 | + if ((!\defined('PHPMAILER_SMTP_HOST') || PHPMAILER_SMTP_HOST === '') || |
|
| 903 | + (!\defined('PHPMAILER_SMTP_PORT') || PHPMAILER_SMTP_PORT === '') |
|
| 904 | 904 | ) { |
| 905 | 905 | throw new PHPMailerException( |
| 906 | 906 | 'You opted to use SMTP but the PHPMAILER_SMTP_HOST and/or PHPMAILER_SMTP_PORT is/are not defined correctly! Either fix the missing/incorrect values or change PHPMAILER_USE_SMTP to false in the www/settings.php' |
@@ -909,8 +909,8 @@ discard block |
||
| 909 | 909 | |
| 910 | 910 | // If the user enabled SMTP & Auth but did not setup credentials, throw an exception. |
| 911 | 911 | if (\defined('PHPMAILER_SMTP_AUTH') && PHPMAILER_SMTP_AUTH === true) { |
| 912 | - if ((! \defined('PHPMAILER_SMTP_USER') || PHPMAILER_SMTP_USER === '') || |
|
| 913 | - (! \defined('PHPMAILER_SMTP_PASSWORD') || PHPMAILER_SMTP_PASSWORD === '') |
|
| 912 | + if ((!\defined('PHPMAILER_SMTP_USER') || PHPMAILER_SMTP_USER === '') || |
|
| 913 | + (!\defined('PHPMAILER_SMTP_PASSWORD') || PHPMAILER_SMTP_PASSWORD === '') |
|
| 914 | 914 | ) { |
| 915 | 915 | throw new PHPMailerException( |
| 916 | 916 | 'You opted to use SMTP and SMTP Auth but the PHPMAILER_SMTP_USER and/or PHPMAILER_SMTP_PASSWORD is/are not defined correctly. Please set them in www/settings.php' |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | * |
| 928 | 928 | * @todo Log this failure. |
| 929 | 929 | */ |
| 930 | - if (! ($mail instanceof \PHPMailer\PHPMailer\PHPMailer)) { |
|
| 930 | + if (!($mail instanceof \PHPMailer\PHPMailer\PHPMailer)) { |
|
| 931 | 931 | $result = self::sendEmailViaPHP($to, $subject, $body, $from); |
| 932 | 932 | } else { |
| 933 | 933 | $mail->isHTML(true); |
@@ -947,11 +947,9 @@ discard block |
||
| 947 | 947 | } |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | - $fromEmail = (PHPMAILER_FROM_EMAIL === '') ? Settings::value('site.main.email') : |
|
| 951 | - PHPMAILER_FROM_EMAIL; |
|
| 952 | - $fromName = (PHPMAILER_FROM_NAME === '') ? Settings::value('site.main.title') : |
|
| 953 | - PHPMAILER_FROM_NAME; |
|
| 954 | - $replyTo = ! empty($from) ? $from : PHPMAILER_REPLYTO; |
|
| 950 | + $fromEmail = (PHPMAILER_FROM_EMAIL === '') ? Settings::value('site.main.email') : PHPMAILER_FROM_EMAIL; |
|
| 951 | + $fromName = (PHPMAILER_FROM_NAME === '') ? Settings::value('site.main.title') : PHPMAILER_FROM_NAME; |
|
| 952 | + $replyTo = !empty($from) ? $from : PHPMAILER_REPLYTO; |
|
| 955 | 953 | |
| 956 | 954 | if (PHPMAILER_BCC !== '') { |
| 957 | 955 | $mail->addBCC(PHPMAILER_BCC); |
@@ -966,7 +964,7 @@ discard block |
||
| 966 | 964 | |
| 967 | 965 | $result = $mail->send(); |
| 968 | 966 | |
| 969 | - if (! $result) { |
|
| 967 | + if (!$result) { |
|
| 970 | 968 | //@todo Log failed email send attempt. |
| 971 | 969 | throw new PHPMailerException('Unable to send mail. Error: ' . $mail->ErrorInfo); |
| 972 | 970 | } |
@@ -1040,7 +1038,7 @@ discard block |
||
| 1040 | 1038 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . |
| 1041 | 1039 | '<error code="' . $status . '" description="' . $message . "\"/>\n"; |
| 1042 | 1040 | header('Content-type: text/xml'); |
| 1043 | - header('Content-Length: ' . \strlen($response) ); |
|
| 1041 | + header('Content-Length: ' . \strlen($response)); |
|
| 1044 | 1042 | header('X-nZEDb: API ERROR [' . $status . '] ' . $message); |
| 1045 | 1043 | http_response_code($status); |
| 1046 | 1044 | |
@@ -775,8 +775,10 @@ discard block |
||
| 775 | 775 | //get attributes from all namespaces |
| 776 | 776 | foreach ($xml->attributes($namespace) as $attributeName => $attribute) { |
| 777 | 777 | //replace characters in attribute name |
| 778 | - if ($options['keySearch']) $attributeName = |
|
| 778 | + if ($options['keySearch']) { |
|
| 779 | + $attributeName = |
|
| 779 | 780 | str_replace($options['keySearch'], $options['keyReplace'], $attributeName); |
| 781 | + } |
|
| 780 | 782 | $attributeKey = $options['attributePrefix'] |
| 781 | 783 | . ($prefix ? $prefix . $options['namespaceSeparator'] : '') |
| 782 | 784 | . $attributeName; |
@@ -790,10 +792,14 @@ discard block |
||
| 790 | 792 | $childProperties = current($childArray); |
| 791 | 793 | |
| 792 | 794 | //replace characters in tag name |
| 793 | - if ($options['keySearch']) $childTagName = |
|
| 795 | + if ($options['keySearch']) { |
|
| 796 | + $childTagName = |
|
| 794 | 797 | str_replace($options['keySearch'], $options['keyReplace'], $childTagName); |
| 798 | + } |
|
| 795 | 799 | //add namespace prefix, if any |
| 796 | - if ($prefix) $childTagName = $prefix . $options['namespaceSeparator'] . $childTagName; |
|
| 800 | + if ($prefix) { |
|
| 801 | + $childTagName = $prefix . $options['namespaceSeparator'] . $childTagName; |
|
| 802 | + } |
|
| 797 | 803 | |
| 798 | 804 | if (!isset($tagsArray[$childTagName])) { |
| 799 | 805 | //only entry with this key |
@@ -817,7 +823,9 @@ discard block |
||
| 817 | 823 | //get text content of node |
| 818 | 824 | $textContentArray = array(); |
| 819 | 825 | $plainText = trim((string)$xml); |
| 820 | - if ($plainText !== '') $textContentArray[$options['textContent']] = $plainText; |
|
| 826 | + if ($plainText !== '') { |
|
| 827 | + $textContentArray[$options['textContent']] = $plainText; |
|
| 828 | + } |
|
| 821 | 829 | |
| 822 | 830 | //stick it all together |
| 823 | 831 | $propertiesArray = !$options['autoText'] || $attributesArray || $tagsArray || ($plainText === '') |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if (! \preg_match("/\n/i", $_POST['useremail'])) { |
|
| 25 | + if (!\preg_match("/\n/i", $_POST['useremail'])) { |
|
| 26 | 26 | Misc::sendEmail($mailto, $mailsubj, $mailbody, $email); |
| 27 | 27 | } |
| 28 | 28 | $msg = "<h2 style='text-align:center;'>Thank you for getting in touch with " . $title . '.</h2>'; |
@@ -197,7 +197,7 @@ |
||
| 197 | 197 | $rows = \file($options['file']); |
| 198 | 198 | |
| 199 | 199 | if (! \is_array($rows)) { |
| 200 | - throw new \InvalidArgumentException("File {$options['file']} did not return a list of rows!"); |
|
| 200 | + throw new \InvalidArgumentException("file {$options['file']} did not return a list of rows!"); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | // Move the column names/order off of the array. |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | //$groups = new Groups(); |
| 119 | 119 | /* @var $ids string[][] */ |
| 120 | 120 | foreach ($ids as $groupID) { |
| 121 | - if (! \in_array('binaries_' . $groupID, $binaries, false) || |
|
| 122 | - ! \in_array('collections_' . $groupID, $collections, false) || |
|
| 123 | - ! \in_array('parts_' . $groupID, $parts, false) |
|
| 121 | + if (!\in_array('binaries_' . $groupID, $binaries, false) || |
|
| 122 | + !\in_array('collections_' . $groupID, $collections, false) || |
|
| 123 | + !\in_array('parts_' . $groupID, $parts, false) |
|
| 124 | 124 | ) { |
| 125 | 125 | echo "Creating missing tables for group id: $groupID" . PHP_EOL; |
| 126 | 126 | $errors[] = $groupID; |
@@ -199,16 +199,16 @@ discard block |
||
| 199 | 199 | $fix = $output = $test = ''; |
| 200 | 200 | \extract($options, EXTR_IF_EXISTS | EXTR_REFS); // create short-name variable refs |
| 201 | 201 | |
| 202 | - if (! \is_callable($test)) { |
|
| 202 | + if (!\is_callable($test)) { |
|
| 203 | 203 | throw new \InvalidArgumentException('The option "test" must be a closure to perform the test!'); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if (! \file_exists($options['file'])) { |
|
| 206 | + if (!\file_exists($options['file'])) { |
|
| 207 | 207 | throw new \InvalidArgumentException("Unable to find {$options['file']}!"); |
| 208 | 208 | } |
| 209 | 209 | $rows = \file($options['file']); |
| 210 | 210 | |
| 211 | - if (! \is_array($rows)) { |
|
| 211 | + if (!\is_array($rows)) { |
|
| 212 | 212 | throw new \InvalidArgumentException("File {$options['file']} did not return a list of rows!"); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -17,6 +17,6 @@ |
||
| 17 | 17 | |
| 18 | 18 | use nzedb\libraries\Forking; |
| 19 | 19 | |
| 20 | -declare(ticks = 1); |
|
| 20 | +declare(ticks=1); |
|
| 21 | 21 | |
| 22 | 22 | (new Forking())->processWorkType('postProcess_' . $argv[1], (isset($argv[2]) && $argv[2] === 'true' ? [0 => true] : [])); |
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use nzedb\libraries\Forking; |
| 6 | 6 | |
| 7 | -declare(ticks = 1); |
|
| 7 | +declare(ticks=1); |
|
| 8 | 8 | |
| 9 | 9 | (new Forking())->processWorkType('releases'); |