@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | if ($notificationsDatabase !== null) { |
| 61 | 61 | $this->notificationsDatabase = $notificationsDatabase; |
| 62 | 62 | $this->notificationsEnabled = $siteConfiguration->getIrcNotificationsEnabled(); |
| 63 | - } |
|
| 64 | - else { |
|
| 63 | + } else { |
|
| 65 | 64 | $this->notificationsEnabled = false; |
| 66 | 65 | } |
| 67 | 66 | |
@@ -239,8 +238,7 @@ discard block |
||
| 239 | 238 | { |
| 240 | 239 | if ($ban->getDuration() === null) { |
| 241 | 240 | $duration = "indefinitely"; |
| 242 | - } |
|
| 243 | - else { |
|
| 241 | + } else { |
|
| 244 | 242 | $duration = "until " . date("F j, Y, g:i a", $ban->getDuration()); |
| 245 | 243 | } |
| 246 | 244 | |
@@ -23,7 +23,8 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return JobQueueSearchHelper |
| 25 | 25 | */ |
| 26 | - public static function get(PdoDatabase $database) { |
|
| 26 | + public static function get(PdoDatabase $database) |
|
| 27 | + { |
|
| 27 | 28 | $helper = new JobQueueSearchHelper($database); |
| 28 | 29 | return $helper; |
| 29 | 30 | } |
@@ -33,7 +34,8 @@ discard block |
||
| 33 | 34 | * |
| 34 | 35 | * @return $this |
| 35 | 36 | */ |
| 36 | - public function statusIn($statuses) { |
|
| 37 | + public function statusIn($statuses) |
|
| 38 | + { |
|
| 37 | 39 | $this->inClause('status', $statuses); |
| 38 | 40 | |
| 39 | 41 | return $this; |
@@ -42,27 +44,31 @@ discard block |
||
| 42 | 44 | /** |
| 43 | 45 | * @return $this |
| 44 | 46 | */ |
| 45 | - public function notAcknowledged() { |
|
| 47 | + public function notAcknowledged() |
|
| 48 | + { |
|
| 46 | 49 | $this->whereClause .= ' AND (acknowledged IS NULL OR acknowledged = 0)'; |
| 47 | 50 | |
| 48 | 51 | return $this; |
| 49 | 52 | } |
| 50 | 53 | |
| 51 | - public function byTask($task) { |
|
| 54 | + public function byTask($task) |
|
| 55 | + { |
|
| 52 | 56 | $this->whereClause .= ' AND task = ?'; |
| 53 | 57 | $this->parameterList[] = $task; |
| 54 | 58 | |
| 55 | 59 | return $this; |
| 56 | 60 | } |
| 57 | 61 | |
| 58 | - public function byUser($userId) { |
|
| 62 | + public function byUser($userId) |
|
| 63 | + { |
|
| 59 | 64 | $this->whereClause .= ' AND user = ?'; |
| 60 | 65 | $this->parameterList[] = $userId; |
| 61 | 66 | |
| 62 | 67 | return $this; |
| 63 | 68 | } |
| 64 | 69 | |
| 65 | - public function byStatus($status) { |
|
| 70 | + public function byStatus($status) |
|
| 71 | + { |
|
| 66 | 72 | $this->whereClause .= ' AND status = ?'; |
| 67 | 73 | $this->parameterList[] = $status; |
| 68 | 74 | |
@@ -53,7 +53,8 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return int |
| 55 | 55 | */ |
| 56 | - $sortKey = function(DataObject $item) { |
|
| 56 | + $sortKey = function(DataObject $item) |
|
| 57 | + { |
|
| 57 | 58 | if ($item instanceof Log) { |
| 58 | 59 | return $item->getTimestamp()->getTimestamp(); |
| 59 | 60 | } |
@@ -310,8 +311,7 @@ discard block |
||
| 310 | 311 | // some old templates have been completely deleted and lost to the depths of time. |
| 311 | 312 | if ($welcomeTemplate === false) { |
| 312 | 313 | return "Welcome template #{$objectId}"; |
| 313 | - } |
|
| 314 | - else { |
|
| 314 | + } else { |
|
| 315 | 315 | $userCode = htmlentities($welcomeTemplate->getUserCode(), ENT_COMPAT, 'UTF-8'); |
| 316 | 316 | |
| 317 | 317 | return "<a href=\"{$baseurl}/internal.php/welcomeTemplates/view?template={$objectId}\">{$userCode}</a>"; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $taskDescriptions = JobQueue::getTaskDescriptions(); |
| 324 | 324 | |
| 325 | 325 | $task = $job->getTask(); |
| 326 | - if(isset($taskDescriptions[$task])){ |
|
| 326 | + if(isset($taskDescriptions[$task])) { |
|
| 327 | 327 | $description = $taskDescriptions[$task]; |
| 328 | 328 | } else { |
| 329 | 329 | $description = 'Unknown task'; |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | if ($securityResult === SecurityManager::ALLOWED) { |
| 86 | 86 | // We're allowed to run the page, so let's run it. |
| 87 | 87 | $this->runPage(); |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | $this->handleAccessDenied($securityResult); |
| 91 | 90 | |
| 92 | 91 | // Send the headers |
@@ -110,8 +109,7 @@ discard block |
||
| 110 | 109 | |
| 111 | 110 | if (WebRequest::testSiteNoticeCookieValue($siteNoticeHash)) { |
| 112 | 111 | $this->assign('siteNoticeState', 'd-none'); |
| 113 | - } |
|
| 114 | - else { |
|
| 112 | + } else { |
|
| 115 | 113 | $this->assign('siteNoticeState', 'd-block'); |
| 116 | 114 | } |
| 117 | 115 | |
@@ -157,19 +155,16 @@ discard block |
||
| 157 | 155 | $this->redirect("login"); |
| 158 | 156 | |
| 159 | 157 | return; |
| 160 | - } |
|
| 161 | - else { |
|
| 158 | + } else { |
|
| 162 | 159 | // Decide whether this was a rights failure, or an identification failure. |
| 163 | 160 | |
| 164 | 161 | if ($denyReason === SecurityManager::ERROR_NOT_IDENTIFIED) { |
| 165 | 162 | // Not identified |
| 166 | 163 | throw new NotIdentifiedException($this->getSecurityManager()); |
| 167 | - } |
|
| 168 | - elseif ($denyReason === SecurityManager::ERROR_DENIED) { |
|
| 164 | + } elseif ($denyReason === SecurityManager::ERROR_DENIED) { |
|
| 169 | 165 | // Nope, plain old access denied |
| 170 | 166 | throw new AccessDeniedException($this->getSecurityManager()); |
| 171 | - } |
|
| 172 | - else { |
|
| 167 | + } else { |
|
| 173 | 168 | throw new Exception('Unknown response from security manager.'); |
| 174 | 169 | } |
| 175 | 170 | } |
@@ -259,8 +259,7 @@ discard block |
||
| 259 | 259 | // Are we changing script? |
| 260 | 260 | if ($script === null || substr($currentScriptName, -1 * count($script)) === $script) { |
| 261 | 261 | $targetScriptName = $currentScriptName; |
| 262 | - } |
|
| 263 | - else { |
|
| 262 | + } else { |
|
| 264 | 263 | $targetScriptName = $this->getSiteConfiguration()->getBaseUrl() . '/' . $script; |
| 265 | 264 | } |
| 266 | 265 | |
@@ -319,8 +318,9 @@ discard block |
||
| 319 | 318 | * |
| 320 | 319 | * @param string $path The path (relative to the application root) of the file |
| 321 | 320 | */ |
| 322 | - final protected function addJs($path){ |
|
| 323 | - if(in_array($path, $this->extraJs)){ |
|
| 321 | + final protected function addJs($path) |
|
| 322 | + { |
|
| 323 | + if(in_array($path, $this->extraJs)) { |
|
| 324 | 324 | // nothing to do |
| 325 | 325 | return; |
| 326 | 326 | } |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | if ($pageCount < $pageLimit) { |
| 56 | 56 | if ($pageData['lowpage'] == 1 && $pageData['hipage'] < $pageData['maxpage']) { |
| 57 | 57 | $pageData['hipage'] = min($pageLimit, $pageData['maxpage']); |
| 58 | - } |
|
| 59 | - elseif ($pageData['lowpage'] > 1 && $pageData['hipage'] == $pageData['maxpage']) { |
|
| 58 | + } elseif ($pageData['lowpage'] > 1 && $pageData['hipage'] == $pageData['maxpage']) { |
|
| 60 | 59 | $pageData['lowpage'] = max(1, $pageData['maxpage'] - $pageLimit + 1); |
| 61 | 60 | } |
| 62 | 61 | } |
@@ -102,7 +101,7 @@ discard block |
||
| 102 | 101 | $formParameters['limit'] = $this->limit; |
| 103 | 102 | $this->assign('searchParamsUrl', http_build_query($formParameters, '', '&')); |
| 104 | 103 | |
| 105 | - foreach ($formParameters as $key => $value) { |
|
| 104 | + foreach ($formParameters as $key => $value) { |
|
| 106 | 105 | $this->assign($key, $value); |
| 107 | 106 | } |
| 108 | 107 | } |
@@ -132,7 +132,8 @@ |
||
| 132 | 132 | $task->setNotificationHelper($this->getNotificationHelper()); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - public static function errorHandler($errno, $errstr, $errfile, $errline) { |
|
| 135 | + public static function errorHandler($errno, $errstr, $errfile, $errline) |
|
| 136 | + { |
|
| 136 | 137 | throw new Exception($errfile . "@" . $errline . ": " . $errstr); |
| 137 | 138 | } |
| 138 | 139 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $users = UserSearchHelper::get($database)->inIds( |
| 22 | 22 | $database->query('SELECT user FROM oauthtoken WHERE type = \'access\'')->fetchColumn()); |
| 23 | 23 | |
| 24 | - foreach ($users as $u){ |
|
| 24 | + foreach ($users as $u) { |
|
| 25 | 25 | $oauth = new OAuthUserHelper($u, $database, $this->getOAuthProtocolHelper(), $this->getSiteConfiguration()); |
| 26 | 26 | $oauth->detach(); |
| 27 | 27 | } |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | if ($showAll) { |
| 43 | 43 | $statement = $database->prepare('SELECT * FROM comment WHERE request = :target;'); |
| 44 | - } |
|
| 45 | - else { |
|
| 44 | + } else { |
|
| 46 | 45 | $statement = $database->prepare(<<<SQL |
| 47 | 46 | SELECT * FROM comment |
| 48 | 47 | WHERE request = :target AND (visibility = 'user' OR visibility = 'requester' OR user = :userid); |
@@ -84,12 +83,10 @@ discard block |
||
| 84 | 83 | |
| 85 | 84 | if ($statement->execute()) { |
| 86 | 85 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 87 | - } |
|
| 88 | - else { |
|
| 86 | + } else { |
|
| 89 | 87 | throw new Exception($statement->errorInfo()); |
| 90 | 88 | } |
| 91 | - } |
|
| 92 | - else { |
|
| 89 | + } else { |
|
| 93 | 90 | // update |
| 94 | 91 | $statement = $this->dbObject->prepare(<<<SQL |
| 95 | 92 | UPDATE comment |