@@ -29,7 +29,7 @@ discard block |
||
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 |
||
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 | ?> |
@@ -174,8 +174,7 @@ |
||
174 | 174 | array("agree_to_terms_of_use", "", false), |
175 | 175 | ); |
176 | 176 | form_checkboxes(tra("Do you agree to the terms of use above?"), $myitems, 'tabindex="0"'); |
177 | - } |
|
178 | - else { |
|
177 | + } else { |
|
179 | 178 | // error - no terms of use for user to agree to! |
180 | 179 | } |
181 | 180 |
@@ -41,14 +41,12 @@ |
||
41 | 41 | // Obtain data from cookies |
42 | 42 | if (isset($_COOKIE['tempuserid'])) { |
43 | 43 | $userid = $_COOKIE['tempuserid']; |
44 | -} |
|
45 | -else { |
|
44 | +} else { |
|
46 | 45 | error_page(tra("Website error when attempting to agree to terms of use. Please contact the site administrators.")); |
47 | 46 | } |
48 | 47 | if (isset($_COOKIE['tempperm'])) { |
49 | 48 | $perm = $_COOKIE['tempperm']; |
50 | -} |
|
51 | -else { |
|
49 | +} else { |
|
52 | 50 | error_page(tra("Website error when attempting to agree to terms of use. Please contact the site administrators.")); |
53 | 51 | } |
54 | 52 | $user = BoincUser::lookup_id_nocache($userid); |
@@ -59,7 +59,7 @@ |
||
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."); |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | if ($disable_account_creation || defined('INVITE_CODES')) { |
84 | - echo " <account_creation_disabled/>\n"; |
|
84 | + echo " <account_creation_disabled/>\n"; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | if (defined('INVITE_CODES')) { |
88 | - echo " <invite_code_required/>\n"; |
|
88 | + echo " <invite_code_required/>\n"; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | echo " <min_passwd_length>$min_passwd_length</min_passwd_length>\n"; |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | // project has not defined the constant TERMSOFUSE_FILE, then look for |
108 | 108 | // the terms_of_use.txt file in the project base directory. |
109 | 109 | if (defined('TERMSOFUSE_FILE')) { |
110 | - $tou_file = TERMSOFUSE_FILE; |
|
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)); |
@@ -28,10 +28,10 @@ discard block |
||
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 |
||
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)); |
@@ -28,10 +28,10 @@ discard block |
||
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> |
@@ -108,8 +108,7 @@ discard block |
||
108 | 108 | // the terms_of_use.txt file in the project base directory. |
109 | 109 | if (defined('TERMSOFUSE_FILE')) { |
110 | 110 | $tou_file = TERMSOFUSE_FILE; |
111 | -} |
|
112 | -else { |
|
111 | +} else { |
|
113 | 112 | $tou_file = "../../terms_of_use.txt"; |
114 | 113 | } |
115 | 114 | if (file_exists($tou_file)) { |
@@ -187,7 +187,7 @@ discard block |
||
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 |
||
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) { |
@@ -104,7 +104,7 @@ |
||
104 | 104 | // set to 1. |
105 | 105 | if ($consent_flag==0) { |
106 | 106 | $rc = consent_to_a_policy($user, $ctid, 0, 1, $source); |
107 | - } else { |
|
107 | + } else { |
|
108 | 108 | $rc = consent_to_a_policy($user, $ctid, 1, 0, $source); |
109 | 109 | } |
110 | 110 | if (!$rc) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | xml_error(ERR_ACCT_CREATION_DISABLED); |
41 | 41 | } |
42 | 42 | |
43 | -if(defined('INVITE_CODES')) { |
|
43 | +if (defined('INVITE_CODES')) { |
|
44 | 44 | $invite_code = get_str("invite_code"); |
45 | 45 | if (!preg_match(INVITE_CODES, $invite_code)) { |
46 | 46 | xml_error(ERR_ATTACH_FAIL_INIT); |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | // clients who do use this flag to continue. I.e., if |
121 | 121 | // is_null($consent_flag) returns TRUE, then return an |
122 | 122 | // xml_error(-1, ...). |
123 | - if ( (!is_null($consent_flag)) and $source) { |
|
123 | + if ((!is_null($consent_flag)) and $source) { |
|
124 | 124 | // Record the user giving consent in database - if consent_flag is 0, |
125 | 125 | // this is an 'anonymous account' and consent_not_required is |
126 | 126 | // set to 1. |
127 | - if ($consent_flag==0) { |
|
127 | + if ($consent_flag == 0) { |
|
128 | 128 | $rc = consent_to_a_policy($user, $ctid, 0, 1, $source); |
129 | - } else { |
|
129 | + } else { |
|
130 | 130 | $rc = consent_to_a_policy($user, $ctid, 1, 0, $source); |
131 | 131 | } |
132 | 132 | if (!$rc) { |
@@ -53,7 +53,7 @@ |
||
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"; |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | if ($toggle == "Click to Enable") { |
47 | 47 | $state = 1; |
48 | 48 | $action = "Enabled"; |
49 | - } |
|
50 | - else { |
|
49 | + } else { |
|
51 | 50 | $state = 0; |
52 | 51 | $action = "Disabled"; |
53 | 52 | } |
@@ -91,12 +90,10 @@ discard block |
||
91 | 90 | if (!in_rops()) { |
92 | 91 | if (!($ct->enabled)) { |
93 | 92 | echo " <td><input class=\"btn btn-default\" name=toggleenabled type=submit value=\"Click to Enable\"></td>"; |
94 | - } |
|
95 | - else { |
|
93 | + } else { |
|
96 | 94 | echo " <td><input class=\"btn btn-default\" name=toggleenabled type=submit value=\"Click to Disable\"></td>"; |
97 | 95 | } |
98 | - } |
|
99 | - else { |
|
96 | + } else { |
|
100 | 97 | echo " <td>$ct->enabled</td>"; |
101 | 98 | } |
102 | 99 | |
@@ -107,12 +104,10 @@ discard block |
||
107 | 104 | if (!in_rops()) { |
108 | 105 | if (!($ct->privacypref)) { |
109 | 106 | echo " <td><input class=\"btn btn-default\" name=toggleprivacypref type=submit value=\"Click to Enable\"></td>"; |
110 | - } |
|
111 | - else { |
|
107 | + } else { |
|
112 | 108 | echo " <td><input class=\"btn btn-default\" name=toggleprivacypref type=submit value=\"Click to Disable\"></td>"; |
113 | 109 | } |
114 | - } |
|
115 | - else { |
|
110 | + } else { |
|
116 | 111 | echo " <td>$ct->privacypref</td>"; |
117 | 112 | } |
118 | 113 | |
@@ -156,11 +151,9 @@ discard block |
||
156 | 151 | |
157 | 152 | if (post_str("add_consenttype", true)) { |
158 | 153 | add_consenttype(); |
159 | -} |
|
160 | -else if (post_str("toggleenabled", true)) { |
|
154 | +} else if (post_str("toggleenabled", true)) { |
|
161 | 155 | mct_toggle_field("enabled"); |
162 | -} |
|
163 | -else if (post_str("toggleprivacypref", true)) { |
|
156 | +} else if (post_str("toggleprivacypref", true)) { |
|
164 | 157 | mct_toggle_field("privacypref"); |
165 | 158 | } |
166 | 159 |
@@ -42,7 +42,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -208,11 +208,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |