Completed
Push — master ( 40b7eb...708e0f )
by Christian
07:55
created
html/inc/account.inc 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -18,6 +18,10 @@  discard block
 block discarded – undo
18 18
 
19 19
 // forms for account creation and login
20 20
 
21
+/**
22
+ * @param integer $teamid
23
+ * @param string $next_url
24
+ */
21 25
 function create_account_form($teamid, $next_url) {
22 26
     global $recaptcha_public_key;
23 27
     echo "
@@ -92,6 +96,9 @@  discard block
 block discarded – undo
92 96
     echo "</form>\n";
93 97
 }
94 98
 
99
+/**
100
+ * @param string $next_url
101
+ */
95 102
 function login_form($next_url) {
96 103
     echo "
97 104
         <form name=\"f\" method=\"post\" action=\"".secure_url_base()."/login_action.php\">
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@
 block discarded – undo
35 35
     // Using invitation codes to restrict access?
36 36
     //
37 37
     if (defined('INVITE_CODES')) {
38
-         row2(
39
-             tra("Invitation Code")."<br><small>".tra("A valid invitation code is required to create an account.")."</small>",
40
-             '<input class="form-control" type="text" name="invite_code" size="30" >'
41
-         );
38
+            row2(
39
+                tra("Invitation Code")."<br><small>".tra("A valid invitation code is required to create an account.")."</small>",
40
+                '<input class="form-control" type="text" name="invite_code" size="30" >'
41
+            );
42 42
     }
43 43
 
44 44
     row2(
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
         $x .= '<br><small><a href="get_passwd.php">'.tra("forgot email address?")."</a></small>";
108 108
     }
109 109
     row2($x, '<input class="form-control" name=email_addr type="text" size=40 tabindex=1>');
110
-    row2(tra("Password:") . '<br><small><a href="get_passwd.php">' . tra("forgot password?") . "</a></small>",
110
+    row2(tra("Password:").'<br><small><a href="get_passwd.php">'.tra("forgot password?")."</a></small>",
111 111
         '<input class="form-control" type="password" name="passwd" size="40" tabindex="2">'
112 112
     );
113 113
     row2(tra("Stay logged in"),
Please login to merge, or discard this patch.
html/inc/akismet.inc 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -52,6 +52,9 @@
 block discarded – undo
52 52
     }
53 53
 }
54 54
 
55
+/**
56
+ * @param string $path
57
+ */
55 58
 function akismet_request($request, $host, $path, $port = 80) {
56 59
     $http_request  = "POST $path HTTP/1.0\r\n";
57 60
     $http_request .= "Host: $host\r\n";
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     $master_url_enc = urlencode($master_url);
28 28
     $response = akismet_request("key=$key&blog=$master_url_enc", "rest.akismet.com", "/1.1/verify-key");
29
-    if ("valid" == $response[1] ) {
29
+    if ("valid" == $response[1]) {
30 30
         $post = urlencode($post);
31 31
         $ip = urlencode($_SERVER['REMOTE_ADDR']);
32 32
         $referrer = urlencode($_SERVER['HTTP_REFERER']);
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
     $http_request  = "POST $path HTTP/1.0\r\n";
57 57
     $http_request .= "Host: $host\r\n";
58 58
     $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n";
59
-    $http_request .= "Content-Length: " . strlen($request) . "\r\n";
59
+    $http_request .= "Content-Length: ".strlen($request)."\r\n";
60 60
     $http_request .= "User-Agent: BOINC | Akismet 1.1\r\n";
61 61
     $http_request .= "\r\n";
62 62
     $http_request .= $request;
63 63
 
64 64
     $response = '';
65
-    if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) {
65
+    if (false !== ($fs = @fsockopen($host, $port, $errno, $errstr, 3))) {
66 66
         fwrite($fs, $http_request);
67
-        while ( !feof($fs) )
67
+        while (!feof($fs))
68 68
             $response .= fgets($fs, 1160); // One TCP-IP packet
69 69
         fclose($fs);
70 70
         $response = explode("\r\n\r\n", $response, 2);
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
         $response = akismet_request($request, "$key.rest.akismet.com", "/1.1/comment-check");
44 44
 
45
-        if ("true" == $response[1]) { // Akismet says it's spam
45
+        if ("true" == $response[1]) {
46
+// Akismet says it's spam
46 47
             return false;
47 48
         } else {
48 49
             return true;
@@ -64,8 +65,10 @@  discard block
 block discarded – undo
64 65
     $response = '';
65 66
     if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) {
66 67
         fwrite($fs, $http_request);
67
-        while ( !feof($fs) )
68
-            $response .= fgets($fs, 1160); // One TCP-IP packet
68
+        while ( !feof($fs) ) {
69
+                    $response .= fgets($fs, 1160);
70
+        }
71
+        // One TCP-IP packet
69 72
         fclose($fs);
70 73
         $response = explode("\r\n\r\n", $response, 2);
71 74
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 }
54 54
 
55 55
 function akismet_request($request, $host, $path, $port = 80) {
56
-    $http_request  = "POST $path HTTP/1.0\r\n";
56
+    $http_request  = "post $path HTTP/1.0\r\n";
57 57
     $http_request .= "Host: $host\r\n";
58 58
     $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n";
59 59
     $http_request .= "Content-Length: " . strlen($request) . "\r\n";
Please login to merge, or discard this patch.
html/inc/boinc_db.inc 3 patches
Doc Comments   +107 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>');
@@ -204,6 +208,10 @@  discard block
 block discarded – undo
204 208
         $db = BoincDb::get();
205 209
         return $db->count('user', $clause);
206 210
     }
211
+
212
+    /**
213
+     * @param string $field
214
+     */
207 215
     static function max($field) {
208 216
         $db = BoincDb::get();
209 217
         return $db->max('user', $field);
@@ -216,6 +224,10 @@  discard block
 block discarded – undo
216 224
         $db = BoincDb::get();
217 225
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
218 226
     }
227
+
228
+    /**
229
+     * @param string $fields
230
+     */
219 231
     static function enum_fields($fields, $where_clause, $order_clause=null) {
220 232
         $db = BoincDb::get();
221 233
         return $db->enum_fields(
@@ -233,10 +245,19 @@  discard block
 block discarded – undo
233 245
         $db->delete_aux('profile', "userid=$this->id");
234 246
         return $db->delete($this, 'user');
235 247
     }
248
+
249
+    /**
250
+     * @param string $field
251
+     */
236 252
     static function sum($field) {
237 253
         $db = BoincDb::get();
238 254
         return $db->sum('user', $field);
239 255
     }
256
+
257
+    /**
258
+     * @param string $field
259
+     * @param string $clause
260
+     */
240 261
     static function percentile($field, $clause, $pct) {
241 262
         $db = BoincDb::get();
242 263
         return $db->percentile('user', $field, $clause, $pct);
@@ -245,6 +266,10 @@  discard block
 block discarded – undo
245 266
 
246 267
 class BoincTeam {
247 268
     static $cache;
269
+
270
+    /**
271
+     * @param string $clause
272
+     */
248 273
     static function insert($clause) {
249 274
         $db = BoincDb::get();
250 275
         $ret = $db->insert('team', $clause);
@@ -282,14 +307,27 @@  discard block
 block discarded – undo
282 307
         $db = BoincDb::get();
283 308
         return $db->delete($this, 'team');
284 309
     }
310
+
311
+    /**
312
+     * @param string $field
313
+     * @param string $clause
314
+     */
285 315
     static function percentile($field, $clause, $pct) {
286 316
         $db = BoincDb::get();
287 317
         return $db->percentile('team', $field, $clause, $pct);
288 318
     }
319
+
320
+    /**
321
+     * @param string $field
322
+     */
289 323
     static function max($field) {
290 324
         $db = BoincDb::get();
291 325
         return $db->max('team', $field);
292 326
     }
327
+
328
+    /**
329
+     * @param string $fields
330
+     */
293 331
     static function enum_fields($fields, $where_clause, $order_clause=null) {
294 332
         $db = BoincDb::get();
295 333
         return $db->enum_fields(
@@ -326,6 +364,12 @@  discard block
 block discarded – undo
326 364
         $db = BoincDb::get();
327 365
         return $db->enum('host', 'BoincHost', $where_clause, $order_clause);
328 366
     }
367
+
368
+    /**
369
+     * @param string $fields
370
+     * @param string $where_clause
371
+     * @param string $order_clause
372
+     */
329 373
     static function enum_fields($fields, $where_clause, $order_clause=null) {
330 374
         $db = BoincDb::get();
331 375
         return $db->enum_fields(
@@ -358,6 +402,10 @@  discard block
 block discarded – undo
358 402
         $db = BoincDb::get();
359 403
         return $db->enum('result', 'BoincResult', $where_clause);
360 404
     }
405
+
406
+	/**
407
+	 * @param string $fields
408
+	 */
361 409
 	static function enum_fields($fields, $where_clause, $order_clause) {
362 410
         $db = BoincDb::get();
363 411
 		return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause);
@@ -412,6 +460,10 @@  discard block
 block discarded – undo
412 460
         $db = BoincDb::get();
413 461
         return $db->update_aux('workunit', $clause);
414 462
     }
463
+
464
+    /**
465
+     * @param string $clause
466
+     */
415 467
     static function count($clause) {
416 468
         $db = BoincDb::get();
417 469
         return $db->count('workunit', $clause);
@@ -427,6 +479,10 @@  discard block
 block discarded – undo
427 479
         $db = BoincDb::get();
428 480
         return $db->lookup('app', 'BoincApp', $clause);
429 481
     }
482
+
483
+    /**
484
+     * @param string $where_clause
485
+     */
430 486
     static function enum($where_clause) {
431 487
         $db = BoincDb::get();
432 488
         return $db->enum('app', 'BoincApp', $where_clause);
@@ -441,6 +497,11 @@  discard block
 block discarded – undo
441 497
         $db = BoincDb::get();
442 498
         return $db->update($this, 'app', $clause);
443 499
     }
500
+
501
+    /**
502
+     * @param string $field
503
+     * @param string $clause
504
+     */
444 505
     static function sum($field, $clause=null) {
445 506
         $db = BoincDb::get();
446 507
         return $db->sum('app', $field, $clause);
@@ -473,6 +534,10 @@  discard block
 block discarded – undo
473 534
 }
474 535
 
475 536
 class BoincProfile {
537
+
538
+    /**
539
+     * @param string $fields
540
+     */
476 541
     static function lookup_fields($fields, $clause) {
477 542
         $db = BoincDb::get();
478 543
         return $db->lookup_fields('profile', 'BoincProfile', $fields, $clause);
@@ -489,18 +554,37 @@  discard block
 block discarded – undo
489 554
         $db = BoincDb::get();
490 555
         return $db->update_aux('profile', $clause.' where userid='.$this->userid);
491 556
     }
557
+
558
+    /**
559
+     * @param string $clause
560
+     */
492 561
     static function update_aux($clause) {
493 562
         $db = BoincDb::get();
494 563
         return $db->update_aux('profile', $clause);
495 564
     }
565
+
566
+    /**
567
+     * @param string $clause
568
+     */
496 569
     static function insert($clause) {
497 570
         $db = BoincDb::get();
498 571
         return $db->insert('profile', $clause);
499 572
     }
573
+
574
+    /**
575
+     * @param string $where_clause
576
+     * @param string $order_clause
577
+     */
500 578
     static function enum($where_clause=null, $order_clause=null) {
501 579
         $db = BoincDb::get();
502 580
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
503 581
     }
582
+
583
+    /**
584
+     * @param string $fields
585
+     * @param string $where_clause
586
+     * @param string $order_clause
587
+     */
504 588
     static function enum_fields($fields, $where_clause=null, $order_clause=null) {
505 589
         $db = BoincDb::get();
506 590
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
@@ -568,6 +652,10 @@  discard block
 block discarded – undo
568 652
 }
569 653
 
570 654
 class BoincPlatform {
655
+
656
+    /**
657
+     * @param string $where_clause
658
+     */
571 659
     static function enum($where_clause) {
572 660
         $db = BoincDb::get();
573 661
         return $db->enum('platform', 'BoincPlatform', $where_clause);
@@ -648,6 +736,10 @@  discard block
 block discarded – undo
648 736
 }
649 737
 
650 738
 class BoincBadge {
739
+
740
+    /**
741
+     * @param string $where_clause
742
+     */
651 743
     static function enum($where_clause) {
652 744
         $db = BoincDb::get();
653 745
         return $db->enum('badge', 'BoincBadge', $where_clause);
@@ -743,6 +835,11 @@  discard block
 block discarded – undo
743 835
         $db = BoincDb::get();
744 836
         return $db->enum('credit_user', 'BoincCreditUser', $where_clause);
745 837
     }
838
+
839
+    /**
840
+     * @param string $field
841
+     * @param string $clause
842
+     */
746 843
     static function sum($field, $clause) {
747 844
         $db = BoincDb::get();
748 845
         return $db->sum('credit_user', $field, $clause);
@@ -766,6 +863,11 @@  discard block
 block discarded – undo
766 863
         $db = BoincDb::get();
767 864
         return $db->enum('credit_team', 'BoincCreditTeam', $where_clause);
768 865
     }
866
+
867
+    /**
868
+     * @param string $field
869
+     * @param string $clause
870
+     */
769 871
     static function sum($field, $clause) {
770 872
         $db = BoincDb::get();
771 873
         return $db->sum('credit_team', $field, $clause);
@@ -780,6 +882,11 @@  discard block
 block discarded – undo
780 882
 // 
781 883
 // apply this to any user-supplied strings used in queries
782 884
 // 
885
+/**
886
+ * @param string $x
887
+ *
888
+ * @return string
889
+ */
783 890
 function boinc_real_escape_string($x) {
784 891
     if (version_compare(phpversion(),"4.3.0")>=0) {
785 892
         return BoincDb::escape_string($x);
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -358,10 +358,10 @@
 block discarded – undo
358 358
         $db = BoincDb::get();
359 359
         return $db->enum('result', 'BoincResult', $where_clause);
360 360
     }
361
-	static function enum_fields($fields, $where_clause, $order_clause) {
361
+    static function enum_fields($fields, $where_clause, $order_clause) {
362 362
         $db = BoincDb::get();
363
-		return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause);
364
-	}
363
+        return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause);
364
+    }
365 365
     function update($clause) {
366 366
         $db = BoincDb::get();
367 367
         return $db->update($this, 'result', $clause);
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
         $db = BoincDb::get();
213 213
         return $db->update($this, 'user', $clause);
214 214
     }
215
-    static function enum($where_clause, $order_clause=null) {
215
+    static function enum($where_clause, $order_clause = null) {
216 216
         $db = BoincDb::get();
217 217
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
218 218
     }
219
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
219
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
220 220
         $db = BoincDb::get();
221 221
         return $db->enum_fields(
222 222
             'user', 'BoincUser', $fields, $where_clause, $order_clause
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $db = BoincDb::get();
266 266
         return $db->update($this, 'team', $clause);
267 267
     }
268
-    static function enum($where_clause, $order_clause=null) {
268
+    static function enum($where_clause, $order_clause = null) {
269 269
         $db = BoincDb::get();
270 270
         return $db->enum('team', 'BoincTeam', $where_clause, $order_clause);
271 271
     }
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         $db = BoincDb::get();
291 291
         return $db->max('team', $field);
292 292
     }
293
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
293
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
294 294
         $db = BoincDb::get();
295 295
         return $db->enum_fields(
296 296
             'team', 'BoincTeam', $fields, $where_clause, $order_clause
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
         $db = BoincDb::get();
323 323
         return $db->delete($this, 'host');
324 324
     }
325
-    static function enum($where_clause, $order_clause=null) {
325
+    static function enum($where_clause, $order_clause = null) {
326 326
         $db = BoincDb::get();
327 327
         return $db->enum('host', 'BoincHost', $where_clause, $order_clause);
328 328
     }
329
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
329
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
330 330
         $db = BoincDb::get();
331 331
         return $db->enum_fields(
332 332
             'host', 'BoincHost', $fields, $where_clause, $order_clause
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
         $db = BoincDb::get();
442 442
         return $db->update($this, 'app', $clause);
443 443
     }
444
-    static function sum($field, $clause=null) {
444
+    static function sum($field, $clause = null) {
445 445
         $db = BoincDb::get();
446 446
         return $db->sum('app', $field, $clause);
447 447
     }
@@ -497,11 +497,11 @@  discard block
 block discarded – undo
497 497
         $db = BoincDb::get();
498 498
         return $db->insert('profile', $clause);
499 499
     }
500
-    static function enum($where_clause=null, $order_clause=null) {
500
+    static function enum($where_clause = null, $order_clause = null) {
501 501
         $db = BoincDb::get();
502 502
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
503 503
     }
504
-    static function enum_fields($fields, $where_clause=null, $order_clause=null) {
504
+    static function enum_fields($fields, $where_clause = null, $order_clause = null) {
505 505
         $db = BoincDb::get();
506 506
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
507 507
     }
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 // apply this to any user-supplied strings used in queries
782 782
 // 
783 783
 function boinc_real_escape_string($x) {
784
-    if (version_compare(phpversion(),"4.3.0")>=0) {
784
+    if (version_compare(phpversion(), "4.3.0") >= 0) {
785 785
         return BoincDb::escape_string($x);
786 786
     } else {
787 787
         $x = str_replace("'", "\'", $x);
Please login to merge, or discard this patch.
html/inc/bolt.inc 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -246,6 +246,9 @@  discard block
 block discarded – undo
246 246
 
247 247
 }
248 248
 
249
+/**
250
+ * @param string $n
251
+ */
249 252
 function name($n) {
250 253
     return array('name', $n);
251 254
 }
@@ -254,10 +257,16 @@  discard block
 block discarded – undo
254 257
     return array('title', $n);
255 258
 }
256 259
 
260
+/**
261
+ * @param integer $n
262
+ */
257 263
 function number($n) {
258 264
     return array('number', $n);
259 265
 }
260 266
 
267
+/**
268
+ * @param string $n
269
+ */
261 270
 function filename($n) {
262 271
     return array('filename', $n);
263 272
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public $title;
31 31
         // Optional; used when showing course history outline.
32 32
     public $is_item;
33
-    public $attrs;        // course-defined
33
+    public $attrs; // course-defined
34 34
 
35 35
     abstract function walk(&$iter, $incr, &$frac_done);
36 36
         // multi-purpose function for traversing a course.
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             $this->query_string = null;
56 56
         } else {
57 57
             $this->filename = substr($filename, 0, $p);
58
-            $this->query_string = substr($filename, $p+1);
58
+            $this->query_string = substr($filename, $p + 1);
59 59
         }
60 60
         $this->name = $filename;
61 61
         $this->title = $title;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             // look up unit by name
163 163
             //
164 164
             $child = null;
165
-            for ($i=0; $i<$n; $i++) {
165
+            for ($i = 0; $i < $n; $i++) {
166 166
                 $c = $this->units[$i];
167 167
                 if ($c->name == $child_name) {
168 168
                     $child = $c;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                 if ($i >= $n) {
178 178
                     // and if index is too big, use last unit
179 179
                     //
180
-                    $i = $n-1;
180
+                    $i = $n - 1;
181 181
                 }
182 182
                 $child = $this->units[$i];
183 183
             }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                         $this->finished($iter);
198 198
                         return true;
199 199
                     } else {
200
-                        $i = ($i+1)%$n;
200
+                        $i = ($i + 1)%$n;
201 201
                     }
202 202
                 }
203 203
             }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         if (array_key_exists($this->name, $state)) {
236 236
             $state_rec = $state[$this->name];
237 237
             $child_name = $state_rec['child_name'];
238
-            foreach($this->units as $c) {
238
+            foreach ($this->units as $c) {
239 239
                 if ($c->name == $child_name) {
240 240
                     return $c;
241 241
                 }
Please login to merge, or discard this patch.
html/inc/bolt_ex.inc 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -240,6 +240,10 @@  discard block
 block discarded – undo
240 240
 
241 241
 class BoltFitbField {
242 242
     public $textarea, $nrows, $ncols;
243
+
244
+    /**
245
+     * @param boolean $textarea
246
+     */
243 247
     function __construct($textarea, $nrows, $ncols) {
244 248
         $this->textarea = $textarea;
245 249
         $this->nrows = $nrows;
@@ -258,6 +262,10 @@  discard block
 block discarded – undo
258 262
 class BoltFitbAnswer {
259 263
     public $type;   // 0=constant, 1=regexp, 2=func
260 264
     public $ans;
265
+
266
+    /**
267
+     * @param integer $type
268
+     */
261 269
     function __construct($type, $ans) {
262 270
         $this->type = $type;
263 271
         $this->ans = $ans;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 // The following is a global var accessed by exercise functions.
22 22
 //
23 23
 $bolt_ex = null;
24
-$bolt_ex->mode = 0;     // input: SHOW/SCORE/ANSWER
25
-$bolt_ex->index = 0;    // input: sequence of this exercise in file
26
-$bolt_ex->score = 0;    // input/output: cumulative score (if mode = SCORE)
27
-$bolt_ex->weight = 0;   // input/output: cumulative weight
28
-$bolt_ex->query_string = "";    // user's response (if SCORE or ANSWER)
24
+$bolt_ex->mode = 0; // input: SHOW/SCORE/ANSWER
25
+$bolt_ex->index = 0; // input: sequence of this exercise in file
26
+$bolt_ex->score = 0; // input/output: cumulative score (if mode = SCORE)
27
+$bolt_ex->weight = 0; // input/output: cumulative weight
28
+$bolt_ex->query_string = ""; // user's response (if SCORE or ANSWER)
29 29
 
30 30
 function weight($w) {
31 31
     return array('weight', $w);
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
             $response = isset($$key);
171 171
             $r = $choice[1];
172 172
             $correct = ($r && $response) || (!$r && !$response);
173
-            $color = $correct?"#88ff88":"#ff8888";
174
-            table_row($c, $r?"yes":"no",
175
-                array($response?"yes":"no", "bgcolor=$color")
173
+            $color = $correct ? "#88ff88" : "#ff8888";
174
+            table_row($c, $r ? "yes" : "no",
175
+                array($response ? "yes" : "no", "bgcolor=$color")
176 176
             );
177 177
             $i++;
178 178
         }
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
         if ($y > $rect[3]) $right = false;
216 216
         $cx = $rect[0];
217 217
         $cy = $rect[2];
218
-        $sizex = $rect[1]-$rect[0];
219
-        $sizey = $rect[3]-$rect[2];
220
-        $ax = $x-4;
221
-        $ay = $y-4;
222
-        $color = $right?"green":"red";
218
+        $sizex = $rect[1] - $rect[0];
219
+        $sizey = $rect[3] - $rect[2];
220
+        $ax = $x - 4;
221
+        $ay = $y - 4;
222
+        $color = $right ? "green" : "red";
223 223
         if ($right) {
224 224
             echo "The point you selected (shown in green) is correct.";
225 225
         } else {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 }
257 257
 
258 258
 class BoltFitbAnswer {
259
-    public $type;   // 0=constant, 1=regexp, 2=func
259
+    public $type; // 0=constant, 1=regexp, 2=func
260 260
     public $ans;
261 261
     function __construct($type, $ans) {
262 262
         $this->type = $type;
Please login to merge, or discard this patch.
html/inc/bolt_select.inc 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -52,6 +52,9 @@
 block discarded – undo
52 52
     }
53 53
 }
54 54
 
55
+/**
56
+ * @param string $n
57
+ */
55 58
 function valuator($n) {
56 59
     return array('valuator', $n);
57 60
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
 function select_cmp($a, $b) {
20 20
     if ($a->value == $b->value) return 0;
21
-    return ($a->value < $b->value)?1:-1;
21
+    return ($a->value < $b->value) ? 1 : -1;
22 22
 }
23 23
 
24 24
 class BoltSelect extends BoltSet {
Please login to merge, or discard this patch.
html/inc/bolt_snap.inc 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -45,6 +45,9 @@  discard block
 block discarded – undo
45 45
     return "../bolt_snap/compare_snapshot_$x";
46 46
 }
47 47
 
48
+/**
49
+ * @param null|integer $dur
50
+ */
48 51
 function write_compare_snapshot($course_id, $select_name, $xset_name, $dur) {
49 52
     $now = time();
50 53
     $start = $now - $dur*86400;
@@ -127,6 +130,9 @@  discard block
 block discarded – undo
127 130
     return "../bolt_snap/map_snapshot_".$course_id;
128 131
 }
129 132
 
133
+/**
134
+ * @param null|integer $dur
135
+ */
130 136
 function write_map_snapshot($course_id, $dur) {
131 137
     $now = time();
132 138
     $start = $now - $dur*86400;
Please login to merge, or discard this patch.
html/inc/bolt_util_ops.inc 2 patches
Doc Comments   +21 added lines patch added patch discarded remove patch
@@ -23,6 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 // get names of units of a given type
25 25
 
26
+/**
27
+ * @param string $type
28
+ */
26 29
 function units_of_type($unit, $type) {
27 30
     $names = array();
28 31
     if (get_class($unit) == $type) {
@@ -118,6 +121,10 @@  discard block
 block discarded – undo
118 121
 
119 122
 //////////// graph drawing
120 123
 
124
+/**
125
+ * @param integer $n
126
+ * @param integer $width
127
+ */
121 128
 function compare_bar($title, $n, $width, $lo, $hi) {
122 129
     $x1 = $width*$lo;
123 130
     $x2 = $width*($hi-$lo);
@@ -137,6 +144,9 @@  discard block
 block discarded – undo
137 144
     ";
138 145
 }
139 146
 
147
+/**
148
+ * @param integer $width
149
+ */
140 150
 function compare_bar_insuff($title, $width) {
141 151
     return "
142 152
         <tr>
@@ -150,6 +160,10 @@  discard block
 block discarded – undo
150 160
     ";
151 161
 }
152 162
 
163
+/**
164
+ * @param integer[] $x
165
+ * @param integer $width
166
+ */
153 167
 function outcome_graph($x, $width) {
154 168
     $n = $x[0]+$x[1]+$x[2];
155 169
     if (!$n) return empty_cell();
@@ -182,6 +196,9 @@  discard block
 block discarded – undo
182 196
     return $s;
183 197
 }
184 198
 
199
+/**
200
+ * @param integer $w
201
+ */
185 202
 function time_graph($t, $w) {
186 203
     if ($t == 0) return "<td>---</td>";
187 204
     $x = (log10($t)+2)*$w/4;
@@ -193,6 +210,10 @@  discard block
 block discarded – undo
193 210
     </td>";
194 211
 }
195 212
 
213
+/**
214
+ * @param integer $t
215
+ * @param integer $w
216
+ */
196 217
 function score_graph($t, $w) {
197 218
     if ($t == 0) return "<td>---</td>";
198 219
     $x = $t*$w;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
         $n++;
90 90
         $delta = $x - $m;
91 91
         $m += $delta/$n;
92
-        $m2 += $delta*($x-$m);
92
+        $m2 += $delta*($x - $m);
93 93
     }
94 94
     $mean = $m;
95
-    $stdev = sqrt($m2/($n-1));
95
+    $stdev = sqrt($m2/($n - 1));
96 96
 }
97 97
 
98 98
 // approximate the 90% confidence interval for the mean of an array
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 
104 104
     // I'm too lazy to compute the t distribution
105 105
     $t_90 = 1.7;
106
-    $d = $t_90 * $stdev / sqrt($n);
106
+    $d = $t_90*$stdev/sqrt($n);
107 107
     $lo = $mean - $d;
108 108
     $hi = $mean + $d;
109 109
 }
110 110
 
111 111
 function test_stats() {
112
-    $a = array(1,1,1,1,0,1,1,1,3, 1, 1, 1, 1);
112
+    $a = array(1, 1, 1, 1, 0, 1, 1, 1, 3, 1, 1, 1, 1);
113 113
     mean_stdev($a, $mean, $stdev);
114 114
     echo "mean: $mean stdev: $stdev\n";
115 115
     conf_int_90($a, $lo, $hi);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 function compare_bar($title, $n, $width, $lo, $hi) {
122 122
     $x1 = $width*$lo;
123
-    $x2 = $width*($hi-$lo);
123
+    $x2 = $width*($hi - $lo);
124 124
     $a1 = number_format($lo*100);
125 125
     $a2 = number_format($hi*100);
126 126
     return "
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 }
152 152
 
153 153
 function outcome_graph($x, $width) {
154
-    $n = $x[0]+$x[1]+$x[2];
154
+    $n = $x[0] + $x[1] + $x[2];
155 155
     if (!$n) return empty_cell();
156 156
     $x0 = $width*$x[1]/$n;
157 157
     $x1 = $width*$x[0]/$n;
158 158
     $x2 = $width*$x[2]/$n;
159
-    if ($x[1]/$n>0.05) {
159
+    if ($x[1]/$n > 0.05) {
160 160
         $t0 = number_format(100*$x[1]/$n)."%";
161 161
     } else {
162 162
         $t0 = "";
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
 function time_graph($t, $w) {
186 186
     if ($t == 0) return "<td>---</td>";
187
-    $x = (log10($t)+2)*$w/4;
187
+    $x = (log10($t) + 2)*$w/4;
188 188
     $t = number_format($t, 1);
189 189
     return "<td>
190 190
         <table class=bolt_bar><tr>
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 function score_graph($t, $w) {
197 197
     if ($t == 0) return "<td>---</td>";
198 198
     $x = $t*$w;
199
-    $y = (1-$t)*$w;
199
+    $y = (1 - $t)*$w;
200 200
     $t = number_format($t*100);
201 201
     $s = "<td>
202 202
         <table class=bolt_bar><tr>
Please login to merge, or discard this patch.
html/inc/bolt_xset.inc 3 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -22,6 +22,9 @@  discard block
 block discarded – undo
22 22
     public $weight;
23 23
     public $callback;
24 24
 
25
+    /**
26
+     * @param null|BoltRefresh $refresh
27
+     */
25 28
     function __construct(
26 29
         $name, $units, $number, $repeats, $refresh, $attrs, $callback, $weight
27 30
     ) {
@@ -156,10 +159,16 @@  discard block
 block discarded – undo
156 159
 define('REPEAT', 2);
157 160
 define('NEXT', 4);
158 161
 
162
+/**
163
+ * @param integer $f
164
+ */
159 165
 function repeat($s, $u, $f) {
160 166
     return new BoltRepeat($s, $u, $f);
161 167
 }
162 168
 
169
+/**
170
+ * @param integer[] $a
171
+ */
163 172
 function refresh($a) {
164 173
     return new BoltRefresh($a);
165 174
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $nshown = $state_rec['nshown'];
53 53
         $state_rec['scores'][$nshown] = $score;
54 54
         $iter->state[$this->name] = $state_rec;
55
-        $is_last = ($nshown+1 == $this->ntoshow);
55
+        $is_last = ($nshown + 1 == $this->ntoshow);
56 56
         if (!$is_last) {
57 57
             return false;
58 58
         }
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
         //   - optionally create or update bolt_refresh record
63 63
         //
64 64
         $total_score = 0;
65
-        for ($i=0; $i<$nshown+1; $i++) {
65
+        for ($i = 0; $i < $nshown + 1; $i++) {
66 66
             $total_score += $state_rec['scores'][$i];
67 67
         }
68
-        $avg_score = $total_score/($nshown+1);
68
+        $avg_score = $total_score/($nshown + 1);
69 69
 
70 70
         $repeat = null;
71 71
         $least = 2;
72 72
         foreach ($this->repeats as $r) {
73
-            if ($avg_score < $r->score && $r->score<$least) {
73
+            if ($avg_score < $r->score && $r->score < $least) {
74 74
                 $repeat = $r;
75 75
                 $least = $r->score;
76 76
             }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     }
135 135
 }
136 136
 
137
-class BoltRefresh{
137
+class BoltRefresh {
138 138
     public $intervals;
139 139
     function __construct($i) {
140 140
         $this->intervals = $i;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             } else if (get_class($arg) == "BoltRepeat") {
192 192
                 $repeats[] = $arg;
193 193
             } else if (get_class($arg) == "BoltRefresh") {
194
-                $refresh= $arg;
194
+                $refresh = $arg;
195 195
             } else {
196 196
                 echo "Can't include object of type ".get_class($arg)." within an exercise set.";
197 197
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
     }
135 135
 }
136 136
 
137
-class BoltRefresh{
137
+class BoltRefresh {
138 138
     public $intervals;
139 139
     function __construct($i) {
140 140
         $this->intervals = $i;
Please login to merge, or discard this patch.