@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | require_once('../inc/sanitize_html.inc'); |
21 | 21 | |
22 | -function image_as_bb($text){ |
|
22 | +function image_as_bb($text) { |
|
23 | 23 | // This function depends on sanitized HTML |
24 | 24 | |
25 | 25 | $pattern = '@<img(.*) src=\"([^>^"]+)\"([^>]*)>@si'; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | return $text; |
34 | 34 | } |
35 | 35 | |
36 | -function link_as_bb($text){ |
|
36 | +function link_as_bb($text) { |
|
37 | 37 | /* This function depends on sanitized HTML */ |
38 | 38 | // Build some regex (should be a *lot* faster) |
39 | 39 | $pattern = '@<a href=\"([^>]+)\">@si'; // Gives us the URL in $1... |
@@ -49,35 +49,35 @@ discard block |
||
49 | 49 | return $text; |
50 | 50 | } |
51 | 51 | |
52 | -function formatting_as_bb($text){ |
|
52 | +function formatting_as_bb($text) { |
|
53 | 53 | /* This function depends on sanitized HTML */ |
54 | - $in[]="<b>";$out[]="[b]"; |
|
55 | - $in[]="</b>";$out[]="[/b]"; |
|
54 | + $in[] = "<b>"; $out[] = "[b]"; |
|
55 | + $in[] = "</b>"; $out[] = "[/b]"; |
|
56 | 56 | |
57 | - $in[]="<i>";$out[]="[i]"; |
|
58 | - $in[]="</i>";$out[]="[/i]"; |
|
57 | + $in[] = "<i>"; $out[] = "[i]"; |
|
58 | + $in[] = "</i>"; $out[] = "[/i]"; |
|
59 | 59 | |
60 | - $in[]="<u>";$out[]="[u]"; |
|
61 | - $in[]="</u>";$out[]="[/u]"; |
|
60 | + $in[] = "<u>"; $out[] = "[u]"; |
|
61 | + $in[] = "</u>"; $out[] = "[/u]"; |
|
62 | 62 | |
63 | - $in[]="<b>";$out[]="[b]"; |
|
64 | - $in[]="</b>";$out[]="[/b]"; |
|
63 | + $in[] = "<b>"; $out[] = "[b]"; |
|
64 | + $in[] = "</b>"; $out[] = "[/b]"; |
|
65 | 65 | |
66 | - $in[]="<ul>";$out[]="[list]"; |
|
67 | - $in[]="</ul>";$out[]="[/list]"; |
|
66 | + $in[] = "<ul>"; $out[] = "[list]"; |
|
67 | + $in[] = "</ul>"; $out[] = "[/list]"; |
|
68 | 68 | |
69 | - $in[]="<ol>";$out[]="[list=1]"; |
|
70 | - $in[]="</ol>";$out[]="[/list]"; |
|
69 | + $in[] = "<ol>"; $out[] = "[list=1]"; |
|
70 | + $in[] = "</ol>"; $out[] = "[/list]"; |
|
71 | 71 | |
72 | - $in[]="<pre>";$out[]="[pre]"; |
|
73 | - $in[]="</pre>";$out[]="[/pre]"; |
|
72 | + $in[] = "<pre>"; $out[] = "[pre]"; |
|
73 | + $in[] = "</pre>"; $out[] = "[/pre]"; |
|
74 | 74 | |
75 | - $in[]="</br>";$out[]="\n"; |
|
76 | - $in[]="<br/>";$out[]="\n"; |
|
77 | - $in[]="<br>";$out[]="\n"; |
|
78 | - $in[]=">";$out[]=">"; |
|
79 | - $in[]="<";$out[]="<"; |
|
80 | - $in[]="&";$out[]="&"; |
|
75 | + $in[] = "</br>"; $out[] = "\n"; |
|
76 | + $in[] = "<br/>"; $out[] = "\n"; |
|
77 | + $in[] = "<br>"; $out[] = "\n"; |
|
78 | + $in[] = ">"; $out[] = ">"; |
|
79 | + $in[] = "<"; $out[] = "<"; |
|
80 | + $in[] = "&"; $out[] = "&"; |
|
81 | 81 | |
82 | 82 | return str_replace($in, $out, $text); |
83 | 83 | } |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | // The following is a global var accessed by exercise functions. |
22 | 22 | // |
23 | 23 | $bolt_ex = null; |
24 | -$bolt_ex->mode = 0; // input: SHOW/SCORE/ANSWER |
|
25 | -$bolt_ex->index = 0; // input: sequence of this exercise in file |
|
26 | -$bolt_ex->score = 0; // input/output: cumulative score (if mode = SCORE) |
|
27 | -$bolt_ex->weight = 0; // input/output: cumulative weight |
|
28 | -$bolt_ex->query_string = ""; // user's response (if SCORE or ANSWER) |
|
24 | +$bolt_ex->mode = 0; // input: SHOW/SCORE/ANSWER |
|
25 | +$bolt_ex->index = 0; // input: sequence of this exercise in file |
|
26 | +$bolt_ex->score = 0; // input/output: cumulative score (if mode = SCORE) |
|
27 | +$bolt_ex->weight = 0; // input/output: cumulative weight |
|
28 | +$bolt_ex->query_string = ""; // user's response (if SCORE or ANSWER) |
|
29 | 29 | |
30 | 30 | function weight($w) { |
31 | 31 | return array('weight', $w); |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | $response = isset($$key); |
171 | 171 | $r = $choice[1]; |
172 | 172 | $correct = ($r && $response) || (!$r && !$response); |
173 | - $color = $correct?"#88ff88":"#ff8888"; |
|
174 | - table_row($c, $r?"yes":"no", |
|
175 | - array($response?"yes":"no", "bgcolor=$color") |
|
173 | + $color = $correct ? "#88ff88" : "#ff8888"; |
|
174 | + table_row($c, $r ? "yes" : "no", |
|
175 | + array($response ? "yes" : "no", "bgcolor=$color") |
|
176 | 176 | ); |
177 | 177 | $i++; |
178 | 178 | } |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | if ($y > $rect[3]) $right = false; |
216 | 216 | $cx = $rect[0]; |
217 | 217 | $cy = $rect[2]; |
218 | - $sizex = $rect[1]-$rect[0]; |
|
219 | - $sizey = $rect[3]-$rect[2]; |
|
220 | - $ax = $x-4; |
|
221 | - $ay = $y-4; |
|
222 | - $color = $right?"green":"red"; |
|
218 | + $sizex = $rect[1] - $rect[0]; |
|
219 | + $sizey = $rect[3] - $rect[2]; |
|
220 | + $ax = $x - 4; |
|
221 | + $ay = $y - 4; |
|
222 | + $color = $right ? "green" : "red"; |
|
223 | 223 | if ($right) { |
224 | 224 | echo "The point you selected (shown in green) is correct."; |
225 | 225 | } else { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | class BoltFitbAnswer { |
259 | - public $type; // 0=constant, 1=regexp, 2=func |
|
259 | + public $type; // 0=constant, 1=regexp, 2=func |
|
260 | 260 | public $ans; |
261 | 261 | function __construct($type, $ans) { |
262 | 262 | $this->type = $type; |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | global $language_names; |
60 | 60 | $supported_languages = get_supported_languages(); |
61 | 61 | $supported_languages[] = "en"; |
62 | - $sel = $cur_lang_name?"":"selected"; |
|
62 | + $sel = $cur_lang_name ? "" : "selected"; |
|
63 | 63 | echo " |
64 | 64 | <option $sel value=auto> Browser default |
65 | 65 | "; |
66 | 66 | foreach ($language_names as $lang) { |
67 | 67 | if (!in_array($lang[0], $supported_languages)) continue; |
68 | - $sel = ($cur_lang_name == $lang[0])?"selected":""; |
|
68 | + $sel = ($cur_lang_name == $lang[0]) ? "selected" : ""; |
|
69 | 69 | if ($lang[0] == "en") { |
70 | 70 | echo "<option $sel value=".$lang[0].">".$lang[1]; |
71 | 71 | } else { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | // show a menu of supported languages |
79 | 79 | // |
80 | -function language_form($cur_lang_name=null) { |
|
80 | +function language_form($cur_lang_name = null) { |
|
81 | 81 | echo ' |
82 | 82 | <form name="language" method="get" action="set_language.php"> |
83 | 83 | <select class="selectbox form-control" name="lang" onchange="javascript: submit()"> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if (!$user->has_profile) return null; |
72 | 72 | $profile = BoincProfile::lookup("userid=$user->id"); |
73 | 73 | if (!$profile->has_picture) return null; |
74 | - if (profile_screening() && $profile->verification!=1) return null; |
|
74 | + if (profile_screening() && $profile->verification != 1) return null; |
|
75 | 75 | return profile_thumb_url($user->id); |
76 | 76 | } |
77 | 77 | |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | return $image; |
126 | 126 | } |
127 | 127 | |
128 | - ($origWidth > $origHeight)? $scalar = ($origWidth / $targetWidth) : $scalar = ($origHeight / $targetHeight); |
|
128 | + ($origWidth > $origHeight) ? $scalar = ($origWidth/$targetWidth) : $scalar = ($origHeight/$targetHeight); |
|
129 | 129 | |
130 | 130 | if ($scalar != 0) { |
131 | - $destWidth = $origWidth / $scalar; |
|
132 | - $destHeight = $origHeight / $scalar; |
|
131 | + $destWidth = $origWidth/$scalar; |
|
132 | + $destHeight = $origHeight/$scalar; |
|
133 | 133 | } else { |
134 | 134 | $destWidth = $origWidth; |
135 | 135 | $destHeight = $origHeight; |
136 | 136 | } |
137 | 137 | |
138 | 138 | $gd_info = gd_info(); |
139 | - $newGD = (strstr($gd_info["GD Version"], "2.0")!=""); |
|
139 | + $newGD = (strstr($gd_info["GD Version"], "2.0") != ""); |
|
140 | 140 | if ($newGD) { |
141 | 141 | // If you are using a modern PHP/GD installation that does |
142 | 142 | // 'truecolor' images, this is what's needed. |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $options->htmlitems = false; |
180 | 180 | $temp = output_transform($profile->response1, $options); |
181 | 181 | $temp = sanitize_tags($temp); |
182 | - $description = "(\"" . sub_sentence($temp, ' ', MAX_DESC_LENGTH, true) . "\")"; |
|
182 | + $description = "(\"".sub_sentence($temp, ' ', MAX_DESC_LENGTH, true)."\")"; |
|
183 | 183 | |
184 | 184 | } |
185 | 185 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | function check_whether_to_show_profile($user, $logged_in_user) { |
191 | 191 | $min_credit = parse_config(get_config(), "<profile_min_credit>"); |
192 | - if (!$logged_in_user && $min_credit && $user->expavg_credit < $min_credit ) { |
|
192 | + if (!$logged_in_user && $min_credit && $user->expavg_credit < $min_credit) { |
|
193 | 193 | error_page( |
194 | 194 | tra("To prevent spam, profiles of users with an average credit of less than %1 are displayed only to logged-in users. We apologize for this inconvenience.", $min_credit) |
195 | 195 | ); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // |
228 | 228 | $show_picture = $profile->has_picture; |
229 | 229 | if (profile_screening()) { |
230 | - if (!$screen_mode && !$can_edit && $profile->verification!=1) { |
|
230 | + if (!$screen_mode && !$can_edit && $profile->verification != 1) { |
|
231 | 231 | $show_picture = false; |
232 | 232 | } |
233 | 233 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | // yet verified. This will tell them if other users can't view it yet, or |
244 | 244 | // if there is a problem with it and they need to replace it. |
245 | 245 | // |
246 | - if (profile_screening() && $profile->has_picture && $can_edit && $profile->verification!=1) { |
|
246 | + if (profile_screening() && $profile->has_picture && $can_edit && $profile->verification != 1) { |
|
247 | 247 | row1(offensive_profile_warning($profile->verification)); |
248 | 248 | } |
249 | 249 | |
@@ -276,6 +276,6 @@ discard block |
||
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
279 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
280 | 280 | |
281 | 281 | ?> |
@@ -46,8 +46,8 @@ |
||
46 | 46 | define('BOLT_COURSE_FINISHED', 3); |
47 | 47 | |
48 | 48 | // bits in bolt_user.flags |
49 | -define('BOLT_FLAGS_DEBUG', 1); // print debugging info in output pages |
|
50 | -define('BOLT_FLAGS_SHOW_ALL', 2); // show hidden courses |
|
49 | +define('BOLT_FLAGS_DEBUG', 1); // print debugging info in output pages |
|
50 | +define('BOLT_FLAGS_SHOW_ALL', 2); // show hidden courses |
|
51 | 51 | |
52 | 52 | class BoltDb extends DbConn { |
53 | 53 | static $instance; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | function _mysql_connect($host, $user, $pass, $dbname) { |
44 | 44 | global $mysqli; |
45 | 45 | $x = explode(":", $host); |
46 | - if (sizeof($x)>1) { |
|
46 | + if (sizeof($x) > 1) { |
|
47 | 47 | $host = $x[0]; |
48 | 48 | $port = $x[1]; |
49 | 49 | } else { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | -function db_init_aux($try_replica=false) { |
|
165 | +function db_init_aux($try_replica = false) { |
|
166 | 166 | $config = get_config(); |
167 | 167 | $user = parse_config($config, "<db_user>"); |
168 | 168 | $pass = parse_config($config, "<db_passwd>"); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | echo " |
53 | 53 | <span style=\"width:".$size."px;height:".$size."px;position:absolute;top:".$cy.";left:".$cx.";color:white;border-style:solid;border-width:1px\"> |
54 | 54 | "; |
55 | - $c = $f->comment?"($f->comment)":""; |
|
55 | + $c = $f->comment ? "($f->comment)" : ""; |
|
56 | 56 | echo " |
57 | 57 | <span class=link> |
58 | 58 | <a href=\"javascript: void(0)\"> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $features = $opaque_data->features; |
99 | 99 | $x = ""; |
100 | 100 | foreach ($features as $f) { |
101 | - $c = $f->comment?"($f->comment)":""; |
|
101 | + $c = $f->comment ? "($f->comment)" : ""; |
|
102 | 102 | $x .= "$f->type $c <br>"; |
103 | 103 | } |
104 | 104 | return $x; |
@@ -33,6 +33,6 @@ |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | function wap_timestamp() { |
36 | - return gmdate('j M Y G:i:s', time()) . " UTC"; |
|
36 | + return gmdate('j M Y G:i:s', time())." UTC"; |
|
37 | 37 | } |
38 | 38 | ?> |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | $gd_info = gd_info(); |
24 | 24 | // libgd version numbers seem to be always three numbers |
25 | 25 | preg_match('/(\d).(\d).(\d)/', $gd_info['GD Version'], $match); |
26 | - $newGD = ($match[1]>=2); |
|
26 | + $newGD = ($match[1] >= 2); |
|
27 | 27 | |
28 | 28 | list($ow, $oh, $from_type) = getimagesize($sourcefile); |
29 | - switch($from_type) { |
|
29 | + switch ($from_type) { |
|
30 | 30 | case 1: // GIF |
31 | 31 | $srcImage = imageCreateFromGif($sourcefile); |
32 | 32 | break; |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | $tempw = $fw; |
42 | 42 | $temph = number_format((($oh*$fw)/$ow), 0); |
43 | 43 | |
44 | - if($temph < $fh) { |
|
44 | + if ($temph < $fh) { |
|
45 | 45 | $tempw = number_format((($ow*$fh)/$oh), 0); |
46 | 46 | $temph = $fh; |
47 | 47 | } |
48 | 48 | |
49 | - if ($newGD){ |
|
49 | + if ($newGD) { |
|
50 | 50 | $tempImage = imageCreateTrueColor($tempw, $temph); |
51 | 51 | // Seems not to work: |
52 | 52 | // imageAntiAlias($tempImage, true); |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | |
59 | 59 | |
60 | 60 | // Calculate offsets |
61 | - if($temph < $fh) { |
|
62 | - $offsety = number_format(($temph/2)-($fh/2), 0); |
|
61 | + if ($temph < $fh) { |
|
62 | + $offsety = number_format(($temph/2) - ($fh/2), 0); |
|
63 | 63 | $offsetx = 0; |
64 | 64 | } else { |
65 | 65 | $offsety = 0; |
66 | - $offsetx = number_format(($tempw/2)-($fw/2), 0); |
|
66 | + $offsetx = number_format(($tempw/2) - ($fw/2), 0); |
|
67 | 67 | } |
68 | 68 | |
69 | - if ($newGD){ |
|
69 | + if ($newGD) { |
|
70 | 70 | $destImage = imageCreateTrueColor($fw, $fh); |
71 | 71 | // Seems not to work: |
72 | 72 | // imageAntiAlias($tempImage, true); |