@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // Return path of sandbox directory for the given user. |
26 | 26 | // Create dir if not present. |
27 | 27 | // |
28 | -if (!function_exists("sandbox_dir")){ |
|
28 | +if (!function_exists("sandbox_dir")) { |
|
29 | 29 | function sandbox_dir($user) { |
30 | 30 | $dir = parse_config(get_config(), "<sandbox_dir>"); |
31 | 31 | if (!$dir) { $dir = "../../sandbox/"; } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | foreach ($files as $file) { |
55 | 55 | $path = $dir."/".$file; |
56 | 56 | list($err, $file_size, $file_md5) = sandbox_parse_link_file($path); |
57 | - if (!$err){ |
|
57 | + if (!$err) { |
|
58 | 58 | if (strcmp($md5, $file_md5) == 0) { |
59 | 59 | //echo "this file with $md5 already exisits with another name $file"; |
60 | 60 | $exist = 1; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | $files = sandbox_file_names($user); |
127 | 127 | foreach ($files as $f) { |
128 | - if(preg_match("/$regexp/",$f)){ |
|
128 | + if (preg_match("/$regexp/", $f)) { |
|
129 | 129 | $x .= "<option value=\"$f\">$f</option>\n"; |
130 | 130 | } |
131 | 131 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | //check if a file is still being used by a unfinished batch |
138 | 138 | // |
139 | -function sandbox_file_in_use($user, $file){ |
|
139 | +function sandbox_file_in_use($user, $file) { |
|
140 | 140 | $ufiles = array(); |
141 | 141 | |
142 | 142 | // batch status: 2(completed), 3(aborted) |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | $pbatches = BoincBatch::enum("user_id = $user->id and state != 2 and state != 3"); |
145 | 145 | if (!$pbatches) return false; |
146 | 146 | |
147 | - foreach ($pbatches as $batch){ |
|
148 | - $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
|
149 | - if ($wus == null){ |
|
147 | + foreach ($pbatches as $batch) { |
|
148 | + $wus = BoincWorkUnit::enum("batch = $batch->id limit 1"); |
|
149 | + if ($wus == null) { |
|
150 | 150 | //echo " no workunit for this batch<br/>"; |
151 | 151 | continue; |
152 | 152 | } |
153 | - foreach($wus as $wu){ |
|
153 | + foreach ($wus as $wu) { |
|
154 | 154 | $x = "<in>".$wu->xml_doc."</in>"; |
155 | 155 | $x = simplexml_load_string($x); |
156 | 156 | global $fanout; |
157 | - foreach($x->workunit->file_ref as $fr){ |
|
157 | + foreach ($x->workunit->file_ref as $fr) { |
|
158 | 158 | $pname = (string)$fr->file_name; |
159 | 159 | $ufiles[] = $pname; |
160 | 160 | } |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | $dir = sandbox_dir($user); |
166 | 166 | $path = $dir."/".$file; |
167 | 167 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
168 | - if (!$err){ |
|
168 | + if (!$err) { |
|
169 | 169 | $f = sandbox_file_name($user, $md5); |
170 | - foreach($ufiles as $uf) { |
|
171 | - if (strcmp($f,$uf) == 0){ |
|
170 | + foreach ($ufiles as $uf) { |
|
171 | + if (strcmp($f, $uf) == 0) { |
|
172 | 172 | return true; |
173 | 173 | } |
174 | 174 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // Return path of sandbox directory for the given user. |
26 | 26 | // Create dir if not present. |
27 | 27 | // |
28 | -if (!function_exists("sandbox_dir")){ |
|
28 | +if (!function_exists("sandbox_dir")) { |
|
29 | 29 | function sandbox_dir($user) { |
30 | 30 | $dir = parse_config(get_config(), "<sandbox_dir>"); |
31 | 31 | if (!$dir) { $dir = "../../sandbox/"; } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | foreach ($files as $file) { |
55 | 55 | $path = $dir."/".$file; |
56 | 56 | list($err, $file_size, $file_md5) = sandbox_parse_link_file($path); |
57 | - if (!$err){ |
|
57 | + if (!$err) { |
|
58 | 58 | if (strcmp($md5, $file_md5) == 0) { |
59 | 59 | //echo "this file with $md5 already exisits with another name $file"; |
60 | 60 | $exist = 1; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | $files = sandbox_file_names($user); |
127 | 127 | foreach ($files as $f) { |
128 | - if(preg_match("/$regexp/",$f)){ |
|
128 | + if(preg_match("/$regexp/",$f)) { |
|
129 | 129 | $x .= "<option value=\"$f\">$f</option>\n"; |
130 | 130 | } |
131 | 131 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | //check if a file is still being used by a unfinished batch |
138 | 138 | // |
139 | -function sandbox_file_in_use($user, $file){ |
|
139 | +function sandbox_file_in_use($user, $file) { |
|
140 | 140 | $ufiles = array(); |
141 | 141 | |
142 | 142 | // batch status: 2(completed), 3(aborted) |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | $pbatches = BoincBatch::enum("user_id = $user->id and state != 2 and state != 3"); |
145 | 145 | if (!$pbatches) return false; |
146 | 146 | |
147 | - foreach ($pbatches as $batch){ |
|
147 | + foreach ($pbatches as $batch) { |
|
148 | 148 | $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
149 | - if ($wus == null){ |
|
149 | + if ($wus == null) { |
|
150 | 150 | //echo " no workunit for this batch<br/>"; |
151 | 151 | continue; |
152 | 152 | } |
153 | - foreach($wus as $wu){ |
|
153 | + foreach($wus as $wu) { |
|
154 | 154 | $x = "<in>".$wu->xml_doc."</in>"; |
155 | 155 | $x = simplexml_load_string($x); |
156 | 156 | global $fanout; |
157 | - foreach($x->workunit->file_ref as $fr){ |
|
157 | + foreach($x->workunit->file_ref as $fr) { |
|
158 | 158 | $pname = (string)$fr->file_name; |
159 | 159 | $ufiles[] = $pname; |
160 | 160 | } |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | $dir = sandbox_dir($user); |
166 | 166 | $path = $dir."/".$file; |
167 | 167 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
168 | - if (!$err){ |
|
168 | + if (!$err) { |
|
169 | 169 | $f = sandbox_file_name($user, $md5); |
170 | 170 | foreach($ufiles as $uf) { |
171 | - if (strcmp($f,$uf) == 0){ |
|
171 | + if (strcmp($f,$uf) == 0) { |
|
172 | 172 | return true; |
173 | 173 | } |
174 | 174 |
@@ -88,18 +88,18 @@ |
||
88 | 88 | $errno = 0; |
89 | 89 | $errstr = ''; |
90 | 90 | |
91 | - if (false === $this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30)) { |
|
91 | + if (false === $this->socket->fsockopen('ssl://'.self::RECAPTCHA_HOST, 443, $errno, $errstr, 30)) { |
|
92 | 92 | return self::BAD_REQUEST; |
93 | 93 | } |
94 | 94 | |
95 | 95 | $content = $params->toQueryString(); |
96 | 96 | |
97 | - $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
98 | - $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
97 | + $request = "POST ".self::SITE_VERIFY_PATH." HTTP/1.1\r\n"; |
|
98 | + $request .= "Host: ".self::RECAPTCHA_HOST."\r\n"; |
|
99 | 99 | $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
100 | - $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
100 | + $request .= "Content-length: ".strlen($content)."\r\n"; |
|
101 | 101 | $request .= "Connection: close\r\n\r\n"; |
102 | - $request .= $content . "\r\n\r\n"; |
|
102 | + $request .= $content."\r\n\r\n"; |
|
103 | 103 | |
104 | 104 | $this->socket->fwrite($request); |
105 | 105 | $response = ''; |
@@ -34,8 +34,7 @@ discard block |
||
34 | 34 | * instead of get_file_contents(). This is to account for people who may be on |
35 | 35 | * servers where allow_furl_open is disabled. |
36 | 36 | */ |
37 | -class SocketPost implements RequestMethod |
|
38 | -{ |
|
37 | +class SocketPost implements RequestMethod { |
|
39 | 38 | /** |
40 | 39 | * reCAPTCHA service host. |
41 | 40 | * @const string |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | * |
69 | 68 | * @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing |
70 | 69 | */ |
71 | - public function __construct(Socket $socket = null) |
|
72 | - { |
|
70 | + public function __construct(Socket $socket = null) { |
|
73 | 71 | if (!is_null($socket)) { |
74 | 72 | $this->socket = $socket; |
75 | 73 | } else { |
@@ -83,8 +81,7 @@ discard block |
||
83 | 81 | * @param RequestParameters $params Request parameters |
84 | 82 | * @return string Body of the reCAPTCHA response |
85 | 83 | */ |
86 | - public function submit(RequestParameters $params) |
|
87 | - { |
|
84 | + public function submit(RequestParameters $params) { |
|
88 | 85 | $errno = 0; |
89 | 86 | $errstr = ''; |
90 | 87 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | function send_friend_request_email($src_user, $dest_user, $msg) { |
53 | - $message = " |
|
53 | + $message = " |
|
54 | 54 | $src_user->name has added you as a friend at ".PROJECT.". |
55 | 55 | "; |
56 | 56 | if (strlen($msg)) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | function send_friend_accept_email($dest_user, $src_user, $msg) { |
75 | - $message = " |
|
75 | + $message = " |
|
76 | 76 | $dest_user->name has confirmed you as a friend at ".PROJECT.". |
77 | 77 | "; |
78 | 78 | if (strlen($msg)) { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | // Some of this should be merged with translation.inc |
21 | 21 | |
22 | 22 | function get_lang_list() { |
23 | - if (isset($_COOKIE['lang'])){ |
|
23 | + if (isset($_COOKIE['lang'])) { |
|
24 | 24 | $language_string = $_COOKIE['lang'].","; |
25 | 25 | } else { |
26 | 26 | $language_string = ''; |
@@ -28,28 +28,28 @@ discard block |
||
28 | 28 | if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { |
29 | 29 | $language_string .= strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"]); |
30 | 30 | } |
31 | - $client_languages = explode(",",$language_string); |
|
31 | + $client_languages = explode(",", $language_string); |
|
32 | 32 | |
33 | 33 | $lang_list = array(); |
34 | - for ($i=0; $i<sizeof($client_languages); $i++) { |
|
35 | - if ((strlen($client_languages[$i])>2) |
|
36 | - && (substr($client_languages[$i],2,1)=="_" || substr($client_languages[$i],2,1)=="-")) |
|
34 | + for ($i = 0; $i < sizeof($client_languages); $i++) { |
|
35 | + if ((strlen($client_languages[$i]) > 2) |
|
36 | + && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")) |
|
37 | 37 | { |
38 | 38 | // If this is defined as primary-secondary, represent it as xx_YY |
39 | 39 | // |
40 | 40 | $language = substr( |
41 | - $client_languages[$i],0,2)."_".strtoupper(substr($client_languages[$i],3,2) |
|
41 | + $client_languages[$i], 0, 2)."_".strtoupper(substr($client_languages[$i], 3, 2) |
|
42 | 42 | ); |
43 | 43 | $lang_list[] = $language; |
44 | 44 | |
45 | 45 | // And also check for the primary language |
46 | 46 | // |
47 | - $language = substr($client_languages[$i],0,2); |
|
47 | + $language = substr($client_languages[$i], 0, 2); |
|
48 | 48 | $lang_list[] = $language; |
49 | 49 | } else { |
50 | 50 | // else just use xx |
51 | 51 | // |
52 | - $language = substr($client_languages[$i],0,2); |
|
52 | + $language = substr($client_languages[$i], 0, 2); |
|
53 | 53 | $lang_list[] = $language; |
54 | 54 | } |
55 | 55 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | // Some of this should be merged with translation.inc |
21 | 21 | |
22 | 22 | function get_lang_list() { |
23 | - if (isset($_COOKIE['lang'])){ |
|
23 | + if (isset($_COOKIE['lang'])) { |
|
24 | 24 | $language_string = $_COOKIE['lang'].","; |
25 | 25 | } else { |
26 | 26 | $language_string = ''; |
@@ -33,8 +33,7 @@ discard block |
||
33 | 33 | $lang_list = array(); |
34 | 34 | for ($i=0; $i<sizeof($client_languages); $i++) { |
35 | 35 | if ((strlen($client_languages[$i])>2) |
36 | - && (substr($client_languages[$i],2,1)=="_" || substr($client_languages[$i],2,1)=="-")) |
|
37 | - { |
|
36 | + && (substr($client_languages[$i],2,1)=="_" || substr($client_languages[$i],2,1)=="-")) { |
|
38 | 37 | // If this is defined as primary-secondary, represent it as xx_YY |
39 | 38 | // |
40 | 39 | $language = substr( |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | $n++; |
90 | 90 | $delta = $x - $m; |
91 | 91 | $m += $delta/$n; |
92 | - $m2 += $delta*($x-$m); |
|
92 | + $m2 += $delta*($x - $m); |
|
93 | 93 | } |
94 | 94 | $mean = $m; |
95 | - $stdev = sqrt($m2/($n-1)); |
|
95 | + $stdev = sqrt($m2/($n - 1)); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // approximate the 90% confidence interval for the mean of an array |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | |
104 | 104 | // I'm too lazy to compute the t distribution |
105 | 105 | $t_90 = 1.7; |
106 | - $d = $t_90 * $stdev / sqrt($n); |
|
106 | + $d = $t_90*$stdev/sqrt($n); |
|
107 | 107 | $lo = $mean - $d; |
108 | 108 | $hi = $mean + $d; |
109 | 109 | } |
110 | 110 | |
111 | 111 | function test_stats() { |
112 | - $a = array(1,1,1,1,0,1,1,1,3, 1, 1, 1, 1); |
|
112 | + $a = array(1, 1, 1, 1, 0, 1, 1, 1, 3, 1, 1, 1, 1); |
|
113 | 113 | mean_stdev($a, $mean, $stdev); |
114 | 114 | echo "mean: $mean stdev: $stdev\n"; |
115 | 115 | conf_int_90($a, $lo, $hi); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | function compare_bar($title, $n, $width, $lo, $hi) { |
122 | 122 | $x1 = $width*$lo; |
123 | - $x2 = $width*($hi-$lo); |
|
123 | + $x2 = $width*($hi - $lo); |
|
124 | 124 | $a1 = number_format($lo*100); |
125 | 125 | $a2 = number_format($hi*100); |
126 | 126 | return " |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | function outcome_graph($x, $width) { |
154 | - $n = $x[0]+$x[1]+$x[2]; |
|
154 | + $n = $x[0] + $x[1] + $x[2]; |
|
155 | 155 | if (!$n) return empty_cell(); |
156 | 156 | $x0 = $width*$x[1]/$n; |
157 | 157 | $x1 = $width*$x[0]/$n; |
158 | 158 | $x2 = $width*$x[2]/$n; |
159 | - if ($x[1]/$n>0.05) { |
|
159 | + if ($x[1]/$n > 0.05) { |
|
160 | 160 | $t0 = number_format(100*$x[1]/$n)."%"; |
161 | 161 | } else { |
162 | 162 | $t0 = ""; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | function time_graph($t, $w) { |
186 | 186 | if ($t == 0) return "<td>---</td>"; |
187 | - $x = (log10($t)+2)*$w/4; |
|
187 | + $x = (log10($t) + 2)*$w/4; |
|
188 | 188 | $t = number_format($t, 1); |
189 | 189 | return "<td> |
190 | 190 | <table class=bolt_bar><tr> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | function score_graph($t, $w) { |
197 | 197 | if ($t == 0) return "<td>---</td>"; |
198 | 198 | $x = $t*$w; |
199 | - $y = (1-$t)*$w; |
|
199 | + $y = (1 - $t)*$w; |
|
200 | 200 | $t = number_format($t*100); |
201 | 201 | $s = "<td> |
202 | 202 | <table class=bolt_bar><tr> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $nshown = $state_rec['nshown']; |
53 | 53 | $state_rec['scores'][$nshown] = $score; |
54 | 54 | $iter->state[$this->name] = $state_rec; |
55 | - $is_last = ($nshown+1 == $this->ntoshow); |
|
55 | + $is_last = ($nshown + 1 == $this->ntoshow); |
|
56 | 56 | if (!$is_last) { |
57 | 57 | return false; |
58 | 58 | } |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | // - optionally create or update bolt_refresh record |
63 | 63 | // |
64 | 64 | $total_score = 0; |
65 | - for ($i=0; $i<$nshown+1; $i++) { |
|
65 | + for ($i = 0; $i < $nshown + 1; $i++) { |
|
66 | 66 | $total_score += $state_rec['scores'][$i]; |
67 | 67 | } |
68 | - $avg_score = $total_score/($nshown+1); |
|
68 | + $avg_score = $total_score/($nshown + 1); |
|
69 | 69 | |
70 | 70 | $repeat = null; |
71 | 71 | $least = 2; |
72 | 72 | foreach ($this->repeats as $r) { |
73 | - if ($avg_score < $r->score && $r->score<$least) { |
|
73 | + if ($avg_score < $r->score && $r->score < $least) { |
|
74 | 74 | $repeat = $r; |
75 | 75 | $least = $r->score; |
76 | 76 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | -class BoltRefresh{ |
|
137 | +class BoltRefresh { |
|
138 | 138 | public $intervals; |
139 | 139 | function __construct($i) { |
140 | 140 | $this->intervals = $i; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | } else if (get_class($arg) == "BoltRepeat") { |
192 | 192 | $repeats[] = $arg; |
193 | 193 | } else if (get_class($arg) == "BoltRefresh") { |
194 | - $refresh= $arg; |
|
194 | + $refresh = $arg; |
|
195 | 195 | } else { |
196 | 196 | echo "Can't include object of type ".get_class($arg)." within an exercise set."; |
197 | 197 | } |
@@ -134,7 +134,7 @@ |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | -class BoltRefresh{ |
|
137 | +class BoltRefresh { |
|
138 | 138 | public $intervals; |
139 | 139 | function __construct($i) { |
140 | 140 | $this->intervals = $i; |
@@ -46,7 +46,7 @@ |
||
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | - $news_date=gmdate('D, d M Y H:i:s',$notify->create_time) . ' GMT'; |
|
49 | + $news_date = gmdate('D, d M Y H:i:s', $notify->create_time).' GMT'; |
|
50 | 50 | echo "<item> |
51 | 51 | <title><![CDATA[$title]]></title> |
52 | 52 | <guid>".url_base()."_notify_$notify->id</guid> |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $link = secure_url_base() . "forum_thread.php?id=" . $thread->id; |
129 | 129 | $body = "Another " . PROJECT . " user has posted to the thread |
130 | 130 | \"" . $thread->title . "\".\n" |
131 | - ."To view the updated thread, visit:\n$link |
|
131 | + ."To view the updated thread, visit:\n$link |
|
132 | 132 | |
133 | 133 | -------------------------- |
134 | 134 | To change email preferences, visit: |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | //////////////////// a user clicks the red "x" to report a post /////////// |
142 | 142 | // |
143 | 143 | function send_report_post_email($user, $forum, $thread, $post, $message) { |
144 | - global $master_url; |
|
144 | + global $master_url; |
|
145 | 145 | |
146 | 146 | $body = ""; |
147 | 147 | $owner = BoincUser::lookup_id($post->user); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | //////////////////// a banishment vote has been started /////////// |
198 | 198 | // |
199 | 199 | function send_banish_vote_email($user, $duration, $reason, $end_time) { |
200 | - global $master_url; |
|
200 | + global $master_url; |
|
201 | 201 | $now=time(); |
202 | 202 | $subject = PROJECT." banishment vote underway"; |
203 | 203 | $vote_url = $master_url."forum_banishment_vote.php"; |
@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | pm_send_msg($user, $user, $subject, $body, false); |
220 | 220 | |
221 | 221 | $body .= "\n\n<a href=".$vote_url."?action=yes&userid=" |
222 | - .$user->id |
|
223 | - .">[vote to banish author]</a>\n\n" |
|
224 | - ."<a href=".$vote_url."?action=no&userid=" |
|
225 | - .$user->id |
|
226 | - .">[vote not to banish author]</a>"; |
|
222 | + .$user->id |
|
223 | + .">[vote to banish author]</a>\n\n" |
|
224 | + ."<a href=".$vote_url."?action=no&userid=" |
|
225 | + .$user->id |
|
226 | + .">[vote not to banish author]</a>"; |
|
227 | 227 | |
228 | 228 | $forum = new BoincForum; |
229 | 229 | $forum->parent_type = 0; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | // - project forums: everyone in POST_REPORT_EMAILS |
25 | 25 | // - team message board: team founder and admins |
26 | 26 | // |
27 | -function mail_report_list($forum, $subject, $body, $must_send=false) { |
|
27 | +function mail_report_list($forum, $subject, $body, $must_send = false) { |
|
28 | 28 | $success = true; |
29 | 29 | switch ($forum->parent_type) { |
30 | 30 | case 0: |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | function send_moderation_email($forum, $post, $thread, $explanation, $action) { |
63 | 63 | global $master_url; |
64 | 64 | |
65 | - $moderator=get_logged_in_user(); |
|
65 | + $moderator = get_logged_in_user(); |
|
66 | 66 | $body = ""; |
67 | 67 | $user = BoincUser::lookup_id($post->user); |
68 | 68 | |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | // If a user is subscribed to a thread that is replied to, |
124 | 124 | // send them an email notifying them of the reply. |
125 | 125 | // |
126 | -function send_reply_notification_email($thread, $user){ |
|
127 | - $title = PROJECT . ": A user has posted to '". $thread->title ."'"; |
|
128 | - $link = secure_url_base() . "forum_thread.php?id=" . $thread->id; |
|
129 | - $body = "Another " . PROJECT . " user has posted to the thread |
|
130 | -\"" . $thread->title . "\".\n" |
|
126 | +function send_reply_notification_email($thread, $user) { |
|
127 | + $title = PROJECT.": A user has posted to '".$thread->title."'"; |
|
128 | + $link = secure_url_base()."forum_thread.php?id=".$thread->id; |
|
129 | + $body = "Another ".PROJECT." user has posted to the thread |
|
130 | +\"" . $thread->title."\".\n" |
|
131 | 131 | ."To view the updated thread, visit:\n$link |
132 | 132 | |
133 | 133 | -------------------------- |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | //////////////////// a user clicks the red "x" to report a post /////////// |
142 | 142 | // |
143 | -function send_report_post_email($user, $forum, $thread, $post, $message) { |
|
143 | +function send_report_post_email($user, $forum, $thread, $post, $message) { |
|
144 | 144 | global $master_url; |
145 | 145 | |
146 | 146 | $body = ""; |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | // |
199 | 199 | function send_banish_vote_email($user, $duration, $reason, $end_time) { |
200 | 200 | global $master_url; |
201 | - $now=time(); |
|
201 | + $now = time(); |
|
202 | 202 | $subject = PROJECT." banishment vote underway"; |
203 | 203 | $vote_url = $master_url."forum_banishment_vote.php"; |
204 | 204 | $body = " |
205 | 205 | A vote has been started to banish you |
206 | 206 | from the ".PROJECT." message boards until ".date('M j, |
207 | -Y G:i', $duration+$now).", |
|
207 | +Y G:i', $duration + $now).", |
|
208 | 208 | because your postings have not followed our guidelines. |
209 | 209 | |
210 | -This vote will last until ".date('M j, Y G:i',$end_time)." or until a majority |
|
210 | +This vote will last until ".date('M j, Y G:i', $end_time)." or until a majority |
|
211 | 211 | decision has been reached. If the vote does not result in banishment, you will be |
212 | 212 | able to resume posting at that time. |
213 | 213 | "; |
@@ -123,7 +123,7 @@ |
||
123 | 123 | // If a user is subscribed to a thread that is replied to, |
124 | 124 | // send them an email notifying them of the reply. |
125 | 125 | // |
126 | -function send_reply_notification_email($thread, $user){ |
|
126 | +function send_reply_notification_email($thread, $user) { |
|
127 | 127 | $title = PROJECT . ": A user has posted to '". $thread->title ."'"; |
128 | 128 | $link = secure_url_base() . "forum_thread.php?id=" . $thread->id; |
129 | 129 | $body = "Another " . PROJECT . " user has posted to the thread |
@@ -113,7 +113,7 @@ |
||
113 | 113 | |
114 | 114 | For assistance with ".PROJECT." go to ".$master_url; |
115 | 115 | |
116 | - $subject = "THREAD $action REPORT: $thread->title"; |
|
116 | + $subject = "thread $action REPORT: $thread->title"; |
|
117 | 117 | $success = mail_report_list($forum, $subject, $body); |
118 | 118 | $success &= send_email($user, $subject, $body); |
119 | 119 | pm_send_msg($user, $user, $subject, $body, false); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $master_url_enc = urlencode($master_url); |
28 | 28 | $response = akismet_request("key=$key&blog=$master_url_enc", "rest.akismet.com", "/1.1/verify-key"); |
29 | - if ("valid" == $response[1] ) { |
|
29 | + if ("valid" == $response[1]) { |
|
30 | 30 | $post = urlencode($post); |
31 | 31 | $ip = urlencode($_SERVER['REMOTE_ADDR']); |
32 | 32 | $referrer = urlencode($_SERVER['HTTP_REFERER']); |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | $http_request = "POST $path HTTP/1.0\r\n"; |
57 | 57 | $http_request .= "Host: $host\r\n"; |
58 | 58 | $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"; |
59 | - $http_request .= "Content-Length: " . strlen($request) . "\r\n"; |
|
59 | + $http_request .= "Content-Length: ".strlen($request)."\r\n"; |
|
60 | 60 | $http_request .= "User-Agent: BOINC | Akismet 1.1\r\n"; |
61 | 61 | $http_request .= "\r\n"; |
62 | 62 | $http_request .= $request; |
63 | 63 | |
64 | 64 | $response = ''; |
65 | - if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) { |
|
65 | + if (false !== ($fs = @fsockopen($host, $port, $errno, $errstr, 3))) { |
|
66 | 66 | fwrite($fs, $http_request); |
67 | - while ( !feof($fs) ) |
|
67 | + while (!feof($fs)) |
|
68 | 68 | $response .= fgets($fs, 1160); // One TCP-IP packet |
69 | 69 | fclose($fs); |
70 | 70 | $response = explode("\r\n\r\n", $response, 2); |
@@ -42,7 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | $response = akismet_request($request, "$key.rest.akismet.com", "/1.1/comment-check"); |
44 | 44 | |
45 | - if ("true" == $response[1]) { // Akismet says it's spam |
|
45 | + if ("true" == $response[1]) { |
|
46 | +// Akismet says it's spam |
|
46 | 47 | return false; |
47 | 48 | } else { |
48 | 49 | return true; |
@@ -64,8 +65,10 @@ discard block |
||
64 | 65 | $response = ''; |
65 | 66 | if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) { |
66 | 67 | fwrite($fs, $http_request); |
67 | - while ( !feof($fs) ) |
|
68 | - $response .= fgets($fs, 1160); // One TCP-IP packet |
|
68 | + while ( !feof($fs) ) { |
|
69 | + $response .= fgets($fs, 1160); |
|
70 | + } |
|
71 | + // One TCP-IP packet |
|
69 | 72 | fclose($fs); |
70 | 73 | $response = explode("\r\n\r\n", $response, 2); |
71 | 74 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | function akismet_request($request, $host, $path, $port = 80) { |
56 | - $http_request = "POST $path HTTP/1.0\r\n"; |
|
56 | + $http_request = "post $path HTTP/1.0\r\n"; |
|
57 | 57 | $http_request .= "Host: $host\r\n"; |
58 | 58 | $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"; |
59 | 59 | $http_request .= "Content-Length: " . strlen($request) . "\r\n"; |