@@ -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, |
@@ -79,7 +79,7 @@ |
||
79 | 79 | if ($first) { |
80 | 80 | $first = false; |
81 | 81 | echo "<p>"; |
82 | - echo forum_title($category, NULL, NULL); |
|
82 | + echo forum_title($category, null, null); |
|
83 | 83 | echo "<p>"; |
84 | 84 | show_mark_as_read_button($user); |
85 | 85 | start_table('table-striped'); |
@@ -69,7 +69,7 @@ |
||
69 | 69 | project_forum_index_intro(); |
70 | 70 | } |
71 | 71 | |
72 | - if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE){ |
|
72 | + if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE) { |
|
73 | 73 | $categories = BoincCategory::enum("true order by orderID"); |
74 | 74 | } else { |
75 | 75 | echo "<p>" |
@@ -58,7 +58,7 @@ |
||
58 | 58 | project_forum_index_intro(); |
59 | 59 | } |
60 | 60 | |
61 | - if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE){ |
|
61 | + if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE) { |
|
62 | 62 | $categories = BoincCategory::enum("true order by orderID"); |
63 | 63 | } else { |
64 | 64 | echo "<p>" |
@@ -7,7 +7,7 @@ |
||
7 | 7 | // add other criteria like # of countries (based on IP addr) |
8 | 8 | // consider only hosts with recent last RPC time |
9 | 9 | |
10 | -define ('MAX_HOSTS', 100); |
|
10 | +define('MAX_HOSTS', 100); |
|
11 | 11 | |
12 | 12 | require_once('../inc/boinc_db.inc'); |
13 | 13 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $parent_post_id = 0; |
57 | 57 | } |
58 | 58 | |
59 | -if ($filter != "false"){ |
|
59 | +if ($filter != "false") { |
|
60 | 60 | $filter = true; |
61 | 61 | } else { |
62 | 62 | $filter = false; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | $warning = null; |
74 | -if ($content && (!$preview)){ |
|
74 | +if ($content && (!$preview)) { |
|
75 | 75 | check_tokens($logged_in_user->authenticator); |
76 | 76 | if (!akismet_check($logged_in_user, $content)) { |
77 | 77 | $warning = tra("Your post has been flagged as spam by the Akismet anti-spam system. Please modify your text and try again."); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $parent_post_id = 0; |
57 | 57 | } |
58 | 58 | |
59 | -if ($filter != "false"){ |
|
59 | +if ($filter != "false") { |
|
60 | 60 | $filter = true; |
61 | 61 | } else { |
62 | 62 | $filter = false; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | $warning = null; |
74 | -if ($content && (!$preview)){ |
|
74 | +if ($content && (!$preview)) { |
|
75 | 75 | check_tokens($logged_in_user->authenticator); |
76 | 76 | if (!akismet_check($logged_in_user, $content)) { |
77 | 77 | $warning = tra("Your post has been flagged as spam by the Akismet anti-spam system. Please modify your text and try again."); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | -page_head(tra("Post to thread")." '$thread->title'",'','','', $bbcode_js); |
|
96 | +page_head(tra("Post to thread")." '$thread->title'", '', '', '', $bbcode_js); |
|
97 | 97 | |
98 | 98 | if ($parent_post) { |
99 | 99 | echo sprintf( |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $x2 .= " method=\"post\" name=\"post\" onsubmit=\"return checkForm(this)\">\n"; |
162 | 162 | $x2 .= form_tokens($logged_in_user->authenticator); |
163 | 163 | $x2 .= $bbcode_html."<textarea class=\"form-control\" name=\"content\" rows=\"18\">"; |
164 | - $no_quote = get_int("no_quote", true)==1; |
|
164 | + $no_quote = get_int("no_quote", true) == 1; |
|
165 | 165 | if ($preview) { |
166 | 166 | $x2 .= htmlspecialchars($content); |
167 | 167 | } else if (!$no_quote) { |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | if (!$logged_in_user->prefs->no_signature_by_default) { |
173 | - $enable_signature='checked="true"'; |
|
173 | + $enable_signature = 'checked="true"'; |
|
174 | 174 | } else { |
175 | - $enable_signature=""; |
|
175 | + $enable_signature = ""; |
|
176 | 176 | } |
177 | 177 | $x2 .= sprintf('</textarea><p> </p> |
178 | 178 | <input class="btn btn-sm" %s type="submit" name="preview" value="%s"> |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | return sprintf( |
201 | 201 | 'In reply to %s\'s message of %s: |
202 | 202 | [quote]%s[/quote]', |
203 | - $user?$user->name:'unknown user', |
|
203 | + $user ? $user->name : 'unknown user', |
|
204 | 204 | date_str($post->timestamp), |
205 | 205 | htmlspecialchars($post->content) |
206 | 206 | ); |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | if ($forum->parent_type == 1) { |
92 | 92 | // post to team msg board |
93 | 93 | if ($forum->category == $teamid) { |
94 | - if ($thread->hidden && !$show_team_hidden) { |
|
95 | - continue; |
|
96 | - } |
|
94 | + if ($thread->hidden && !$show_team_hidden) { |
|
95 | + continue; |
|
96 | + } |
|
97 | 97 | if ($post->hidden && !$show_team_hidden) { |
98 | 98 | continue; |
99 | 99 | } |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | continue; |
102 | 102 | } |
103 | 103 | } else { |
104 | - if ($thread->hidden && !$show_hidden) { |
|
105 | - continue; |
|
106 | - } |
|
104 | + if ($thread->hidden && !$show_hidden) { |
|
105 | + continue; |
|
106 | + } |
|
107 | 107 | if ($post->hidden && !$show_hidden) { |
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
112 | - if ($n == $offset + $items_per_page) { |
|
113 | - $show_next = true; |
|
114 | - break; |
|
115 | - } |
|
112 | + if ($n == $offset + $items_per_page) { |
|
113 | + $show_next = true; |
|
114 | + break; |
|
115 | + } |
|
116 | 116 | if ($n >= $offset) { |
117 | 117 | show_post_and_context($post, $thread, $forum, $options, $n+1); |
118 | 118 | } |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | end_table(); |
122 | 122 | |
123 | 123 | if ($offset) { |
124 | - $x = $offset - $items_per_page; |
|
124 | + $x = $offset - $items_per_page; |
|
125 | 125 | echo "<a href=forum_user_posts.php?userid=$userid&offset=$x> |
126 | 126 | <b>".tra("Previous %1", $items_per_page)."</b> |
127 | 127 | </a> |
128 | 128 | "; |
129 | - if ($show_next) echo " · "; |
|
129 | + if ($show_next) echo " · "; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | if ($show_next) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $user = BoincUser::lookup_id($userid); |
30 | 30 | if (!$user) error_page('no such user'); |
31 | 31 | $offset = get_int("offset", true); |
32 | -if (!$offset) $offset=0; |
|
32 | +if (!$offset) $offset = 0; |
|
33 | 33 | $items_per_page = 20; |
34 | 34 | |
35 | 35 | $logged_in_user = get_logged_in_user(false); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | break; |
115 | 115 | } |
116 | 116 | if ($n >= $offset) { |
117 | - show_post_and_context($post, $thread, $forum, $options, $n+1); |
|
117 | + show_post_and_context($post, $thread, $forum, $options, $n + 1); |
|
118 | 118 | } |
119 | 119 | $n++; |
120 | 120 | } |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | $preview = post_str("preview", true); |
57 | 57 | $warning = null; |
58 | 58 | |
59 | -if ($content && $title && (!$preview)){ |
|
59 | +if ($content && $title && (!$preview)) { |
|
60 | 60 | if (post_str('add_signature', true)) { |
61 | 61 | $add_signature = true; // set a flag and concatenate later |
62 | - } else { |
|
62 | + } else { |
|
63 | 63 | $add_signature = false; |
64 | 64 | } |
65 | 65 | check_tokens($logged_in_user->authenticator); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>"; |
123 | 123 | } |
124 | 124 | |
125 | -if ($force_title && $title){ |
|
125 | +if ($force_title && $title) { |
|
126 | 126 | row2( |
127 | 127 | tra("Title"), |
128 | 128 | sprintf( |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | error_page("Forums are disabled"); |
44 | 44 | } |
45 | 45 | |
46 | -if (user_can_create_thread($logged_in_user, $forum)=='no') { |
|
46 | +if (user_can_create_thread($logged_in_user, $forum) == 'no') { |
|
47 | 47 | error_page(tra("Only project admins may create a thread here. However, you may reply to existing threads.")); |
48 | 48 | } |
49 | 49 | check_post_access($logged_in_user, $forum); |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | $preview = post_str("preview", true); |
57 | 57 | $warning = null; |
58 | 58 | |
59 | -if ($content && $title && (!$preview)){ |
|
59 | +if ($content && $title && (!$preview)) { |
|
60 | 60 | if (post_str('add_signature', true)) { |
61 | - $add_signature = true; // set a flag and concatenate later |
|
62 | - } else { |
|
61 | + $add_signature = true; // set a flag and concatenate later |
|
62 | + } else { |
|
63 | 63 | $add_signature = false; |
64 | 64 | } |
65 | 65 | check_tokens($logged_in_user->authenticator); |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | if (post_str('subscribe', true)) { |
75 | 75 | BoincSubscription::replace($logged_in_user->id, $thread->id); |
76 | 76 | } |
77 | - header('Location: forum_thread.php?id=' . $thread->id); |
|
77 | + header('Location: forum_thread.php?id='.$thread->id); |
|
78 | 78 | } else { |
79 | 79 | error_page("Can't create thread. $forum_error"); |
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | -page_head(tra("Create new thread"),'','','', $bbcode_js); |
|
84 | +page_head(tra("Create new thread"), '', '', '', $bbcode_js); |
|
85 | 85 | show_forum_header($logged_in_user); |
86 | 86 | |
87 | 87 | if ($warning) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>"; |
123 | 123 | } |
124 | 124 | |
125 | -if ($force_title && $title){ |
|
125 | +if ($force_title && $title) { |
|
126 | 126 | row2( |
127 | 127 | tra("Title"), |
128 | 128 | sprintf( |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | row2( |
137 | 137 | tra("Title").$submit_help, |
138 | 138 | sprintf('<input type="text" class="form-control" name="title" value="%s">', |
139 | - $title?htmlspecialchars($title):'' |
|
139 | + $title ?htmlspecialchars($title) : '' |
|
140 | 140 | ), |
141 | 141 | null, FORUM_LH_PCT |
142 | 142 | ); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | sprintf( |
148 | 148 | '%s <textarea class="form-control" name="content" rows="12" cols="80">%s</textarea>', |
149 | 149 | $bbcode_html, |
150 | - $content?htmlspecialchars($content):'' |
|
150 | + $content ?htmlspecialchars($content) : '' |
|
151 | 151 | ), |
152 | 152 | null, FORUM_LH_PCT |
153 | 153 | ); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | if (!$logged_in_user->prefs->no_signature_by_default) { |
156 | 156 | $enable_signature = 'checked="true"'; |
157 | 157 | } else { |
158 | - $enable_signature=''; |
|
158 | + $enable_signature = ''; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if (is_news_forum($forum)) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if ($n === false) return ''; |
34 | 34 | $m = strpos($p, ']', $n); |
35 | 35 | if ($m === false) return ''; |
36 | - $x = substr($p, $n+5, $m-$n-5); |
|
36 | + $x = substr($p, $n + 5, $m - $n - 5); |
|
37 | 37 | |
38 | 38 | $n = strpos($x, ' '); |
39 | 39 | if ($n !== false) return substr($x, 0, $n); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($n === false) return ''; |
48 | 48 | $m = strpos($p, ']', $n); |
49 | 49 | if ($m === false) return ''; |
50 | - $x = substr($p, $n+5, $m-$n-5); |
|
50 | + $x = substr($p, $n + 5, $m - $n - 5); |
|
51 | 51 | $n = strpos($x, '_'); |
52 | 52 | if ($n !== false) return substr($x, 0, $n); |
53 | 53 | $n = strpos($x, 'r'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | function main() { |
59 | 59 | global $max_days; |
60 | - $t = time()-$max_days*86400; |
|
60 | + $t = time() - $max_days*86400; |
|
61 | 61 | $hosts = BoincHost::enum("rpc_time>$t"); |
62 | 62 | $descs = []; |
63 | 63 | foreach ($hosts as $host) { |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | // Intended to be subclassed (e.g., BoincDb, BossaDb) |
23 | 23 | // |
24 | 24 | class DbConn { |
25 | - var $db_conn; // a mysqli object |
|
26 | - var $db_name; // the DB name |
|
25 | + var $db_conn; // a mysqli object |
|
26 | + var $db_name; // the DB name |
|
27 | 27 | |
28 | 28 | function init_conn($user, $passwd, $host, $name) { |
29 | 29 | $x = explode(":", $host); |
30 | - if (sizeof($x)>1) { |
|
30 | + if (sizeof($x) > 1) { |
|
31 | 31 | $host = $x[0]; |
32 | 32 | $port = $x[1]; |
33 | 33 | } else { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | try { |
37 | 37 | $this->db_conn = @new mysqli($host, $user, $passwd, $name, $port); |
38 | - } catch(Exception $e) { |
|
38 | + } catch (Exception $e) { |
|
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | if (mysqli_connect_error()) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | return $this->enum_general($classname, $query); |
137 | 137 | } |
138 | 138 | |
139 | - function enum($table, $classname, $where_clause=null, $order_clause=null) { |
|
139 | + function enum($table, $classname, $where_clause = null, $order_clause = null) { |
|
140 | 140 | return self::enum_fields( |
141 | 141 | $table, $classname, '*', $where_clause, $order_clause |
142 | 142 | ); |
@@ -181,15 +181,15 @@ discard block |
||
181 | 181 | if ($x) return (double)$x->$field; |
182 | 182 | return false; |
183 | 183 | } |
184 | - function count($table, $clause="TRUE") { |
|
184 | + function count($table, $clause = "TRUE") { |
|
185 | 185 | $query = "select count(*) as total from DBNAME.$table where $clause"; |
186 | 186 | return $this->get_int($query, 'total'); |
187 | 187 | } |
188 | - function sum($table, $field, $clause="") { |
|
188 | + function sum($table, $field, $clause = "") { |
|
189 | 189 | $query = "select sum($field) as total from DBNAME.$table $clause"; |
190 | 190 | return $this->get_double($query, 'total'); |
191 | 191 | } |
192 | - function max($table, $field, $clause="") { |
|
192 | + function max($table, $field, $clause = "") { |
|
193 | 193 | $query = "select max($field) as total from DBNAME.$table $clause"; |
194 | 194 | return $this->get_double($query, 'total'); |
195 | 195 | } |