@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | "Zimbabwe" |
258 | 258 | ); |
259 | 259 | |
260 | -$country_to_iso3166_2 = array ( |
|
260 | +$country_to_iso3166_2 = array( |
|
261 | 261 | "Afghanistan" => "af", |
262 | 262 | "Albania" => "al", |
263 | 263 | "Algeria" => "dz", |
@@ -493,25 +493,25 @@ discard block |
||
493 | 493 | |
494 | 494 | // return a list of country options for a <select> |
495 | 495 | // |
496 | -function country_select_options($selected_country="None") { |
|
496 | +function country_select_options($selected_country = "None") { |
|
497 | 497 | global $countries; |
498 | 498 | |
499 | 499 | require_once("../inc/geoip.inc"); |
500 | 500 | |
501 | 501 | // See if we can find the user's country and select it as default: |
502 | 502 | // |
503 | - $gi = geoip_open("../inc/GeoIP.dat",GEOIP_STANDARD); |
|
504 | - $geoip_country = geoip_country_name_by_addr($gi,$_SERVER["REMOTE_ADDR"]); |
|
503 | + $gi = geoip_open("../inc/GeoIP.dat", GEOIP_STANDARD); |
|
504 | + $geoip_country = geoip_country_name_by_addr($gi, $_SERVER["REMOTE_ADDR"]); |
|
505 | 505 | geoip_close($gi); |
506 | 506 | |
507 | - if ($selected_country=="") $selected_country="None"; |
|
508 | - if ($selected_country=="None" and $geoip_country!=""){ |
|
509 | - $selected_country=$geoip_country; |
|
507 | + if ($selected_country == "") $selected_country = "None"; |
|
508 | + if ($selected_country == "None" and $geoip_country != "") { |
|
509 | + $selected_country = $geoip_country; |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | $x = ""; |
513 | 513 | foreach ($countries as $country) { |
514 | - $selected = ($selected_country == $country ? "selected":""); |
|
514 | + $selected = ($selected_country == $country ? "selected" : ""); |
|
515 | 515 | $x .= "<option value=\"$country\" $selected>$country</option>\n"; |
516 | 516 | } |
517 | 517 | return $x; |
@@ -43,10 +43,10 @@ |
||
43 | 43 | credit_to_ops($credit, $ops, $unit); |
44 | 44 | |
45 | 45 | if ($bolden) { |
46 | - $lbold="[["; |
|
47 | - $rbold="]]"; |
|
46 | + $lbold = "[["; |
|
47 | + $rbold = "]]"; |
|
48 | 48 | } else { |
49 | - $lbold=""; $rbold=""; |
|
49 | + $lbold = ""; $rbold = ""; |
|
50 | 50 | } |
51 | 51 | return " $lbold$cobbs Cobblestones$rbold of computation ($ops $unit floating-point operations)"; |
52 | 52 | } |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | "; |
45 | 45 | } |
46 | 46 | |
47 | -function xml_error($num, $msg=null, $file=null, $line=null) { |
|
47 | +function xml_error($num, $msg = null, $file = null, $line = null) { |
|
48 | 48 | global $xml_outer_tag; |
49 | 49 | if (!$msg) { |
50 | - switch($num) { |
|
50 | + switch ($num) { |
|
51 | 51 | case -112: $msg = "Invalid XML"; break; |
52 | 52 | case -136: $msg = "Not found"; break; |
53 | 53 | case -137: $msg = "Name or email address is not unique"; break; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | // |
95 | 95 | function parse_element($xml, $tag) { |
96 | 96 | $element = null; |
97 | - $closetag = "</" . substr($tag,1); |
|
97 | + $closetag = "</".substr($tag, 1); |
|
98 | 98 | $x = strstr($xml, $tag); |
99 | 99 | if ($x) { |
100 | 100 | if (strstr($tag, "/>")) return $tag; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | |
110 | 110 | function parse_next_element($xml, $tag, &$cursor) { |
111 | 111 | $element = null; |
112 | - $closetag = "</" . substr($tag,1); |
|
113 | - $pos = substr($xml,$cursor); |
|
112 | + $closetag = "</".substr($tag, 1); |
|
113 | + $pos = substr($xml, $cursor); |
|
114 | 114 | $x = strstr($pos, $tag); |
115 | 115 | if ($x) { |
116 | 116 | if (strstr($tag, "/>")) return $tag; |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | require_once('../inc/sanitize_html.inc'); |
27 | 27 | |
28 | 28 | class output_options { |
29 | - var $bb2html; // BBCode as HTML? (on) |
|
30 | - var $images_as_links; // Images as hyperlinks? (off) |
|
31 | - var $link_popup; // Links in new windows? (off) |
|
32 | - var $nl2br; // Convert newlines to <br>'s? (on) |
|
33 | - var $htmlitems; // Convert special chars to HTML entities? (on) |
|
34 | - var $htmlscrub; // Scrub "bad" HTML tags? (off) |
|
35 | - var $highlight_terms;// Array of terms to be highlighted (off) |
|
29 | + var $bb2html; // BBCode as HTML? (on) |
|
30 | + var $images_as_links; // Images as hyperlinks? (off) |
|
31 | + var $link_popup; // Links in new windows? (off) |
|
32 | + var $nl2br; // Convert newlines to <br>'s? (on) |
|
33 | + var $htmlitems; // Convert special chars to HTML entities? (on) |
|
34 | + var $htmlscrub; // Scrub "bad" HTML tags? (off) |
|
35 | + var $highlight_terms; // Array of terms to be highlighted (off) |
|
36 | 36 | |
37 | 37 | // Constructor - set the defaults. |
38 | 38 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | if ($export) { |
110 | 110 | $text = preg_replace_callback( |
111 | 111 | "@\[pre\](.*?)\[/pre\]@is", |
112 | - function ($matches) { |
|
112 | + function($matches) { |
|
113 | 113 | $x = remove_br(substr($matches[0], 5, -6)); |
114 | 114 | $x = htmlspecialchars($x, ENT_COMPAT, "UTF-8", false); |
115 | 115 | $x = str_replace("[", "[", $x); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | ); |
120 | 120 | return preg_replace_callback( |
121 | 121 | "@\[code\](.*?)\[/code\]@is", |
122 | - function ($matches) { |
|
122 | + function($matches) { |
|
123 | 123 | $x = remove_br(substr($matches[0], 6, -7)); |
124 | 124 | $x = htmlspecialchars($x, ENT_COMPAT, "UTF-8", false); |
125 | 125 | $x = str_replace("[", "[", $x); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } else { |
131 | 131 | $text = preg_replace_callback( |
132 | 132 | "@\[pre\](.*?)\[/pre\]@is", |
133 | - function ($matches) { |
|
133 | + function($matches) { |
|
134 | 134 | $x = remove_br(substr($matches[0], 5, -6)); |
135 | 135 | $x = htmlspecialchars($x, ENT_COMPAT, "UTF-8", false); |
136 | 136 | $x = str_replace("[", "[", $x); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ); |
141 | 141 | return preg_replace_callback( |
142 | 142 | "@\[code\](.*?)\[/code\]@is", |
143 | - function ($matches) { |
|
143 | + function($matches) { |
|
144 | 144 | $x = remove_br(substr($matches[0], 6, -7)); |
145 | 145 | $x = htmlspecialchars($x, ENT_COMPAT, "UTF-8", false); |
146 | 146 | $x = str_replace("[", "[", $x); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | -function bb2html($text, $export=false) { |
|
154 | +function bb2html($text, $export = false) { |
|
155 | 155 | $urlregex = "(?:\"?)(?:(http\:\/\/)?)([^\[\"<\ ]+)(?:\"?)"; |
156 | 156 | // NOTE: |
157 | 157 | // This matches https:// too; I don't understand why. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)"; |
173 | 173 | // List of allowable tags |
174 | - $bbtags = array ( |
|
174 | + $bbtags = array( |
|
175 | 175 | "@\[b\](.*?)\[/b\]@is", |
176 | 176 | "@\[i\](.*?)\[/i\]@is", |
177 | 177 | "@\[u\](.*?)\[/u\]@is", |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | |
201 | 201 | // What the above tags are turned in to |
202 | 202 | if ($export) { |
203 | - $htmltags = array ( |
|
203 | + $htmltags = array( |
|
204 | 204 | "<b>\\1</b>", |
205 | 205 | "<i>\\1</i>", |
206 | 206 | "<u>\\1</u>", |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | "<a href=\"https://github.com/BOINC/boinc-dev-doc/wiki/\\1\">\\1</a>", |
228 | 228 | ); |
229 | 229 | } else { |
230 | - $htmltags = array ( |
|
230 | + $htmltags = array( |
|
231 | 231 | "<b>\\1</b>", |
232 | 232 | "<i>\\1</i>", |
233 | 233 | "<u>\\1</u>", |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $lasttext = ""; |
260 | 260 | $i = 0; |
261 | 261 | // $i<1000 to prevent DoS |
262 | - while ($text != $lasttext && $i<1000) { |
|
262 | + while ($text != $lasttext && $i < 1000) { |
|
263 | 263 | $lasttext = $text; |
264 | 264 | $text = replace_pre_code($text, $export); |
265 | 265 | $text = preg_replace($bbtags, $htmltags, $text); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | // for example inside <pre> containers |
273 | 273 | // The original \n was retained after the br when it was added |
274 | 274 | // |
275 | -function remove_br($text){ |
|
275 | +function remove_br($text) { |
|
276 | 276 | return str_replace("<br />", "", $text); |
277 | 277 | } |
278 | 278 | |
@@ -280,19 +280,19 @@ discard block |
||
280 | 280 | // |
281 | 281 | function externalize_links($text) { |
282 | 282 | // TODO: Convert this to PCRE |
283 | - $i=0; |
|
284 | - $linkpos=true; |
|
283 | + $i = 0; |
|
284 | + $linkpos = true; |
|
285 | 285 | $out = ""; |
286 | - while (true){ |
|
286 | + while (true) { |
|
287 | 287 | //Find a link |
288 | 288 | // |
289 | - $linkpos=strpos($text, "<a ", $i); |
|
290 | - if ($linkpos===false) break; |
|
289 | + $linkpos = strpos($text, "<a ", $i); |
|
290 | + if ($linkpos === false) break; |
|
291 | 291 | |
292 | 292 | //Replace with target='_new' |
293 | 293 | // |
294 | - $out .= substr($text, $i, $linkpos-$i)."<a target=\"_new\" "; |
|
295 | - $i = $linkpos+3; |
|
294 | + $out .= substr($text, $i, $linkpos - $i)."<a target=\"_new\" "; |
|
295 | + $i = $linkpos + 3; |
|
296 | 296 | } |
297 | 297 | $out .= substr($text, $i); |
298 | 298 | return $out; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | // Converts image tags to links to the images. |
302 | 302 | |
303 | -function image_as_link($text){ |
|
303 | +function image_as_link($text) { |
|
304 | 304 | /* This function depends on sanitized HTML */ |
305 | 305 | // Build some regex (should be a *lot* faster) |
306 | 306 | $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si'; |
@@ -325,5 +325,5 @@ discard block |
||
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
328 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
329 | 329 | ?> |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * classes. |
10 | 10 | */ |
11 | 11 | |
12 | -spl_autoload_register(function ($class) { |
|
12 | +spl_autoload_register(function($class) { |
|
13 | 13 | if (substr($class, 0, 10) !== 'ReCaptcha\\') { |
14 | 14 | /* If the class does not lie under the "ReCaptcha" namespace, |
15 | 15 | * then we can exit immediately. |
@@ -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; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | if ($app_types->cpu) { |
71 | - $project_pref_descs[] = new PREF_BOOL ( |
|
71 | + $project_pref_descs[] = new PREF_BOOL( |
|
72 | 72 | tra("Use CPU"), |
73 | 73 | "Request CPU-only tasks from this project.", |
74 | 74 | "no_cpu", |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ); |
78 | 78 | } |
79 | 79 | if ($app_types->ati) { |
80 | - $project_pref_descs[] = new PREF_BOOL ( |
|
80 | + $project_pref_descs[] = new PREF_BOOL( |
|
81 | 81 | tra("Use ATI GPU"), |
82 | 82 | "Request ATI GPU tasks from this project.", |
83 | 83 | "no_ati", |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ); |
87 | 87 | } |
88 | 88 | if ($app_types->cuda) { |
89 | - $project_pref_descs[] = new PREF_BOOL ( |
|
89 | + $project_pref_descs[] = new PREF_BOOL( |
|
90 | 90 | tra("Use NVIDIA GPU"), |
91 | 91 | "Request NVIDIA GPU tasks from this project.", |
92 | 92 | "no_cuda", |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | } |
97 | 97 | if ($app_types->intel_gpu) { |
98 | - $project_pref_descs[] = new PREF_BOOL ( |
|
98 | + $project_pref_descs[] = new PREF_BOOL( |
|
99 | 99 | tra("Use Intel GPU"), |
100 | 100 | "Request Intel GPU tasks from this project.", |
101 | 101 | "no_intel_gpu", |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $x = ""; |
121 | 121 | } |
122 | 122 | |
123 | -$privacy_pref_descs = array ( |
|
123 | +$privacy_pref_descs = array( |
|
124 | 124 | new PREF_BOOL( |
125 | 125 | tra("Is it OK for %1 and your team (if any) to email you?", PROJECT).$x, |
126 | 126 | "", |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | global $in_project_specific; |
153 | 153 | global $venue_name; |
154 | 154 | |
155 | - switch($name) { |
|
155 | + switch ($name) { |
|
156 | 156 | case "venue": |
157 | 157 | $venue_name = $attrs["name"]; |
158 | 158 | $top_parse_result = $parse_result; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | break; |
165 | 165 | default: |
166 | 166 | if ($in_project_specific) { |
167 | - $text= $text."<$name>"; |
|
167 | + $text = $text."<$name>"; |
|
168 | 168 | } else { |
169 | 169 | $text = ""; |
170 | 170 | } |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | global $venue_name; |
180 | 180 | global $project_pref_descs; |
181 | 181 | |
182 | - foreach($project_pref_descs as $p) { |
|
182 | + foreach ($project_pref_descs as $p) { |
|
183 | 183 | if ($p->xml_parse($parse_result, $name, $text)) { |
184 | 184 | return; |
185 | 185 | } |
186 | 186 | } |
187 | - switch($name) { |
|
187 | + switch ($name) { |
|
188 | 188 | case "venue": |
189 | 189 | $top_parse_result->$venue_name = $parse_result; |
190 | 190 | $parse_result = $top_parse_result; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | return $parse_result; |
229 | 229 | } |
230 | 230 | |
231 | -function prefs_show_project($prefs, $columns=false) { |
|
231 | +function prefs_show_project($prefs, $columns = false) { |
|
232 | 232 | global $project_pref_descs; |
233 | 233 | if ($columns) { |
234 | 234 | foreach ($project_pref_descs as $p) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
257 | -function prefs_show_project_specific($prefs, $columns=false) { |
|
257 | +function prefs_show_project_specific($prefs, $columns = false) { |
|
258 | 258 | if ($columns) { |
259 | 259 | $project_specific_prefs = project_specific_prefs_parse($prefs->project_specific); |
260 | 260 | $project_specific_prefs->home = isset($prefs->home) ? project_specific_prefs_parse($prefs->home->project_specific) : ""; |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | project_specific_prefs_show($project_specific_prefs, $columns); |
267 | 267 | } |
268 | 268 | |
269 | -function print_prefs_display_project($user, $columns=false) { |
|
269 | +function print_prefs_display_project($user, $columns = false) { |
|
270 | 270 | $project_prefs = prefs_parse_project($user->project_prefs); |
271 | 271 | |
272 | - $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>"; |
|
272 | + $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=".(int)!$columns.">".tra("(Switch View)")."</a></font>"; |
|
273 | 273 | if ($columns) { |
274 | 274 | start_table(); |
275 | 275 | row_heading(tra("Combined preferences").$switch_link); |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | -function prefs_form_project($prefs, $error=false) { |
|
314 | +function prefs_form_project($prefs, $error = false) { |
|
315 | 315 | global $project_pref_descs; |
316 | 316 | foreach ($project_pref_descs as $p) { |
317 | 317 | $p->show_form_row($prefs, $error); |
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
321 | -function prefs_form_project_specific($prefs_xml, $error=false) { |
|
321 | +function prefs_form_project_specific($prefs_xml, $error = false) { |
|
322 | 322 | $prefs = project_specific_prefs_parse($prefs_xml); |
323 | 323 | project_specific_prefs_edit($prefs, $error); |
324 | 324 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | |
358 | 358 | // given a prefs structure, return the corresponding XML string |
359 | 359 | // |
360 | -function project_prefs_make_xml($prefs, $primary=true) { |
|
360 | +function project_prefs_make_xml($prefs, $primary = true) { |
|
361 | 361 | global $project_pref_descs; |
362 | 362 | $xml = ""; |
363 | 363 | if ($primary) { |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | // |
393 | 393 | function project_prefs_update(&$user, $prefs) { |
394 | 394 | $prefs_xml = BoincDb::escape_string(project_prefs_make_xml($prefs)); |
395 | - $send_email = $user->send_email?1:0; |
|
396 | - $show_hosts = $user->show_hosts?1:0; |
|
395 | + $send_email = $user->send_email ? 1 : 0; |
|
396 | + $show_hosts = $user->show_hosts ? 1 : 0; |
|
397 | 397 | $retval = $user->update("project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts"); |
398 | 398 | if (!$retval) { |
399 | 399 | return 1; |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | $db = BoincDb::get(); |
213 | 213 | return $db->update($this, 'user', $clause); |
214 | 214 | } |
215 | - static function enum($where_clause, $order_clause=null) { |
|
215 | + static function enum($where_clause, $order_clause = null) { |
|
216 | 216 | $db = BoincDb::get(); |
217 | 217 | return $db->enum('user', 'BoincUser', $where_clause, $order_clause); |
218 | 218 | } |
219 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
219 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
220 | 220 | $db = BoincDb::get(); |
221 | 221 | return $db->enum_fields( |
222 | 222 | 'user', 'BoincUser', $fields, $where_clause, $order_clause |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $db = BoincDb::get(); |
266 | 266 | return $db->update($this, 'team', $clause); |
267 | 267 | } |
268 | - static function enum($where_clause, $order_clause=null) { |
|
268 | + static function enum($where_clause, $order_clause = null) { |
|
269 | 269 | $db = BoincDb::get(); |
270 | 270 | return $db->enum('team', 'BoincTeam', $where_clause, $order_clause); |
271 | 271 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $db = BoincDb::get(); |
291 | 291 | return $db->max('team', $field); |
292 | 292 | } |
293 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
293 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
294 | 294 | $db = BoincDb::get(); |
295 | 295 | return $db->enum_fields( |
296 | 296 | 'team', 'BoincTeam', $fields, $where_clause, $order_clause |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | $db = BoincDb::get(); |
323 | 323 | return $db->delete($this, 'host'); |
324 | 324 | } |
325 | - static function enum($where_clause, $order_clause=null) { |
|
325 | + static function enum($where_clause, $order_clause = null) { |
|
326 | 326 | $db = BoincDb::get(); |
327 | 327 | return $db->enum('host', 'BoincHost', $where_clause, $order_clause); |
328 | 328 | } |
329 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
329 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
330 | 330 | $db = BoincDb::get(); |
331 | 331 | return $db->enum_fields( |
332 | 332 | 'host', 'BoincHost', $fields, $where_clause, $order_clause |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $db = BoincDb::get(); |
442 | 442 | return $db->update($this, 'app', $clause); |
443 | 443 | } |
444 | - static function sum($field, $clause=null) { |
|
444 | + static function sum($field, $clause = null) { |
|
445 | 445 | $db = BoincDb::get(); |
446 | 446 | return $db->sum('app', $field, $clause); |
447 | 447 | } |
@@ -497,11 +497,11 @@ discard block |
||
497 | 497 | $db = BoincDb::get(); |
498 | 498 | return $db->insert('profile', $clause); |
499 | 499 | } |
500 | - static function enum($where_clause=null, $order_clause=null) { |
|
500 | + static function enum($where_clause = null, $order_clause = null) { |
|
501 | 501 | $db = BoincDb::get(); |
502 | 502 | return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause); |
503 | 503 | } |
504 | - static function enum_fields($fields, $where_clause=null, $order_clause=null) { |
|
504 | + static function enum_fields($fields, $where_clause = null, $order_clause = null) { |
|
505 | 505 | $db = BoincDb::get(); |
506 | 506 | return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause); |
507 | 507 | } |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | // apply this to any user-supplied strings used in queries |
782 | 782 | // |
783 | 783 | function boinc_real_escape_string($x) { |
784 | - if (version_compare(phpversion(),"4.3.0")>=0) { |
|
784 | + if (version_compare(phpversion(), "4.3.0") >= 0) { |
|
785 | 785 | return BoincDb::escape_string($x); |
786 | 786 | } else { |
787 | 787 | $x = str_replace("'", "\'", $x); |