Completed
Pull Request — master (#2401)
by Kevin
10:26
created
html/inc/password.php 1 patch
Switch Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -50,47 +50,47 @@  discard block
 block discarded – undo
50 50
             }
51 51
             $resultLength = 0;
52 52
             switch ($algo) {
53
-                case PASSWORD_BCRYPT:
54
-                    $cost = PASSWORD_BCRYPT_DEFAULT_COST;
55
-                    if (isset($options['cost'])) {
56
-                        $cost = (int) $options['cost'];
57
-                        if ($cost < 4 || $cost > 31) {
58
-                            trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
59
-                            return null;
60
-                        }
53
+            case PASSWORD_BCRYPT:
54
+                $cost = PASSWORD_BCRYPT_DEFAULT_COST;
55
+                if (isset($options['cost'])) {
56
+                    $cost = (int) $options['cost'];
57
+                    if ($cost < 4 || $cost > 31) {
58
+                        trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
59
+                        return null;
61 60
                     }
62
-                    // The length of salt to generate
63
-                    $raw_salt_len = 16;
64
-                    // The length required in the final serialization
65
-                    $required_salt_len = 22;
66
-                    $hash_format = sprintf("$2y$%02d$", $cost);
67
-                    // The expected length of the final crypt() output
68
-                    $resultLength = 60;
69
-                    break;
70
-                default:
71
-                    trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
72
-                    return null;
61
+                }
62
+                // The length of salt to generate
63
+                $raw_salt_len = 16;
64
+                // The length required in the final serialization
65
+                $required_salt_len = 22;
66
+                $hash_format = sprintf("$2y$%02d$", $cost);
67
+                // The expected length of the final crypt() output
68
+                $resultLength = 60;
69
+                break;
70
+            default:
71
+                trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
72
+                return null;
73 73
             }
74 74
             $salt_req_encoding = false;
75 75
             if (isset($options['salt'])) {
76 76
                 switch (gettype($options['salt'])) {
77
-                    case 'NULL':
78
-                    case 'boolean':
79
-                    case 'integer':
80
-                    case 'double':
81
-                    case 'string':
77
+                case 'NULL':
78
+                case 'boolean':
79
+                case 'integer':
80
+                case 'double':
81
+                case 'string':
82
+                    $salt = (string) $options['salt'];
83
+                    break;
84
+                case 'object':
85
+                    if (method_exists($options['salt'], '__tostring')) {
82 86
                         $salt = (string) $options['salt'];
83 87
                         break;
84
-                    case 'object':
85
-                        if (method_exists($options['salt'], '__tostring')) {
86
-                            $salt = (string) $options['salt'];
87
-                            break;
88
-                        }
89
-                    case 'array':
90
-                    case 'resource':
91
-                    default:
92
-                        trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
93
-                        return null;
88
+                    }
89
+                case 'array':
90
+                case 'resource':
91
+                default:
92
+                    trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
93
+                    return null;
94 94
                 }
95 95
                 if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) {
96 96
                     trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", PasswordCompat\binary\_strlen($salt), $required_salt_len), E_USER_WARNING);
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
                 return true;
213 213
             }
214 214
             switch ($algo) {
215
-                case PASSWORD_BCRYPT:
216
-                    $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
217
-                    if ($cost !== $info['options']['cost']) {
218
-                        return true;
219
-                    }
220
-                    break;
215
+            case PASSWORD_BCRYPT:
216
+                $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
217
+                if ($cost !== $info['options']['cost']) {
218
+                    return true;
219
+                }
220
+                break;
221 221
             }
222 222
             return false;
223 223
         }
Please login to merge, or discard this patch.
html/inc/bootstrap.inc 1 patch
Doc Comments   +42 added lines patch added patch discarded remove patch
@@ -30,6 +30,11 @@  discard block
 block discarded – undo
30 30
 // $brand: the text or image to show at left of navbar
31 31
 // If text, put it in <a class="navbar-brand" ...
32 32
 //
33
+/**
34
+ * @param string $brand
35
+ * @param boolean $fixed
36
+ * @param boolean $inverse
37
+ */
33 38
 function navbar_start($brand, $fixed, $inverse) {
34 39
     global $fixed_navbar;
35 40
     $class = "navbar";
@@ -99,6 +104,9 @@  discard block
 block discarded – undo
99 104
 
100 105
 // add a dropdown menu
101 106
 //
107
+/**
108
+ * @param string $name
109
+ */
102 110
 function navbar_menu($name, $items) {
103 111
     echo '
104 112
       <li class="dropdown">
@@ -218,6 +226,10 @@  discard block
 block discarded – undo
218 226
 // output a panel.
219 227
 // $content_func is a function that generates the panel contents
220 228
 //
229
+/**
230
+ * @param string|null $title
231
+ * @param Closure $content_func
232
+ */
221 233
 function panel($title, $content_func, $class="panel-primary") {
222 234
     echo sprintf('<div class="panel %s">
223 235
         ', $class
@@ -244,6 +256,11 @@  discard block
 block discarded – undo
244 256
 // are functions that generate the top, left, and right content
245 257
 // $left_width is the width of left column in 1/12 units.
246 258
 //
259
+/**
260
+ * @param boolean $top_func
261
+ * @param Closure $left_func
262
+ * @param Closure $right_func
263
+ */
247 264
 function grid($top_func, $left_func, $right_func, $left_width=6) {
248 265
     echo '
249 266
         <div class="container-fluid">
@@ -277,6 +294,9 @@  discard block
 block discarded – undo
277 294
     ';
278 295
 }
279 296
 
297
+/**
298
+ * @param string $action
299
+ */
280 300
 function form_start($action, $method='get') {
281 301
     echo sprintf(
282 302
         '<div class="container">
@@ -286,6 +306,9 @@  discard block
 block discarded – undo
286 306
     );
287 307
 }
288 308
 
309
+/**
310
+ * @param string $name
311
+ */
289 312
 function form_input_hidden($name, $value) {
290 313
     echo '<input type="hidden" name="'.$name.'" value="'.$value.'">
291 314
     ';
@@ -301,6 +324,10 @@  discard block
 block discarded – undo
301 324
 define('FORM_LEFT_OFFSET', 'col-sm-offset-4');
302 325
 define('FORM_RIGHT_CLASS', 'col-sm-8');
303 326
 
327
+/**
328
+ * @param string $label
329
+ * @param string $name
330
+ */
304 331
 function form_input_text($label, $name, $value='', $type='text', $attrs='', $extra='') {
305 332
     echo sprintf('
306 333
         <div class="form-group">
@@ -343,6 +370,11 @@  discard block
 block discarded – undo
343 370
 
344 371
 // $items is either a string of <option> elements, or an array
345 372
 //
373
+/**
374
+ * @param string $label
375
+ * @param string $name
376
+ * @param string $items
377
+ */
346 378
 function form_select($label, $name, $items) {
347 379
     echo sprintf('
348 380
         <div class="form-group">
@@ -387,6 +419,9 @@  discard block
 block discarded – undo
387 419
 
388 420
 // $items is list of (name, label, checked)
389 421
 //
422
+/**
423
+ * @param string $label
424
+ */
390 425
 function form_checkboxes($label, $items, $attrs='') {
391 426
     echo sprintf('
392 427
         <div class="form-group">
@@ -434,6 +469,10 @@  discard block
 block discarded – undo
434 469
     ';
435 470
 }
436 471
 
472
+/**
473
+ * @param string $label
474
+ * @param string $item
475
+ */
437 476
 function form_general($label, $item) {
438 477
     echo '
439 478
         <div class="form-group">
@@ -456,6 +495,9 @@  discard block
 block discarded – undo
456 495
 ';
457 496
 }
458 497
 
498
+/**
499
+ * @param string $text
500
+ */
459 501
 function form_submit($text, $attrs='') {
460 502
     form_general(
461 503
         "",
Please login to merge, or discard this patch.
html/user/login_action.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -32,6 +32,9 @@
 block discarded – undo
32 32
 
33 33
 check_get_args(array("id", "t", "h", "key"));
34 34
 
35
+/**
36
+ * @param string $passwd_hash
37
+ */
35 38
 function do_passwd_rehash($user,$passwd_hash) {
36 39
     $database_passwd_hash = password_hash($passwd_hash , PASSWORD_DEFAULT);
37 40
     $result = $user->update(
Please login to merge, or discard this patch.