Completed
Pull Request — master (#2472)
by Kevin
10:54
created
html/inc/email.inc 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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_confirm_delete_account_token($user);
115
-    if ( $token == null ) {
115
+    if ($token == null) {
116 116
         error_page("Error creating token.  Please try again later.");
117 117
     }
118 118
     
Please login to merge, or discard this patch.
html/inc/user.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 // they've participated in
34 34
 //
35 35
 function get_other_projects($user) {
36
-    $cpid = md5($user->cross_project_id . $user->email_addr);
36
+    $cpid = md5($user->cross_project_id.$user->email_addr);
37 37
     $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid;
38 38
 
39 39
     // Check the cache for that URL
40 40
     //
41 41
     $cacheddata = get_cached_data(REMOTE_PROJECTS_TTL, $url);
42
-    if ($cacheddata){
42
+    if ($cacheddata) {
43 43
         $remote = unserialize($cacheddata);
44 44
     } else {
45 45
         // Fetch the XML, use curl if fopen() is disallowed
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 function cmp($a, $b) {
112 112
     if ($a->expavg_credit == $b->expavg_credit) return 0;
113
-    return ($a->expavg_credit < $b->expavg_credit)? 1 : -1;
113
+    return ($a->expavg_credit < $b->expavg_credit) ? 1 : -1;
114 114
 }
115 115
 
116 116
 function show_other_projects($user, $personal) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         ),
134 134
         array("", ALIGN_RIGHT, ALIGN_RIGHT, ALIGN_RIGHT)
135 135
     );
136
-    foreach($user->projects as $project) {
136
+    foreach ($user->projects as $project) {
137 137
         show_project($project);
138 138
     }
139 139
     end_table();
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     }
175 175
 
176 176
     if (!NO_STATS) {
177
-        $cpid = md5($user->cross_project_id . $user->email_addr);
177
+        $cpid = md5($user->cross_project_id.$user->email_addr);
178 178
         $x = "";
179 179
         shuffle($cpid_stats_sites);
180 180
         foreach ($cpid_stats_sites as $site) {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     } else {
263 263
         $delete_account_str = "";
264 264
         $config = get_config();
265
-        if ( parse_bool($config, "enable_delete_account") ) {
265
+        if (parse_bool($config, "enable_delete_account")) {
266 266
             $delete_account_str = " &middot; <a href=\"delete_account_request.php\">".tra("delete account")."</a>";
267 267
         }
268 268
         
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 // show user name, with links to profile if present.
328 328
 // if $badge_height is > 0, show badges
329 329
 //
330
-function user_links($user, $badge_height=0) {
330
+function user_links($user, $badge_height = 0) {
331 331
     BoincForumPrefs::lookup($user);
332 332
     if (is_banished($user)) {
333 333
         return "(banished: ID $user->id)";
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         $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>';
339 339
     }
340 340
     $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$user->name."</a>";
341
-    if (function_exists("project_user_links")){
341
+    if (function_exists("project_user_links")) {
342 342
         $x .= project_user_links($user);
343 343
     }
344 344
     if ($badge_height) {
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
             // if there's a foundership request, notify the founder
393 393
             //
394
-            if ($user->id==$team->userid && $team->ping_user >0) {
394
+            if ($user->id == $team->userid && $team->ping_user > 0) {
395 395
                 $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>";
396 396
             }
397 397
             row2(tra("Member of team"), $x);
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
     $x = "<a href=\"user_search.php\">".tra("Find friends")."</a><br/>\n";
417 417
     $n = count($friends);
418 418
     if ($n) {
419
-        foreach($friends as $friend) {
419
+        foreach ($friends as $friend) {
420 420
             $fuser = BoincUser::lookup_id($friend->user_dest);
421 421
             if (!$fuser) continue;
422 422
             $x .= friend_links($fuser);
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 // Returns a cacheable community links data object
460 460
 // @param user The user to produce a community links object for
461 461
 
462
-function get_community_links_object($user){
462
+function get_community_links_object($user) {
463 463
     $cache_object = new StdClass;
464 464
     $cache_object->post_count = total_posts($user);
465 465
     $cache_object->user = $user;
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
     $cache_object->friends = array();
468 468
 
469 469
     $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1");
470
-    foreach($friends as $friend) {
470
+    foreach ($friends as $friend) {
471 471
         $fuser = BoincUser::lookup_id($friend->user_dest);
472 472
         if (!$fuser) continue;
473 473
         $cache_object->friends[] = $fuser;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
     return $cache_object;
476 476
 }
477 477
 
478
-function community_links($clo, $logged_in_user){
478
+function community_links($clo, $logged_in_user) {
479 479
     $user = $clo->user;
480 480
     $team = $clo->team;
481 481
     $friends = $clo->friends;
@@ -501,15 +501,15 @@  discard block
 block discarded – undo
501 501
                 "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>"
502 502
             );
503 503
         } else if ($friend) {
504
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
504
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
505 505
         } else {
506
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
506
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
507 507
         }
508 508
     }
509 509
     
510 510
     if ($friends) {
511 511
         $x = "";
512
-        foreach($friends as $friend) {
512
+        foreach ($friends as $friend) {
513 513
             $x .= friend_links($friend);
514 514
         }
515 515
         row2(tra("Friends")." (".sizeof($friends).")", $x);
@@ -553,6 +553,6 @@  discard block
 block discarded – undo
553 553
     );
554 554
 }
555 555
 
556
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
556
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
557 557
 
558 558
 ?>
Please login to merge, or discard this patch.
html/inc/user_util.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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
     
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 function is_banned_email_addr($email_addr) {
51 51
     global $banned_email_domains;
52 52
     if (isset($banned_email_domains)) {
53
-        foreach($banned_email_domains as $d) {
53
+        foreach ($banned_email_domains as $d) {
54 54
             $x = strstr($email_addr, $d);
55 55
             if ($x == $d) return true;
56 56
         }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 //
79 79
 function make_user(
80 80
     $email_addr, $name, $passwd_hash,
81
-    $country=null, $postal_code=null, $project_prefs=null, $teamid=0
81
+    $country = null, $postal_code = null, $project_prefs = null, $teamid = 0
82 82
 ) {
83 83
     if (!is_valid_email_addr($email_addr)) return null;
84 84
     if (is_banned_email_addr($email_addr)) return null;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         show_error(tra("Passwords may only include ASCII characters."));
207 207
     }
208 208
 
209
-    if (strlen($passwd)<$min_passwd_length) {
209
+    if (strlen($passwd) < $min_passwd_length) {
210 210
         show_error(
211 211
             tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length)
212 212
         );
Please login to merge, or discard this patch.
html/inc/token.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 function create_confirm_delete_account_token($user) {
33 33
     $token = random_string();
34 34
     $ret = BoincToken::insert("(token,userid,type,expire_time) values ('$token', $user->id, '".TOKEN_TYPE_DELETE_ACCOUNT."', unix_timestamp()+".TOKEN_DURATION_ONE_DAY.")");
35
-    if ( !$ret ) {
35
+    if (!$ret) {
36 36
         return null;
37 37
     }
38 38
     return $token;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 function is_valid_delete_account_token($user, $token) {
42 42
     $boincToken = BoincToken::lookup_valid_token($user->id, $token, TOKEN_TYPE_DELETE_ACCOUNT);
43
-    if ( $boincToken == null ) {
43
+    if ($boincToken == null) {
44 44
         return false;
45 45
     }
46 46
     return true;
Please login to merge, or discard this patch.
html/user/delete_account_request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 $user = get_logged_in_user();
23 23
 
24 24
 $config = get_config();
25
-if ( !parse_bool($config, "enable_delete_account") ) {
25
+if (!parse_bool($config, "enable_delete_account")) {
26 26
     error_page(
27 27
         tra("This feature is disabled.  Please contact the project administrator.")
28 28
     );
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     ."</ul><br/>";
41 41
 
42 42
 form_start(secure_url_base()."delete_account_request_action.php", "post");
43
-form_input_text(tra("Password"), "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd"));
43
+form_input_text(tra("Password"), "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd"));
44 44
 form_submit(tra("Send Confirmation Email"));
45 45
 form_end();
46 46
 
Please login to merge, or discard this patch.
html/user/delete_account_request_action.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 $user = get_logged_in_user();
26 26
 
27 27
 $config = get_config();
28
-if ( !parse_bool($config, "enable_delete_account") ) {
28
+if (!parse_bool($config, "enable_delete_account")) {
29 29
     error_page(
30 30
         tra("This feature is disabled.  Please contact the project administrator.")
31 31
     );
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 $user = get_logged_in_user();
36 36
 $passwd = post_str("passwd");
37 37
 
38
-if( !check_passwd($user, $passwd) ) {
38
+if (!check_passwd($user, $passwd)) {
39 39
     sleep(LOGIN_FAIL_SLEEP_SEC);
40 40
     page_head("Password incorrect");
41 41
     echo "The password you entered is incorrect. Please go back and try again.\n";
Please login to merge, or discard this patch.
html/ops/test_token.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,31 +8,31 @@
 block discarded – undo
8 8
 BoincToken::insert("(token,userid,type,expire_time) values ('$token', 0, 'T', unix_timestamp()+3600)");
9 9
 
10 10
 $boincTokens = BoincToken::enum("userid=0");
11
-foreach($boincTokens as $boincToken) {
12
-    echo $boincToken->token . "\n";
13
-    echo $boincToken->userid . "\n";
14
-    echo $boincToken->type . "\n";
15
-    echo $boincToken->create_time . "\n";
16
-    echo $boincToken->expire_time . "\n";
11
+foreach ($boincTokens as $boincToken) {
12
+    echo $boincToken->token."\n";
13
+    echo $boincToken->userid."\n";
14
+    echo $boincToken->type."\n";
15
+    echo $boincToken->create_time."\n";
16
+    echo $boincToken->expire_time."\n";
17 17
 }
18 18
 
19 19
 echo "---------------\n";
20 20
 $boincToken = BoincToken::lookup("userid=0");
21
-echo $boincToken->token . "\n";
22
-echo $boincToken->userid . "\n";
23
-echo $boincToken->type . "\n";
24
-echo $boincToken->create_time . "\n";
25
-echo $boincToken->expire_time . "\n";
21
+echo $boincToken->token."\n";
22
+echo $boincToken->userid."\n";
23
+echo $boincToken->type."\n";
24
+echo $boincToken->create_time."\n";
25
+echo $boincToken->expire_time."\n";
26 26
 
27 27
 echo "---------------\n";
28 28
 $boincToken = BoincToken::lookup_valid_token(0, $token, 'T');
29
-if ( $boincToken != null ) {
29
+if ($boincToken != null) {
30 30
    echo "Found valid token\n";
31 31
 }
32 32
 
33 33
 echo "---------------\n";
34 34
 $boincToken = BoincToken::lookup_valid_token(0, 'notrealtoken', 'T');
35
-if ( $boincToken == null ) {
35
+if ($boincToken == null) {
36 36
    echo "Successfully didn't find invalid token\n";
37 37
 }
38 38
 
Please login to merge, or discard this patch.