@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | CURLOPT_CONNECTTIMEOUT => 10, |
| 59 | 59 | CURLOPT_SSL_VERIFYHOST => 2, |
| 60 | 60 | CURLOPT_SSL_VERIFYPEER => 1, |
| 61 | - CURLOPT_CAINFO => realpath(__DIR__ . '/../ca-chain.crt'), |
|
| 61 | + CURLOPT_CAINFO => realpath(__DIR__.'/../ca-chain.crt'), |
|
| 62 | 62 | ]; |
| 63 | 63 | |
| 64 | 64 | $hardOptions = [ |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $responseHeaders = []; |
| 79 | 79 | |
| 80 | 80 | } elseif (in_array(substr($line, 0, 1), [' ', "\t"], TRUE)) { |
| 81 | - $responseHeaders[$last] .= ' ' . trim($line); # RFC2616, 2.2 |
|
| 81 | + $responseHeaders[$last] .= ' '.trim($line); # RFC2616, 2.2 |
|
| 82 | 82 | |
| 83 | 83 | } elseif ($line !== "\r\n") { |
| 84 | 84 | list($name, $value) = explode(':', $line, 2); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $result = curl_setopt_array($this->curl, $hardOptions + ($this->options ?: []) + $softOptions); |
| 104 | 104 | if ($result === FALSE) { |
| 105 | - throw new BadResponseException('Setting cURL options failed: ' . curl_error($this->curl), curl_errno($this->curl)); |
|
| 105 | + throw new BadResponseException('Setting cURL options failed: '.curl_error($this->curl), curl_errno($this->curl)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $content = curl_exec($this->curl); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | $code = curl_getinfo($this->curl, CURLINFO_HTTP_CODE); |
| 114 | 114 | if ($code === FALSE) { |
| 115 | - throw new BadResponseException('HTTP status code is missing:' . curl_error($this->curl), curl_errno($this->curl)); |
|
| 115 | + throw new BadResponseException('HTTP status code is missing:'.curl_error($this->curl), curl_errno($this->curl)); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | return new Response($code, $responseHeaders, $content); |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | |
| 65 | 65 | $this->storage->set('auth.state', $state); |
| 66 | 66 | |
| 67 | - $url = $this->authUrl . '?' . http_build_query($params); |
|
| 67 | + $url = $this->authUrl.'?'.http_build_query($params); |
|
| 68 | 68 | if ($redirectCb === NULL) { |
| 69 | 69 | header("Location: $url"); |
| 70 | 70 | die(); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | throw new MissingDirectoryException("Directory '$tempDir' is missing."); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $dir = $tempDir . DIRECTORY_SEPARATOR . 'milo.github-api'; |
|
| 30 | + $dir = $tempDir.DIRECTORY_SEPARATOR.'milo.github-api'; |
|
| 31 | 31 | |
| 32 | 32 | if (!is_dir($dir)) { |
| 33 | 33 | set_error_handler(function($severity, $message, $file, $line) use ($dir, & $valid) { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | private function filePath($key) |
| 93 | 93 | { |
| 94 | - return $this->dir . DIRECTORY_SEPARATOR . sha1($key) . '.php'; |
|
| 94 | + return $this->dir.DIRECTORY_SEPARATOR.sha1($key).'.php'; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | } |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | $editorMaxchar = $helper->getConfig('editor_maxchar'); |
| 123 | 123 | $ret = $this->getValues($keys, $format, $maxDepth); |
| 124 | 124 | $ret['id'] = $this->getVar('log_id'); |
| 125 | - $ret['type'] = $this->getVar('log_type'); |
|
| 125 | + $ret['type'] = $this->getVar('log_type'); |
|
| 126 | 126 | switch ($ret['type']) { |
| 127 | 127 | case Constants::LOG_TYPE_NONE: |
| 128 | 128 | default: |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | public const PERM_README_UPDATE = 3; |
| 53 | 53 | |
| 54 | 54 | // Constants for log type |
| 55 | - public const LOG_TYPE_NONE = 0; |
|
| 55 | + public const LOG_TYPE_NONE = 0; |
|
| 56 | 56 | public const LOG_TYPE_UPDATE_START = 1; |
| 57 | 57 | public const LOG_TYPE_UPDATE_END = 2; |
| 58 | 58 | public const LOG_TYPE_REQUEST = 3; |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | $logsObj->setVar('log_type', $type); |
| 143 | 143 | $logsObj->setVar('log_details', $detail); |
| 144 | 144 | $logsObj->setVar('log_result', $result); |
| 145 | - $logsObj->setVar('log_datecreated',time()); |
|
| 145 | + $logsObj->setVar('log_datecreated', time()); |
|
| 146 | 146 | $logsObj->setVar('log_submitter', $submitter); |
| 147 | 147 | // Insert Data |
| 148 | 148 | if ($logsHandler->insert($logsObj)) { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function getUserRepositories($username, $per_page = 100, $page = 1) |
| 112 | 112 | { |
| 113 | - $url = static::BASE_URL . 'users/' . \rawurlencode($username) . '/repos?per_page=' . $per_page . '&page=' . $page; |
|
| 113 | + $url = static::BASE_URL.'users/'.\rawurlencode($username).'/repos?per_page='.$per_page.'&page='.$page; |
|
| 114 | 114 | |
| 115 | 115 | return $this->_get($url); |
| 116 | 116 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function getOrgRepositories($org, $per_page = 100, $page = 1) |
| 127 | 127 | { |
| 128 | - $url = static::BASE_URL . 'orgs/' . \rawurlencode($org) . '/repos?per_page=' . $per_page . '&page=' . $page; |
|
| 128 | + $url = static::BASE_URL.'orgs/'.\rawurlencode($org).'/repos?per_page='.$per_page.'&page='.$page; |
|
| 129 | 129 | |
| 130 | 130 | return $this->_get($url); |
| 131 | 131 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function getReadme($username, $repository) |
| 144 | 144 | { |
| 145 | - $url = static::BASE_URL . 'repos/' . \rawurlencode($username) . '/' . \rawurlencode($repository) . '/readme'; |
|
| 145 | + $url = static::BASE_URL.'repos/'.\rawurlencode($username).'/'.\rawurlencode($repository).'/readme'; |
|
| 146 | 146 | |
| 147 | 147 | return $this->_get($url); |
| 148 | 148 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function getReleases($user, $repository) |
| 158 | 158 | { |
| 159 | - $url = static::BASE_URL . 'repos/' . $user . '/' . $repository . '/releases'; |
|
| 159 | + $url = static::BASE_URL.'repos/'.$user.'/'.$repository.'/releases'; |
|
| 160 | 160 | |
| 161 | 161 | return $this->_get($url); |
| 162 | 162 | } |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | public function getLatestRelease($user, $repository, $prerelease = false) |
| 173 | 173 | { |
| 174 | 174 | if ($prerelease) { |
| 175 | - $url = static::BASE_URL . 'repos/' . $user . '/' . $repository . '/releases'; |
|
| 175 | + $url = static::BASE_URL.'repos/'.$user.'/'.$repository.'/releases'; |
|
| 176 | 176 | } else { |
| 177 | - $url = static::BASE_URL . 'repos/' . $user . '/' . $repository . '/releases/latest'; |
|
| 177 | + $url = static::BASE_URL.'repos/'.$user.'/'.$repository.'/releases/latest'; |
|
| 178 | 178 | } |
| 179 | 179 | $result = $this->_get($url); |
| 180 | 180 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $api->setToken($token); |
| 200 | 200 | $request = $api->createRequest('GET', $url, [], [], ''); |
| 201 | 201 | $response = $api->request($request); |
| 202 | - $data = (array)$api->decode($response); |
|
| 202 | + $data = (array) $api->decode($response); |
|
| 203 | 203 | |
| 204 | 204 | return $data; |
| 205 | 205 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $setting = $settingsHandler->getPrimarySetting(); |
| 217 | 217 | |
| 218 | 218 | if (0 == \count($setting)) { |
| 219 | - \redirect_header(\XOOPS_URL . '/index.php', 3, \_AM_WGGITHUB_THEREARENT_SETTINGS); |
|
| 219 | + \redirect_header(\XOOPS_URL.'/index.php', 3, \_AM_WGGITHUB_THEREARENT_SETTINGS); |
|
| 220 | 220 | } |
| 221 | 221 | $this->userAuth = $setting['user']; |
| 222 | 222 | $this->tokenAuth = $setting['token']; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | if (Constants::STATUS_NEW === $repoStatus || Constants::STATUS_UPDATED === $repoStatus || 0 == $releasesCount) { |
| 150 | 150 | $ghReleases = $githubClient->getReleases($repositoriesAll[$i]->getVar('repo_user'), $repositoriesAll[$i]->getVar('repo_name')); |
| 151 | 151 | if ($releasesCount > 0) { |
| 152 | - $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId; |
|
| 152 | + $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId; |
|
| 153 | 153 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
| 154 | 154 | return false; |
| 155 | 155 | } |
@@ -159,13 +159,13 @@ discard block |
||
| 159 | 159 | $first = true; |
| 160 | 160 | $final = false; |
| 161 | 161 | foreach ($ghReleases as $ghRelease) { |
| 162 | - if ($first || (!$final && !(bool)$ghRelease['prerelease'])) { |
|
| 162 | + if ($first || (!$final && !(bool) $ghRelease['prerelease'])) { |
|
| 163 | 163 | // save first in any case and save first final version |
| 164 | 164 | $releasesObj = $releasesHandler->create(); |
| 165 | 165 | $releasesObj->setVar('rel_repoid', $repoId); |
| 166 | 166 | $releasesObj->setVar('rel_type', $ghRelease['type']); |
| 167 | 167 | $releasesObj->setVar('rel_name', $ghRelease['name']); |
| 168 | - $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease'])); |
|
| 168 | + $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease'])); |
|
| 169 | 169 | $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at'])); |
| 170 | 170 | $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']); |
| 171 | 171 | $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | $first = false; |
| 180 | - if (false === (bool)$ghRelease['prerelease']) { |
|
| 180 | + if (false === (bool) $ghRelease['prerelease']) { |
|
| 181 | 181 | $final = true; |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | // must return true otherwise releases will not be loaded |
| 216 | 216 | return true; |
| 217 | 217 | } |
| 218 | - $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId; |
|
| 218 | + $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId; |
|
| 219 | 219 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
| 220 | 220 | return false; |
| 221 | 221 | } |
@@ -224,13 +224,13 @@ discard block |
||
| 224 | 224 | $first = true; |
| 225 | 225 | $final = false; |
| 226 | 226 | foreach ($ghReleases as $ghRelease) { |
| 227 | - if ($first || (!$final && !(bool)$ghRelease['prerelease'])) { |
|
| 227 | + if ($first || (!$final && !(bool) $ghRelease['prerelease'])) { |
|
| 228 | 228 | // save first in any case and save first final version |
| 229 | 229 | $releasesObj = $releasesHandler->create(); |
| 230 | 230 | $releasesObj->setVar('rel_repoid', $repoId); |
| 231 | 231 | $releasesObj->setVar('rel_type', $ghRelease['type']); |
| 232 | 232 | $releasesObj->setVar('rel_name', $ghRelease['name']); |
| 233 | - $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease'])); |
|
| 233 | + $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease'])); |
|
| 234 | 234 | $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at'])); |
| 235 | 235 | $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']); |
| 236 | 236 | $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | $first = false; |
| 245 | - if (false === (bool)$ghRelease['prerelease']) { |
|
| 245 | + if (false === (bool) $ghRelease['prerelease']) { |
|
| 246 | 246 | $final = true; |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -259,17 +259,17 @@ discard block |
||
| 259 | 259 | public function updateRepoReleases() |
| 260 | 260 | { |
| 261 | 261 | // update repo_prerelease |
| 262 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
| 263 | - $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid '; |
|
| 264 | - $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_prerelease = 1 '; |
|
| 265 | - $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=1));'; |
|
| 262 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
| 263 | + $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid '; |
|
| 264 | + $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_prerelease = 1 '; |
|
| 265 | + $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=1));'; |
|
| 266 | 266 | $GLOBALS['xoopsDB']->queryF($sql); |
| 267 | 267 | |
| 268 | 268 | // update repo_release |
| 269 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
| 270 | - $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid '; |
|
| 271 | - $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_release = 1 '; |
|
| 272 | - $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=0));'; |
|
| 269 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
| 270 | + $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid '; |
|
| 271 | + $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_release = 1 '; |
|
| 272 | + $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=0));'; |
|
| 273 | 273 | $GLOBALS['xoopsDB']->queryF($sql); |
| 274 | 274 | |
| 275 | 275 | return true; |