@@ -221,8 +221,7 @@ discard block |
||
| 221 | 221 | if (is_array($this->request->lang)) |
| 222 | 222 | { |
| 223 | 223 | $this->load->language($file, $this->request->lang[0]); |
| 224 | - } |
|
| 225 | - else |
|
| 224 | + } else |
|
| 226 | 225 | { |
| 227 | 226 | $this->load->language($file, $this->request->lang); |
| 228 | 227 | } |
@@ -233,9 +232,15 @@ discard block |
||
| 233 | 232 | $this->config->load('api'); |
| 234 | 233 | |
| 235 | 234 | // Gather config defaults when a value isn't set for this controller |
| 236 | - if ( empty($this->enable_logging) ) $this->enable_logging = config_item('api.enable_logging'); |
|
| 237 | - if ( empty($this->enable_rate_limits) ) $this->enable_rate_limits = config_item('api.enable_rate_limits'); |
|
| 238 | - if ( empty($this->rate_limits) ) $this->rate_limits = config_item('api.rate_limits'); |
|
| 235 | + if ( empty($this->enable_logging) ) { |
|
| 236 | + $this->enable_logging = config_item('api.enable_logging'); |
|
| 237 | + } |
|
| 238 | + if ( empty($this->enable_rate_limits) ) { |
|
| 239 | + $this->enable_rate_limits = config_item('api.enable_rate_limits'); |
|
| 240 | + } |
|
| 241 | + if ( empty($this->rate_limits) ) { |
|
| 242 | + $this->rate_limits = config_item('api.rate_limits'); |
|
| 243 | + } |
|
| 239 | 244 | |
| 240 | 245 | // Should we restrict to SSL requests? |
| 241 | 246 | if (config_item('api.require_ssl') === true && ! $this->request->ssl) |
@@ -299,8 +304,7 @@ discard block |
||
| 299 | 304 | { |
| 300 | 305 | $this->logTime(); |
| 301 | 306 | } |
| 302 | - } |
|
| 303 | - else |
|
| 307 | + } else |
|
| 304 | 308 | { |
| 305 | 309 | return $this->fail( lang('api.unknown_endpoint'), 'not_implemented'); |
| 306 | 310 | } |
@@ -338,9 +342,7 @@ discard block |
||
| 338 | 342 | else if ($data === null && is_numeric($status_code)) |
| 339 | 343 | { |
| 340 | 344 | $output = null; |
| 341 | - } |
|
| 342 | - |
|
| 343 | - else |
|
| 345 | + } else |
|
| 344 | 346 | { |
| 345 | 347 | header('Content-Type: application/json'); |
| 346 | 348 | |
@@ -674,8 +676,7 @@ discard block |
||
| 674 | 676 | if (! $page || $page == 1) |
| 675 | 677 | { |
| 676 | 678 | $offset = 0; |
| 677 | - } |
|
| 678 | - else |
|
| 679 | + } else |
|
| 679 | 680 | { |
| 680 | 681 | $offset = (($page - 1) * $this->per_page) + 1; |
| 681 | 682 | } |
@@ -122,9 +122,7 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | return true; |
| 124 | 124 | } |
| 125 | - } |
|
| 126 | - |
|
| 127 | - else if (is_string($group)) |
|
| 125 | + } else if (is_string($group)) |
|
| 128 | 126 | { |
| 129 | 127 | $ids = array_column($user_groups, 'name'); |
| 130 | 128 | if (in_array($group, $ids)) |
@@ -389,8 +387,7 @@ discard block |
||
| 389 | 387 | if (! empty($permissions)) |
| 390 | 388 | { |
| 391 | 389 | $permissions = unserialize($permissions); |
| 392 | - } |
|
| 393 | - else |
|
| 390 | + } else |
|
| 394 | 391 | { |
| 395 | 392 | $permissions = []; |
| 396 | 393 | } |
@@ -89,21 +89,31 @@ discard block |
||
| 89 | 89 | for ($x = 0; $x < $y; $x++) |
| 90 | 90 | { |
| 91 | 91 | $tempchr = ord(substr($password, $x, 1)); |
| 92 | - if ($x > 19) $result += $charmult[$tempchr]; |
|
| 93 | - else if ($x > 7) $result += $charmult[$tempchr] * 1.5; |
|
| 94 | - else if ($x > 0) $result += $charmult[$tempchr] * 2; |
|
| 95 | - else $result += 4; |
|
| 92 | + if ($x > 19) { |
|
| 93 | + $result += $charmult[$tempchr]; |
|
| 94 | + } else if ($x > 7) { |
|
| 95 | + $result += $charmult[$tempchr] * 1.5; |
|
| 96 | + } else if ($x > 0) { |
|
| 97 | + $result += $charmult[$tempchr] * 2; |
|
| 98 | + } else { |
|
| 99 | + $result += 4; |
|
| 100 | + } |
|
| 96 | 101 | |
| 97 | 102 | $charmult[$tempchr] *= 0.75; |
| 98 | 103 | } |
| 99 | 104 | |
| 100 | 105 | return $result; |
| 101 | - } |
|
| 102 | - else |
|
| 106 | + } else |
|
| 103 | 107 | { |
| 104 | - if ($y > 20) return 4 + (7 * 2) + (12 * 1.5) + $y - 20; |
|
| 105 | - if ($y > 8) return 4 + (7 * 2) + (($y - 8) * 1.5); |
|
| 106 | - if ($y > 1) return 4 + (($y - 1) * 2); |
|
| 108 | + if ($y > 20) { |
|
| 109 | + return 4 + (7 * 2) + (12 * 1.5) + $y - 20; |
|
| 110 | + } |
|
| 111 | + if ($y > 8) { |
|
| 112 | + return 4 + (7 * 2) + (($y - 8) * 1.5); |
|
| 113 | + } |
|
| 114 | + if ($y > 1) { |
|
| 115 | + return 4 + (($y - 1) * 2); |
|
| 116 | + } |
|
| 107 | 117 | |
| 108 | 118 | return ($y == 1 ? 4 : 0); |
| 109 | 119 | } |
@@ -151,21 +161,32 @@ discard block |
||
| 151 | 161 | for ($x = 0; $x < $y; $x++) |
| 152 | 162 | { |
| 153 | 163 | $tempchr = ord(substr($password, $x, 1)); |
| 154 | - if ($tempchr >= ord("A") && $tempchr <= ord("Z")) $upper = true; |
|
| 155 | - else if ($tempchr >= ord("a") && $tempchr <= ord("z")) $lower = true; |
|
| 156 | - else if ($tempchr >= ord("0") && $tempchr <= ord("9")) $numeric = true; |
|
| 157 | - else if ($tempchr == ord(" ")) $space = true; |
|
| 158 | - else $other = true; |
|
| 164 | + if ($tempchr >= ord("A") && $tempchr <= ord("Z")) { |
|
| 165 | + $upper = true; |
|
| 166 | + } else if ($tempchr >= ord("a") && $tempchr <= ord("z")) { |
|
| 167 | + $lower = true; |
|
| 168 | + } else if ($tempchr >= ord("0") && $tempchr <= ord("9")) { |
|
| 169 | + $numeric = true; |
|
| 170 | + } else if ($tempchr == ord(" ")) { |
|
| 171 | + $space = true; |
|
| 172 | + } else { |
|
| 173 | + $other = true; |
|
| 174 | + } |
|
| 159 | 175 | } |
| 160 | 176 | $extrabits = ($upper && $lower && $other ? ($numeric ? 6 : 5) : ($numeric && !$upper && !$lower ? ($other ? -2 : -6) : 0)); |
| 161 | - if (!$space) $extrabits -= 2; |
|
| 162 | - else if (count(explode(" ", preg_replace('/\s+/', " ", $password))) > 3) $extrabits++; |
|
| 177 | + if (!$space) { |
|
| 178 | + $extrabits -= 2; |
|
| 179 | + } else if (count(explode(" ", preg_replace('/\s+/', " ", $password))) > 3) { |
|
| 180 | + $extrabits++; |
|
| 181 | + } |
|
| 163 | 182 | $result = self::getNISTNumBits($password, true) + $extrabits; |
| 164 | 183 | |
| 165 | 184 | $password = strtolower($password); |
| 166 | 185 | $revpassword = strrev($password); |
| 167 | 186 | $numbits = self::getNISTNumBits($password) + $extrabits; |
| 168 | - if ($result > $numbits) $result = $numbits; |
|
| 187 | + if ($result > $numbits) { |
|
| 188 | + $result = $numbits; |
|
| 189 | + } |
|
| 169 | 190 | |
| 170 | 191 | // Remove QWERTY strings. |
| 171 | 192 | $qwertystrs = array( |
@@ -200,11 +221,17 @@ discard block |
||
| 200 | 221 | } while ($z > 2); |
| 201 | 222 | |
| 202 | 223 | $numbits = self::getNISTNumBits($qpassword) + $extrabits; |
| 203 | - if ($result > $numbits) $result = $numbits; |
|
| 224 | + if ($result > $numbits) { |
|
| 225 | + $result = $numbits; |
|
| 226 | + } |
|
| 204 | 227 | $numbits = self::getNISTNumBits($qrevpassword) + $extrabits; |
| 205 | - if ($result > $numbits) $result = $numbits; |
|
| 228 | + if ($result > $numbits) { |
|
| 229 | + $result = $numbits; |
|
| 230 | + } |
|
| 206 | 231 | |
| 207 | - if ($result < $minbits) return false; |
|
| 232 | + if ($result < $minbits) { |
|
| 233 | + return false; |
|
| 234 | + } |
|
| 208 | 235 | } |
| 209 | 236 | |
| 210 | 237 | if ($usedict && $result >= $minbits) |
@@ -328,15 +355,21 @@ discard block |
||
| 328 | 355 | for ($x2 = $x + 1; $x2 < $y; $x2++) |
| 329 | 356 | { |
| 330 | 357 | $tempchr = ord(substr($password, $x2, 1)); |
| 331 | - if ($tempchr < $a || $tempchr > $z) break; |
|
| 358 | + if ($tempchr < $a || $tempchr > $z) { |
|
| 359 | + break; |
|
| 360 | + } |
|
| 332 | 361 | } |
| 333 | 362 | |
| 334 | 363 | $found = false; |
| 335 | 364 | while (!$found && $x2 - $x >= $minwordlen) |
| 336 | 365 | { |
| 337 | 366 | $word = "/\\n" . substr($password, $x, $minwordlen); |
| 338 | - for ($x3 = $x + $minwordlen; $x3 < $x2; $x3++) $word .= "(" . $password{$x3}; |
|
| 339 | - for ($x3 = $x + $minwordlen; $x3 < $x2; $x3++) $word .= ")?"; |
|
| 367 | + for ($x3 = $x + $minwordlen; $x3 < $x2; $x3++) { |
|
| 368 | + $word .= "(" . $password{$x3}; |
|
| 369 | + } |
|
| 370 | + for ($x3 = $x + $minwordlen; $x3 < $x2; $x3++) { |
|
| 371 | + $word .= ")?"; |
|
| 372 | + } |
|
| 340 | 373 | $word .= "\\n/"; |
| 341 | 374 | |
| 342 | 375 | preg_match_all($word, $data, $matches); |
@@ -345,24 +378,31 @@ discard block |
||
| 345 | 378 | $password{$x} = "*"; |
| 346 | 379 | $x++; |
| 347 | 380 | $numbits = self::getNISTNumBits(substr($password, 0, $x)) + $extrabits; |
| 348 | - if ($numbits >= $minbits) $found = true; |
|
| 349 | - } |
|
| 350 | - else |
|
| 381 | + if ($numbits >= $minbits) { |
|
| 382 | + $found = true; |
|
| 383 | + } |
|
| 384 | + } else |
|
| 351 | 385 | { |
| 352 | 386 | foreach ($matches[0] as $match) |
| 353 | 387 | { |
| 354 | 388 | $password2 = str_replace(trim($match), "*", $password); |
| 355 | 389 | $numbits = self::getNISTNumBits($password2) + $extrabits; |
| 356 | - if ($result > $numbits) $result = $numbits; |
|
| 390 | + if ($result > $numbits) { |
|
| 391 | + $result = $numbits; |
|
| 392 | + } |
|
| 357 | 393 | |
| 358 | - if ($result < $minbits) return false; |
|
| 394 | + if ($result < $minbits) { |
|
| 395 | + return false; |
|
| 396 | + } |
|
| 359 | 397 | } |
| 360 | 398 | |
| 361 | 399 | $found = true; |
| 362 | 400 | } |
| 363 | 401 | } |
| 364 | 402 | |
| 365 | - if ($found) break; |
|
| 403 | + if ($found) { |
|
| 404 | + break; |
|
| 405 | + } |
|
| 366 | 406 | |
| 367 | 407 | $x = $x2 - 1; |
| 368 | 408 | } |
@@ -136,8 +136,7 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | $this->setMessage(lang('auth.did_register'), 'success'); |
| 138 | 138 | redirect( Route::named('login') ); |
| 139 | - } |
|
| 140 | - else |
|
| 139 | + } else |
|
| 141 | 140 | { |
| 142 | 141 | $this->setMessage($auth->error(), 'danger'); |
| 143 | 142 | } |
@@ -169,8 +168,7 @@ discard block |
||
| 169 | 168 | { |
| 170 | 169 | $this->setMessage(lang('auth.did_activate'), 'success'); |
| 171 | 170 | redirect( Route::named('login') ); |
| 172 | - } |
|
| 173 | - else |
|
| 171 | + } else |
|
| 174 | 172 | { |
| 175 | 173 | $this->setMessage($auth->error(), 'danger'); |
| 176 | 174 | } |
@@ -202,8 +200,7 @@ discard block |
||
| 202 | 200 | { |
| 203 | 201 | $this->setMessage(lang('auth.send_success'), 'success'); |
| 204 | 202 | redirect( Route::named('reset_pass') ); |
| 205 | - } |
|
| 206 | - else |
|
| 203 | + } else |
|
| 207 | 204 | { |
| 208 | 205 | $this->setMessage($auth->error(), 'danger'); |
| 209 | 206 | } |
@@ -237,8 +234,7 @@ discard block |
||
| 237 | 234 | { |
| 238 | 235 | $this->setMessage(lang('auth.new_password_success'), 'success'); |
| 239 | 236 | redirect( Route::named('login') ); |
| 240 | - } |
|
| 241 | - else |
|
| 237 | + } else |
|
| 242 | 238 | { |
| 243 | 239 | $this->setMessage($auth->error(), 'danger'); |
| 244 | 240 | } |
@@ -134,8 +134,7 @@ |
||
| 134 | 134 | if (! $query->num_rows()) |
| 135 | 135 | { |
| 136 | 136 | $average = 0; |
| 137 | - } |
|
| 138 | - else |
|
| 137 | + } else |
|
| 139 | 138 | { |
| 140 | 139 | $average = $query->row()->num_rows; |
| 141 | 140 | } |
@@ -116,8 +116,7 @@ |
||
| 116 | 116 | $seeder->run(); |
| 117 | 117 | |
| 118 | 118 | unset($seeder); |
| 119 | - } |
|
| 120 | - catch (\Exception $e) |
|
| 119 | + } catch (\Exception $e) |
|
| 121 | 120 | { |
| 122 | 121 | show_error($e->getMessage(), $e->getCode()); |
| 123 | 122 | } |
@@ -11,12 +11,18 @@ discard block |
||
| 11 | 11 | <?php endforeach; ?> |
| 12 | 12 | </ul> |
| 13 | 13 | </li> |
| 14 | - <?php else : ?> |
|
| 15 | - <li><?php echo anchor($docsDir . str_replace($docsExt, '', $file), $name); ?></li> |
|
| 14 | + <?php else { |
|
| 15 | + : ?> |
|
| 16 | + <li><?php echo anchor($docsDir . str_replace($docsExt, '', $file), $name); |
|
| 17 | +} |
|
| 18 | +?></li> |
|
| 16 | 19 | <?php endif ?> |
| 17 | 20 | <?php endforeach ?> |
| 18 | - <?php else : ?> |
|
| 19 | - <p class="text-center"><?php echo lang('docs_not_found'); ?></p> |
|
| 21 | + <?php else { |
|
| 22 | + : ?> |
|
| 23 | + <p class="text-center"><?php echo lang('docs_not_found'); |
|
| 24 | +} |
|
| 25 | +?></p> |
|
| 20 | 26 | <?php endif ?> |
| 21 | 27 | |
| 22 | 28 | <?php if ( ! empty($module_docs) && is_array($module_docs)) : ?> |
@@ -33,8 +39,11 @@ discard block |
||
| 33 | 39 | <?php endforeach; ?> |
| 34 | 40 | </ul> |
| 35 | 41 | </li> |
| 36 | - <?php else : ?> |
|
| 37 | - <li class='parent'><?php echo anchor(site_url($docsDir . '/' . str_replace($docsExt, '', $module)), ucwords(str_replace('_', ' ', $module))); ?></li> |
|
| 42 | + <?php else { |
|
| 43 | + : ?> |
|
| 44 | + <li class='parent'><?php echo anchor(site_url($docsDir . '/' . str_replace($docsExt, '', $module)), ucwords(str_replace('_', ' ', $module))); |
|
| 45 | +} |
|
| 46 | +?></li> |
|
| 38 | 47 | <?php endif ?> |
| 39 | 48 | <?php endforeach ?> |
| 40 | 49 | <?php endif ?> |
@@ -2,15 +2,21 @@ |
||
| 2 | 2 | <div class="alert alert-info" style="margin-top: 40px;"> |
| 3 | 3 | <?php if (isset($notice)) : ?> |
| 4 | 4 | <?= $notice; ?> |
| 5 | - <?php else: ?> |
|
| 6 | - <?php echo lang('docs_not_found'); ?> |
|
| 5 | + <?php else { |
|
| 6 | + : ?> |
|
| 7 | + <?php echo lang('docs_not_found'); |
|
| 8 | +} |
|
| 9 | +?> |
|
| 7 | 10 | <?php endif; ?> |
| 8 | 11 | </div> |
| 9 | 12 | |
| 10 | -<?php else: ?> |
|
| 13 | +<?php else { |
|
| 14 | + : ?> |
|
| 11 | 15 | |
| 12 | 16 | <div class="page"> |
| 13 | - <?php echo $content; ?> |
|
| 17 | + <?php echo $content; |
|
| 18 | +} |
|
| 19 | +?> |
|
| 14 | 20 | </div> |
| 15 | 21 | |
| 16 | 22 | <?php endif; ?> |
@@ -24,10 +24,13 @@ |
||
| 24 | 24 | </div> |
| 25 | 25 | <?php endforeach; ?> |
| 26 | 26 | |
| 27 | -<?php else: ?> |
|
| 27 | +<?php else { |
|
| 28 | + : ?> |
|
| 28 | 29 | |
| 29 | 30 | <div class="alert alert-info"> |
| 30 | - <?php echo sprintf(lang('docs_no_results'), $search_terms); ?> |
|
| 31 | + <?php echo sprintf(lang('docs_no_results'), $search_terms); |
|
| 32 | +} |
|
| 33 | +?> |
|
| 31 | 34 | </div> |
| 32 | 35 | |
| 33 | 36 | <?php endif; ?> |