@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $y = []; |
27 | 27 | $x[] = sprintf('%s%s', |
28 | 28 | user_links($user, BADGE_HEIGHT_MEDIUM), |
29 | - UNIQUE_USER_NAME?'':" (ID $user->id)" |
|
29 | + UNIQUE_USER_NAME ? '' : " (ID $user->id)" |
|
30 | 30 | ); |
31 | 31 | $y[] = null; |
32 | 32 | if (!DISABLE_TEAMS) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $where = "true"; |
105 | 105 | $search_string = get_str('search_string'); |
106 | 106 | if (strlen($search_string)) { |
107 | - if (strlen($search_string)<3) { |
|
107 | + if (strlen($search_string) < 3) { |
|
108 | 108 | error_page(tra("search string must be at least 3 characters")); |
109 | 109 | } |
110 | 110 | $s = BoincDb::escape_string($search_string); |
@@ -136,17 +136,17 @@ discard block |
||
136 | 136 | $search_type = get_str('search_type', true); |
137 | 137 | $order_clause = "id desc"; |
138 | 138 | if ($search_type == 'rac') { |
139 | - $order_clause ="expavg_credit desc"; |
|
139 | + $order_clause = "expavg_credit desc"; |
|
140 | 140 | } else if ($search_type == 'total') { |
141 | - $order_clause ="total_credit desc"; |
|
141 | + $order_clause = "total_credit desc"; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated"; |
145 | 145 | $users = BoincUser::enum_fields($fields, $where, "order by $order_clause limit 100"); |
146 | 146 | page_head(tra("User search results")); |
147 | - $n=0; |
|
147 | + $n = 0; |
|
148 | 148 | foreach ($users as $user) { |
149 | - if ($n==0) { |
|
149 | + if ($n == 0) { |
|
150 | 150 | start_table('table-striped'); |
151 | 151 | $x = ['Name']; |
152 | 152 | $y = [null]; |
@@ -183,5 +183,5 @@ discard block |
||
183 | 183 | user_search_form(); |
184 | 184 | } |
185 | 185 | |
186 | -$cvs_version_tracker[]="\$Id: user_search.php 13586 2007-09-13 09:46:36Z Rytis $"; //Generated automatically - do not edit |
|
186 | +$cvs_version_tracker[] = "\$Id: user_search.php 13586 2007-09-13 09:46:36Z Rytis $"; //Generated automatically - do not edit |
|
187 | 187 | ?> |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | // ------------ Notification ----------- |
39 | 39 | |
40 | 40 | row1(tra("Notifications")); |
41 | -$ch0 = $user->prefs->pm_notification==0?"checked":""; |
|
42 | -$ch1 = $user->prefs->pm_notification==1?"checked":""; |
|
43 | -$ch2 = $user->prefs->pm_notification==2?"checked":""; |
|
41 | +$ch0 = $user->prefs->pm_notification == 0 ? "checked" : ""; |
|
42 | +$ch1 = $user->prefs->pm_notification == 1 ? "checked" : ""; |
|
43 | +$ch2 = $user->prefs->pm_notification == 2 ? "checked" : ""; |
|
44 | 44 | row2( |
45 | 45 | tra("How should we notify you of new private messages, friend requests, posts in subscribed threads, and other events?"), |
46 | 46 | "<input type=radio name=pm_notification value=0 $ch0> ".tra("On my Account page (no email)")." |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | // ------------ Forum identity ----------- |
54 | 54 | |
55 | 55 | $select_0 = $select_1 = $select_2 = ""; |
56 | -if (strlen($user->prefs->avatar)){ |
|
57 | - if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar |
|
56 | +if (strlen($user->prefs->avatar)) { |
|
57 | + if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18) == "//www.gravatar.com") { // Gravatar |
|
58 | 58 | $select_1 = "checked=\"true\""; |
59 | 59 | } else { |
60 | 60 | $select_2 = "checked=\"true\""; |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
74 | 74 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
75 | 75 | ); |
76 | -if (strlen($user->prefs->avatar)){ |
|
76 | +if (strlen($user->prefs->avatar)) { |
|
77 | 77 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
78 | 78 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
79 | 79 | } |
80 | 80 | |
81 | -$signature_by_default = $user->prefs->no_signature_by_default==false?"checked=\"checked\"":""; |
|
81 | +$signature_by_default = $user->prefs->no_signature_by_default == false ? "checked=\"checked\"" : ""; |
|
82 | 82 | |
83 | -$signature=$user->prefs->signature; |
|
84 | -$maxlen=250; |
|
83 | +$signature = $user->prefs->signature; |
|
84 | +$maxlen = 250; |
|
85 | 85 | $x = ''; |
86 | 86 | if (!NO_COMPUTING) { |
87 | 87 | $x = tra( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | tra("Attach signature by default") |
104 | 104 | ) |
105 | 105 | ); |
106 | -if ($user->prefs->signature!=""){ |
|
106 | +if ($user->prefs->signature != "") { |
|
107 | 107 | row2(tra("Signature preview"). |
108 | 108 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
109 | 109 | output_transform($user->prefs->signature) |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | |
113 | 113 | // ------------ Message display ----------- |
114 | 114 | |
115 | -$forum_hide_avatars = $user->prefs->hide_avatars?"checked=\"checked\"":""; |
|
116 | -$forum_hide_signatures = $user->prefs->hide_signatures?"checked=\"checked\"":""; |
|
117 | -$forum_link_popup = $user->prefs->link_popup?"checked=\"checked\"":""; |
|
118 | -$forum_image_as_link = $user->prefs->images_as_links?"checked=\"checked\"":""; |
|
119 | -$forum_jump_to_unread = $user->prefs->jump_to_unread?"checked=\"checked\"":""; |
|
120 | -$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts?"checked=\"checked\"":""; |
|
121 | -$forum_highlight_special = $user->prefs->highlight_special?"checked=\"checked\"":""; |
|
115 | +$forum_hide_avatars = $user->prefs->hide_avatars ? "checked=\"checked\"" : ""; |
|
116 | +$forum_hide_signatures = $user->prefs->hide_signatures ? "checked=\"checked\"" : ""; |
|
117 | +$forum_link_popup = $user->prefs->link_popup ? "checked=\"checked\"" : ""; |
|
118 | +$forum_image_as_link = $user->prefs->images_as_links ? "checked=\"checked\"" : ""; |
|
119 | +$forum_jump_to_unread = $user->prefs->jump_to_unread ? "checked=\"checked\"" : ""; |
|
120 | +$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts ? "checked=\"checked\"" : ""; |
|
121 | +$forum_highlight_special = $user->prefs->highlight_special ? "checked=\"checked\"" : ""; |
|
122 | 122 | |
123 | 123 | $forum_minimum_wrap_postcount = intval($user->prefs->minimum_wrap_postcount); |
124 | 124 | $forum_display_wrap_postcount = intval($user->prefs->display_wrap_postcount); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | <input class="btn btn-default" type="submit" name="remove%d" value="%s"> |
165 | 165 | <br> |
166 | 166 | ', |
167 | - UNIQUE_USER_NAME?'':"$blocked_user->id -", |
|
167 | + UNIQUE_USER_NAME ? '' : "$blocked_user->id -", |
|
168 | 168 | user_links($blocked_user), |
169 | 169 | $blocked_user->id, |
170 | 170 | tra("Unblock") |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | tra("Blocked users"), |
179 | 179 | tra('Ignore message board posts and private messages from these users.') |
180 | 180 | ), |
181 | - $blocked_str?$blocked_str:'---' |
|
181 | + $blocked_str ? $blocked_str : '---' |
|
182 | 182 | ); |
183 | 183 | row2( |
184 | 184 | tra('Block user'), |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | <input type="text" name="forum_filter_user" size=12> |
189 | 189 | <input class="btn btn-default" type="submit" name="add_user_to_filter" value="%s"> |
190 | 190 | ', |
191 | - UNIQUE_USER_NAME?tra('User name'):tra('User ID (For instance: 123456789)'), |
|
191 | + UNIQUE_USER_NAME ?tra('User name') : tra('User ID (For instance: 123456789)'), |
|
192 | 192 | tra("Block") |
193 | 193 | ) |
194 | 194 | ); |
@@ -206,5 +206,5 @@ discard block |
||
206 | 206 | end_table(); |
207 | 207 | page_tail(); |
208 | 208 | |
209 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
209 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
210 | 210 | ?> |
@@ -53,8 +53,9 @@ discard block |
||
53 | 53 | // ------------ Forum identity ----------- |
54 | 54 | |
55 | 55 | $select_0 = $select_1 = $select_2 = ""; |
56 | -if (strlen($user->prefs->avatar)){ |
|
57 | - if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar |
|
56 | +if (strlen($user->prefs->avatar)) { |
|
57 | + if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { |
|
58 | +// Gravatar |
|
58 | 59 | $select_1 = "checked=\"true\""; |
59 | 60 | } else { |
60 | 61 | $select_2 = "checked=\"true\""; |
@@ -73,7 +74,7 @@ discard block |
||
73 | 74 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
74 | 75 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
75 | 76 | ); |
76 | -if (strlen($user->prefs->avatar)){ |
|
77 | +if (strlen($user->prefs->avatar)) { |
|
77 | 78 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
78 | 79 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
79 | 80 | } |
@@ -103,7 +104,7 @@ discard block |
||
103 | 104 | tra("Attach signature by default") |
104 | 105 | ) |
105 | 106 | ); |
106 | -if ($user->prefs->signature!=""){ |
|
107 | +if ($user->prefs->signature!="") { |
|
107 | 108 | row2(tra("Signature preview"). |
108 | 109 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
109 | 110 | output_transform($user->prefs->signature) |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | if ($offset === false) $offset = 0; |
85 | 85 | if ($offset >= $nmsgs) $offset = 0; |
86 | 86 | echo sprintf('Showing messages %d to %d of %d', |
87 | - $offset+1, |
|
88 | - min($offset+$nshow, $nmsgs), |
|
87 | + $offset + 1, |
|
88 | + min($offset + $nshow, $nmsgs), |
|
89 | 89 | $nmsgs |
90 | 90 | ); |
91 | 91 | if ($offset) { |
92 | 92 | echo sprintf( |
93 | 93 | ' · <a href=pm.php?action=inbox&offset=%d>Previous %d</a>', |
94 | - max(0, $offset-$nshow), $nshow |
|
94 | + max(0, $offset - $nshow), $nshow |
|
95 | 95 | ); |
96 | 96 | } |
97 | - if ($offset+$nshow < $nmsgs) { |
|
97 | + if ($offset + $nshow < $nmsgs) { |
|
98 | 98 | echo sprintf( |
99 | 99 | ' · <a href=pm.php?action=inbox&offset=%d>Next %d</a>', |
100 | - $offset+$nshow, $nshow |
|
100 | + $offset + $nshow, $nshow |
|
101 | 101 | ); |
102 | 102 | } |
103 | 103 | } |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | array('style="width: 12em;"', 'style="width: 10em;"', "") |
113 | 113 | ); |
114 | 114 | $i = 0; |
115 | - foreach($msgs as $msg) { |
|
116 | - if ($i<$offset) { |
|
115 | + foreach ($msgs as $msg) { |
|
116 | + if ($i < $offset) { |
|
117 | 117 | $i++; |
118 | 118 | continue; |
119 | 119 | } |
120 | - if ($i>=$offset+$nshow) break; |
|
120 | + if ($i >= $offset + $nshow) break; |
|
121 | 121 | $i++; |
122 | 122 | $sender = BoincUser::lookup_id($msg->senderid); |
123 | 123 | if (!$sender) { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $msgs = BoincPrivateMessage::enum( |
366 | 366 | "userid=$logged_in_user->id" |
367 | 367 | ); |
368 | - foreach($msgs as $msg) { |
|
368 | + foreach ($msgs as $msg) { |
|
369 | 369 | $x = "pm_select_$msg->id"; |
370 | 370 | if (post_str($x, true)) { |
371 | 371 | $msg = BoincPrivateMessage::lookup_id($msg->id); |
@@ -420,5 +420,5 @@ discard block |
||
420 | 420 | error_page(tra("Unknown action")); |
421 | 421 | } |
422 | 422 | |
423 | -$cvs_version_tracker[]="\$Id: pm.php 14077 2007-11-03 04:26:47Z davea $"; |
|
423 | +$cvs_version_tracker[] = "\$Id: pm.php 14077 2007-11-03 04:26:47Z davea $"; |
|
424 | 424 | ?> |
@@ -285,7 +285,8 @@ discard block |
||
285 | 285 | // (PM reply fills in the latter) |
286 | 286 | // |
287 | 287 | $x = explode(' ', $username); |
288 | - if (is_numeric($x[0])) { // user ID |
|
288 | + if (is_numeric($x[0])) { |
|
289 | +// user ID |
|
289 | 290 | $userid = (int)$x[0]; |
290 | 291 | $user = BoincUser::lookup_id($userid); |
291 | 292 | if ($user == null) { |
@@ -303,7 +304,8 @@ discard block |
||
303 | 304 | tra("Could not find user with username %1", $username) |
304 | 305 | ); |
305 | 306 | return; |
306 | - } elseif (count($users) > 1) { // Non-unique username |
|
307 | + } elseif (count($users) > 1) { |
|
308 | +// Non-unique username |
|
307 | 309 | pm_form_page( |
308 | 310 | $replyto, $userid, |
309 | 311 | tra("%1 is not a unique username; you will have to use user ID", $username) |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | foreach ($files as $file) { |
62 | 62 | $path = "$dir/$file"; |
63 | 63 | [$err, $file_size, $file_md5] = sandbox_parse_link_file($path); |
64 | - if (!$err){ |
|
64 | + if (!$err) { |
|
65 | 65 | if (strcmp($md5, $file_md5) == 0) { |
66 | 66 | $exist = true; |
67 | 67 | $elf = $file; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | $files = sandbox_file_names($user); |
126 | 126 | foreach ($files as $f) { |
127 | - if ($regexp && !preg_match("/$regexp/",$f)) continue; |
|
127 | + if ($regexp && !preg_match("/$regexp/", $f)) continue; |
|
128 | 128 | $x .= "<option value=\"$f\">$f</option>\n"; |
129 | 129 | } |
130 | 130 | $x .= "</select>\n"; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // TODO: this is a kludge. |
155 | 155 | // Should we use the job_file and batch_file_assoc tables instead? |
156 | 156 | // |
157 | -function sandbox_file_in_use($user, $file){ |
|
157 | +function sandbox_file_in_use($user, $file) { |
|
158 | 158 | $ufiles = array(); |
159 | 159 | |
160 | 160 | $pbatches = BoincBatch::enum( |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | ); |
165 | 165 | if (!$pbatches) return false; |
166 | 166 | |
167 | - foreach ($pbatches as $batch){ |
|
168 | - $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
|
169 | - if ($wus == null){ |
|
167 | + foreach ($pbatches as $batch) { |
|
168 | + $wus = BoincWorkUnit::enum("batch = $batch->id limit 1"); |
|
169 | + if ($wus == null) { |
|
170 | 170 | continue; |
171 | 171 | } |
172 | - foreach($wus as $wu){ |
|
172 | + foreach ($wus as $wu) { |
|
173 | 173 | $x = "<in>".$wu->xml_doc."</in>"; |
174 | 174 | $x = simplexml_load_string($x); |
175 | 175 | global $fanout; |
176 | - foreach($x->workunit->file_ref as $fr){ |
|
176 | + foreach ($x->workunit->file_ref as $fr) { |
|
177 | 177 | $pname = (string)$fr->file_name; |
178 | 178 | $ufiles[] = $pname; |
179 | 179 | } |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | $dir = sandbox_dir($user); |
183 | 183 | $path = $dir."/".$file; |
184 | 184 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
185 | - if (!$err){ |
|
185 | + if (!$err) { |
|
186 | 186 | $f = sandbox_file_name($user, $md5); |
187 | - foreach($ufiles as $uf) { |
|
188 | - if (strcmp($f,$uf) == 0){ |
|
187 | + foreach ($ufiles as $uf) { |
|
188 | + if (strcmp($f, $uf) == 0) { |
|
189 | 189 | return true; |
190 | 190 | } |
191 | 191 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | foreach ($files as $file) { |
62 | 62 | $path = "$dir/$file"; |
63 | 63 | [$err, $file_size, $file_md5] = sandbox_parse_link_file($path); |
64 | - if (!$err){ |
|
64 | + if (!$err) { |
|
65 | 65 | if (strcmp($md5, $file_md5) == 0) { |
66 | 66 | $exist = true; |
67 | 67 | $elf = $file; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // TODO: this is a kludge. |
155 | 155 | // Should we use the job_file and batch_file_assoc tables instead? |
156 | 156 | // |
157 | -function sandbox_file_in_use($user, $file){ |
|
157 | +function sandbox_file_in_use($user, $file) { |
|
158 | 158 | $ufiles = array(); |
159 | 159 | |
160 | 160 | $pbatches = BoincBatch::enum( |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | ); |
165 | 165 | if (!$pbatches) return false; |
166 | 166 | |
167 | - foreach ($pbatches as $batch){ |
|
167 | + foreach ($pbatches as $batch) { |
|
168 | 168 | $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
169 | - if ($wus == null){ |
|
169 | + if ($wus == null) { |
|
170 | 170 | continue; |
171 | 171 | } |
172 | - foreach($wus as $wu){ |
|
172 | + foreach($wus as $wu) { |
|
173 | 173 | $x = "<in>".$wu->xml_doc."</in>"; |
174 | 174 | $x = simplexml_load_string($x); |
175 | 175 | global $fanout; |
176 | - foreach($x->workunit->file_ref as $fr){ |
|
176 | + foreach($x->workunit->file_ref as $fr) { |
|
177 | 177 | $pname = (string)$fr->file_name; |
178 | 178 | $ufiles[] = $pname; |
179 | 179 | } |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | $dir = sandbox_dir($user); |
183 | 183 | $path = $dir."/".$file; |
184 | 184 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
185 | - if (!$err){ |
|
185 | + if (!$err) { |
|
186 | 186 | $f = sandbox_file_name($user, $md5); |
187 | 187 | foreach($ufiles as $uf) { |
188 | - if (strcmp($f,$uf) == 0){ |
|
188 | + if (strcmp($f,$uf) == 0) { |
|
189 | 189 | return true; |
190 | 190 | } |
191 | 191 | } |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | // prefix for links; needed for pages not in top dir |
142 | 142 | $user, |
143 | 143 | // logged-in user, if any |
144 | - $fixed=false, |
|
144 | + $fixed = false, |
|
145 | 145 | // if true, navbar is fixed at top of page. |
146 | 146 | // NOTE: if you do this, you must set a global var $fixed_navbar |
147 | 147 | // to true at compile time |
148 | 148 | // (it needs to be set when page_head() is called). |
149 | - $inverse=false |
|
149 | + $inverse = false |
|
150 | 150 | // white on black? |
151 | 151 | ) { |
152 | 152 | global $master_url; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | // output a panel. |
216 | 216 | // $content_func is a function that generates the panel contents |
217 | 217 | // |
218 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
218 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
219 | 219 | echo sprintf('<div class="panel %s"> |
220 | 220 | ', $class |
221 | 221 | ); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | // $left_width is the width of left column in 1/12 units. |
243 | 243 | // $arg is passed to the functions. |
244 | 244 | // |
245 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { |
|
245 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { |
|
246 | 246 | echo ' |
247 | 247 | <div class="container-fluid"> |
248 | 248 | '; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | </div> |
258 | 258 | '; |
259 | 259 | } |
260 | - $right_width = 12-$left_width; |
|
260 | + $right_width = 12 - $left_width; |
|
261 | 261 | echo ' |
262 | 262 | <div class="row"> |
263 | 263 | <div class="col-sm-'.$left_width.'"> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | // use extra = "name=x" |
282 | 282 | // call forum_focus(x, foo) after defining the field |
283 | 283 | // |
284 | -function form_start($action, $method='get', $extra='') { |
|
284 | +function form_start($action, $method = 'get', $extra = '') { |
|
285 | 285 | echo sprintf( |
286 | 286 | '<div class="container-fluid"> |
287 | 287 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | // just the input field |
314 | 314 | // |
315 | 315 | function form_input_text_field( |
316 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
316 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
317 | 317 | ) { |
318 | 318 | return sprintf( |
319 | 319 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | // the whole row |
325 | 325 | // |
326 | 326 | function form_input_text( |
327 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
327 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
328 | 328 | ) { |
329 | 329 | echo sprintf(' |
330 | 330 | <div class="form-group"> |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | ); |
353 | 353 | } |
354 | 354 | |
355 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
355 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
356 | 356 | echo sprintf(' |
357 | 357 | <div class="form-group"> |
358 | 358 | <label align=right class="%s" for="%s">%s</label> |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | // $items is either a string of <option> elements, or an array |
370 | 370 | // |
371 | -function form_select($label, $name, $items, $selected=null) { |
|
371 | +function form_select($label, $name, $items, $selected = null) { |
|
372 | 372 | echo sprintf(' |
373 | 373 | <div class="form-group"> |
374 | 374 | <label align=right class="%s" for="%s">%s</label> |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | foreach ($items as $i) { |
382 | 382 | echo sprintf( |
383 | 383 | '<option %s value=%s>%s</option>', |
384 | - ($i[0]==$selected)?'selected':'', |
|
384 | + ($i[0] == $selected) ? 'selected' : '', |
|
385 | 385 | $i[0], $i[1] |
386 | 386 | ); |
387 | 387 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | // same, for multiple select. |
395 | 395 | // $selected, if non-null, is a list of selected values |
396 | 396 | // |
397 | -function form_select_multiple($label, $name, $items, $selected=null) { |
|
397 | +function form_select_multiple($label, $name, $items, $selected = null) { |
|
398 | 398 | echo sprintf(' |
399 | 399 | <div class="form-group"> |
400 | 400 | <label align=right class="%s" for="%s">%s</label> |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | foreach ($items as $i) { |
407 | 407 | echo sprintf( |
408 | 408 | '<option %s value=%s>%s</option>', |
409 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
409 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
410 | 410 | $i[0], $i[1] |
411 | 411 | ); |
412 | 412 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | |
416 | 416 | // return a list of string for checkbox items |
417 | 417 | // |
418 | -function checkbox_item_strings($items, $attrs='') { |
|
418 | +function checkbox_item_strings($items, $attrs = '') { |
|
419 | 419 | $x = []; |
420 | 420 | foreach ($items as $i) { |
421 | 421 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
422 | 422 | ', |
423 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
423 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
424 | 424 | ); |
425 | 425 | } |
426 | 426 | return $x; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | // $items is list of (name, label, checked) |
430 | 430 | // |
431 | -function form_checkboxes($label, $items, $attrs='') { |
|
431 | +function form_checkboxes($label, $items, $attrs = '') { |
|
432 | 432 | echo sprintf(' |
433 | 433 | <div class="form-group"> |
434 | 434 | <label align=right class="%s">%s</label> |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
455 | 455 | ); |
456 | 456 | foreach ($items as $i) { |
457 | - $checked = ($selected == $i[0])?"checked":""; |
|
457 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
458 | 458 | echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br> |
459 | 459 | ', |
460 | 460 | $name, $i[0], $checked, $i[1] |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | '; |
488 | 488 | } |
489 | 489 | |
490 | -function form_submit($text, $attrs='') { |
|
490 | +function form_submit($text, $attrs = '') { |
|
491 | 491 | form_general( |
492 | 492 | "", |
493 | 493 | sprintf( |
@@ -497,11 +497,11 @@ discard block |
||
497 | 497 | ); |
498 | 498 | } |
499 | 499 | |
500 | -function form_checkbox($label, $name, $checked=false) { |
|
500 | +function form_checkbox($label, $name, $checked = false) { |
|
501 | 501 | echo sprintf(' |
502 | 502 | <div class="form-group"> |
503 | 503 | <input type="checkbox" name="%s" %s> <span class="lead">%s</span> |
504 | 504 | </div> |
505 | - ', $name, $checked?"checked":"", $label |
|
505 | + ', $name, $checked ? "checked" : "", $label |
|
506 | 506 | ); |
507 | 507 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return $x; |
50 | 50 | } |
51 | 51 | |
52 | -function pm_team_form($user, $teamid, $error=null) { |
|
52 | +function pm_team_form($user, $teamid, $error = null) { |
|
53 | 53 | global $bbcode_html, $bbcode_js; |
54 | 54 | $team = BoincTeam::lookup_id($teamid); |
55 | 55 | if (!$team) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | error_page("not admin"); |
60 | 60 | } |
61 | 61 | |
62 | - page_head(tra("Send message to team"),'','','', $bbcode_js); |
|
62 | + page_head(tra("Send message to team"), '', '', '', $bbcode_js); |
|
63 | 63 | |
64 | 64 | $subject = post_str("subject", true); |
65 | 65 | $content = post_str("content", true); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | function pm_form_page($replyto, $userid, $error = null) { |
112 | 112 | global $bbcode_html, $bbcode_js; |
113 | 113 | global $g_logged_in_user; |
114 | - page_head(tra("Send private message"),'','','', $bbcode_js); |
|
114 | + page_head(tra("Send private message"), '', '', '', $bbcode_js); |
|
115 | 115 | |
116 | 116 | if (post_str("preview", true) == tra("Preview")) { |
117 | 117 | $content = post_str("content", true); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | if (!$user) { |
136 | 136 | error_page("Sender no longer exists"); |
137 | 137 | } |
138 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
138 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
139 | 139 | $subject = $message->subject; |
140 | 140 | if (substr($subject, 0, 3) != "re:") { |
141 | 141 | $subject = "re: ".$subject; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if (!$user) { |
146 | 146 | error_page("Sender no longer exists"); |
147 | 147 | } |
148 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
148 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
149 | 149 | } else { |
150 | 150 | $writeto = sanitize_tags(post_str("to", true)); |
151 | 151 | $subject = post_str("subject", true); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | function send_pm_notification_email( |
201 | 201 | $logged_in_user, $to_user, $subject, $content |
202 | 202 | ) { |
203 | - $message = " |
|
203 | + $message = " |
|
204 | 204 | You have received a new private message at ".PROJECT.". |
205 | 205 | |
206 | 206 | From: $logged_in_user->name (ID $logged_in_user->id) |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $pm = BoincPrivateMessage::lookup_id($notify->opaque); |
231 | 231 | $from_user = BoincUser::lookup_id($pm->senderid); |
232 | 232 | if (!$pm || !$from_user) return null; |
233 | - return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject"; |
|
233 | + return "<a href=pm.php>".tra("Private message%1 from %2, subject:", "</a>", $from_user->name)." $pm->subject"; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) { |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | |
295 | 295 | function pm_email_remind($user) { |
296 | 296 | if (!$user->prefs->pm_notification) { |
297 | - return "<br><small>" . |
|
297 | + return "<br><small>". |
|
298 | 298 | tra( |
299 | 299 | "For email notification, %1 edit community prefs %2", |
300 | 300 | '<a href="edit_forum_preferences_form.php">', '</a>' |
301 | - ) . |
|
301 | + ). |
|
302 | 302 | "</small>" |
303 | 303 | ; |
304 | 304 | } |
@@ -324,5 +324,5 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | -$cvs_version_tracker[]="\$Id: pm.inc 14019 2007-11-01 23:04:39Z davea $"; |
|
327 | +$cvs_version_tracker[] = "\$Id: pm.inc 14019 2007-11-01 23:04:39Z davea $"; |
|
328 | 328 | ?> |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | require_once('../inc/forum.inc'); |
24 | 24 | require_once('../inc/pm.inc'); |
25 | 25 | |
26 | -function forum_page($forum, $user, $msg=null) { |
|
26 | +function forum_page($forum, $user, $msg = null) { |
|
27 | 27 | global $forum_sort_styles; |
28 | 28 | $sort_style = get_int("sort", true); |
29 | 29 | $start = get_int("start", true); |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | |
47 | 47 | if (!$sort_style) { |
48 | 48 | // get the sort style either from the logged in user or a cookie |
49 | - if ($user){ |
|
49 | + if ($user) { |
|
50 | 50 | $sort_style = $user->prefs->forum_sorting; |
51 | 51 | } else { |
52 | 52 | list($sort_style, $thread_style) = parse_forum_cookie(); |
53 | 53 | } |
54 | 54 | } else { |
55 | 55 | // set the sort style |
56 | - if ($user){ |
|
56 | + if ($user) { |
|
57 | 57 | $user->prefs->forum_sorting = $sort_style; |
58 | 58 | $user->prefs->update("forum_sorting=$sort_style"); |
59 | 59 | } else { |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | echo "<td><a href=\"forum_thread.php?id=$thread->id\">$title</a><br></td>"; |
243 | 243 | |
244 | 244 | echo ' |
245 | - <td>'.($thread->replies+1).'</td> |
|
245 | + <td>'.($thread->replies + 1).'</td> |
|
246 | 246 | <td>'.user_links($owner, BADGE_HEIGHT_SMALL).'</td> |
247 | 247 | <td>'.$thread->views.'</td> |
248 | 248 | <td>'.time_diff_str($thread->timestamp, time()).'</td> |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | flush(); |
252 | 252 | } |
253 | 253 | end_table(); |
254 | - echo "<br>$page_nav"; // show page links |
|
254 | + echo "<br>$page_nav"; // show page links |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | $id = get_int("id"); |
@@ -46,14 +46,14 @@ |
||
46 | 46 | |
47 | 47 | if (!$sort_style) { |
48 | 48 | // get the sort style either from the logged in user or a cookie |
49 | - if ($user){ |
|
49 | + if ($user) { |
|
50 | 50 | $sort_style = $user->prefs->forum_sorting; |
51 | 51 | } else { |
52 | 52 | list($sort_style, $thread_style) = parse_forum_cookie(); |
53 | 53 | } |
54 | 54 | } else { |
55 | 55 | // set the sort style |
56 | - if ($user){ |
|
56 | + if ($user) { |
|
57 | 57 | $user->prefs->forum_sorting = $sort_style; |
58 | 58 | $user->prefs->update("forum_sorting=$sort_style"); |
59 | 59 | } else { |
@@ -70,7 +70,7 @@ |
||
70 | 70 | page_head(sprintf("%s '%s'", tra("Forum"), $forum->title)); |
71 | 71 | if ($msg) echo "<p>$msg</p>\n"; |
72 | 72 | show_forum_header($user); |
73 | - echo forum_title($category, $forum, NULL); |
|
73 | + echo forum_title($category, $forum, null); |
|
74 | 74 | break; |
75 | 75 | case 1: |
76 | 76 | $team = BoincTeam::lookup_id($forum->category); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | die("Delete this line first\n"); |
29 | 29 | |
30 | 30 | if (is_numeric($argv[1])) { |
31 | - $user = BoincUser::lookup_id((int) $argv[1]); |
|
31 | + $user = BoincUser::lookup_id((int)$argv[1]); |
|
32 | 32 | if (!$user) die("no such user\n"); |
33 | 33 | $retval = delete_account($user); |
34 | 34 | if ($retval) { |
@@ -43,7 +43,7 @@ |
||
43 | 43 | if ($retval) { |
44 | 44 | echo "Failed to delete user: $retval\n"; |
45 | 45 | } else { |
46 | - echo "User $user->id deleted\n"; |
|
46 | + echo "user $user->id deleted\n"; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | // send an email, using PHPMailer or not. |
28 | 28 | // |
29 | -function send_email($user, $subject, $body, $body_html=null, $email_addr=null) { |
|
29 | +function send_email($user, $subject, $body, $body_html = null, $email_addr = null) { |
|
30 | 30 | if (!$email_addr) { |
31 | 31 | $email_addr = $user->email_addr; |
32 | 32 | } |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | return true; |
70 | 70 | } |
71 | 71 | } else { |
72 | - $headers =""; |
|
72 | + $headers = ""; |
|
73 | 73 | if (defined('EMAIL_FROM') && defined('EMAIL_FROM_NAME')) { |
74 | 74 | $headers = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM.">"; |
75 | 75 | } else if (defined('EMAIL_FROM')) { |
76 | - $headers = "From: ". EMAIL_FROM; |
|
76 | + $headers = "From: ".EMAIL_FROM; |
|
77 | 77 | } |
78 | 78 | if ($body_html) { |
79 | 79 | $body = "<html><body>\n"; |
80 | 80 | $body .= $body_html; |
81 | 81 | $body .= "\n</body></html>\n"; |
82 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
82 | + $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
83 | 83 | } |
84 | 84 | return mail($email_addr, $subject, $body, $headers); |
85 | 85 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | // otherwise check both IP and email |
161 | 161 | if ($ip && filter_var( |
162 | 162 | $ip, FILTER_VALIDATE_IP, |
163 | - FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE |
|
163 | + FILTER_FLAG_NO_PRIV_RANGE|FILTER_FLAG_NO_RES_RANGE |
|
164 | 164 | )) { |
165 | 165 | $x = @file_get_contents("https://www.stopforumspam.com/api?ip=".$ip."&email=".$addr); |
166 | 166 | } else { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | return md5($key.'oogabooga'); |
206 | 206 | } |
207 | 207 | |
208 | -function opt_out_url($user, $page="opt_out.php") { |
|
208 | +function opt_out_url($user, $page = "opt_out.php") { |
|
209 | 209 | return sprintf("%s%s?code=%s&userid=%d", |
210 | 210 | secure_url_base(), |
211 | 211 | $page, |