@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | // Check if consent to terms of use has been given. |
180 | - $myconsent = FALSE; |
|
180 | + $myconsent = false; |
|
181 | 181 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
182 | 182 | if ($checkct and check_termsofuse()) { |
183 | 183 | $agree = post_str("agree_to_terms_of_use", true); |
184 | 184 | if (!$agree) { |
185 | 185 | error_page(tra("You have not agreeed to our terms of use. Please agree to the terms of use by navigating back to the previous page, in order to create your account")); |
186 | 186 | } |
187 | - $myconsent = TRUE; |
|
187 | + $myconsent = true; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | // see whether the new account should be pre-enrolled in a team, |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $team = BoincTeam::lookup_id($teamid); |
196 | 196 | $clone_user = BoincUser::lookup_id($team->userid); |
197 | 197 | if (!$clone_user) { |
198 | - error_page("User $userid not found"); |
|
198 | + error_page("user $userid not found"); |
|
199 | 199 | } |
200 | 200 | $project_prefs = $clone_user->project_prefs; |
201 | 201 | } else { |
@@ -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 | send_cookie('tempuserid', $user->id, false); |
76 | 76 | send_cookie('tempperm', $perm, false); |
@@ -27,8 +27,7 @@ discard block |
||
27 | 27 | $mys = BoincDb::escape_string($source); |
28 | 28 | if ($ctime==0) { |
29 | 29 | $mytime = $user->create_time; |
30 | - } |
|
31 | - else { |
|
30 | + } else { |
|
32 | 31 | $mytime = $ctime; |
33 | 32 | } |
34 | 33 | return BoincConsent::insert( |
@@ -76,8 +75,7 @@ discard block |
||
76 | 75 | send_cookie('tempperm', $perm, false); |
77 | 76 | $save_url = $in_next_url; |
78 | 77 | return "user_agreetermsofuse.php?next_url=$save_url"; |
79 | - } |
|
80 | - else { |
|
78 | + } else { |
|
81 | 79 | send_cookie('auth', $user->authenticator, $perm); |
82 | 80 | return $in_next_url; |
83 | 81 | } |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | if ($checkct) { |
45 | 45 | $consent_result = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id=$ctid AND consent_flag=1"); |
46 | 46 | if ($consent_result) { |
47 | - return TRUE; |
|
47 | + return true; |
|
48 | 48 | } |
49 | 49 | } |
50 | - return FALSE; |
|
50 | + return false; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Checks to see if a particular consent_type name is in |
@@ -56,12 +56,12 @@ 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 | 61 | if ($ct and ( !$checkenabled or ($ct->enabled)) ) { |
62 | - return array(TRUE, $ct->id); |
|
62 | + return array(true, $ct->id); |
|
63 | 63 | } |
64 | - return array(FALSE, -1); |
|
64 | + return array(false, -1); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // When a user uses the Web site to login, this funtion checks the |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | $t->user_postal_code = decode($t->user_postal_code); |
65 | 65 | $t->user_url = decode($t->user_url); |
66 | 66 | return $t; |
67 | - } |
|
68 | - else if (strstr($s, '<name>')) $t->name = parse_element($s, '<name>'); |
|
67 | + } else if (strstr($s, '<name>')) $t->name = parse_element($s, '<name>'); |
|
69 | 68 | else if (strstr($s, '<url>')) $t->url = parse_element($s, '<url>'); |
70 | 69 | else if (strstr($s, '<type>')) $t->type = parse_element($s, '<type>'); |
71 | 70 | else if (strstr($s, '<name_html>')) $t->name_html = parse_element($s, '<name_html>'); |
@@ -74,14 +73,12 @@ discard block |
||
74 | 73 | if (strstr($s, '</description>')) break; |
75 | 74 | $t->description .= $s; |
76 | 75 | } |
77 | - } |
|
78 | - else if (strstr($s, '<country>')) $t->country = parse_element($s, '<country>'); |
|
76 | + } else if (strstr($s, '<country>')) $t->country = parse_element($s, '<country>'); |
|
79 | 77 | else if (strstr($s, '<id>')) $t->id = parse_element($s, '<id>'); |
80 | 78 | else if (strstr($s, '<user_email_munged>')) { |
81 | 79 | $user_email_munged = parse_element($s, '<user_email_munged>'); |
82 | 80 | $t->user_email = str_rot13($user_email_munged); |
83 | - } |
|
84 | - else if (strstr($s, '<user_name>')) $t->user_name = parse_element($s, '<user_name>'); |
|
81 | + } else if (strstr($s, '<user_name>')) $t->user_name = parse_element($s, '<user_name>'); |
|
85 | 82 | else if (strstr($s, '<user_country>')) $t->user_country = parse_element($s, '<user_country>'); |
86 | 83 | else if (strstr($s, '<user_postal_code>')) $t->user_postal_code = parse_element($s, '<user_postal_code>'); |
87 | 84 | else if (strstr($s, '<user_url>')) $t->user_url = parse_element($s, '<user_url>'); |
@@ -140,8 +137,7 @@ discard block |
||
140 | 137 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
141 | 138 | if ($checkct) { |
142 | 139 | echo " cannot make user when an consent to terms of use is required\n"; |
143 | - } |
|
144 | - else { |
|
140 | + } else { |
|
145 | 141 | echo " making user $t->user_email\n"; |
146 | 142 | $user = make_user($t->user_email, $t->user_name, random_string()); |
147 | 143 | if (!$user) { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | echo " making team $t->name\n"; |
136 | 136 | return; |
137 | 137 | } |
138 | - $make_user = FALSE; |
|
138 | + $make_user = false; |
|
139 | 139 | if (!$user) { |
140 | 140 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
141 | 141 | if ($checkct) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | echo " Can't make user $t->user_email\n"; |
149 | 149 | return; |
150 | 150 | } |
151 | - $make_user = TRUE; |
|
151 | + $make_user = true; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | echo " making team $t->name\n"; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | return; |
229 | 229 | } |
230 | 230 | |
231 | - echo "Processing $t->name $t->user_email\n"; |
|
231 | + echo "processing $t->name $t->user_email\n"; |
|
232 | 232 | $user = BoincUser::lookup_email_addr($t->user_email); |
233 | 233 | $team = BoincTeam::lookup_name($t->name); |
234 | 234 | if ($team) { |