Completed
Pull Request — master (#2472)
by Kevin
23:17 queued 12:03
created
html/inc/boinc_db.inc 1 patch
Doc Comments   +124 added lines patch added patch discarded remove patch
@@ -40,6 +40,10 @@  discard block
 block discarded – undo
40 40
     // 2: only use replica_db_user, only try replica_db_host
41 41
     // can be set projectwide using <replica_fallback_mode>
42 42
     //
43
+
44
+    /**
45
+     * @param boolean $readonly
46
+     */
43 47
     static function get_aux($readonly, $fallback_mode = 0) {
44 48
         $config = get_config();
45 49
         $user = parse_config($config, '<db_user>');
@@ -196,6 +200,10 @@  discard block
 block discarded – undo
196 200
         $db = BoincDb::get();
197 201
         return $db->count('user', $clause);
198 202
     }
203
+
204
+    /**
205
+     * @param string $field
206
+     */
199 207
     static function max($field) {
200 208
         $db = BoincDb::get();
201 209
         return $db->max('user', $field);
@@ -208,6 +216,10 @@  discard block
 block discarded – undo
208 216
         $db = BoincDb::get();
209 217
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
210 218
     }
219
+
220
+    /**
221
+     * @param string $fields
222
+     */
211 223
     static function enum_fields($fields, $where_clause, $order_clause=null) {
212 224
         $db = BoincDb::get();
213 225
         return $db->enum_fields(
@@ -225,10 +237,19 @@  discard block
 block discarded – undo
225 237
         $db->delete_aux('profile', "userid=$this->id");
226 238
         return $db->delete($this, 'user');
227 239
     }
240
+
241
+    /**
242
+     * @param string $field
243
+     */
228 244
     static function sum($field) {
229 245
         $db = BoincDb::get();
230 246
         return $db->sum('user', $field);
231 247
     }
248
+
249
+    /**
250
+     * @param string $field
251
+     * @param string $clause
252
+     */
232 253
     static function percentile($field, $clause, $pct) {
233 254
         $db = BoincDb::get();
234 255
         return $db->percentile('user', $field, $clause, $pct);
@@ -237,6 +258,10 @@  discard block
 block discarded – undo
237 258
 
238 259
 class BoincTeam {
239 260
     static $cache;
261
+
262
+    /**
263
+     * @param string $clause
264
+     */
240 265
     static function insert($clause) {
241 266
         $db = BoincDb::get();
242 267
         $ret = $db->insert('team', $clause);
@@ -274,14 +299,27 @@  discard block
 block discarded – undo
274 299
         $db = BoincDb::get();
275 300
         return $db->delete($this, 'team');
276 301
     }
302
+
303
+    /**
304
+     * @param string $field
305
+     * @param string $clause
306
+     */
277 307
     static function percentile($field, $clause, $pct) {
278 308
         $db = BoincDb::get();
279 309
         return $db->percentile('team', $field, $clause, $pct);
280 310
     }
311
+
312
+    /**
313
+     * @param string $field
314
+     */
281 315
     static function max($field) {
282 316
         $db = BoincDb::get();
283 317
         return $db->max('team', $field);
284 318
     }
319
+
320
+    /**
321
+     * @param string $fields
322
+     */
285 323
     static function enum_fields($fields, $where_clause, $order_clause=null) {
286 324
         $db = BoincDb::get();
287 325
         return $db->enum_fields(
@@ -318,6 +356,12 @@  discard block
 block discarded – undo
318 356
         $db = BoincDb::get();
319 357
         return $db->enum('host', 'BoincHost', $where_clause, $order_clause);
320 358
     }
359
+
360
+    /**
361
+     * @param string $fields
362
+     * @param string $where_clause
363
+     * @param string $order_clause
364
+     */
321 365
     static function enum_fields($fields, $where_clause, $order_clause=null) {
322 366
         $db = BoincDb::get();
323 367
         return $db->enum_fields(
@@ -350,6 +394,11 @@  discard block
 block discarded – undo
350 394
         $db = BoincDb::get();
351 395
         return $db->enum('result', 'BoincResult', $where_clause);
352 396
     }
397
+
398
+	/**
399
+	 * @param string $fields
400
+	 * @param string $where_clause
401
+	 */
353 402
 	static function enum_fields($fields, $where_clause, $order_clause) {
354 403
         $db = BoincDb::get();
355 404
 		return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause);
@@ -404,6 +453,10 @@  discard block
 block discarded – undo
404 453
         $db = BoincDb::get();
405 454
         return $db->update_aux('workunit', $clause);
406 455
     }
456
+
457
+    /**
458
+     * @param string $clause
459
+     */
407 460
     static function count($clause) {
408 461
         $db = BoincDb::get();
409 462
         return $db->count('workunit', $clause);
@@ -419,6 +472,10 @@  discard block
 block discarded – undo
419 472
         $db = BoincDb::get();
420 473
         return $db->lookup('app', 'BoincApp', $clause);
421 474
     }
475
+
476
+    /**
477
+     * @param string $where_clause
478
+     */
422 479
     static function enum($where_clause) {
423 480
         $db = BoincDb::get();
424 481
         return $db->enum('app', 'BoincApp', $where_clause);
@@ -433,6 +490,11 @@  discard block
 block discarded – undo
433 490
         $db = BoincDb::get();
434 491
         return $db->update($this, 'app', $clause);
435 492
     }
493
+
494
+    /**
495
+     * @param string $field
496
+     * @param string $clause
497
+     */
436 498
     static function sum($field, $clause=null) {
437 499
         $db = BoincDb::get();
438 500
         return $db->sum('app', $field, $clause);
@@ -465,6 +527,10 @@  discard block
 block discarded – undo
465 527
 }
466 528
 
467 529
 class BoincProfile {
530
+
531
+    /**
532
+     * @param string $fields
533
+     */
468 534
     static function lookup_fields($fields, $clause) {
469 535
         $db = BoincDb::get();
470 536
         return $db->lookup_fields('profile', 'BoincProfile', $fields, $clause);
@@ -481,18 +547,37 @@  discard block
 block discarded – undo
481 547
         $db = BoincDb::get();
482 548
         return $db->update_aux('profile', $clause.' where userid='.$this->userid);
483 549
     }
550
+
551
+    /**
552
+     * @param string $clause
553
+     */
484 554
     static function update_aux($clause) {
485 555
         $db = BoincDb::get();
486 556
         return $db->update_aux('profile', $clause);
487 557
     }
558
+
559
+    /**
560
+     * @param string $clause
561
+     */
488 562
     static function insert($clause) {
489 563
         $db = BoincDb::get();
490 564
         return $db->insert('profile', $clause);
491 565
     }
566
+
567
+    /**
568
+     * @param string $where_clause
569
+     * @param string $order_clause
570
+     */
492 571
     static function enum($where_clause=null, $order_clause=null) {
493 572
         $db = BoincDb::get();
494 573
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
495 574
     }
575
+
576
+    /**
577
+     * @param string $fields
578
+     * @param string $where_clause
579
+     * @param string $order_clause
580
+     */
496 581
     static function enum_fields($fields, $where_clause=null, $order_clause=null) {
497 582
         $db = BoincDb::get();
498 583
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
@@ -560,6 +645,10 @@  discard block
 block discarded – undo
560 645
 }
561 646
 
562 647
 class BoincPlatform {
648
+
649
+    /**
650
+     * @param string $where_clause
651
+     */
563 652
     static function enum($where_clause) {
564 653
         $db = BoincDb::get();
565 654
         return $db->enum('platform', 'BoincPlatform', $where_clause);
@@ -640,6 +729,10 @@  discard block
 block discarded – undo
640 729
 }
641 730
 
642 731
 class BoincBadge {
732
+
733
+    /**
734
+     * @param string $where_clause
735
+     */
643 736
     static function enum($where_clause) {
644 737
         $db = BoincDb::get();
645 738
         return $db->enum('badge', 'BoincBadge', $where_clause);
@@ -735,6 +828,11 @@  discard block
 block discarded – undo
735 828
         $db = BoincDb::get();
736 829
         return $db->enum('credit_user', 'BoincCreditUser', $where_clause);
737 830
     }
831
+
832
+    /**
833
+     * @param string $field
834
+     * @param string $clause
835
+     */
738 836
     static function sum($field, $clause) {
739 837
         $db = BoincDb::get();
740 838
         return $db->sum('credit_user', $field, $clause);
@@ -747,6 +845,11 @@  discard block
 block discarded – undo
747 845
         $db = BoincDb::get();
748 846
         $db->delete_aux('credit_user', "userid=$user->id");
749 847
     }
848
+
849
+    /**
850
+     * @param string $order_clause
851
+     * @param string $limit
852
+     */
750 853
     static function get_list($where_clause, $order_clause, $limit) {
751 854
         $db = BoincDB::get();
752 855
         return $db->get_list('user', 'credit_user', 'id', 'userid', 'BoincCreditUser', '*', $where_clause, $order_clause, $limit);
@@ -762,6 +865,11 @@  discard block
 block discarded – undo
762 865
         $db = BoincDb::get();
763 866
         return $db->enum('credit_team', 'BoincCreditTeam', $where_clause);
764 867
     }
868
+
869
+    /**
870
+     * @param string $field
871
+     * @param string $clause
872
+     */
765 873
     static function sum($field, $clause) {
766 874
         $db = BoincDb::get();
767 875
         return $db->sum('credit_team', $field, $clause);
@@ -770,6 +878,11 @@  discard block
 block discarded – undo
770 878
         $db = BoincDb::get();
771 879
         return $db->update_aux('credit_team', $clause);
772 880
     }
881
+
882
+    /**
883
+     * @param string $order_clause
884
+     * @param string $limit
885
+     */
773 886
     static function get_list($where_clause, $order_clause, $limit) {
774 887
         $db = BoincDB::get();
775 888
         return $db->get_list('team', 'credit_team', 'id', 'teamid', 'BoincCreditTeam', '*', $where_clause, $order_clause, $limit);
@@ -783,6 +896,9 @@  discard block
 block discarded – undo
783 896
         return $db->lookup('token', 'BoincToken', $clause);
784 897
     }
785 898
     
899
+    /**
900
+     * @param string $type
901
+     */
786 902
     static function lookup_valid_token($userid, $token, $type) {
787 903
         $db = BoincDb::get();
788 904
         $token = BoincDb::escape_string($token);
@@ -795,6 +911,9 @@  discard block
 block discarded – undo
795 911
         return $db->enum('token', 'BoincToken', $where_clause);
796 912
     }
797 913
 
914
+    /**
915
+     * @param string $clause
916
+     */
798 917
     static function insert($clause) {
799 918
         $db = BoincDb::get();
800 919
         return $db->insert('token', $clause);
@@ -818,6 +937,11 @@  discard block
 block discarded – undo
818 937
 // 
819 938
 // apply this to any user-supplied strings used in queries
820 939
 // 
940
+/**
941
+ * @param string $x
942
+ *
943
+ * @return string
944
+ */
821 945
 function boinc_real_escape_string($x) {
822 946
     if (version_compare(phpversion(),"4.3.0")>=0) {
823 947
         return BoincDb::escape_string($x);
Please login to merge, or discard this patch.
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/user/delete_account_confirm.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@
 block discarded – undo
40 40
 page_head(tra("Delete Account"));
41 41
 
42 42
 echo "<p>".tra("Thank you for verifying ownership of your account.")."</p>"
43
-     ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>"
44
-     ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>"
45
-     ."<br/>";
43
+        ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>"
44
+        ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>"
45
+        ."<br/>";
46 46
 
47 47
 form_start(secure_url_base()."delete_account_confirm_action.php", "post");
48 48
 form_input_hidden("token",$token);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@
 block discarded – undo
34 34
      ."<br/>";
35 35
 
36 36
 form_start(secure_url_base()."delete_account_confirm_action.php", "post");
37
-form_input_hidden("token",$token);
38
-form_input_hidden("id",$userid);
39
-form_input_text(tra("Password"), "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd"));
37
+form_input_hidden("token", $token);
38
+form_input_hidden("id", $userid);
39
+form_input_text(tra("Password"), "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd"));
40 40
 form_submit(tra("Delete Account"));
41 41
 form_end();
42 42
 
Please login to merge, or discard this patch.
html/ops/test_token.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,40 +9,40 @@
 block discarded – undo
9 9
 BoincToken::insert("(token,userid,type,create_time, expire_time) values ('$token', 0, 'T', unix_timestamp(), unix_timestamp()+3600)");
10 10
 
11 11
 $boincTokens = BoincToken::enum("userid=0");
12
-foreach($boincTokens as $boincToken) {
13
-    echo $boincToken->token . "\n";
14
-    echo $boincToken->userid . "\n";
15
-    echo $boincToken->type . "\n";
16
-    echo $boincToken->create_time . "\n";
17
-    echo $boincToken->expire_time . "\n";
12
+foreach ($boincTokens as $boincToken) {
13
+    echo $boincToken->token."\n";
14
+    echo $boincToken->userid."\n";
15
+    echo $boincToken->type."\n";
16
+    echo $boincToken->create_time."\n";
17
+    echo $boincToken->expire_time."\n";
18 18
 }
19 19
 
20 20
 echo "---------------\n";
21 21
 $boincToken = BoincToken::lookup("userid=0");
22
-echo $boincToken->token . "\n";
23
-echo $boincToken->userid . "\n";
24
-echo $boincToken->type . "\n";
25
-echo $boincToken->create_time . "\n";
26
-echo $boincToken->expire_time . "\n";
22
+echo $boincToken->token."\n";
23
+echo $boincToken->userid."\n";
24
+echo $boincToken->type."\n";
25
+echo $boincToken->create_time."\n";
26
+echo $boincToken->expire_time."\n";
27 27
 
28 28
 echo "---------------\n";
29 29
 $boincToken = BoincToken::lookup_valid_token(0, $token, 'T');
30
-if ( $boincToken != null ) {
30
+if ($boincToken != null) {
31 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
-if ( $boincToken == null ) {
36
+if ($boincToken == null) {
37 37
    echo "Successfully didn't find invalid token\n";
38 38
 }
39 39
 
40 40
 
41 41
 echo "---------------\n";
42 42
 $user = new BoincUser();
43
-$user->id=0;
43
+$user->id = 0;
44 44
 $token = create_confirm_delete_account_token($user);
45
-if ( is_valid_delete_account_token($user->id, $token) ) {
45
+if (is_valid_delete_account_token($user->id, $token)) {
46 46
     echo "Successfully created and validated delete account token";
47 47
 }
48 48
 
Please login to merge, or discard this 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/inc/token.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 function create_confirm_delete_account_token($user) {
29 29
     $token = random_string();
30 30
     $ret = BoincToken::insert("(token,userid,type,create_time,expire_time) values ('$token', $user->id, '".TOKEN_TYPE_DELETE_ACCOUNT."', unix_timestamp(), unix_timestamp()+".TOKEN_DURATION_ONE_DAY.")");
31
-    if ( !$ret ) {
31
+    if (!$ret) {
32 32
         return null;
33 33
     }
34 34
     return $token;
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 function is_valid_delete_account_token($userid, $token) {
38 38
     $boincToken = BoincToken::lookup_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT);
39
-    if ( $boincToken == null ) {
39
+    if ($boincToken == null) {
40 40
         return false;
41 41
     }
42 42
     return true;
Please login to merge, or discard this patch.
html/user/delete_account_request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     ."</ul><br/>";
35 35
 
36 36
 form_start(secure_url_base()."delete_account_request_action.php", "post");
37
-form_input_text(tra("Password"), "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd"));
37
+form_input_text(tra("Password"), "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd"));
38 38
 form_submit(tra("Send Confirmation Email"));
39 39
 form_end();
40 40
 
Please login to merge, or discard this patch.
html/inc/delete_account.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
 // along with BOINC.  If not, see <https://www.gnu.org/licenses/>.
18 18
 
19 19
 $config = get_config();
20
-if ( !parse_bool($config, "enable_delete_account") ) {
20
+if (!parse_bool($config, "enable_delete_account")) {
21 21
     error_page(
22 22
         tra("This feature is disabled.  Please contact the project administrator.")
23 23
     );
24 24
 }
25 25
 
26 26
 function check_delete_account_token($userid, $token) {
27
-    if( !is_valid_delete_account_token($userid, $token) ) {
27
+    if (!is_valid_delete_account_token($userid, $token)) {
28 28
         sleep(LOGIN_FAIL_SLEEP_SEC);
29 29
         error_page(
30 30
             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>")
Please login to merge, or discard this patch.
html/inc/user_util.inc 1 patch
Spacing   +5 added lines, -5 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
     
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         );
Please login to merge, or discard this patch.