@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | function check_passwd($user, $passwd) { |
34 | 34 | $passwd_hash = md5($passwd.$user->email_addr); |
35 | 35 | |
36 | - if ( password_verify($passwd_hash, $user->passwd_hash) ) { |
|
36 | + if (password_verify($passwd_hash, $user->passwd_hash)) { |
|
37 | 37 | return true; |
38 | 38 | } |
39 | 39 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | function check_passwd_ui($user, $passwd) { |
51 | - if( !check_passwd($user, $passwd) ) { |
|
51 | + if (!check_passwd($user, $passwd)) { |
|
52 | 52 | sleep(LOGIN_FAIL_SLEEP_SEC); |
53 | 53 | page_head("Password incorrect"); |
54 | 54 | echo "The password you entered is incorrect. Please go back and try again.\n"; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | function is_banned_email_addr($email_addr) { |
61 | 61 | global $banned_email_domains; |
62 | 62 | if (isset($banned_email_domains)) { |
63 | - foreach($banned_email_domains as $d) { |
|
63 | + foreach ($banned_email_domains as $d) { |
|
64 | 64 | $x = strstr($email_addr, $d); |
65 | 65 | if ($x == $d) return true; |
66 | 66 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | // |
89 | 89 | function make_user( |
90 | 90 | $email_addr, $name, $passwd_hash, |
91 | - $country=null, $postal_code=null, $project_prefs=null, $teamid=0 |
|
91 | + $country = null, $postal_code = null, $project_prefs = null, $teamid = 0 |
|
92 | 92 | ) { |
93 | 93 | if (!is_valid_email_addr($email_addr)) return null; |
94 | 94 | if (is_banned_email_addr($email_addr)) return null; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | show_error(tra("Passwords may only include ASCII characters.")); |
217 | 217 | } |
218 | 218 | |
219 | - if (strlen($passwd)<$min_passwd_length) { |
|
219 | + if (strlen($passwd) < $min_passwd_length) { |
|
220 | 220 | show_error( |
221 | 221 | tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length) |
222 | 222 | ); |
@@ -28,13 +28,13 @@ |
||
28 | 28 | echo "---------------\n"; |
29 | 29 | $boincToken = BoincToken::lookup_valid_token(0, $token, 'T'); |
30 | 30 | if ( $boincToken != null ) { |
31 | - echo "Found valid token\n"; |
|
31 | + echo "Found valid token\n"; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | echo "---------------\n"; |
35 | 35 | $boincToken = BoincToken::lookup_valid_token(0, 'notrealtoken', 'T'); |
36 | 36 | if ( $boincToken == null ) { |
37 | - echo "Successfully didn't find invalid token\n"; |
|
37 | + echo "Successfully didn't find invalid token\n"; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | echo "---------------\n"; |
@@ -32,9 +32,9 @@ |
||
32 | 32 | page_head(tra("Delete Account")); |
33 | 33 | |
34 | 34 | echo "<p>".tra("Thank you for verifying ownership of your account.")."</p>" |
35 | - ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>" |
|
36 | - ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>" |
|
37 | - ."<br/>"; |
|
35 | + ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>" |
|
36 | + ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>" |
|
37 | + ."<br/>"; |
|
38 | 38 | |
39 | 39 | form_start(secure_url_base()."delete_account_confirm_action.php", "post"); |
40 | 40 | form_input_hidden("token",$token); |
@@ -37,9 +37,9 @@ |
||
37 | 37 | ."<br/>"; |
38 | 38 | |
39 | 39 | form_start(secure_url_base()."delete_account_confirm_action.php", "post"); |
40 | - form_input_hidden("token",$token); |
|
41 | - form_input_hidden("id",$userid); |
|
42 | - form_input_text(tra("Password"), "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd")); |
|
40 | + form_input_hidden("token", $token); |
|
41 | + form_input_hidden("id", $userid); |
|
42 | + form_input_text(tra("Password"), "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd")); |
|
43 | 43 | form_submit(tra("Delete Account")); |
44 | 44 | form_end(); |
45 | 45 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | ."</ul><br/>"; |
38 | 38 | |
39 | 39 | form_start(secure_url_base()."delete_account_request.php", "post"); |
40 | - form_input_text(tra("Password"), "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd")); |
|
40 | + form_input_text(tra("Password"), "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd")); |
|
41 | 41 | form_submit(tra("Send Confirmation Email")); |
42 | 42 | form_end(); |
43 | 43 |
@@ -25,6 +25,10 @@ discard block |
||
25 | 25 | // Constants for token durations |
26 | 26 | define("TOKEN_DURATION_ONE_DAY", 86400); |
27 | 27 | |
28 | +/** |
|
29 | + * @param string $type |
|
30 | + * @param integer $duration |
|
31 | + */ |
|
28 | 32 | function create_token($userid, $type, $duration) { |
29 | 33 | $token = random_string(); |
30 | 34 | $now = time(); |
@@ -37,6 +41,9 @@ discard block |
||
37 | 41 | return $token; |
38 | 42 | } |
39 | 43 | |
44 | +/** |
|
45 | + * @param string $type |
|
46 | + */ |
|
40 | 47 | function is_valid_token($userid, $token, $type) { |
41 | 48 | $boincToken = BoincToken::lookup_valid_token($userid, $token, $type); |
42 | 49 | if ( $boincToken == null ) { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | // send an email, using PHPMailer or not. |
27 | 27 | // |
28 | -function send_email($user, $subject, $body, $body_html=null) { |
|
28 | +function send_email($user, $subject, $body, $body_html = null) { |
|
29 | 29 | if (function_exists("make_php_mailer")) { |
30 | 30 | require_once("../inc/phpmailer/class.phpmailer.php"); |
31 | 31 | $mail = make_php_mailer(); |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | return true; |
45 | 45 | } |
46 | 46 | } else { |
47 | - $headers =""; |
|
47 | + $headers = ""; |
|
48 | 48 | if (defined('EMAIL_FROM') && defined('EMAIL_FROM_NAME')) { |
49 | 49 | $headers = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM.">"; |
50 | 50 | } else if (defined('EMAIL_FROM')) { |
51 | - $headers = "From: ". EMAIL_FROM; |
|
51 | + $headers = "From: ".EMAIL_FROM; |
|
52 | 52 | } |
53 | 53 | return mail($user->email_addr, $subject, $body, $headers); |
54 | 54 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | if (defined("USE_STOPFORUMSPAM") && USE_STOPFORUMSPAM && array_key_exists('REMOTE_ADDR', $_SERVER)) { |
97 | 97 | $ip = $_SERVER['REMOTE_ADDR']; |
98 | 98 | // For obviously private IPs check just the email against SFS, otherwise check both IP and email |
99 | - if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
99 | + if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE|FILTER_FLAG_NO_RES_RANGE)) { |
|
100 | 100 | $x = @file_get_contents("https://www.stopforumspam.com/api?ip=".$ip."&email=".$addr); |
101 | 101 | } else { |
102 | 102 | $x = @file_get_contents("https://www.stopforumspam.com/api?email=".$addr); |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | } |
108 | 108 | $pattern = '/^([^@]+)@([^@\.]+)\.([^@]{2,})$/'; |
109 | 109 | $match = preg_match($pattern, $addr); |
110 | - return (bool) $match; |
|
110 | + return (bool)$match; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | function send_confirm_delete_email($user) { |
114 | 114 | $token = create_token($user->id, TOKEN_TYPE_DELETE_ACCOUNT, TOKEN_DURATION_ONE_DAY); |
115 | - if ( $token == null ) { |
|
115 | + if ($token == null) { |
|
116 | 116 | error_page("Error creating token. Please try again later."); |
117 | 117 | } |
118 | 118 |
@@ -27,6 +27,9 @@ |
||
27 | 27 | ); |
28 | 28 | } |
29 | 29 | |
30 | +/** |
|
31 | + * @param null|integer $userid |
|
32 | + */ |
|
30 | 33 | function check_delete_account_token($userid, $token) { |
31 | 34 | if( !is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT) ) { |
32 | 35 | sleep(LOGIN_FAIL_SLEEP_SEC); |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | define("DELETE_ACCOUNT_METHOD_WIPE", 2); |
22 | 22 | |
23 | 23 | $config = get_config(); |
24 | -if ( !parse_bool($config, "enable_delete_account") ) { |
|
24 | +if (!parse_bool($config, "enable_delete_account")) { |
|
25 | 25 | error_page( |
26 | 26 | tra("This feature is disabled. Please contact the project administrator.") |
27 | 27 | ); |
28 | 28 | } |
29 | 29 | |
30 | 30 | function check_delete_account_token($userid, $token) { |
31 | - if( !is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT) ) { |
|
31 | + if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT)) { |
|
32 | 32 | sleep(LOGIN_FAIL_SLEEP_SEC); |
33 | 33 | error_page( |
34 | 34 | tra("The token you used has expired or is otherwise not valid. Please request a new one <a href=\"delete_account_request.php\">here</a>") |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | */ |
43 | 43 | function delete_account($userid) { |
44 | 44 | $enable_delete_account = parse_int($config, "enable_delete_account"); |
45 | - if ( $enable_delete_account == DELETE_ACCOUNT_METHOD_OBFUSCATE ) { |
|
45 | + if ($enable_delete_account == DELETE_ACCOUNT_METHOD_OBFUSCATE) { |
|
46 | 46 | return obfuscate_account($userid); |
47 | - } else if ( $enable_delete_account == DELETE_ACCOUNT_METHOD_WIPE ) { |
|
47 | + } else if ($enable_delete_account == DELETE_ACCOUNT_METHOD_WIPE) { |
|
48 | 48 | return wipe_account($userid); |
49 | 49 | } else { |
50 | 50 | error_page( |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | // they've participated in |
36 | 36 | // |
37 | 37 | function get_other_projects($user) { |
38 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
38 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
39 | 39 | $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid; |
40 | 40 | |
41 | 41 | // Check the cache for that URL |
42 | 42 | // |
43 | 43 | $cacheddata = get_cached_data(REMOTE_PROJECTS_TTL, $url); |
44 | - if ($cacheddata){ |
|
44 | + if ($cacheddata) { |
|
45 | 45 | $remote = unserialize($cacheddata); |
46 | 46 | } else { |
47 | 47 | // Fetch the XML, use curl if fopen() is disallowed |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | function cmp($a, $b) { |
114 | 114 | if ($a->expavg_credit == $b->expavg_credit) return 0; |
115 | - return ($a->expavg_credit < $b->expavg_credit)? 1 : -1; |
|
115 | + return ($a->expavg_credit < $b->expavg_credit) ? 1 : -1; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | function show_other_projects($user, $personal) { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ), |
136 | 136 | array("", ALIGN_RIGHT, ALIGN_RIGHT, ALIGN_RIGHT) |
137 | 137 | ); |
138 | - foreach($user->projects as $project) { |
|
138 | + foreach ($user->projects as $project) { |
|
139 | 139 | show_project($project); |
140 | 140 | } |
141 | 141 | end_table(); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | if (!NO_STATS) { |
179 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
179 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
180 | 180 | $x = ""; |
181 | 181 | shuffle($cpid_stats_sites); |
182 | 182 | foreach ($cpid_stats_sites as $site) { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } else { |
265 | 265 | $delete_account_str = ""; |
266 | 266 | $config = get_config(); |
267 | - if ( parse_bool($config, "enable_delete_account") ) { |
|
267 | + if (parse_bool($config, "enable_delete_account")) { |
|
268 | 268 | $delete_account_str = " · <a href=\"delete_account_request.php\">".tra("delete account")."</a>"; |
269 | 269 | } |
270 | 270 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | // show user name, with links to profile if present. |
330 | 330 | // if $badge_height is > 0, show badges |
331 | 331 | // |
332 | -function user_links($user, $badge_height=0) { |
|
332 | +function user_links($user, $badge_height = 0) { |
|
333 | 333 | BoincForumPrefs::lookup($user); |
334 | 334 | if (is_banished($user)) { |
335 | 335 | return "(banished: ID $user->id)"; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $x .= ' <a href="'.url_base().'view_profile.php?userid='.$user->id.'"><img title="View the profile of '.$user->name.'" src="'.$img_url.'" alt="Profile"></a>'; |
341 | 341 | } |
342 | 342 | $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$user->name."</a>"; |
343 | - if (function_exists("project_user_links")){ |
|
343 | + if (function_exists("project_user_links")) { |
|
344 | 344 | $x .= project_user_links($user); |
345 | 345 | } |
346 | 346 | if ($badge_height) { |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | // if there's a foundership request, notify the founder |
395 | 395 | // |
396 | - if ($user->id==$team->userid && $team->ping_user >0) { |
|
396 | + if ($user->id == $team->userid && $team->ping_user > 0) { |
|
397 | 397 | $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>"; |
398 | 398 | } |
399 | 399 | row2(tra("Member of team"), $x); |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $x = "<a href=\"user_search.php\">".tra("Find friends")."</a><br/>\n"; |
419 | 419 | $n = count($friends); |
420 | 420 | if ($n) { |
421 | - foreach($friends as $friend) { |
|
421 | + foreach ($friends as $friend) { |
|
422 | 422 | $fuser = BoincUser::lookup_id($friend->user_dest); |
423 | 423 | if (!$fuser) continue; |
424 | 424 | $x .= friend_links($fuser); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | // Returns a cacheable community links data object |
462 | 462 | // @param user The user to produce a community links object for |
463 | 463 | |
464 | -function get_community_links_object($user){ |
|
464 | +function get_community_links_object($user) { |
|
465 | 465 | $cache_object = new StdClass; |
466 | 466 | $cache_object->post_count = total_posts($user); |
467 | 467 | $cache_object->user = $user; |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $cache_object->friends = array(); |
470 | 470 | |
471 | 471 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
472 | - foreach($friends as $friend) { |
|
472 | + foreach ($friends as $friend) { |
|
473 | 473 | $fuser = BoincUser::lookup_id($friend->user_dest); |
474 | 474 | if (!$fuser) continue; |
475 | 475 | $cache_object->friends[] = $fuser; |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | return $cache_object; |
478 | 478 | } |
479 | 479 | |
480 | -function community_links($clo, $logged_in_user){ |
|
480 | +function community_links($clo, $logged_in_user) { |
|
481 | 481 | $user = $clo->user; |
482 | 482 | $team = $clo->team; |
483 | 483 | $friends = $clo->friends; |
@@ -503,15 +503,15 @@ discard block |
||
503 | 503 | "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>" |
504 | 504 | ); |
505 | 505 | } else if ($friend) { |
506 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
506 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
507 | 507 | } else { |
508 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
508 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | 512 | if ($friends) { |
513 | 513 | $x = ""; |
514 | - foreach($friends as $friend) { |
|
514 | + foreach ($friends as $friend) { |
|
515 | 515 | $x .= friend_links($friend); |
516 | 516 | } |
517 | 517 | row2(tra("Friends")." (".sizeof($friends).")", $x); |
@@ -578,6 +578,6 @@ discard block |
||
578 | 578 | return true; |
579 | 579 | } |
580 | 580 | |
581 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
581 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
582 | 582 | |
583 | 583 | ?> |