@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | |
47 | 47 | // TODO: get rid of all the following |
48 | 48 | |
49 | -function print_checkbox($text,$name,$checked) { |
|
49 | +function print_checkbox($text, $name, $checked) { |
|
50 | 50 | echo "<input type=\"checkbox\" name=\"$name\"" |
51 | - . (strlen($checked) ? " checked=\"checked\"" : "") . ">" |
|
51 | + . (strlen($checked) ? " checked=\"checked\"" : "").">" |
|
52 | 52 | . "$text\n" |
53 | 53 | . "<p>\n"; |
54 | 54 | } |
55 | 55 | |
56 | -function print_radio_button($text,$name,$value,$checked) { |
|
56 | +function print_radio_button($text, $name, $value, $checked) { |
|
57 | 57 | echo "<input type=\"radio\" name=\"$name\" value=\"$value\"" |
58 | - . (strlen($checked) ? " checked=\"checked\"" : "") . ">" |
|
58 | + . (strlen($checked) ? " checked=\"checked\"" : "").">" |
|
59 | 59 | . "$text\n" |
60 | 60 | . "<br>\n"; |
61 | 61 | } |
62 | 62 | |
63 | -function print_text_field($text,$name,$value) { |
|
63 | +function print_text_field($text, $name, $value) { |
|
64 | 64 | echo "$text <input type=\"text\" size=\"10\" name=\"$name\" value=\"$value\">\n" |
65 | 65 | . "<p>\n"; |
66 | 66 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | if ($host == null) { |
92 | 92 | $host = "localhost"; |
93 | 93 | } |
94 | - $in = fopen("php://stdin","r"); |
|
94 | + $in = fopen("php://stdin", "r"); |
|
95 | 95 | print "Database username (default: owner of mysqld process): "; |
96 | 96 | $user = rtrim(fgets($in, 80)); |
97 | 97 | print "Database password (if any): "; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | -function print_login_form_ops($next_url='') { |
|
106 | +function print_login_form_ops($next_url = '') { |
|
107 | 107 | if ($next_url == '') $next_url = $_SERVER['REQUEST_URI']; |
108 | 108 | start_table(); |
109 | 109 | echo " |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | // return a list of the current, non-deprecated ones |
201 | 201 | // |
202 | 202 | function current_versions($avs) { |
203 | - foreach($avs as $av) { |
|
203 | + foreach ($avs as $av) { |
|
204 | 204 | foreach ($avs as $av2) { |
205 | 205 | if ($av->id == $av2->id) continue; |
206 | 206 | if ($av->platformid == $av2->platformid && $av->plan_class == $av2->plan_class && $av->version_num > $av2->version_num) { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | } |
211 | 211 | $x = array(); |
212 | - foreach($avs as $av) { |
|
212 | + foreach ($avs as $av) { |
|
213 | 213 | if (!$av->deprecated) $x[] = $av; |
214 | 214 | } |
215 | 215 | return $x; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | // |
322 | 322 | function unassign_badges($is_user, $item, $badges, $k) { |
323 | 323 | $list = null; |
324 | - for ($i=0; $i<count($badges); $i++) { |
|
324 | + for ($i = 0; $i < count($badges); $i++) { |
|
325 | 325 | if ($i == $k) continue; |
326 | 326 | $badge = $badges[$i]; |
327 | 327 | if ($list) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | function show_forum_rss_item($thread, $userid, $threads_only, $no_images) { |
33 | - $unique_url=secure_url_base()."forum_thread.php?id=".$thread->id; |
|
33 | + $unique_url = secure_url_base()."forum_thread.php?id=".$thread->id; |
|
34 | 34 | |
35 | 35 | $clause2 = " and hidden=0 "; |
36 | 36 | if ($userid) $clause2 .= "and user=$userid"; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | if (!count($posts)) return; |
43 | 43 | $post = $posts[0]; |
44 | - $post_date = gmdate('D, d M Y H:i:s',$post->timestamp).' GMT'; |
|
44 | + $post_date = gmdate('D, d M Y H:i:s', $post->timestamp).' GMT'; |
|
45 | 45 | $post_user = BOincUser::lookup_id($post->user); |
46 | 46 | BoincForumPrefs::lookup($post_user); |
47 | 47 | $options = new output_options(); |
@@ -84,25 +84,25 @@ discard block |
||
84 | 84 | |
85 | 85 | // Now construct header |
86 | 86 | // |
87 | - header ("Expires: " . gmdate('D, d M Y H:i:s', time()+86400) . " GMT"); |
|
87 | + header("Expires: ".gmdate('D, d M Y H:i:s', time() + 86400)." GMT"); |
|
88 | 88 | if (sizeof($threads)) { |
89 | 89 | $t = $threads[0]; |
90 | - $last_mod_time = $threads_only?$t->create_time:$t->timestamp; |
|
91 | - $create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; |
|
92 | - header ("Last-Modified: " . $create_date); |
|
90 | + $last_mod_time = $threads_only ? $t->create_time : $t->timestamp; |
|
91 | + $create_date = gmdate('D, d M Y H:i:s', $last_mod_time).' GMT'; |
|
92 | + header("Last-Modified: ".$create_date); |
|
93 | 93 | } else { |
94 | - $create_date = gmdate('D, d M Y H:i:s') . ' GMT'; |
|
94 | + $create_date = gmdate('D, d M Y H:i:s').' GMT'; |
|
95 | 95 | } |
96 | - header ("Content-Type: application/xml"); |
|
96 | + header("Content-Type: application/xml"); |
|
97 | 97 | |
98 | - $forum=BoincForum::lookup_id($forumid); |
|
98 | + $forum = BoincForum::lookup_id($forumid); |
|
99 | 99 | // Create channel header and open XML content |
100 | 100 | // |
101 | 101 | $description = PROJECT.": $forum->title"; |
102 | 102 | if ($userid) { |
103 | 103 | $description .= " (posts by $user->name)"; |
104 | 104 | } |
105 | - $channel_image = secure_url_base() . "rss_image.gif"; |
|
105 | + $channel_image = secure_url_base()."rss_image.gif"; |
|
106 | 106 | $language = "en-us"; |
107 | 107 | echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> |
108 | 108 | <rss version=\"2.0\"> |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | return "Sex"; |
33 | 33 | } |
34 | 34 | function categories() { |
35 | - return array ("Male", "Female", "Unknown"); |
|
35 | + return array("Male", "Female", "Unknown"); |
|
36 | 36 | } |
37 | 37 | function categorize($user) { |
38 | 38 | switch ($user->bolt->sex) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | function filter_form($sel_name, $sel_cat) { |
79 | 79 | global $categorizations; |
80 | - $checked = (!$sel_name || $sel_name == "none")?"checked":""; |
|
80 | + $checked = (!$sel_name || $sel_name == "none") ? "checked" : ""; |
|
81 | 81 | echo " |
82 | 82 | Filter by: |
83 | 83 | <ul> |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | <ul> |
92 | 92 | "; |
93 | 93 | foreach ($cats as $x) { |
94 | - $checked = ($sel_name == $name && $sel_cat == $x) ? "checked":""; |
|
94 | + $checked = ($sel_name == $name && $sel_cat == $x) ? "checked" : ""; |
|
95 | 95 | echo " |
96 | 96 | <li> <input type=radio name=filter value=\"$name:$x\" $checked> $x |
97 | 97 | "; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | function breakdown_form($sel_name) { |
105 | 105 | global $categorizations; |
106 | - $checked = (!$sel_name || $sel_name == "none")?"checked":""; |
|
106 | + $checked = (!$sel_name || $sel_name == "none") ? "checked" : ""; |
|
107 | 107 | echo " |
108 | 108 | Break down by: |
109 | 109 | <ul> |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | "; |
112 | 112 | foreach ($categorizations as $c) { |
113 | 113 | $name = $c->name(); |
114 | - $checked = ($sel_name == $name)?"checked":""; |
|
114 | + $checked = ($sel_name == $name) ? "checked" : ""; |
|
115 | 115 | echo " |
116 | 116 | <li> <input type=radio name=breakdown value=\"$name\" $checked> $name |
117 | 117 | "; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | $u->email_addr = UOTD_ADMIN_EMAIL; |
99 | 99 | $u->name = "UOTD admin"; |
100 | 100 | send_email($u, |
101 | - PROJECT . ": User of the Day pool is running low!", |
|
101 | + PROJECT.": User of the Day pool is running low!", |
|
102 | 102 | "The pool of approved candidates for User of the Day has". |
103 | - " reached your assigned threshold: there are now only " . $result->num_rows . " approved users.\n\n". |
|
103 | + " reached your assigned threshold: there are now only ".$result->num_rows." approved users.\n\n". |
|
104 | 104 | "To approve more candidates for User of the Day,". |
105 | - " go to the " . PROJECT . " administration page and click \"Screen user profiles\"" |
|
105 | + " go to the ".PROJECT." administration page and click \"Screen user profiles\"" |
|
106 | 106 | ); |
107 | 107 | } |
108 | 108 | |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | $profile->update("uotd_time = ".time()); |
148 | 148 | |
149 | 149 | send_email($user, |
150 | - "You're the " . PROJECT . " user of the day!", |
|
150 | + "You're the ".PROJECT." user of the day!", |
|
151 | 151 | "Congratulations!\n\nYou've been chosen as the " |
152 | - . PROJECT . " user of the day! |
|
153 | - Your profile will be featured on the " . PROJECT . " website for the next 24 hours." |
|
152 | + . PROJECT." user of the day! |
|
153 | + Your profile will be featured on the " . PROJECT." website for the next 24 hours." |
|
154 | 154 | ); |
155 | 155 | echo "Chose user $user->id as UOTD\n"; |
156 | 156 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | // To override this with your own policy, create a similar function in |
162 | 162 | // your own project.inc called uotd_candidates_query() |
163 | 163 | // |
164 | -function default_uotd_candidates_query(){ |
|
164 | +function default_uotd_candidates_query() { |
|
165 | 165 | $query = "SELECT * FROM profile,user WHERE profile.userid=user.id "; |
166 | 166 | $query .= " AND verification=1 "; |
167 | 167 | $query .= " AND expavg_credit>1 "; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | // get a list of profiles that have been 'approved' for UOTD, |
174 | 174 | // using a project-specific query if supplied in project.inc |
175 | 175 | // |
176 | -function count_uotd_candidates(){ |
|
177 | - $n = -1; // negative value returned on error |
|
176 | +function count_uotd_candidates() { |
|
177 | + $n = -1; // negative value returned on error |
|
178 | 178 | if (function_exists('uotd_candidates_query')) { |
179 | 179 | $query = uotd_candidates_query(); |
180 | 180 | } else { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $db = BoincDb::get(); |
185 | 185 | $result = $db->do_query($query); |
186 | - if($result) { |
|
186 | + if ($result) { |
|
187 | 187 | $n = $result->num_rows; |
188 | 188 | } |
189 | 189 | $result->free(); |
@@ -195,15 +195,15 @@ discard block |
||
195 | 195 | // |
196 | 196 | function generate_uotd_gadget($profile, $user) { |
197 | 197 | $x = "<font size='2'>\n"; |
198 | - $gadget = PROFILE_PATH."uotd_gadget.html"; |
|
199 | - if( $h = fopen($gadget, "w") ){ |
|
200 | - $age = time()-$profile->uotd_time; |
|
198 | + $gadget = PROFILE_PATH."uotd_gadget.html"; |
|
199 | + if ($h = fopen($gadget, "w")) { |
|
200 | + $age = time() - $profile->uotd_time; |
|
201 | 201 | echo "age: $age"; |
202 | - if($age <= 86400+3600) { // allow for slop |
|
202 | + if ($age <= 86400 + 3600) { // allow for slop |
|
203 | 203 | $x .= uotd_thumbnail($profile, $user); |
204 | 204 | $x .= user_links($user, BADGE_HEIGHT_MEDIUM); |
205 | 205 | $resp = sanitize_tags(output_transform($profile->response1)); |
206 | - $x .= " ". sub_sentence($resp, ' ', 250, true); |
|
206 | + $x .= " ".sub_sentence($resp, ' ', 250, true); |
|
207 | 207 | } |
208 | 208 | else { |
209 | 209 | $x .= "<font color='fuscia'> |
@@ -22,21 +22,21 @@ discard block |
||
22 | 22 | function time_diff_str($t1, $t2) { |
23 | 23 | if (!$t1 || !$t2) return "---"; |
24 | 24 | $diff = $t2 - $t1; |
25 | - if ($diff<0){ |
|
26 | - $pre="In "; |
|
27 | - $post=""; |
|
28 | - $diff=-$diff; |
|
25 | + if ($diff < 0) { |
|
26 | + $pre = "In "; |
|
27 | + $post = ""; |
|
28 | + $diff = -$diff; |
|
29 | 29 | } else { |
30 | 30 | if ($diff > 86400*30) { |
31 | 31 | return date_str($t1); |
32 | 32 | } |
33 | - $pre=""; |
|
34 | - $post=" ago"; |
|
33 | + $pre = ""; |
|
34 | + $post = " ago"; |
|
35 | 35 | } |
36 | 36 | $x = ""; |
37 | 37 | |
38 | 38 | if ($diff >= 3600*24) { |
39 | - $n = (int) ($diff/(3600*24)); |
|
39 | + $n = (int)($diff/(3600*24)); |
|
40 | 40 | if ($n == 1) { |
41 | 41 | $x .= "1 day "; |
42 | 42 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return $pre.$x.$post; |
46 | 46 | //$diff -= $n*3600*24; |
47 | 47 | } elseif ($diff >= 3600) { |
48 | - $n = (int) ($diff/3600); |
|
48 | + $n = (int)($diff/3600); |
|
49 | 49 | if ($n == 1) { |
50 | 50 | $x .= "1 hour "; |
51 | 51 | } else { |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | return $pre.$x.$post; |
55 | 55 | //$diff -= $n*3600; |
56 | 56 | } elseif ($diff >= 60) { |
57 | - $n = (int) ($diff/60); |
|
57 | + $n = (int)($diff/60); |
|
58 | 58 | if ($n == 1) { |
59 | 59 | $x .= "1 minute "; |
60 | 60 | } else { |
61 | 61 | $x .= $n." minutes "; |
62 | 62 | } |
63 | 63 | return $pre.$x.$post; |
64 | - } elseif($diff > 1 || $diff==0) { |
|
64 | + } elseif ($diff > 1 || $diff == 0) { |
|
65 | 65 | return $pre."$diff seconds".$post; |
66 | - } elseif($diff == 1){ |
|
66 | + } elseif ($diff == 1) { |
|
67 | 67 | return $pre."$diff seconds".$post; |
68 | 68 | } |
69 | 69 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | function bossa_batch_create($appid, $name, $calibration) { |
42 | 42 | $now = time(); |
43 | - $c = $calibration?"1":"0"; |
|
43 | + $c = $calibration ? "1" : "0"; |
|
44 | 44 | return BossaBatch::insert("(create_time, app_id, name, calibration) values ($now, $appid, '$name', $c)"); |
45 | 45 | } |
46 | 46 |
@@ -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 | } |
@@ -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 | ?> |