@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | foreach ($users as $user) { |
30 | 30 | $toAdd = array('user'); |
31 | 31 | |
32 | - if($user['status'] === 'Admin'){ |
|
32 | + if($user['status'] === 'Admin') { |
|
33 | 33 | $toAdd[] = 'admin'; |
34 | 34 | } |
35 | 35 | |
36 | - if($user['checkuser'] == 1){ |
|
36 | + if($user['checkuser'] == 1) { |
|
37 | 37 | $toAdd[] = 'checkuser'; |
38 | 38 | } |
39 | 39 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $log->setComment($logData); |
61 | 61 | $log->save(); |
62 | 62 | |
63 | - if($user['status'] === 'Admin' || $user['status'] === 'User'){ |
|
63 | + if($user['status'] === 'Admin' || $user['status'] === 'User') { |
|
64 | 64 | $update->execute(array('id' => $user['id'])); |
65 | 65 | } |
66 | 66 | } |
@@ -142,8 +142,7 @@ |
||
142 | 142 | |
143 | 143 | if ($siteConfiguration->getLocationProviderApiKey() === null) { |
144 | 144 | $page->setLocationProvider(new FakeLocationProvider()); |
145 | - } |
|
146 | - else { |
|
145 | + } else { |
|
147 | 146 | $page->setLocationProvider( |
148 | 147 | new IpLocationProvider( |
149 | 148 | $database, |
@@ -99,8 +99,7 @@ discard block |
||
99 | 99 | if ($securityResult === SecurityManager::ALLOWED) { |
100 | 100 | // We're allowed to run the page, so let's run it. |
101 | 101 | $this->runPage(); |
102 | - } |
|
103 | - else { |
|
102 | + } else { |
|
104 | 103 | $this->handleAccessDenied($securityResult); |
105 | 104 | |
106 | 105 | // Send the headers |
@@ -158,19 +157,16 @@ discard block |
||
158 | 157 | $this->redirect("login"); |
159 | 158 | |
160 | 159 | return; |
161 | - } |
|
162 | - else { |
|
160 | + } else { |
|
163 | 161 | // Decide whether this was a rights failure, or an identification failure. |
164 | 162 | |
165 | 163 | if ($denyReason === SecurityManager::ERROR_NOT_IDENTIFIED) { |
166 | 164 | // Not identified |
167 | 165 | throw new NotIdentifiedException($this->getSecurityManager()); |
168 | - } |
|
169 | - elseif ($denyReason === SecurityManager::ERROR_DENIED) { |
|
166 | + } elseif ($denyReason === SecurityManager::ERROR_DENIED) { |
|
170 | 167 | // Nope, plain old access denied |
171 | 168 | throw new AccessDeniedException($this->getSecurityManager()); |
172 | - } |
|
173 | - else { |
|
169 | + } else { |
|
174 | 170 | throw new Exception('Unknown response from security manager.'); |
175 | 171 | } |
176 | 172 | } |
@@ -217,8 +217,7 @@ discard block |
||
217 | 217 | // Are we changing script? |
218 | 218 | if ($script === null || substr($currentScriptName, -1 * count($script)) === $script) { |
219 | 219 | $targetScriptName = $currentScriptName; |
220 | - } |
|
221 | - else { |
|
220 | + } else { |
|
222 | 221 | $targetScriptName = $this->getSiteConfiguration()->getBaseUrl() . '/' . $script; |
223 | 222 | } |
224 | 223 | |
@@ -277,8 +276,9 @@ discard block |
||
277 | 276 | * |
278 | 277 | * @param string $path The path (relative to the application root) of the file |
279 | 278 | */ |
280 | - final protected function addCss($path) { |
|
281 | - if(in_array($path, $this->extraCss)){ |
|
279 | + final protected function addCss($path) |
|
280 | + { |
|
281 | + if(in_array($path, $this->extraCss)) { |
|
282 | 282 | // nothing to do |
283 | 283 | return; |
284 | 284 | } |
@@ -291,8 +291,9 @@ discard block |
||
291 | 291 | * |
292 | 292 | * @param string $path The path (relative to the application root) of the file |
293 | 293 | */ |
294 | - final protected function addJs($path){ |
|
295 | - if(in_array($path, $this->extraJs)){ |
|
294 | + final protected function addJs($path) |
|
295 | + { |
|
296 | + if(in_array($path, $this->extraJs)) { |
|
296 | 297 | // nothing to do |
297 | 298 | return; |
298 | 299 | } |
@@ -89,8 +89,7 @@ |
||
89 | 89 | // all over the rest of the code |
90 | 90 | if ($this->hasActiveTransaction) { |
91 | 91 | return false; |
92 | - } |
|
93 | - else { |
|
92 | + } else { |
|
94 | 93 | // set the transaction isolation level for every transaction. |
95 | 94 | $this->exec("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;"); |
96 | 95 |
@@ -60,12 +60,10 @@ |
||
60 | 60 | |
61 | 61 | if ($statement->execute()) { |
62 | 62 | $this->id = (int)$this->dbObject->lastInsertId(); |
63 | - } |
|
64 | - else { |
|
63 | + } else { |
|
65 | 64 | throw new Exception($statement->errorInfo()); |
66 | 65 | } |
67 | - } |
|
68 | - else { |
|
66 | + } else { |
|
69 | 67 | // update |
70 | 68 | $statement = $this->dbObject->prepare(<<<SQL |
71 | 69 | UPDATE `geolocation` |
@@ -59,12 +59,10 @@ |
||
59 | 59 | |
60 | 60 | if ($statement->execute()) { |
61 | 61 | $this->id = (int)$this->dbObject->lastInsertId(); |
62 | - } |
|
63 | - else { |
|
62 | + } else { |
|
64 | 63 | throw new Exception($statement->errorInfo()); |
65 | 64 | } |
66 | - } |
|
67 | - else { |
|
65 | + } else { |
|
68 | 66 | // update |
69 | 67 | $statement = $this->dbObject->prepare(<<<SQL |
70 | 68 | UPDATE `rdnscache` |
@@ -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 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 |
@@ -61,12 +61,10 @@ |
||
61 | 61 | |
62 | 62 | if ($statement->execute()) { |
63 | 63 | $this->id = (int)$this->dbObject->lastInsertId(); |
64 | - } |
|
65 | - else { |
|
64 | + } else { |
|
66 | 65 | throw new Exception($statement->errorInfo()); |
67 | 66 | } |
68 | - } |
|
69 | - else { |
|
67 | + } else { |
|
70 | 68 | // update |
71 | 69 | throw new Exception('Updating roles is not available'); |
72 | 70 | } |