@@ -50,14 +50,12 @@ |
||
50 | 50 | } |
51 | 51 | if (isset($_COOKIE['tempuserid'])) { |
52 | 52 | $userid = $_COOKIE['tempuserid']; |
53 | -} |
|
54 | -else { |
|
53 | +} else { |
|
55 | 54 | error_page(tra("Website error when attempting to agree to terms of use. Please contact the site administrators.")); |
56 | 55 | } |
57 | 56 | if (isset($_COOKIE['tempperm'])) { |
58 | 57 | $perm = $_COOKIE['tempperm']; |
59 | -} |
|
60 | -else { |
|
58 | +} else { |
|
61 | 59 | error_page(tra("Website error when attempting to agree to terms of use. Please contact the site administrators.")); |
62 | 60 | } |
63 | 61 |
@@ -21,18 +21,18 @@ discard block |
||
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 |
||
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 |
||
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 | $mytoken = create_token($user->id, TOKEN_TYPE_LOGIN_INTERCEPT, TOKEN_DURATION_TWO_HOURS); |
76 | 76 | send_cookie('logintoken', $mytoken, false); |