Passed
Push — master ( 6fae8e...4198df )
by Kevin
01:15 queued 23s
created
html/user/prefs_edit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 $subset = sanitize_tags(get_str("subset"));
30 30
 $venue = sanitize_tags(get_str("venue", true));
31 31
 $columns = get_str("cols", true);
32
-$c = $columns?"&cols=$columns":"";
32
+$c = $columns ? "&cols=$columns" : "";
33 33
 check_subset($subset);
34 34
 if ($action) {
35 35
     check_tokens($user->authenticator);
@@ -116,5 +116,5 @@  discard block
 block discarded – undo
116 116
 echo "<a href=prefs.php?subset=$subset$c>".tra("Back to preferences")."</a>\n";
117 117
 page_tail();
118 118
 
119
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
119
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
120 120
 ?>
Please login to merge, or discard this patch.
html/user/get_project_config.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 //
29 29
 function show_platforms() {
30 30
     $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml"));
31
-    if ($xmlFragment==false){
31
+    if ($xmlFragment == false) {
32 32
         $platforms = BoincDB::get()->enum_fields("platform, DBNAME.app_version, DBNAME.app", "BoincPlatform", "platform.name, platform.user_friendly_name, plan_class", "app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class", "");
33 33
         $xmlFragment = "    <platforms>";
34
-        foreach ($platforms as $platform){
34
+        foreach ($platforms as $platform) {
35 35
             $xmlFragment .= "
36 36
             <platform>
37 37
                 <platform_name>$platform->name</platform_name>
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
   $tou_file = TERMSOFUSE_FILE;
111 111
 }
112 112
 else {
113
-  $tou_file =  "../../terms_of_use.txt";
113
+  $tou_file = "../../terms_of_use.txt";
114 114
 }
115 115
 if (file_exists($tou_file)) {
116 116
     $terms_of_use = trim(file_get_contents($tou_file));
Please login to merge, or discard this patch.
html/user/am_set_info.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 }
188 188
 
189 189
 if (!is_null($teamid)) {
190
-    if ($teamid==0) {
190
+    if ($teamid == 0) {
191 191
         user_quit_team($user);
192 192
     } else {
193 193
         $team = BoincTeam::lookup_id_nocache($teamid);
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
 // table. If one or more of these consent_xyz parameters are NOT
241 241
 // present, the RPC will still return 'success', even though the
242 242
 // consent table is not updated.
243
-if ( (isset($consent_name) and isset($consent_flag) and isset($consent_not_required) and isset($consent_source)) ) {
243
+if ((isset($consent_name) and isset($consent_flag) and isset($consent_not_required) and isset($consent_source))) {
244 244
     list($checkct, $ctid) = check_consent_type($consent_name);
245 245
     if ($checkct) {
246 246
 
247 247
         // Check to see if latest consent of this name is already
248 248
         // given.
249
-        $cr= BoincConsent::lookup("userid={$user->id} AND consent_type_id='${ctid}' ORDER BY consent_time DESC LIMIT 1");
250
-        if ( (($cr) and ($cr->consent_flag!=$consent_flag)) or
251
-             (!$cr) ) {
249
+        $cr = BoincConsent::lookup("userid={$user->id} AND consent_type_id='${ctid}' ORDER BY consent_time DESC LIMIT 1");
250
+        if ((($cr) and ($cr->consent_flag != $consent_flag)) or
251
+             (!$cr)) {
252 252
 
253 253
             $rc = consent_to_a_policy($user, $ctid, $consent_flag, $consent_not_required, $consent_source, time());
254 254
             if (!$rc) {
Please login to merge, or discard this patch.
html/ops/manage_consent_types.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 // Toggles the enable flag
54 54
 function mct_toggle_field($field) {
55 55
     $ctid = post_int("consent_type_id");
56
-    $toggle = post_str("toggle" . $field);
56
+    $toggle = post_str("toggle".$field);
57 57
     if ($toggle == "Click to Enable") {
58 58
         $state = 1;
59 59
         $action = "Enabled";
Please login to merge, or discard this patch.
html/inc/delete_account.inc 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 if (!defined("DELETE_DELAY")) define("DELETE_DELAY", 2);
43 43
 
44 44
 function is_delete_account_token_valid($userid, $token) {
45
-    if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT) ) {
45
+    if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT)) {
46 46
         sleep(LOGIN_FAIL_SLEEP_SEC);
47 47
         return false;
48 48
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 //
127 127
 function is_over_but_not_validated($res) {
128 128
     if ($res->server_state == RESULT_SERVER_STATE_OVER && $res->outcome == RESULT_OUTCOME_SUCCESS &&
129
-            ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE) ) {
129
+            ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE)) {
130 130
         return true;
131 131
     }    
132 132
     return false;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 //
145 145
 function cancel_results_for_user($user) {
146 146
     $ress = BoincResult::enum("userid = $user->id");
147
-    $cancel_clause="server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID;
148
-    $set_id_clause="hostid=0, userid=0";
147
+    $cancel_clause = "server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID;
148
+    $set_id_clause = "hostid=0, userid=0";
149 149
     foreach ($ress as $res) {
150 150
         if (is_in_progress($res) || is_over_but_not_validated($res)) {
151 151
             $res->update($cancel_clause.", ".$set_id_clause);
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 
169 169
     // delete remote submit user
170 170
     //
171
-    delete_remote_submit_user($user);  // from submit_util.inc
171
+    delete_remote_submit_user($user); // from submit_util.inc
172 172
     
173 173
     // remove user's team records
174 174
     //
175
-    user_erase_team_owner($user);      // from team.inc
176
-    user_quit_team($user);        // from team.inc
175
+    user_erase_team_owner($user); // from team.inc
176
+    user_quit_team($user); // from team.inc
177 177
     user_erase_team_delta($user); // from team.inc
178 178
     
179 179
     // Items that do not have logic elsewhere
@@ -199,6 +199,6 @@  discard block
 block discarded – undo
199 199
     BoincConsent::delete_for_user($user->id);
200 200
 
201 201
     // final action
202
-    delete_user($user);  //from user_util.inc
202
+    delete_user($user); //from user_util.inc
203 203
     return 0;
204 204
 }
Please login to merge, or discard this patch.
html/user/user_agreetermsofuse_action.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 if ($checkct) {
60 60
     $rc1 = consent_to_a_policy($user, $ctid, 1, 0, 'Webform', time());
61 61
     if (!$rc1) {
62
-        error_page("Database error when attempting to INSERT into table consent with ID=$user->id. " . BoincDb::error() . " Please contact site administrators.");
62
+        error_page("Database error when attempting to INSERT into table consent with ID=$user->id. ".BoincDb::error()." Please contact site administrators.");
63 63
     }
64 64
 } else {
65 65
     error_page("Error: consent type for enrollment not found. Please contact site administrators.");
Please login to merge, or discard this patch.
html/inc/boinc_db.inc 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
         $db = BoincDb::get();
209 209
         return $db->update($this, 'user', $clause);
210 210
     }
211
-    static function enum($where_clause, $order_clause=null) {
211
+    static function enum($where_clause, $order_clause = null) {
212 212
         $db = BoincDb::get();
213 213
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
214 214
     }
215
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
215
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
216 216
         $db = BoincDb::get();
217 217
         return $db->enum_fields(
218 218
             'user', 'BoincUser', $fields, $where_clause, $order_clause
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $db = BoincDb::get();
262 262
         return $db->update($this, 'team', $clause);
263 263
     }
264
-    static function enum($where_clause, $order_clause=null) {
264
+    static function enum($where_clause, $order_clause = null) {
265 265
         $db = BoincDb::get();
266 266
         return $db->enum('team', 'BoincTeam', $where_clause, $order_clause);
267 267
     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $db = BoincDb::get();
287 287
         return $db->max('team', $field);
288 288
     }
289
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
289
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
290 290
         $db = BoincDb::get();
291 291
         return $db->enum_fields(
292 292
             '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
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         $db = BoincDb::get();
446 446
         return $db->update($this, 'app', $clause);
447 447
     }
448
-    static function sum($field, $clause=null) {
448
+    static function sum($field, $clause = null) {
449 449
         $db = BoincDb::get();
450 450
         return $db->sum('app', $field, $clause);
451 451
     }
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
         $db = BoincDb::get();
502 502
         return $db->insert('profile', $clause);
503 503
     }
504
-    static function enum($where_clause=null, $order_clause=null) {
504
+    static function enum($where_clause = null, $order_clause = null) {
505 505
         $db = BoincDb::get();
506 506
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
507 507
     }
508
-    static function enum_fields($fields, $where_clause=null, $order_clause=null) {
508
+    static function enum_fields($fields, $where_clause = null, $order_clause = null) {
509 509
         $db = BoincDb::get();
510 510
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
511 511
     }
@@ -889,12 +889,12 @@  discard block
 block discarded – undo
889 889
         return $db->enum('consent', 'BoincConsent', $where_clause);
890 890
     }
891 891
 
892
-    static function insert ($clause) {
892
+    static function insert($clause) {
893 893
         $db = BoincDb::get();
894 894
         return $db->insert('consent', $clause);
895 895
     }
896 896
 
897
-    static function update ($clause) {
897
+    static function update($clause) {
898 898
         $db = BoincDb::get();
899 899
         return $db->update_aux('consent', $clause);
900 900
     }
@@ -918,17 +918,17 @@  discard block
 block discarded – undo
918 918
         return $db->lookup('consent_type', 'BoincConsentType', $clause);
919 919
     }
920 920
 
921
-    static function enum($where_clause, $order_clause=null) {
921
+    static function enum($where_clause, $order_clause = null) {
922 922
         $db = BoincDb::get();
923 923
         return $db->enum('consent_type', 'BoincConsentType', $where_clause, $order_clause);
924 924
     }
925 925
 
926
-    static function insert ($clause) {
926
+    static function insert($clause) {
927 927
         $db = BoincDb::get();
928 928
         return $db->insert('consent_type', $clause);
929 929
     }
930 930
 
931
-    static function update ($clause) {
931
+    static function update($clause) {
932 932
         $db = BoincDb::get();
933 933
         return $db->update_aux('consent_type', $clause);
934 934
     }
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
         return $db->lookup('latest_consent', 'BoincLatestConsent', $clause);
954 954
     }
955 955
 
956
-    static function enum($where_clause, $order_clause=null) {
956
+    static function enum($where_clause, $order_clause = null) {
957 957
         $db = BoincDb::get();
958 958
         return $db->enum('latest_consent', 'BoincLatestConsent', $where_clause, $order_clause);
959 959
     }
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 // apply this to any user-supplied strings used in queries
965 965
 // 
966 966
 function boinc_real_escape_string($x) {
967
-    if (version_compare(phpversion(),"4.3.0")>=0) {
967
+    if (version_compare(phpversion(), "4.3.0") >= 0) {
968 968
         return BoincDb::escape_string($x);
969 969
     } else {
970 970
         $x = str_replace("'", "\'", $x);
Please login to merge, or discard this patch.
html/inc/prefs_util.inc 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 abstract class PREF {
45
-    public $desc;       // short description
46
-    public $tooltip;    // longer description, shown as tooltip
47
-    public $tag;        // the pref's primary XML tag
45
+    public $desc; // short description
46
+    public $tooltip; // longer description, shown as tooltip
47
+    public $tag; // the pref's primary XML tag
48 48
     function __construct($desc, $tooltip, $tag) {
49 49
         $this->desc = $desc;
50 50
         $this->tooltip = $tooltip;
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 
123 123
 class PREF_BOOL extends PREF {
124 124
     public $default;
125
-    public $invert;     // show to user in opposite sense
126
-    function __construct($desc, $tooltip, $tag, $default, $invert=false) {
125
+    public $invert; // show to user in opposite sense
126
+    function __construct($desc, $tooltip, $tag, $default, $invert = false) {
127 127
         $this->default = $default;
128 128
         $this->invert = $invert;
129 129
         parent::__construct($desc, $tooltip, $tag);
130 130
     }
131 131
     function show_value($prefs) {
132 132
         $tag = $this->tag;
133
-        $v = $this->invert?!$prefs->$tag:$prefs->$tag;
133
+        $v = $this->invert ? !$prefs->$tag : $prefs->$tag;
134 134
         echo "<td>".readonly_checkbox($v)."</td>";
135 135
     }
136 136
     function show_form($prefs, $error) {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         }
143 143
         echo "<td ".VALUE_ATTRS.">"
144 144
             ."<input type=checkbox name=$this->tag "
145
-            . ($checked?"checked":"")
145
+            . ($checked ? "checked" : "")
146 146
             ."></td>
147 147
         ";
148 148
     }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     function xml_string($prefs) {
156 156
         $tag = $this->tag;
157 157
         return "<$tag>"
158
-            .($prefs->$tag?"1":"0")
158
+            .($prefs->$tag ? "1" : "0")
159 159
             ."</$tag>\n";
160 160
     }
161 161
     function xml_parse(&$prefs, $name, $text) {
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
     public $consent_type_id; // the consent_type_id from the consent_type table
176 176
     public $consent_name; // the consent_name to configure
177 177
     public $default;
178
-    public $invert;     // show to user in opposite sense
178
+    public $invert; // show to user in opposite sense
179 179
 
180
-    function __construct($desc, $tooltip, $tag, $consent_type_id, $consent_name, $default, $invert=false) {
180
+    function __construct($desc, $tooltip, $tag, $consent_type_id, $consent_name, $default, $invert = false) {
181 181
         $this->consent_type_id = $consent_type_id;
182 182
         $this->consent_name = $consent_name;
183 183
         $this->default = $default;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         } else {
232 232
             $value = false;
233 233
         }
234
-        echo "<td>" . readonly_checkbox($value) . "</td>";
234
+        echo "<td>".readonly_checkbox($value)."</td>";
235 235
     }
236 236
     function show_form($user, $error) {
237 237
         $consent_type_id = $this->consent_type_id;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         }
248 248
         echo "<td ".VALUE_ATTRS.">"
249 249
             ."<input type=checkbox name=$this->tag "
250
-            . ($checked?"checked":"")
250
+            . ($checked ? "checked" : "")
251 251
             ."></td>
252 252
         ";
253 253
     }
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
         // to this consent type.
265 265
         $cr = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id='${consent_type_id}'");
266 266
 
267
-        if ( (($cr) and ($cr->consent_flag!=$flag)) or
268
-             (!$cr) ) {
267
+        if ((($cr) and ($cr->consent_flag != $flag)) or
268
+             (!$cr)) {
269 269
             $rc = consent_to_a_policy($user, $consent_type_id, $flag, 0, 'Webform', time());
270 270
             if (!$rc) {
271 271
                 error_page(tra("Database error:").BoincDb::error());
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
         // this is the value if they check the box
302 302
     public $scale;
303 303
 
304
-    function __construct($suffix, $min, $max, $default, $scale=1, $default2=0) {
304
+    function __construct($suffix, $min, $max, $default, $scale = 1, $default2 = 0) {
305 305
         $this->suffix = " $suffix";
306 306
         $this->min = $min;
307 307
         $this->max = $max;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         $v .= "$this->suffix ";
321 321
         return $v;
322 322
     }
323
-    function form_str($tag, $v, $had_error, $disabled=false, $id=null) {
323
+    function form_str($tag, $v, $had_error, $disabled = false, $id = null) {
324 324
         if (is_numeric($v)) {
325 325
             $v /= $this->scale;
326 326
             if (!$had_error && ($v < $this->min || $v > $this->max)) {
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
             }
329 329
         }
330 330
         if ($disabled) $v = "";
331
-        $i = $id?"id=\"$id\"":"";
331
+        $i = $id ? "id=\"$id\"" : "";
332 332
         return '<input type="text" size="5" class="form-control input-sm" name="'.$tag.'" value="'.$v."\" $disabled $i> &nbsp; $this->suffix ";
333 333
     }
334 334
     function form_convert($in, &$out, &$error) {
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
         $text_id = $this->tag;
452 452
         $default = $this->num_spec->get_default();
453 453
         $val = $prefs->$tag;
454
-        $c = $val?"checked":"";
455
-        $d = $val?"":"disabled";
454
+        $c = $val ? "checked" : "";
455
+        $d = $val ? "" : "disabled";
456 456
         echo "<td $attrs>"
457 457
             ."<input type=checkbox id=$checkbox_id onClick=\"checkbox_clicked('$checkbox_id', '$text_id', $default)\" $c> &nbsp;"
458 458
             .$this->num_spec->form_str($tag, $prefs->$tag, $had_error, $d, $text_id)
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 function hour_select($x, $name, $id, $d) {
566 566
     $s = "";
567 567
     $s .= "<select class=\"selectbox form-control input-sm\" name=$name id=$id $d>\n";
568
-    for ($i=0; $i<24; $i++) {
569
-        $sel = ($x == $i)?"selected":"";
568
+    for ($i = 0; $i < 24; $i++) {
569
+        $sel = ($x == $i) ? "selected" : "";
570 570
         $s .= "<option value=$i $sel> $i:00";
571 571
     }
572 572
     $s .= "</select>\n";
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 
668 668
 // row_defs - Display a value for all 4 venues in one row
669 669
 //
670
-function row_defs($pre, $item, $post, $type, $prefs, $tooltip=null) {
670
+function row_defs($pre, $item, $post, $type, $prefs, $tooltip = null) {
671 671
     $gen = $prefs->$item;
672 672
     $hom  = (isset($prefs->home) && isset($prefs->home->$item)) ? $prefs->home->$item : "--";
673 673
     $schl = (isset($prefs->school) && isset($prefs->school->$item)) ? $prefs->school->$item : "--";
@@ -679,10 +679,10 @@  discard block
 block discarded – undo
679 679
         echo "<tr>";
680 680
     }
681 681
     echo "<td ".NAME_ATTRS.">$pre</td>";
682
-    row_field($gen,  $type);
683
-    row_field($hom,  $type);
682
+    row_field($gen, $type);
683
+    row_field($hom, $type);
684 684
     row_field($schl, $type);
685
-    row_field($wrk,  $type);
685
+    row_field($wrk, $type);
686 686
     echo "<td align=left>$post</td></tr>\n";
687 687
 }
688 688
 
@@ -692,16 +692,16 @@  discard block
 block discarded – undo
692 692
 function row_field($value, $type) {
693 693
     echo "<td>";
694 694
     $type = $value === "--" ? "--" : $type;
695
-    switch($type) {
695
+    switch ($type) {
696 696
     case "yesno":
697
-        echo $value ?tra("yes"):tra("no");
697
+        echo $value ?tra("yes") : tra("no");
698 698
         break;
699 699
     case "noyes":
700
-        echo $value ?tra("no"):tra("yes");
700
+        echo $value ?tra("no") : tra("yes");
701 701
         break;
702 702
     case "limit":
703 703
         $x = max_bytes_display_mode($value);
704
-        $y = "$x " . BYTE_ABBR;
704
+        $y = "$x ".BYTE_ABBR;
705 705
         echo $x ? "$y" : tra("no limit");
706 706
         break;
707 707
     case "minutes":
Please login to merge, or discard this patch.
html/inc/consent.inc 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 include_once("../inc/boinc_db.inc");
22 22
 include_once("../inc/util.inc");
23 23
 
24
-define('CONSENT_TYPE_ENROLL','ENROLL');
24
+define('CONSENT_TYPE_ENROLL', 'ENROLL');
25 25
 
26 26
 function consent_to_a_policy($user, $consent_type_id, $consent_flag, $consent_not_required, $source, $ctime = 0) {
27 27
     $mys = BoincDb::escape_string($source);
28
-    if ($ctime==0) {
28
+    if ($ctime == 0) {
29 29
         $mytime = $user->create_time;
30 30
     }
31 31
     else {
32 32
         $mytime = $ctime;
33 33
     }
34 34
     return BoincConsent::insert(
35
-        "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) " .
35
+        "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) ".
36 36
         "values($user->id, $consent_type_id, $mytime, $consent_flag, $consent_not_required, '$mys')"
37 37
     );
38 38
 
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 // if checkenabled=TRUE, if the consent_type is enabled/available for
57 57
 // use. The integer is the consent_type_id- the id from consent_type
58 58
 // table. If the boolean is FALSE, the integer returned is -1.
59
-function check_consent_type($name, $checkenabled=TRUE) {
59
+function check_consent_type($name, $checkenabled = TRUE) {
60 60
     $ct = BoincConsentType::lookup("shortname = '{$name}'");
61
-    if ($ct and ( !$checkenabled or ($ct->enabled)) ) {
61
+    if ($ct and (!$checkenabled or ($ct->enabled))) {
62 62
         return array(TRUE, $ct->id);
63 63
     }
64 64
     return array(FALSE, -1);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 function intercept_login($user, $perm, $in_next_url = "") {
71 71
     list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL);
72 72
     $config = get_config();
73
-    if ( parse_bool($config, "enable_login_mustagree_termsofuse") and $checkct and check_termsofuse() and (!check_user_consent($user, CONSENT_TYPE_ENROLL))) {
73
+    if (parse_bool($config, "enable_login_mustagree_termsofuse") and $checkct and check_termsofuse() and (!check_user_consent($user, CONSENT_TYPE_ENROLL))) {
74 74
         // sent user to terms-of-use Web form after login
75 75
         send_cookie('tempuserid', $user->id, false);
76 76
         send_cookie('tempperm', $perm, false);
Please login to merge, or discard this patch.