Completed
Pull Request — master (#2472)
by Kevin
11:50
created
html/ops/test_token.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@
 block discarded – undo
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";
Please login to merge, or discard this patch.
html/user/delete_account_confirm.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
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.php", "post");
40 40
     form_input_hidden("token",$token);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 require_once("../inc/user_util.inc");
25 25
 
26 26
 $config = get_config();
27
-if ( !parse_bool($config, "enable_delete_account") ) {
27
+if (!parse_bool($config, "enable_delete_account")) {
28 28
     error_page(
29 29
         tra("This feature is disabled.  Please contact the project administrator.")
30 30
     );
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     $userid = get_int("id");
36 36
     $token = get_str("token");
37 37
     $retval = check_delete_account_token($userid, $token);
38
-    if ( !$retval ) {
38
+    if (!$retval) {
39 39
         error_page(
40 40
             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>")
41 41
         );
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
          ."<br/>";
50 50
     
51 51
     form_start(secure_url_base()."delete_account_confirm.php", "post");
52
-    form_input_hidden("token",$token);
53
-    form_input_hidden("id",$userid);
54
-    form_input_text(tra("Password"), "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd"));
52
+    form_input_hidden("token", $token);
53
+    form_input_hidden("id", $userid);
54
+    form_input_text(tra("Password"), "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd"));
55 55
     form_submit(tra("Delete Account"));
56 56
     form_end();
57 57
     
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     $userid = post_int("id");
64 64
     $token = post_str("token");
65 65
     $retval = check_delete_account_token($userid, $token);
66
-    if ( !$retval ) {
66
+    if (!$retval) {
67 67
         error_page(
68 68
             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>")
69 69
         );
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     $passwd = post_str("passwd");
75 75
     check_passwd_ui($user, $passwd);
76 76
     
77
-    if ( !delete_account($user) ) {
77
+    if (!delete_account($user)) {
78 78
         error_page(
79 79
             tra("Failed to delete your account.  Please contact the project administrator.")
80 80
         );    
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);
@@ -554,6 +554,6 @@  discard block
 block discarded – undo
554 554
 }
555 555
 
556 556
 
557
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
557
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
558 558
 
559 559
 ?>
Please login to merge, or discard this patch.
html/inc/team.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     row2('<b>'.tra('Search criteria (use one or more)').'</b>', '');
41 41
     row2(
42 42
         tra('Key words').'<br><small>'.tra('Find teams with these words in their names or descriptions').'</small>',
43
-        '<input class="form-control" type="text" name="keywords" value="' . htmlspecialchars($params->keywords) . '">');
43
+        '<input class="form-control" type="text" name="keywords" value="'.htmlspecialchars($params->keywords).'">');
44 44
     row2_init(tra('Country'), '');
45 45
     echo '<select class="form-control" name="country"><option value="" selected>---</option>';
46 46
     $country = $params->country;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     echo country_select_options($country);
49 49
     echo "</select></td></tr>\n";
50 50
     row2(tra('Type of team'), team_type_select($params->type, true));
51
-    $checked = $params->active?"checked":"";
51
+    $checked = $params->active ? "checked" : "";
52 52
     row2(tra('Show only active teams'), "<input type=checkbox name=active $checked>");
53 53
     row2("", "<input class=\"btn btn-primary\" type=submit name=submit value=\"".tra('Search')."\">");
54 54
     end_table();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     row2("Created", date_str($team->create_time));
97 97
     if (defined("SHOW_NONVALIDATED_TEAMS")) {
98 98
         $founder = $team->founder;
99
-        row2("Founder email validated", $founder->email_validated?"Yes":"No (team will not be exported)");
99
+        row2("Founder email validated", $founder->email_validated ? "Yes" : "No (team will not be exported)");
100 100
     }
101 101
     if (strlen($team->url)) {;
102 102
         if (strstr($team->url, "http://")) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     }
170 170
     row1(tra('Members'));
171 171
     row2(tra('Founder'),
172
-        $team->founder?user_links($team->founder, BADGE_HEIGHT_MEDIUM):"---"
172
+        $team->founder ?user_links($team->founder, BADGE_HEIGHT_MEDIUM) : "---"
173 173
     );
174 174
     if (count($team->admins)) {
175 175
         $first = true;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
         foreach ($deltas as $delta) {
354 354
             $u = BoincUser::lookup_id($delta->userid);
355 355
             if ($u->teamid == $teamid) {
356
-                $new_members[] = $u;  // they might have later quit
356
+                $new_members[] = $u; // they might have later quit
357 357
             }
358 358
         }
359 359
     }
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     if (!$user->teamid) return;
437 437
     $user->update("teamid=0");
438 438
     $team = BoincTeam::lookup_id($user->teamid);
439
-    if ($team && $team->ping_user==$user->id) {
439
+    if ($team && $team->ping_user == $user->id) {
440 440
         $team->update("ping_user=-ping_user");
441 441
     }
442 442
     BoincTeamAdmin::delete("teamid=$user->teamid and userid=$user->id");
@@ -475,34 +475,34 @@  discard block
 block discarded – undo
475 475
     start_table();
476 476
     row2(tra('Team name, text version').'
477 477
         <br><p class=\"text-muted\">'.tra('Don\'t use HTML tags.').'</p>',
478
-        '<input class="form-control" name="name" type="text" size="50" value="'.($team?$team->name:"").'">'
478
+        '<input class="form-control" name="name" type="text" size="50" value="'.($team ? $team->name : "").'">'
479 479
     );
480 480
     row2(tra('Team name, HTML version').'
481 481
         <br><p class=\"text-muted\">
482 482
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
483 483
         '.tra('If you don\'t know HTML, leave this box blank.').'</p>',
484
-        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"',"'",($team?$team->name_html:"")).'">'
484
+        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"', "'", ($team ? $team->name_html : "")).'">'
485 485
     );
486 486
     row2(tra('URL of team web page, if any').':<br><font size=-2>('.tra('without "http://"').')
487 487
         '.tra('This URL will be linked to from the team\'s page on this site.'),
488
-        '<input class="form-control" type="text" name="url" size="60" value="'.($team?$team->url:"").'">'
488
+        '<input class="form-control" type="text" name="url" size="60" value="'.($team ? $team->url : "").'">'
489 489
     );
490 490
     row2(tra('Description of team').':
491 491
         <br><p class=\"text-muted\">
492 492
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
493 493
         </p>',
494
-        '<textarea class="form-control" name="description" rows=10>'.($team?$team->description:"").'</textarea>'
494
+        '<textarea class="form-control" name="description" rows=10>'.($team ? $team->description : "").'</textarea>'
495 495
     );
496 496
 
497
-    row2(tra('Type of team').':', team_type_select($team?$team->type:null));
497
+    row2(tra('Type of team').':', team_type_select($team ? $team->type : null));
498 498
 
499 499
     row2_init(tra('Country'),
500 500
         '<select class="form-control" name="country">'
501 501
     );
502
-    echo country_select_options($team?$team->country:null);
502
+    echo country_select_options($team ? $team->country : null);
503 503
 
504 504
     echo "</select></td></tr>\n";
505
-    $x = (!$team || $team->joinable)?"checked":"";
505
+    $x = (!$team || $team->joinable) ? "checked" : "";
506 506
     row2(tra("Accept new members?"), "<input type=checkbox name=joinable $x>");
507 507
     // Check if we're using reCaptcha to prevent spam accounts
508 508
     //
@@ -566,12 +566,12 @@  discard block
 block discarded – undo
566 566
 //
567 567
 function new_transfer_request_ok($team, $now) {
568 568
     if ($team->ping_user <= 0) {
569
-        if ($team->ping_time < $now - 60 * 86400) {
569
+        if ($team->ping_time < $now - 60*86400) {
570 570
             return true;
571 571
         }
572 572
         return false;
573 573
     }
574
-    if ($team->ping_time < $now - 90 * 86400) {
574
+    if ($team->ping_time < $now - 90*86400) {
575 575
         return true;
576 576
     }
577 577
     return false;
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
     if (!is_valid_country($country)) {
607 607
         $country = tra('None');
608 608
     }
609
-    $country = BoincDb::escape_string($country);  // for Cote d'Ivoire
609
+    $country = BoincDb::escape_string($country); // for Cote d'Ivoire
610 610
 
611 611
     $clause = sprintf(
612 612
         "(userid, create_time, name, name_lc, url, type, name_html, description, country, nusers, expavg_time) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, unix_timestamp())",
@@ -629,6 +629,6 @@  discard block
 block discarded – undo
629 629
     }
630 630
 }
631 631
 
632
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
632
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
633 633
 
634 634
 ?>
Please login to merge, or discard this patch.
html/inc/user_util.inc 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 }
56 56
 
57 57
 function check_passwd_ui($user, $passwd) {
58
-		$passwd_hash = md5($passwd.$user->email_addr);
58
+        $passwd_hash = md5($passwd.$user->email_addr);
59 59
     if( !check_passwd_hash($user, $passwd_hash) ) {
60 60
         sleep(LOGIN_FAIL_SLEEP_SEC);
61 61
         page_head("Password incorrect");
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 function check_passwd_ui($user, $passwd) {
58 58
 		$passwd_hash = md5($passwd.$user->email_addr);
59
-    if( !check_passwd_hash($user, $passwd_hash) ) {
59
+    if (!check_passwd_hash($user, $passwd_hash)) {
60 60
         sleep(LOGIN_FAIL_SLEEP_SEC);
61 61
         page_head("Password incorrect");
62 62
         echo "The password you entered is incorrect. Please go back and try again.\n";
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 function is_banned_email_addr($email_addr) {
69 69
     global $banned_email_domains;
70 70
     if (isset($banned_email_domains)) {
71
-        foreach($banned_email_domains as $d) {
71
+        foreach ($banned_email_domains as $d) {
72 72
             $x = strstr($email_addr, $d);
73 73
             if ($x == $d) return true;
74 74
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 //
97 97
 function make_user(
98 98
     $email_addr, $name, $passwd_hash,
99
-    $country=null, $postal_code=null, $project_prefs=null, $teamid=0
99
+    $country = null, $postal_code = null, $project_prefs = null, $teamid = 0
100 100
 ) {
101 101
     if (!is_valid_email_addr($email_addr)) return null;
102 102
     if (is_banned_email_addr($email_addr)) return null;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         show_error(tra("Passwords may only include ASCII characters."));
225 225
     }
226 226
 
227
-    if (strlen($passwd)<$min_passwd_length) {
227
+    if (strlen($passwd) < $min_passwd_length) {
228 228
         show_error(
229 229
             tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length)
230 230
         );
Please login to merge, or discard this patch.
html/inc/token.inc 1 patch
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -27,6 +27,10 @@  discard block
 block discarded – undo
27 27
 define("TOKEN_DURATION_ONE_DAY", 86400);
28 28
 define("TOKEN_DURATION_ONE_WEEK", 604800);
29 29
 
30
+/**
31
+ * @param string $type
32
+ * @param integer $duration
33
+ */
30 34
 function create_token($userid, $type, $duration) {
31 35
     $token = random_string();
32 36
     $now = time();
@@ -46,6 +50,9 @@  discard block
 block discarded – undo
46 50
     return $result;
47 51
 }
48 52
 
53
+/**
54
+ * @param string $type
55
+ */
49 56
 function is_valid_token($userid, $token, $type) {
50 57
     $boincToken = BoincToken::lookup_valid_token($userid, $token, $type);
51 58
     if ( $boincToken == null ) {
Please login to merge, or discard this patch.
html/ops/db_update.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     do_query("alter table host add max_results_day integer not null");
277 277
 }
278 278
 
279
-function update_4_20_2005(){
279
+function update_4_20_2005() {
280 280
     do_query("ALTER TABLE `thread` ADD `sticky` TINYINT UNSIGNED DEFAULT '0' NOT NULL");
281 281
     do_query("ALTER TABLE `forum` ADD `post_min_total_credit` INT NOT NULL AFTER `posts`");
282 282
     do_query("ALTER TABLE `forum` ADD `post_min_expavg_credit` INT NOT NULL AFTER `posts`");
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     do_query("ALTER TABLE `forum_preferences` ADD `last_post` INT( 14 ) UNSIGNED NOT NULL AFTER `posts`");
287 287
 }
288 288
 
289
-function update_4_30_2005(){
289
+function update_4_30_2005() {
290 290
     do_query("ALTER TABLE `forum_preferences` ADD `ignore_sticky_posts` TINYINT( 1 ) UNSIGNED NOT NULL");
291 291
 }    
292 292
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
     do_query("update user set country='Macedonia' where country='Macedonia, The Former Yugoslav Republic of'");
314 314
 }
315 315
 
316
-function update_11_24_2005(){
316
+function update_11_24_2005() {
317 317
     do_query("ALTER TABLE `forum_preferences` ADD `minimum_wrap_postcount` INT DEFAULT '100' NOT NULL AFTER `high_rating_threshold` ,
318 318
 ADD `display_wrap_postcount` INT DEFAULT '75' NOT NULL AFTER `minimum_wrap_postcount`");
319 319
 }
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     ");
619 619
 }
620 620
 
621
-function update_10_05_2008(){
621
+function update_10_05_2008() {
622 622
     do_query("alter table forum_preferences add highlight_special tinyint default '1' not null");
623 623
 }
624 624
 
@@ -1129,31 +1129,31 @@  discard block
 block discarded – undo
1129 1129
         ) engine=InnoDB;
1130 1130
     ");
1131 1131
     
1132
-    $retval = $retval &&  do_query("alter table user_deleted
1132
+    $retval = $retval && do_query("alter table user_deleted
1133 1133
         add index ud_create(create_time)
1134 1134
     ");
1135 1135
     
1136
-    $retval = $retval &&  do_query("alter table host_deleted
1136
+    $retval = $retval && do_query("alter table host_deleted
1137 1137
         add index hd_create(create_time)
1138 1138
     ");
1139 1139
     
1140
-    $retval = $retval &&  do_query("alter table team_delta
1140
+    $retval = $retval && do_query("alter table team_delta
1141 1141
         add index team_delta_userid (userid)
1142 1142
     ");
1143 1143
     
1144
-    $retval = $retval &&  do_query("alter table donation_paypal
1144
+    $retval = $retval && do_query("alter table donation_paypal
1145 1145
         add index dp_userid(userid)
1146 1146
     ");
1147 1147
     
1148
-    $retval = $retval &&  do_query("alter table banishment_vote
1148
+    $retval = $retval && do_query("alter table banishment_vote
1149 1149
         add index bv_userid(userid)
1150 1150
     ");
1151 1151
     
1152
-    $retval = $retval &&  do_query("alter table post_ratings
1152
+    $retval = $retval && do_query("alter table post_ratings
1153 1153
         add index pr_user(user)
1154 1154
     ");
1155 1155
     
1156
-    $retval = $retval &&  do_query("alter table msg_from_host
1156
+    $retval = $retval && do_query("alter table msg_from_host
1157 1157
         add index mfh_hostid(hostid)
1158 1158
     ");
1159 1159
     
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 // This used to be the Subversion version#,
1177 1177
 // but with Git we just use sequential integers
1178 1178
 //
1179
-$db_updates = array (
1179
+$db_updates = array(
1180 1180
     array(18490, "update_6_16_2009"),
1181 1181
     array(19001, "update_9_3_2009"),
1182 1182
     array(20807, "update_3_5_2010"),
Please login to merge, or discard this patch.
html/inc/delete_account.inc 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 
40 40
 function check_delete_account_token($userid, $token) {
41
-    if( !is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT) ) {
41
+    if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT)) {
42 42
         sleep(LOGIN_FAIL_SLEEP_SEC);
43 43
         return false;
44 44
     }
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 function delete_account($user) {
64 64
     $config = get_config();
65 65
     $enable_delete_account = parse_config($config, "<enable_delete_account>");
66
-    if ( $enable_delete_account == DELETE_ACCOUNT_METHOD_OBFUSCATE ) {
66
+    if ($enable_delete_account == DELETE_ACCOUNT_METHOD_OBFUSCATE) {
67 67
         return obfuscate_account($user);
68
-    } else if ( $enable_delete_account == DELETE_ACCOUNT_METHOD_WIPE ) {
68
+    } else if ($enable_delete_account == DELETE_ACCOUNT_METHOD_WIPE) {
69 69
         return wipe_account($user);
70
-    } else if ( $enable_delete_account == DELETE_ACCOUNT_METHOD_PROJECT_DEFINED ) {
70
+    } else if ($enable_delete_account == DELETE_ACCOUNT_METHOD_PROJECT_DEFINED) {
71 71
         return project_delete_account($user);
72 72
     } 
73 73
     return false;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 // pending validation or inconclusive
123 123
 function is_over_but_not_validated($res) {
124 124
     if ($res->server_state == RESULT_SERVER_STATE_OVER && $res->outcome == RESULT_OUTCOME_SUCCESS &&
125
-            ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE) ) {
125
+            ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE)) {
126 126
         return true;
127 127
     }    
128 128
     return false;
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 // hostid fields to 0
140 140
 function cancel_results_for_user($user) {
141 141
     $ress = BoincResult::enum("userid = $user->id");
142
-    $cancel_clause="server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID;
143
-    $set_id_clause="hostid=0, userid=0";
144
-    foreach($ress as $res) {
142
+    $cancel_clause = "server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID;
143
+    $set_id_clause = "hostid=0, userid=0";
144
+    foreach ($ress as $res) {
145 145
         if (is_in_progress($res) || is_over_but_not_validated($res)) {
146 146
             $res->update($cancel_clause.", ".$set_id_clause);
147 147
             transition_workunit($res);
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
     insert_deleted_records($user);
161 161
 
162 162
     // delete remote submit user
163
-    delete_remote_submit_user($user);  // from submit_util.inc
163
+    delete_remote_submit_user($user); // from submit_util.inc
164 164
     
165 165
     // remove user's team records
166
-    user_erase_team_owner($user);      // from team.inc
167
-    user_quit_team($user);        // from team.inc
166
+    user_erase_team_owner($user); // from team.inc
167
+    user_quit_team($user); // from team.inc
168 168
     user_erase_team_delta($user); // from team.inc
169 169
     
170 170
     // Items that do not have logic elsewhere
@@ -188,6 +188,6 @@  discard block
 block discarded – undo
188 188
     BoincHost::delete_for_user($user->id);
189 189
 
190 190
     // final action
191
-    delete_user($user);  //from user_util.inc
191
+    delete_user($user); //from user_util.inc
192 192
     return true;
193 193
 }
194 194
\ No newline at end of file
Please login to merge, or discard this patch.
html/ops/delete_user.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@
 block discarded – undo
27 27
 
28 28
 die("Delete this line first\n");
29 29
 $config = get_config();
30
-if ( !parse_bool($config, "enable_delete_account") ) {
30
+if (!parse_bool($config, "enable_delete_account")) {
31 31
     die(tra("This feature is disabled.  Please enable it in the config.xml."));
32 32
 }
33 33
 
34
-$id = (int) $argv[1];
34
+$id = (int)$argv[1];
35 35
 
36 36
 $user = BoincUser::lookup_id($id);
37 37
 if (!$user) die("no such user\n");
38 38
 
39 39
 $retval = delete_account($user);
40
-if ( $retval ) {
40
+if ($retval) {
41 41
     echo tra("User deleted");
42 42
 } else {
43 43
     echo tra("Failed to delete user");
Please login to merge, or discard this patch.