@@ -30,7 +30,7 @@ |
||
30 | 30 | $wuid2 = get_int('wuid2'); |
31 | 31 | $unsent_only = get_str('unsent_only', true); |
32 | 32 | |
33 | -if ($wuid1<1 || $wuid2<$wuid1) { |
|
33 | +if ($wuid1 < 1 || $wuid2 < $wuid1) { |
|
34 | 34 | admin_error_page( |
35 | 35 | "<h2>Workunit IDs fail to satisfy the conditions:<p> 0 < ID1 <= ID2" |
36 | 36 | ); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | db_init(); |
25 | 25 | |
26 | 26 | admin_page_head("screen profile action"); |
27 | -for ($i=0; $i<$n; $i++) { |
|
27 | +for ($i = 0; $i < $n; $i++) { |
|
28 | 28 | $y = "user".$i; |
29 | 29 | $val = $_GET[$y]; |
30 | 30 | $x = "userid".$i; |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | // Delete a user if they have no credit, results, or posts |
41 | 41 | // |
42 | -function possibly_delete_user($user){ |
|
43 | - if ($user->total_credit > 0.0){ |
|
42 | +function possibly_delete_user($user) { |
|
43 | + if ($user->total_credit > 0.0) { |
|
44 | 44 | admin_error_page("Cannot delete user: User has credit."); |
45 | 45 | } |
46 | 46 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | admin_error_page("Cannot delete user: User has forum posts."); |
57 | 57 | } |
58 | 58 | |
59 | - if ($user->teamid){ |
|
59 | + if ($user->teamid) { |
|
60 | 60 | user_quit_team($user); |
61 | 61 | } |
62 | 62 | delete_user($user); |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | function handle_special_user($user) { |
68 | 68 | global $special_user_bitfield; |
69 | 69 | $Nbf = sizeof($special_user_bitfield); |
70 | - $bits=""; |
|
71 | - for ($i=0; $i<$Nbf; $i++) { |
|
70 | + $bits = ""; |
|
71 | + for ($i = 0; $i < $Nbf; $i++) { |
|
72 | 72 | $key = "special_user_$i"; |
73 | 73 | if (array_key_exists($key, $_POST) && $_POST[$key]) { |
74 | 74 | $bits .= "1"; |
@@ -94,35 +94,35 @@ discard block |
||
94 | 94 | ); |
95 | 95 | } else { |
96 | 96 | if (is_numeric($dt)) { |
97 | - $t = $dt>0 ? time()+$dt : 0; |
|
97 | + $t = $dt > 0 ? time() + $dt : 0; |
|
98 | 98 | $q = "UPDATE forum_preferences SET banished_until=$t WHERE userid=$user->id"; |
99 | 99 | _mysql_query($q); |
100 | 100 | |
101 | 101 | // put a timestamp in wiki to trigger re-validation of credentials |
102 | 102 | |
103 | - if (function_exists('touch_wiki_user')){ |
|
103 | + if (function_exists('touch_wiki_user')) { |
|
104 | 104 | touch_wiki_user($user); |
105 | 105 | } |
106 | 106 | |
107 | 107 | // Send suspension e-mail to user and administrators |
108 | 108 | |
109 | - if ($dt>0) { |
|
110 | - $subject = PROJECT." posting privileges suspended for ". $user->name; |
|
109 | + if ($dt > 0) { |
|
110 | + $subject = PROJECT." posting privileges suspended for ".$user->name; |
|
111 | 111 | $body = " |
112 | -Forum posting privileges for the " .PROJECT. " user \"".$user->name."\" |
|
113 | -have been suspended for " .time_diff($dt). " by ".$g_logged_in_user->name.". |
|
112 | +Forum posting privileges for the " .PROJECT." user \"".$user->name."\" |
|
113 | +have been suspended for " .time_diff($dt)." by ".$g_logged_in_user->name.". |
|
114 | 114 | The reason given was: |
115 | 115 | |
116 | 116 | $reason |
117 | 117 | |
118 | -The suspension will end at " .time_str($t)."\n"; |
|
118 | +The suspension will end at ".time_str($t)."\n"; |
|
119 | 119 | } else { |
120 | - $subject = PROJECT." user ". $user->name. " unsuspended"; |
|
120 | + $subject = PROJECT." user ".$user->name." unsuspended"; |
|
121 | 121 | $body = " |
122 | -Forum posting privileges for the " .PROJECT. " user \"".$user->name."\" |
|
122 | +Forum posting privileges for the " .PROJECT." user \"".$user->name."\" |
|
123 | 123 | have been restored by ".$g_logged_in_user->name."\n"; |
124 | 124 | if ($reason) { |
125 | - $body.="The reason given was:\n\n $reason\n"; |
|
125 | + $body .= "The reason given was:\n\n $reason\n"; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | row1("Special User Status"); |
187 | 187 | |
188 | 188 | echo "<tr>\n"; |
189 | - for ($i=0; $i<$Nbf; $i++) { |
|
189 | + for ($i = 0; $i < $Nbf; $i++) { |
|
190 | 190 | $bit = substr($user->prefs->special_user, $i, 1); |
191 | 191 | echo "<tr><td><input type='checkbox'' name='special_user_".$i."' value='1'"; |
192 | 192 | if ($bit == 1) { |
193 | 193 | echo " checked='checked'"; |
194 | 194 | } |
195 | - echo ">". $special_user_bitfield[$i] ."</td></tr>\n"; |
|
195 | + echo ">".$special_user_bitfield[$i]."</td></tr>\n"; |
|
196 | 196 | } |
197 | 197 | echo "</tr>"; |
198 | 198 | |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | if ($user->prefs->banished_until) { |
218 | 218 | $dt = $user->prefs->banished_until - time(); |
219 | 219 | if ($dt > 0) { |
220 | - $x = " Suspended until " . time_str($user->prefs->banished_until) |
|
221 | - ."<br/> (Expires in " . time_diff($dt) .")" ; |
|
220 | + $x = " Suspended until ".time_str($user->prefs->banished_until) |
|
221 | + ."<br/> (Expires in ".time_diff($dt).")"; |
|
222 | 222 | } else { |
223 | - $x = " last suspended " . time_str($user->prefs->banished_until); |
|
223 | + $x = " last suspended ".time_str($user->prefs->banished_until); |
|
224 | 224 | } |
225 | 225 | row1($x); |
226 | 226 | } else { |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | "; |
239 | 239 | echo " |
240 | 240 | <input type='radio' name='suspend_for' value='172800'> 48 hours <br/> |
241 | - <input type='radio' name='suspend_for' value='",86400*7,"'> 1 week <br/> |
|
242 | - <input type='radio' name='suspend_for' value='",86400*14,"'> 2 weeks <br/> |
|
241 | + <input type='radio' name='suspend_for' value='",86400*7, "'> 1 week <br/> |
|
242 | + <input type='radio' name='suspend_for' value='",86400*14, "'> 2 weeks <br/> |
|
243 | 243 | "; |
244 | 244 | |
245 | - if ($dt>0) { |
|
245 | + if ($dt > 0) { |
|
246 | 246 | echo " |
247 | 247 | <input type='radio' name='suspend_for' value='-1'> <b>unsuspend</b> <br/>"; |
248 | 248 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $apps = BoincApp::enum(""); |
156 | 156 | foreach ($apps as $app) { |
157 | 157 | if (in_array($app->id, $show_only) |
158 | - || ( in_array("all", $show_only) |
|
158 | + || (in_array("all", $show_only) |
|
159 | 159 | && (!$app->deprecated || $show_deprecated) |
160 | 160 | )) { |
161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | <b>Results for <tt>$app->name</tt>:</b> |
164 | 164 | <ul> |
165 | 165 | "; |
166 | - for ($i=0; $i<2; $i++) { |
|
166 | + for ($i = 0; $i < 2; $i++) { |
|
167 | 167 | if ($i) { |
168 | 168 | $secs = 7*86400; |
169 | 169 | $period = " 7 days"; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | start_table(); |
36 | 36 | |
37 | -switch($table){ |
|
37 | +switch ($table) { |
|
38 | 38 | case "platform": |
39 | 39 | break; |
40 | 40 | case "app": |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | row1("Current special users", '9'); |
28 | 28 | |
29 | 29 | echo "<tr><td>User</td>"; |
30 | -for ($i=0; $i<S_NFLAGS; $i++) { |
|
31 | - echo "<td width=\"15\">" . $special_user_bitfield[$i] . "</td>\n"; |
|
30 | +for ($i = 0; $i < S_NFLAGS; $i++) { |
|
31 | + echo "<td width=\"15\">".$special_user_bitfield[$i]."</td>\n"; |
|
32 | 32 | } |
33 | 33 | echo "</tr>"; |
34 | 34 | |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | FROM forum_preferences as prefs, user |
38 | 38 | WHERE CONVERT(special_user, DECIMAL) > 0 and prefs.userid=user.id" |
39 | 39 | ); |
40 | -for ($i=1; $i<=_mysql_num_rows($result); $i++){ |
|
40 | +for ($i = 1; $i <= _mysql_num_rows($result); $i++) { |
|
41 | 41 | $foo = _mysql_fetch_object($result); |
42 | 42 | echo "<form action=\"manage_special_users_action.php\" method=\"POST\">\n"; |
43 | 43 | echo "<input type=\"hidden\" name=\"userid\" value=\"$foo->userid\" |
44 | 44 | <tr><td>$foo->name ($foo->id)</td> |
45 | 45 | "; |
46 | - for ($j=0; $j<S_NFLAGS; $j++) { |
|
46 | + for ($j = 0; $j < S_NFLAGS; $j++) { |
|
47 | 47 | $bit = substr($foo->special_user, $j, 1); |
48 | 48 | echo "<td><input type=\"checkbox\" name=\"role".$j."\" value=\"1\""; |
49 | 49 | if ($bit == 1) { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | echo "<tr><form action=\"manage_special_users_action.php\" method=\"POST\">\n"; |
59 | 59 | echo "<td>Add UserID:<input type=\"text\" name=\"userid\" size=\"6\"></td>"; |
60 | 60 | |
61 | -for ($j=0; $j<S_NFLAGS; $j++) { |
|
61 | +for ($j = 0; $j < S_NFLAGS; $j++) { |
|
62 | 62 | echo "<td><input type=\"checkbox\" name=\"role".$j."\" value=\"1\""; |
63 | 63 | echo "></td>\n"; |
64 | 64 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // For display, convert query string characters < and > into 'html form' so |
65 | 65 | // that they will be displayed. |
66 | 66 | // |
67 | -$html_text=str_replace('<', '<', str_replace('>', '>', $main_query)); |
|
67 | +$html_text = str_replace('<', '<', str_replace('>', '>', $main_query)); |
|
68 | 68 | |
69 | 69 | echo "<p>Query: <b>$html_text</b><p>\n"; |
70 | 70 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | if ($result) { |
160 | 160 | if ($detail == "low") { |
161 | 161 | start_table('table-striped'); |
162 | - switch($table) { |
|
162 | + switch ($table) { |
|
163 | 163 | case "result": |
164 | 164 | result_short_header(); |
165 | 165 | break; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | admin_page_head("Cancel Jobs"); |
30 | 30 | |
31 | 31 | $limit = get_int('limit', true); |
32 | -if (!$limit || $limit==0) { |
|
32 | +if (!$limit || $limit == 0) { |
|
33 | 33 | $limit = 100; |
34 | 34 | } |
35 | 35 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $clause = get_str('clause', true); |
43 | 43 | |
44 | 44 | if ($minid && $maxid) { |
45 | - $qclause = "id >=" . $minid . " AND id <=" . $maxid; |
|
45 | + $qclause = "id >=".$minid." AND id <=".$maxid; |
|
46 | 46 | } else if ($list) { |
47 | - $qclause = "id IN (" . $list . ")"; |
|
47 | + $qclause = "id IN (".$list.")"; |
|
48 | 48 | } else if ($uclause) { |
49 | 49 | $qclause = urldecode($uclause); |
50 | 50 | } else if ($clause) { |
@@ -63,24 +63,24 @@ |
||
63 | 63 | // loop over all users |
64 | 64 | while ($user = _mysql_fetch_object($result)) { |
65 | 65 | |
66 | - $id=$user->id; |
|
67 | - $email_addr=$user->email_addr; |
|
68 | - $cpid=$user->cross_project_id; |
|
66 | + $id = $user->id; |
|
67 | + $email_addr = $user->email_addr; |
|
68 | + $cpid = $user->cross_project_id; |
|
69 | 69 | |
70 | - $new_email=strtolower(trim($email_addr)); |
|
70 | + $new_email = strtolower(trim($email_addr)); |
|
71 | 71 | |
72 | 72 | if (strcmp($email_addr, $new_email)) |
73 | 73 | echo "Problematic email address [$id] $email_addr becomes $new_email<br/>"; |
74 | 74 | |
75 | - if (!(strcmp($cpid,"0"))) { |
|
76 | - $newcpid=random_string(); |
|
75 | + if (!(strcmp($cpid, "0"))) { |
|
76 | + $newcpid = random_string(); |
|
77 | 77 | echo "Problematic CPID=0 for [$id] $email_addr gets CPID=$newcpid<br/>"; |
78 | 78 | } |
79 | 79 | else |
80 | - $newcpid=$cpid; |
|
80 | + $newcpid = $cpid; |
|
81 | 81 | |
82 | - if (strcmp($email_addr, $new_email) || strcmp($newcpid,$cpid)) { |
|
83 | - $update="update user set email_addr='$new_email', cross_project_id='$newcpid' where id='$id'"; |
|
82 | + if (strcmp($email_addr, $new_email) || strcmp($newcpid, $cpid)) { |
|
83 | + $update = "update user set email_addr='$new_email', cross_project_id='$newcpid' where id='$id'"; |
|
84 | 84 | if ($confirm != "yes") { |
85 | 85 | echo "QUERY WOULD BE [$id] $query <br/>[click the link at the bottom to enable]<br/>"; |
86 | 86 | $update_needed = TRUE; |