Passed
Pull Request — master (#3189)
by Kevin
13:35
created
html/inc/consent.inc 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  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
     } else {
31 31
         $mytime = $ctime;
32 32
     }
33 33
     return BoincConsent::insert(
34
-        "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) " .
34
+        "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) ".
35 35
         "values($user->id, $consent_type_id, $mytime, $consent_flag, $consent_not_required, '$mys')"
36 36
     );
37 37
 
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 // if checkenabled=TRUE, if the consent_type is enabled/available for
56 56
 // use. The integer is the consent_type_id- the id from consent_type
57 57
 // table. If the boolean is FALSE, the integer returned is -1.
58
-function check_consent_type($name, $checkenabled=TRUE) {
58
+function check_consent_type($name, $checkenabled = TRUE) {
59 59
     $ct = BoincConsentType::lookup("shortname = '{$name}'");
60
-    if ($ct and ( !$checkenabled or ($ct->enabled)) ) {
60
+    if ($ct and (!$checkenabled or ($ct->enabled))) {
61 61
         return array(TRUE, $ct->id);
62 62
     }
63 63
     return array(FALSE, -1);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 function intercept_login($user, $perm, $in_next_url = "") {
70 70
     list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL);
71 71
     $config = get_config();
72
-    if ( parse_bool($config, "enable_login_mustagree_termsofuse") and $checkct and check_termsofuse() and (!check_user_consent($user, CONSENT_TYPE_ENROLL))) {
72
+    if (parse_bool($config, "enable_login_mustagree_termsofuse") and $checkct and check_termsofuse() and (!check_user_consent($user, CONSENT_TYPE_ENROLL))) {
73 73
         // sent user to terms-of-use Web form after login
74 74
         $mytoken = create_token($user->id, TOKEN_TYPE_LOGIN_INTERCEPT, TOKEN_DURATION_TWO_HOURS);
75 75
         send_cookie('logintoken', $mytoken, false);
Please login to merge, or discard this patch.