@@ -58,10 +58,10 @@ |
||
58 | 58 | //panel(null, 'panel_contents'); |
59 | 59 | } |
60 | 60 | |
61 | -function left(){ |
|
61 | +function left() { |
|
62 | 62 | global $user, $no_web_account_creation, $master_url, $project_id; |
63 | 63 | panel( |
64 | - $user?tra("Welcome, %1", $user->name):tra("What is %1?", PROJECT), |
|
64 | + $user ?tra("Welcome, %1", $user->name) : tra("What is %1?", PROJECT), |
|
65 | 65 | function() use($user) { |
66 | 66 | global $no_web_account_creation, $master_url, $project_id; |
67 | 67 | if ($user) { |
@@ -58,7 +58,7 @@ |
||
58 | 58 | //panel(null, 'panel_contents'); |
59 | 59 | } |
60 | 60 | |
61 | -function left(){ |
|
61 | +function left() { |
|
62 | 62 | global $user, $no_web_account_creation, $master_url, $project_id; |
63 | 63 | panel( |
64 | 64 | $user?tra("Welcome, %1", $user->name):tra("What is %1?", PROJECT), |
@@ -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) { |
@@ -96,11 +96,11 @@ |
||
96 | 96 | // Consistency checks |
97 | 97 | if (!check_termsofuse()) { |
98 | 98 | error_log("Project configuration error! " . |
99 | - "Terms of use undefined while 'account_creation_rpc_require_consent' enabled!"); |
|
99 | + "Terms of use undefined while 'account_creation_rpc_require_consent' enabled!"); |
|
100 | 100 | } |
101 | 101 | if (!$checkct) { |
102 | 102 | error_log("Project configuration error! " . |
103 | - "'CONSENT_TYPE_ENROLL' disabled while 'account_creation_rpc_require_consent' enabled!"); |
|
103 | + "'CONSENT_TYPE_ENROLL' disabled while 'account_creation_rpc_require_consent' enabled!"); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | // Check consent requirement |
@@ -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); |
@@ -95,19 +95,19 @@ discard block |
||
95 | 95 | if (parse_bool($config, "account_creation_rpc_require_consent")) { |
96 | 96 | // Consistency checks |
97 | 97 | if (!check_termsofuse()) { |
98 | - error_log("Project configuration error! " . |
|
98 | + error_log("Project configuration error! ". |
|
99 | 99 | "Terms of use undefined while 'account_creation_rpc_require_consent' enabled!"); |
100 | 100 | } |
101 | 101 | if (!$checkct) { |
102 | - error_log("Project configuration error! " . |
|
102 | + error_log("Project configuration error! ". |
|
103 | 103 | "'CONSENT_TYPE_ENROLL' disabled while 'account_creation_rpc_require_consent' enabled!"); |
104 | 104 | } |
105 | 105 | |
106 | 106 | // Check consent requirement |
107 | 107 | if (is_null($consent_flag) or !$source) { |
108 | - xml_error(ERR_ACCT_REQUIRE_CONSENT, "This project requires to consent to its terms of use. " . |
|
109 | - "Please update your BOINC software " . |
|
110 | - "or register via the project's website " . |
|
108 | + xml_error(ERR_ACCT_REQUIRE_CONSENT, "This project requires to consent to its terms of use. ". |
|
109 | + "Please update your BOINC software ". |
|
110 | + "or register via the project's website ". |
|
111 | 111 | "or contact your account manager's provider."); |
112 | 112 | } |
113 | 113 | } |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | // * not agree. |
142 | 142 | // -> no create account RPC at all |
143 | 143 | // |
144 | - if ( (!is_null($consent_flag)) and $source) { |
|
144 | + if ((!is_null($consent_flag)) and $source) { |
|
145 | 145 | // Record the user giving consent in database - if consent_flag is 0, |
146 | 146 | // this is an 'anonymous account' and consent_not_required is |
147 | 147 | // set to 1. |
148 | - if ($consent_flag==0) { |
|
148 | + if ($consent_flag == 0) { |
|
149 | 149 | $rc = consent_to_a_policy($user, $ctid, 0, 1, $source); |
150 | - } else { |
|
150 | + } else { |
|
151 | 151 | $rc = consent_to_a_policy($user, $ctid, 1, 0, $source); |
152 | 152 | } |
153 | 153 | 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 |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | |
33 | 33 | function sched_log_name($x) { |
34 | 34 | if ($x == 0) return "NO_SUCH_LOG"; |
35 | - return gmdate('Y-m-d_H/Y-m-d_H:i', $x) . ".txt"; |
|
35 | + return gmdate('Y-m-d_H/Y-m-d_H:i', $x).".txt"; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | function sched_log_link($x) { |
39 | 39 | if (file_exists("sched_logs")) { |
40 | - return "<a href=\"../sched_logs/" . sched_log_name($x) . "\">" . time_str($x) . "</a>"; |
|
40 | + return "<a href=\"../sched_logs/".sched_log_name($x)."\">".time_str($x)."</a>"; |
|
41 | 41 | } else { |
42 | 42 | return time_str($x); |
43 | 43 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | function location_form($host) { |
47 | 47 | $none = "selected"; |
48 | - $h=$w=$s=$m=""; |
|
48 | + $h = $w = $s = $m = ""; |
|
49 | 49 | if ($host->venue == "home") $h = "selected"; |
50 | 50 | if ($host->venue == "work") $w = "selected"; |
51 | 51 | if ($host->venue == "school") $s = "selected"; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | row2(tra("Product name"), $host->product_name); |
99 | 99 | } |
100 | 100 | $x = $host->timezone/3600; |
101 | - if ($x >= 0) $x="+$x"; |
|
101 | + if ($x >= 0) $x = "+$x"; |
|
102 | 102 | row2(tra("Local Standard Time"), tra("UTC %1 hours", $x)); |
103 | 103 | } else { |
104 | 104 | $owner = BoincUser::lookup_id($host->userid); |
@@ -258,15 +258,15 @@ discard block |
||
258 | 258 | // "[vbox|5.0.0|1|1]", where now two additional flags give information about |
259 | 259 | // hardware virtualization support. Older clients may have the old-style |
260 | 260 | // serialnum in the DB despite the server being upgraded. |
261 | -function vbox_desc($x){ |
|
262 | - if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){ |
|
261 | +function vbox_desc($x) { |
|
262 | + if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/", $x, $matches)) { |
|
263 | 263 | $desc = "Virtualbox (".$matches[1].") ".tra("installed"); |
264 | - if (sizeof($matches)>2){ |
|
265 | - if ($matches[3]=="1" and $matches[4]=="1") { |
|
264 | + if (sizeof($matches) > 2) { |
|
265 | + if ($matches[3] == "1" and $matches[4] == "1") { |
|
266 | 266 | return $desc.tra(", CPU has hardware virtualization support and it is enabled"); |
267 | - } elseif ($matches[3]=="1" and $matches[4]=="0") { |
|
267 | + } elseif ($matches[3] == "1" and $matches[4] == "0") { |
|
268 | 268 | return $desc.tra(", CPU has hardware virtualization support but it is disabled"); |
269 | - } elseif ($matches[3]=="0") { |
|
269 | + } elseif ($matches[3] == "0") { |
|
270 | 270 | return $desc.tra(", CPU does not have hardware virtualization support"); |
271 | 271 | } |
272 | 272 | } else { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | // Given string of the form [BOINC|vers][type|model|count|RAM|driver-vers][vbox|vers], |
281 | 281 | // return a human-readable version of the GPU info |
282 | 282 | // |
283 | -function gpu_desc($x, $detail=true) { |
|
283 | +function gpu_desc($x, $detail = true) { |
|
284 | 284 | $descs = explode("]", $x); |
285 | 285 | array_pop($descs); |
286 | 286 | $str = ""; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | if ($d[0] == "BOINC") continue; |
292 | 292 | if ($d[0] == "vbox") continue; |
293 | 293 | if ($str) $str .= "<p>"; |
294 | - if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] "; |
|
294 | + if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] "; |
|
295 | 295 | if ($d[0] == "CUDA") { |
296 | 296 | $str .= "NVIDIA"; |
297 | 297 | } else if ($d[0] == "CAL") { |
@@ -498,14 +498,14 @@ discard block |
||
498 | 498 | if ($pos1 === false) return $x; |
499 | 499 | $pos2 = strpos($model, ']'); |
500 | 500 | if ($pos2 === false) return $x; |
501 | - $a = substr($model, $pos1+1, $pos2-$pos1-1); |
|
501 | + $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1); |
|
502 | 502 | $y = explode(" ", $a); |
503 | 503 | if (count($y) == 0) return $x; |
504 | 504 | if ($y[0] == "Family") { |
505 | 505 | $x->info = $a; |
506 | 506 | } else { |
507 | 507 | $x->arch = $y[0]; |
508 | - $x->info = substr($a, strlen($y[0])+1); |
|
508 | + $x->info = substr($a, strlen($y[0]) + 1); |
|
509 | 509 | } |
510 | 510 | return $x; |
511 | 511 | } |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | $avg_time = 0; |
595 | 595 | |
596 | 596 | $results = BoincResult::enum("hostid=$hostid order by received_time"); |
597 | - foreach($results as $result) { |
|
597 | + foreach ($results as $result) { |
|
598 | 598 | if ($result->granted_credit <= 0) continue; |
599 | 599 | $total += $result->granted_credit; |
600 | 600 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | |
688 | 688 | function link_url($sort, $rev, $show_all) { |
689 | 689 | global $userid; |
690 | - $x = $userid ? "&userid=$userid":""; |
|
690 | + $x = $userid ? "&userid=$userid" : ""; |
|
691 | 691 | return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x"; |
692 | 692 | } |
693 | 693 | |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | } |
762 | 762 | |
763 | 763 | function show_user_hosts($userid, $private, $show_all, $sort, $rev) { |
764 | - $desc = false; // whether the sort order's default is decreasing |
|
764 | + $desc = false; // whether the sort order's default is decreasing |
|
765 | 765 | switch ($sort) { |
766 | 766 | case "total_credit": $sort_clause = "total_credit"; $desc = true; break; |
767 | 767 | case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break; |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | more_or_less($sort, $rev, $show_all); |
785 | 785 | |
786 | 786 | $now = time(); |
787 | - $old_hosts=0; |
|
787 | + $old_hosts = 0; |
|
788 | 788 | $i = 1; |
789 | 789 | $hosts = BoincHost::enum("userid=$userid order by $sort_clause"); |
790 | 790 | $any_product_name = false; |
@@ -796,9 +796,9 @@ discard block |
||
796 | 796 | } |
797 | 797 | user_host_table_start($private, $sort, $rev, $show_all, $any_product_name); |
798 | 798 | foreach ($hosts as $host) { |
799 | - $is_old=false; |
|
799 | + $is_old = false; |
|
800 | 800 | if (($now - $host->rpc_time) > 30*86400) { |
801 | - $is_old=true; |
|
801 | + $is_old = true; |
|
802 | 802 | $old_hosts++; |
803 | 803 | } |
804 | 804 | if (!$show_all && $is_old) continue; |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | } |
808 | 808 | end_table(); |
809 | 809 | |
810 | - if ($old_hosts>0) { |
|
810 | + if ($old_hosts > 0) { |
|
811 | 811 | more_or_less($sort, $rev, $show_all); |
812 | 812 | } |
813 | 813 | |
@@ -827,6 +827,6 @@ discard block |
||
827 | 827 | } |
828 | 828 | } |
829 | 829 | |
830 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
830 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
831 | 831 | |
832 | 832 | ?> |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if ($host->last_ip_addr != $host->external_ip_addr) { |
91 | 91 | row2(tra("External IP address"), $host->external_ip_addr); |
92 | 92 | } |
93 | - } else { |
|
93 | + } else { |
|
94 | 94 | row2(tra("IP address"), "<a href=show_host_detail.php?hostid=$host->id&ipprivate=1>".tra("Show IP address")."</a>"); |
95 | 95 | } |
96 | 96 | row2(tra("Domain name"), $host->domain_name); |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | // "[vbox|5.0.0|1|1]", where now two additional flags give information about |
259 | 259 | // hardware virtualization support. Older clients may have the old-style |
260 | 260 | // serialnum in the DB despite the server being upgraded. |
261 | -function vbox_desc($x){ |
|
262 | - if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){ |
|
261 | +function vbox_desc($x) { |
|
262 | + if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)) { |
|
263 | 263 | $desc = "Virtualbox (".$matches[1].") ".tra("installed"); |
264 | - if (sizeof($matches)>2){ |
|
264 | + if (sizeof($matches)>2) { |
|
265 | 265 | if ($matches[3]=="1" and $matches[4]=="1") { |
266 | 266 | return $desc.tra(", CPU has hardware virtualization support and it is enabled"); |
267 | 267 | } elseif ($matches[3]=="1" and $matches[4]=="0") { |
@@ -4,110 +4,110 @@ |
||
4 | 4 | * Implementation of hook_user_default_permissions(). |
5 | 5 | */ |
6 | 6 | function discussion_forums_user_default_permissions() { |
7 | - $permissions = array(); |
|
7 | + $permissions = array(); |
|
8 | 8 | |
9 | - // Exported permission: access comments |
|
10 | - $permissions['access comments'] = array( |
|
9 | + // Exported permission: access comments |
|
10 | + $permissions['access comments'] = array( |
|
11 | 11 | 'name' => 'access comments', |
12 | 12 | 'roles' => array( |
13 | - '0' => 'administrator', |
|
14 | - '1' => 'anonymous user', |
|
15 | - '2' => 'authenticated user', |
|
13 | + '0' => 'administrator', |
|
14 | + '1' => 'anonymous user', |
|
15 | + '2' => 'authenticated user', |
|
16 | 16 | ), |
17 | - ); |
|
17 | + ); |
|
18 | 18 | |
19 | - // Exported permission: administer comments |
|
20 | - $permissions['administer comments'] = array( |
|
19 | + // Exported permission: administer comments |
|
20 | + $permissions['administer comments'] = array( |
|
21 | 21 | 'name' => 'administer comments', |
22 | 22 | 'roles' => array( |
23 | - '0' => 'administrator', |
|
24 | - '1' => 'moderator', |
|
23 | + '0' => 'administrator', |
|
24 | + '1' => 'moderator', |
|
25 | 25 | ), |
26 | - ); |
|
26 | + ); |
|
27 | 27 | |
28 | - // Exported permission: administer forums |
|
29 | - $permissions['administer forums'] = array( |
|
28 | + // Exported permission: administer forums |
|
29 | + $permissions['administer forums'] = array( |
|
30 | 30 | 'name' => 'administer forums', |
31 | 31 | 'roles' => array( |
32 | - '0' => 'administrator', |
|
32 | + '0' => 'administrator', |
|
33 | 33 | ), |
34 | - ); |
|
34 | + ); |
|
35 | 35 | |
36 | - // Exported permission: assign community member role |
|
37 | - $permissions['assign community member role'] = array( |
|
36 | + // Exported permission: assign community member role |
|
37 | + $permissions['assign community member role'] = array( |
|
38 | 38 | 'name' => 'assign community member role', |
39 | 39 | 'roles' => array( |
40 | - '0' => 'moderator', |
|
40 | + '0' => 'moderator', |
|
41 | 41 | ), |
42 | - ); |
|
42 | + ); |
|
43 | 43 | |
44 | - // Exported permission: create forum topics |
|
45 | - $permissions['create forum topics'] = array( |
|
44 | + // Exported permission: create forum topics |
|
45 | + $permissions['create forum topics'] = array( |
|
46 | 46 | 'name' => 'create forum topics', |
47 | 47 | 'roles' => array( |
48 | - '0' => 'administrator', |
|
49 | - '1' => 'community member', |
|
50 | - '2' => 'moderator', |
|
51 | - '3' => 'verified contributor', |
|
48 | + '0' => 'administrator', |
|
49 | + '1' => 'community member', |
|
50 | + '2' => 'moderator', |
|
51 | + '3' => 'verified contributor', |
|
52 | 52 | ), |
53 | - ); |
|
53 | + ); |
|
54 | 54 | |
55 | - // Exported permission: delete any forum topic |
|
56 | - $permissions['delete any forum topic'] = array( |
|
55 | + // Exported permission: delete any forum topic |
|
56 | + $permissions['delete any forum topic'] = array( |
|
57 | 57 | 'name' => 'delete any forum topic', |
58 | 58 | 'roles' => array( |
59 | - '0' => 'administrator', |
|
59 | + '0' => 'administrator', |
|
60 | 60 | ), |
61 | - ); |
|
61 | + ); |
|
62 | 62 | |
63 | - // Exported permission: delete own forum topics |
|
64 | - $permissions['delete own forum topics'] = array( |
|
63 | + // Exported permission: delete own forum topics |
|
64 | + $permissions['delete own forum topics'] = array( |
|
65 | 65 | 'name' => 'delete own forum topics', |
66 | 66 | 'roles' => array( |
67 | - '0' => 'administrator', |
|
67 | + '0' => 'administrator', |
|
68 | 68 | ), |
69 | - ); |
|
69 | + ); |
|
70 | 70 | |
71 | - // Exported permission: edit any forum topic |
|
72 | - $permissions['edit any forum topic'] = array( |
|
71 | + // Exported permission: edit any forum topic |
|
72 | + $permissions['edit any forum topic'] = array( |
|
73 | 73 | 'name' => 'edit any forum topic', |
74 | 74 | 'roles' => array( |
75 | - '0' => 'administrator', |
|
76 | - '1' => 'moderator', |
|
75 | + '0' => 'administrator', |
|
76 | + '1' => 'moderator', |
|
77 | 77 | ), |
78 | - ); |
|
78 | + ); |
|
79 | 79 | |
80 | - // Exported permission: edit own forum topics |
|
81 | - $permissions['edit own forum topics'] = array( |
|
80 | + // Exported permission: edit own forum topics |
|
81 | + $permissions['edit own forum topics'] = array( |
|
82 | 82 | 'name' => 'edit own forum topics', |
83 | 83 | 'roles' => array( |
84 | - '0' => 'administrator', |
|
85 | - '1' => 'community member', |
|
86 | - '2' => 'verified contributor', |
|
84 | + '0' => 'administrator', |
|
85 | + '1' => 'community member', |
|
86 | + '2' => 'verified contributor', |
|
87 | 87 | ), |
88 | - ); |
|
88 | + ); |
|
89 | 89 | |
90 | - // Exported permission: post comments |
|
91 | - $permissions['post comments'] = array( |
|
90 | + // Exported permission: post comments |
|
91 | + $permissions['post comments'] = array( |
|
92 | 92 | 'name' => 'post comments', |
93 | 93 | 'roles' => array( |
94 | - '0' => 'administrator', |
|
95 | - '1' => 'community member', |
|
96 | - '2' => 'moderator', |
|
97 | - '3' => 'verified contributor', |
|
94 | + '0' => 'administrator', |
|
95 | + '1' => 'community member', |
|
96 | + '2' => 'moderator', |
|
97 | + '3' => 'verified contributor', |
|
98 | 98 | ), |
99 | - ); |
|
99 | + ); |
|
100 | 100 | |
101 | - // Exported permission: post comments without approval |
|
102 | - $permissions['post comments without approval'] = array( |
|
101 | + // Exported permission: post comments without approval |
|
102 | + $permissions['post comments without approval'] = array( |
|
103 | 103 | 'name' => 'post comments without approval', |
104 | 104 | 'roles' => array( |
105 | - '0' => 'administrator', |
|
106 | - '1' => 'community member', |
|
107 | - '2' => 'moderator', |
|
108 | - '3' => 'verified contributor', |
|
105 | + '0' => 'administrator', |
|
106 | + '1' => 'community member', |
|
107 | + '2' => 'moderator', |
|
108 | + '3' => 'verified contributor', |
|
109 | 109 | ), |
110 | - ); |
|
110 | + ); |
|
111 | 111 | |
112 | - return $permissions; |
|
112 | + return $permissions; |
|
113 | 113 | } |
@@ -155,7 +155,7 @@ |
||
155 | 155 | show_type($vers, $stats); |
156 | 156 | } |
157 | 157 | foreach ($data->darwin as $vers=>$state) { |
158 | - show_type("Darwin $vers", $state); |
|
158 | + show_type("darwin $vers", $state); |
|
159 | 159 | } |
160 | 160 | show_type("Linux total", $data->linux); |
161 | 161 | foreach ($data->other as $vers=>$stats) { |
@@ -22,14 +22,14 @@ |
||
22 | 22 | require_once("../inc/util.inc"); |
23 | 23 | require_once("../inc/cache.inc"); |
24 | 24 | |
25 | -$min_credit = .1; // only count hosts with this much RAC |
|
25 | +$min_credit = .1; // only count hosts with this much RAC |
|
26 | 26 | $total_rac = 0; |
27 | 27 | |
28 | 28 | define("CACHE_PERIOD", 7*86400); |
29 | 29 | |
30 | 30 | function show_type($type, $stats) { |
31 | 31 | global $total_rac; |
32 | - $pct = $total_rac?number_format(100*$stats->rac/$total_rac, 4):0; |
|
32 | + $pct = $total_rac ?number_format(100*$stats->rac/$total_rac, 4) : 0; |
|
33 | 33 | row_array(array($type, $stats->nhosts, "$pct %")); |
34 | 34 | } |
35 | 35 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | start_table(); |
28 | 28 | echo " |
29 | 29 | <tr><td>" |
30 | - . tra("Leader boards for %1",PROJECT).": |
|
30 | + . tra("Leader boards for %1", PROJECT).": |
|
31 | 31 | <ul> |
32 | 32 | <li><a href=\"top_users.php\">" . tra("Participants")."</a> |
33 | 33 | "; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | if (!DISABLE_TEAMS) { |
39 | 39 | echo " |
40 | - <li><a href=\"top_teams.php\">" . tra("Teams"). "</a> |
|
40 | + <li><a href=\"top_teams.php\">" . tra("Teams")."</a> |
|
41 | 41 | "; |
42 | 42 | if ($credit_by_app) { |
43 | 43 | echo "<ul><li><a href=per_app_list.php?is_team=1>Per application</a></ul>\n"; |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * Helper functions |
10 | 10 | */ |
11 | 11 | function _boincuser_delete_goto_admindelete($form, &$form_state) { |
12 | - drupal_goto('/admin/boinc/user_delete/' . $form['#uid']); |
|
12 | + drupal_goto('/admin/boinc/user_delete/'.$form['#uid']); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | function _boincuser_delete_cancel($form, &$form_state) { |
16 | - drupal_goto('/user/' . $form['#uid'] . '/edit'); |
|
16 | + drupal_goto('/user/'.$form['#uid'].'/edit'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account')); |
25 | 25 | } |
26 | 26 | |
27 | - $given_hash = md5($current_pass . $boinc_user->email_addr); |
|
27 | + $given_hash = md5($current_pass.$boinc_user->email_addr); |
|
28 | 28 | |
29 | - if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
29 | + if ((!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash)) { |
|
30 | 30 | return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account')); |
31 | 31 | } |
32 | 32 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Delete the user function. |
42 | 42 | */ |
43 | -function _boincuser_delete_deleteuser($account, $action=NULL) { |
|
43 | +function _boincuser_delete_deleteuser($account, $action = NULL) { |
|
44 | 44 | require_boinc('user_util'); |
45 | 45 | require_boinc('delete_account'); |
46 | 46 | |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | // * erase signature |
75 | 75 | $myarray = array( |
76 | 76 | 'status' => 0, |
77 | - 'name' => 'deleted_' . time() . '_' . random_string(), |
|
78 | - 'mail' => 'deleted_' . time() . '_' . random_string(), |
|
79 | - 'pass' => 'deleted_' . time() . '_' . random_string(), |
|
77 | + 'name' => 'deleted_'.time().'_'.random_string(), |
|
78 | + 'mail' => 'deleted_'.time().'_'.random_string(), |
|
79 | + 'pass' => 'deleted_'.time().'_'.random_string(), |
|
80 | 80 | 'signature' => '', |
81 | - 'init' => 'deleted_' . time() . '_' . random_string(), |
|
81 | + 'init' => 'deleted_'.time().'_'.random_string(), |
|
82 | 82 | ); |
83 | 83 | user_save($account, $myarray); |
84 | 84 | break; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | if (!empty($mids)) { |
132 | 132 | // Delete recipient entries in {pm_index} of the messages the user wrote. |
133 | - db_query('DELETE FROM {pm_index} WHERE mid IN (' . db_placeholders($mids) . ')', $mids); |
|
133 | + db_query('DELETE FROM {pm_index} WHERE mid IN ('.db_placeholders($mids).')', $mids); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | // Delete recipient entries of that user. |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function _boincuser_delete_validatepasswd($boinc_user, $current_pass) { |
23 | 23 | if (!$current_pass) { |
24 | - return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account')); |
|
24 | + return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), null, 'boinc:delete-user-account')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $given_hash = md5($current_pass . $boinc_user->email_addr); |
28 | 28 | |
29 | 29 | if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
30 | - return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account')); |
|
30 | + return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), null, 'boinc:delete-user-account')); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | return true; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Delete the user function. |
42 | 42 | */ |
43 | -function _boincuser_delete_deleteuser($account, $action=NULL) { |
|
43 | +function _boincuser_delete_deleteuser($account, $action=null) { |
|
44 | 44 | require_boinc('user_util'); |
45 | 45 | require_boinc('delete_account'); |
46 | 46 |
@@ -9,28 +9,28 @@ discard block |
||
9 | 9 | * Helper functions |
10 | 10 | */ |
11 | 11 | function _boincuser_delete_goto_admindelete($form, &$form_state) { |
12 | - drupal_goto('/admin/boinc/user_delete/' . $form['#uid']); |
|
12 | + drupal_goto('/admin/boinc/user_delete/' . $form['#uid']); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | function _boincuser_delete_cancel($form, &$form_state) { |
16 | - drupal_goto('/user/' . $form['#uid'] . '/edit'); |
|
16 | + drupal_goto('/user/' . $form['#uid'] . '/edit'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Validation user password function. |
21 | 21 | */ |
22 | 22 | function _boincuser_delete_validatepasswd($boinc_user, $current_pass) { |
23 | - if (!$current_pass) { |
|
23 | + if (!$current_pass) { |
|
24 | 24 | return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account')); |
25 | - } |
|
25 | + } |
|
26 | 26 | |
27 | - $given_hash = md5($current_pass . $boinc_user->email_addr); |
|
27 | + $given_hash = md5($current_pass . $boinc_user->email_addr); |
|
28 | 28 | |
29 | - if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
29 | + if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
30 | 30 | return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account')); |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | - return true; |
|
33 | + return true; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -41,56 +41,56 @@ discard block |
||
41 | 41 | * Delete the user function. |
42 | 42 | */ |
43 | 43 | function _boincuser_delete_deleteuser($account, $action=NULL) { |
44 | - require_boinc('user_util'); |
|
45 | - require_boinc('delete_account'); |
|
44 | + require_boinc('user_util'); |
|
45 | + require_boinc('delete_account'); |
|
46 | 46 | |
47 | - $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
47 | + $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
48 | 48 | |
49 | - // watchdog message |
|
50 | - watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname', |
|
51 | - array( |
|
49 | + // watchdog message |
|
50 | + watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname', |
|
51 | + array( |
|
52 | 52 | '%uid' => $account->uid, |
53 | 53 | '%boincuser_id' => $account->boincuser_id, |
54 | 54 | '%displayname' => $account->boincuser_name, |
55 | - ), WATCHDOG_NOTICE); |
|
55 | + ), WATCHDOG_NOTICE); |
|
56 | 56 | |
57 | - // delete the account - This will delete the boinc user from the |
|
58 | - // boinc project database, and then delete the Drupal user using the |
|
59 | - // hook_user() functions. |
|
57 | + // delete the account - This will delete the boinc user from the |
|
58 | + // boinc project database, and then delete the Drupal user using the |
|
59 | + // hook_user() functions. |
|
60 | 60 | |
61 | - switch ($action) { |
|
61 | + switch ($action) { |
|
62 | 62 | case 'soft_obfuscate': |
63 | 63 | obfuscate_account($boinc_user); |
64 | - _boincuser_delete_comment_reassign($account); |
|
65 | - _boincuser_delete_node_reassign($account); |
|
66 | - _boincuser_delete_privatemsg_delete($account); |
|
67 | - _boincuser_delete_friends($account); |
|
68 | - // delete the user's profile |
|
69 | - $profile = content_profile_load('profile', $account->uid); |
|
70 | - node_delete($profile->nid); |
|
71 | - // Drupal account - |
|
72 | - // * 'block'/disable the account |
|
73 | - // * set name, mail, pass, and init to deleted |
|
74 | - // * erase signature |
|
75 | - $myarray = array( |
|
64 | + _boincuser_delete_comment_reassign($account); |
|
65 | + _boincuser_delete_node_reassign($account); |
|
66 | + _boincuser_delete_privatemsg_delete($account); |
|
67 | + _boincuser_delete_friends($account); |
|
68 | + // delete the user's profile |
|
69 | + $profile = content_profile_load('profile', $account->uid); |
|
70 | + node_delete($profile->nid); |
|
71 | + // Drupal account - |
|
72 | + // * 'block'/disable the account |
|
73 | + // * set name, mail, pass, and init to deleted |
|
74 | + // * erase signature |
|
75 | + $myarray = array( |
|
76 | 76 | 'status' => 0, |
77 | 77 | 'name' => 'deleted_' . time() . '_' . random_string(), |
78 | 78 | 'mail' => 'deleted_' . time() . '_' . random_string(), |
79 | 79 | 'pass' => 'deleted_' . time() . '_' . random_string(), |
80 | 80 | 'signature' => '', |
81 | 81 | 'init' => 'deleted_' . time() . '_' . random_string(), |
82 | - ); |
|
83 | - user_save($account, $myarray); |
|
84 | - break; |
|
82 | + ); |
|
83 | + user_save($account, $myarray); |
|
84 | + break; |
|
85 | 85 | case 'hard_wipe': |
86 | 86 | wipe_account($boinc_user); |
87 | - user_delete(array(), $account->uid); |
|
88 | - break; |
|
87 | + user_delete(array(), $account->uid); |
|
88 | + break; |
|
89 | 89 | default: |
90 | 90 | watchdog('boincuser_delete', 'Delete action is %action, which is not \'soft_obfuscate\' or \'hard_wipe\'.', array( |
91 | 91 | '%action' => $action, |
92 | - ), WATCHDOG_ERROR); |
|
93 | - } |
|
92 | + ), WATCHDOG_ERROR); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * Copied from node.module, node_user() |
100 | 100 | */ |
101 | 101 | function _boincuser_delete_node_reassign($account) { |
102 | - db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $account->uid); |
|
103 | - db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $account->uid); |
|
102 | + db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $account->uid); |
|
103 | + db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $account->uid); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * Copied from comment.module, comment_user() |
110 | 110 | */ |
111 | 111 | function _boincuser_delete_comment_reassign($account) { |
112 | - // bug in comment module, remove user name from comments. |
|
113 | - db_query("UPDATE {comments} SET comments.name='' WHERE uid =%d", $account->uid); |
|
112 | + // bug in comment module, remove user name from comments. |
|
113 | + db_query("UPDATE {comments} SET comments.name='' WHERE uid =%d", $account->uid); |
|
114 | 114 | |
115 | - db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $account->uid); |
|
116 | - db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $account->uid); |
|
115 | + db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $account->uid); |
|
116 | + db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $account->uid); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -122,23 +122,23 @@ discard block |
||
122 | 122 | * Copied from privatemsg module, case 'delete' in privatemsg_user(). |
123 | 123 | */ |
124 | 124 | function _boincuser_delete_privatemsg_delete($account) { |
125 | - // Load all mids of the messages the user wrote. |
|
126 | - $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid); |
|
127 | - $mids = array(); |
|
128 | - while ($row = db_fetch_array($result)) { |
|
125 | + // Load all mids of the messages the user wrote. |
|
126 | + $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid); |
|
127 | + $mids = array(); |
|
128 | + while ($row = db_fetch_array($result)) { |
|
129 | 129 | $mids[] = $row['mid']; |
130 | - } |
|
130 | + } |
|
131 | 131 | |
132 | - // Delete messages the user wrote. |
|
133 | - db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid); |
|
132 | + // Delete messages the user wrote. |
|
133 | + db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid); |
|
134 | 134 | |
135 | - if (!empty($mids)) { |
|
135 | + if (!empty($mids)) { |
|
136 | 136 | // Delete recipient entries in {pm_index} of the messages the user wrote. |
137 | 137 | db_query('DELETE FROM {pm_index} WHERE mid IN (' . db_placeholders($mids) . ')', $mids); |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - // Delete recipient entries of that user. |
|
141 | - db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid); |
|
140 | + // Delete recipient entries of that user. |
|
141 | + db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -147,6 +147,6 @@ discard block |
||
147 | 147 | * Copied from flag_friend, flag_friend_user() |
148 | 148 | */ |
149 | 149 | function _boincuser_delete_friends($account) { |
150 | - // remove any friend relationships if an account is removed |
|
150 | + // remove any friend relationships if an account is removed |
|
151 | 151 | db_query("DELETE FROM {flag_friend} WHERE uid = %d OR friend_uid = %d", $account->uid, $account->uid); |
152 | 152 | } |
153 | 153 | \ No newline at end of file |
@@ -9,28 +9,28 @@ discard block |
||
9 | 9 | * Helper functions |
10 | 10 | */ |
11 | 11 | function _boincuser_delete_goto_admindelete($form, &$form_state) { |
12 | - drupal_goto('/admin/boinc/user_delete/' . $form['#uid']); |
|
12 | +drupal_goto('/admin/boinc/user_delete/' . $form['#uid']); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | function _boincuser_delete_cancel($form, &$form_state) { |
16 | - drupal_goto('/user/' . $form['#uid'] . '/edit'); |
|
16 | +drupal_goto('/user/' . $form['#uid'] . '/edit'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Validation user password function. |
21 | 21 | */ |
22 | 22 | function _boincuser_delete_validatepasswd($boinc_user, $current_pass) { |
23 | - if (!$current_pass) { |
|
24 | - return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account')); |
|
25 | - } |
|
23 | +if (!$current_pass) { |
|
24 | +return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account')); |
|
25 | +} |
|
26 | 26 | |
27 | - $given_hash = md5($current_pass . $boinc_user->email_addr); |
|
27 | +$given_hash = md5($current_pass . $boinc_user->email_addr); |
|
28 | 28 | |
29 | - if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
30 | - return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account')); |
|
31 | - } |
|
29 | +if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
30 | +return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account')); |
|
31 | +} |
|
32 | 32 | |
33 | - return true; |
|
33 | +return true; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -41,56 +41,56 @@ discard block |
||
41 | 41 | * Delete the user function. |
42 | 42 | */ |
43 | 43 | function _boincuser_delete_deleteuser($account, $action=NULL) { |
44 | - require_boinc('user_util'); |
|
45 | - require_boinc('delete_account'); |
|
46 | - |
|
47 | - $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
48 | - |
|
49 | - // watchdog message |
|
50 | - watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname', |
|
51 | - array( |
|
52 | - '%uid' => $account->uid, |
|
53 | - '%boincuser_id' => $account->boincuser_id, |
|
54 | - '%displayname' => $account->boincuser_name, |
|
55 | - ), WATCHDOG_NOTICE); |
|
56 | - |
|
57 | - // delete the account - This will delete the boinc user from the |
|
58 | - // boinc project database, and then delete the Drupal user using the |
|
59 | - // hook_user() functions. |
|
60 | - |
|
61 | - switch ($action) { |
|
62 | - case 'soft_obfuscate': |
|
63 | - obfuscate_account($boinc_user); |
|
64 | - _boincuser_delete_comment_reassign($account); |
|
65 | - _boincuser_delete_node_reassign($account); |
|
66 | - _boincuser_delete_privatemsg_delete($account); |
|
67 | - _boincuser_delete_friends($account); |
|
68 | - // delete the user's profile |
|
69 | - $profile = content_profile_load('profile', $account->uid); |
|
70 | - node_delete($profile->nid); |
|
71 | - // Drupal account - |
|
72 | - // * 'block'/disable the account |
|
73 | - // * set name, mail, pass, and init to deleted |
|
74 | - // * erase signature |
|
75 | - $myarray = array( |
|
76 | - 'status' => 0, |
|
77 | - 'name' => 'deleted_' . time() . '_' . random_string(), |
|
78 | - 'mail' => 'deleted_' . time() . '_' . random_string(), |
|
79 | - 'pass' => 'deleted_' . time() . '_' . random_string(), |
|
80 | - 'signature' => '', |
|
81 | - 'init' => 'deleted_' . time() . '_' . random_string(), |
|
82 | - ); |
|
83 | - user_save($account, $myarray); |
|
84 | - break; |
|
85 | - case 'hard_wipe': |
|
86 | - wipe_account($boinc_user); |
|
87 | - user_delete(array(), $account->uid); |
|
88 | - break; |
|
89 | - default: |
|
90 | - watchdog('boincuser_delete', 'Delete action is %action, which is not \'soft_obfuscate\' or \'hard_wipe\'.', array( |
|
91 | - '%action' => $action, |
|
92 | - ), WATCHDOG_ERROR); |
|
93 | - } |
|
44 | +require_boinc('user_util'); |
|
45 | +require_boinc('delete_account'); |
|
46 | + |
|
47 | +$boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
48 | + |
|
49 | +// watchdog message |
|
50 | +watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname', |
|
51 | +array( |
|
52 | +'%uid' => $account->uid, |
|
53 | +'%boincuser_id' => $account->boincuser_id, |
|
54 | +'%displayname' => $account->boincuser_name, |
|
55 | +), WATCHDOG_NOTICE); |
|
56 | + |
|
57 | +// delete the account - This will delete the boinc user from the |
|
58 | +// boinc project database, and then delete the Drupal user using the |
|
59 | +// hook_user() functions. |
|
60 | + |
|
61 | +switch ($action) { |
|
62 | +case 'soft_obfuscate': |
|
63 | +obfuscate_account($boinc_user); |
|
64 | +_boincuser_delete_comment_reassign($account); |
|
65 | +_boincuser_delete_node_reassign($account); |
|
66 | +_boincuser_delete_privatemsg_delete($account); |
|
67 | +_boincuser_delete_friends($account); |
|
68 | +// delete the user's profile |
|
69 | +$profile = content_profile_load('profile', $account->uid); |
|
70 | +node_delete($profile->nid); |
|
71 | +// Drupal account - |
|
72 | +// * 'block'/disable the account |
|
73 | +// * set name, mail, pass, and init to deleted |
|
74 | +// * erase signature |
|
75 | +$myarray = array( |
|
76 | +'status' => 0, |
|
77 | +'name' => 'deleted_' . time() . '_' . random_string(), |
|
78 | +'mail' => 'deleted_' . time() . '_' . random_string(), |
|
79 | +'pass' => 'deleted_' . time() . '_' . random_string(), |
|
80 | +'signature' => '', |
|
81 | +'init' => 'deleted_' . time() . '_' . random_string(), |
|
82 | +); |
|
83 | +user_save($account, $myarray); |
|
84 | +break; |
|
85 | +case 'hard_wipe': |
|
86 | +wipe_account($boinc_user); |
|
87 | +user_delete(array(), $account->uid); |
|
88 | +break; |
|
89 | +default: |
|
90 | +watchdog('boincuser_delete', 'Delete action is %action, which is not \'soft_obfuscate\' or \'hard_wipe\'.', array( |
|
91 | +'%action' => $action, |
|
92 | +), WATCHDOG_ERROR); |
|
93 | +} |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |