@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | return null; |
39 | 39 | } |
40 | 40 | if (is_null($password) || is_int($password)) { |
41 | - $password = (string) $password; |
|
41 | + $password = (string)$password; |
|
42 | 42 | } |
43 | 43 | if (!is_string($password)) { |
44 | 44 | trigger_error("password_hash(): Password must be a string", E_USER_WARNING); |
45 | 45 | return null; |
46 | 46 | } |
47 | 47 | if (!is_int($algo)) { |
48 | - trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING); |
|
48 | + trigger_error("password_hash() expects parameter 2 to be long, ".gettype($algo)." given", E_USER_WARNING); |
|
49 | 49 | return null; |
50 | 50 | } |
51 | 51 | $resultLength = 0; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | case PASSWORD_BCRYPT: |
54 | 54 | $cost = PASSWORD_BCRYPT_DEFAULT_COST; |
55 | 55 | if (isset($options['cost'])) { |
56 | - $cost = (int) $options['cost']; |
|
56 | + $cost = (int)$options['cost']; |
|
57 | 57 | if ($cost < 4 || $cost > 31) { |
58 | 58 | trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING); |
59 | 59 | return null; |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | case 'integer': |
80 | 80 | case 'double': |
81 | 81 | case 'string': |
82 | - $salt = (string) $options['salt']; |
|
82 | + $salt = (string)$options['salt']; |
|
83 | 83 | break; |
84 | 84 | case 'object': |
85 | 85 | if (method_exists($options['salt'], '__tostring')) { |
86 | - $salt = (string) $options['salt']; |
|
86 | + $salt = (string)$options['salt']; |
|
87 | 87 | break; |
88 | 88 | } |
89 | 89 | case 'array': |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | if ($read >= $raw_salt_len) { |
127 | 127 | $buffer_valid = true; |
128 | 128 | } |
129 | - $buffer = str_pad($buffer, $raw_salt_len, "\0") ^ str_pad($local_buffer, $raw_salt_len, "\0"); |
|
129 | + $buffer = str_pad($buffer, $raw_salt_len, "\0")^str_pad($local_buffer, $raw_salt_len, "\0"); |
|
130 | 130 | } |
131 | 131 | if (!$buffer_valid || PasswordCompat\binary\_strlen($buffer) < $raw_salt_len) { |
132 | 132 | $buffer_length = PasswordCompat\binary\_strlen($buffer); |
133 | 133 | for ($i = 0; $i < $raw_salt_len; $i++) { |
134 | 134 | if ($i < $buffer_length) { |
135 | - $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255)); |
|
135 | + $buffer[$i] = $buffer[$i]^chr(mt_rand(0, 255)); |
|
136 | 136 | } else { |
137 | 137 | $buffer .= chr(mt_rand(0, 255)); |
138 | 138 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | $salt = PasswordCompat\binary\_substr($salt, 0, $required_salt_len); |
155 | 155 | |
156 | - $hash = $hash_format . $salt; |
|
156 | + $hash = $hash_format.$salt; |
|
157 | 157 | |
158 | 158 | $ret = crypt($password, $hash); |
159 | 159 | |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | */ |
209 | 209 | function password_needs_rehash($hash, $algo, array $options = array()) { |
210 | 210 | $info = password_get_info($hash); |
211 | - if ($info['algo'] !== (int) $algo) { |
|
211 | + if ($info['algo'] !== (int)$algo) { |
|
212 | 212 | return true; |
213 | 213 | } |
214 | 214 | switch ($algo) { |
215 | 215 | case PASSWORD_BCRYPT: |
216 | - $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; |
|
216 | + $cost = isset($options['cost']) ? (int)$options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; |
|
217 | 217 | if ($cost !== $info['options']['cost']) { |
218 | 218 | return true; |
219 | 219 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $status = 0; |
244 | 244 | for ($i = 0; $i < PasswordCompat\binary\_strlen($ret); $i++) { |
245 | - $status |= (ord($ret[$i]) ^ ord($hash[$i])); |
|
245 | + $status |= (ord($ret[$i])^ord($hash[$i])); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | return $status === 0; |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | // prefix for links; needed for pages not in top dir |
139 | 139 | $user, |
140 | 140 | // logged-in user, if any |
141 | - $fixed=false, |
|
141 | + $fixed = false, |
|
142 | 142 | // if true, navbar is fixed at top of page. |
143 | 143 | // NOTE: if you do this, you must set a global var $fixed_navbar |
144 | 144 | // to true at compile time |
145 | 145 | // (it needs to be set when page_head() is called). |
146 | - $inverse=false |
|
146 | + $inverse = false |
|
147 | 147 | // white on black? |
148 | 148 | ) { |
149 | 149 | global $master_url; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // output a panel. |
219 | 219 | // $content_func is a function that generates the panel contents |
220 | 220 | // |
221 | -function panel($title, $content_func, $class="panel-primary") { |
|
221 | +function panel($title, $content_func, $class = "panel-primary") { |
|
222 | 222 | echo sprintf('<div class="panel %s"> |
223 | 223 | ', $class |
224 | 224 | ); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | // are functions that generate the top, left, and right content |
245 | 245 | // $left_width is the width of left column in 1/12 units. |
246 | 246 | // |
247 | -function grid($top_func, $left_func, $right_func, $left_width=6) { |
|
247 | +function grid($top_func, $left_func, $right_func, $left_width = 6) { |
|
248 | 248 | echo ' |
249 | 249 | <div class="container-fluid"> |
250 | 250 | '; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | </div> |
260 | 260 | '; |
261 | 261 | } |
262 | - $right_width = 12-$left_width; |
|
262 | + $right_width = 12 - $left_width; |
|
263 | 263 | echo ' |
264 | 264 | <div class="row"> |
265 | 265 | <div class="col-sm-'.$left_width.'"> |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | '; |
278 | 278 | } |
279 | 279 | |
280 | -function form_start($action, $method='get') { |
|
280 | +function form_start($action, $method = 'get') { |
|
281 | 281 | echo sprintf( |
282 | 282 | '<div class="container"> |
283 | 283 | <form class="form-horizontal" method="%s" action="%s">' |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | define('FORM_LEFT_OFFSET', 'col-sm-offset-4'); |
302 | 302 | define('FORM_RIGHT_CLASS', 'col-sm-8'); |
303 | 303 | |
304 | -function form_input_text($label, $name, $value='', $type='text', $attrs='', $extra='') { |
|
304 | +function form_input_text($label, $name, $value = '', $type = 'text', $attrs = '', $extra = '') { |
|
305 | 305 | echo sprintf(' |
306 | 306 | <div class="form-group"> |
307 | 307 | <label class="control-label %s">%s</label> |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | ); |
329 | 329 | } |
330 | 330 | |
331 | -function form_input_textarea($label, $name, $value='') { |
|
331 | +function form_input_textarea($label, $name, $value = '') { |
|
332 | 332 | echo sprintf(' |
333 | 333 | <div class="form-group"> |
334 | 334 | <label class="control-label %s" for="%s">%s</label> |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | ); |
378 | 378 | $n = 0; |
379 | 379 | foreach ($items as $i) { |
380 | - $s = ($flags && $flags[$n])?'selected':''; |
|
380 | + $s = ($flags && $flags[$n]) ? 'selected' : ''; |
|
381 | 381 | echo '<option '.$s.' value="'.$i[0].'">'.$i[1].'</option> |
382 | 382 | '; |
383 | 383 | $n++; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | // $items is list of (name, label, checked) |
389 | 389 | // |
390 | -function form_checkboxes($label, $items, $attrs='') { |
|
390 | +function form_checkboxes($label, $items, $attrs = '') { |
|
391 | 391 | echo sprintf(' |
392 | 392 | <div class="form-group"> |
393 | 393 | <label class="control-label %s">%s</label> |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | } |
405 | 405 | echo sprintf('<input %s type="checkbox" name="%s" %s> %s |
406 | 406 | ', |
407 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
407 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
408 | 408 | ); |
409 | 409 | } |
410 | 410 | echo '</div> |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
424 | 424 | ); |
425 | 425 | foreach ($items as $i) { |
426 | - $checked = ($selected == $i[0])?"checked":""; |
|
426 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
427 | 427 | echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br> |
428 | 428 | ', |
429 | 429 | $name, $i[0], $checked, $i[1] |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | '; |
457 | 457 | } |
458 | 458 | |
459 | -function form_submit($text, $attrs='') { |
|
459 | +function form_submit($text, $attrs = '') { |
|
460 | 460 | form_general( |
461 | 461 | "", |
462 | 462 | sprintf('<button %s type="submit" class="btn btn-success">%s</button>', |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | ); |
466 | 466 | } |
467 | 467 | |
468 | -function form_checkbox($label, $name, $checked=false) { |
|
468 | +function form_checkbox($label, $name, $checked = false) { |
|
469 | 469 | echo sprintf(' |
470 | 470 | <div class="form-group"> |
471 | 471 | <input type="checkbox" name="%s" %s> <span class="lead">%s</span> |
472 | 472 | </div> |
473 | - ', $name, $checked?"checked":"", $label |
|
473 | + ', $name, $checked ? "checked" : "", $label |
|
474 | 474 | ); |
475 | 475 | } |
@@ -56,7 +56,7 @@ |
||
56 | 56 | if (!parse_bool($config, "disable_account_creation") |
57 | 57 | && !parse_bool($config, "no_web_account_creation") |
58 | 58 | ) { |
59 | - echo tra("or %1 create an account %2.", "<a href=\"create_account_form.php?next_url=$next_url\">","</a>"); |
|
59 | + echo tra("or %1 create an account %2.", "<a href=\"create_account_form.php?next_url=$next_url\">", "</a>"); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | page_tail(); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | echo tra("Invalid password."); |
56 | 56 | } else { |
57 | 57 | $passwd_hash = md5($passwd.$email_addr); |
58 | - $database_passwd_hash = password_hash($passwd_hash , PASSWORD_DEFAULT); |
|
58 | + $database_passwd_hash = password_hash($passwd_hash, PASSWORD_DEFAULT); |
|
59 | 59 | $email_addr = BoincDb::escape_string($email_addr); |
60 | 60 | $result = $user->update( |
61 | 61 | "email_addr='$email_addr', passwd_hash='$database_passwd_hash', email_validated=0" |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | tra("Must be at least %1 characters", $min_passwd_length), |
98 | 98 | tra("Password") |
99 | 99 | ), |
100 | - "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd") |
|
100 | + "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd") |
|
101 | 101 | ); |
102 | 102 | form_select( |
103 | 103 | sprintf('<span title="%s">%s</span>', |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | } else { |
124 | 124 | $x = tra("Email address:"); |
125 | 125 | } |
126 | - form_input_text($x, "email_addr", '', 'text', $attrs='autofocus tabindex="1"'); |
|
126 | + form_input_text($x, "email_addr", '', 'text', $attrs = 'autofocus tabindex="1"'); |
|
127 | 127 | form_input_text( |
128 | - tra("Password:").'<br><small><a href="get_passwd.php">' . tra("forgot password?") . "</a></small>", |
|
128 | + tra("Password:").'<br><small><a href="get_passwd.php">'.tra("forgot password?")."</a></small>", |
|
129 | 129 | "passwd", |
130 | 130 | "", |
131 | 131 | "password", |