@@ -70,7 +70,7 @@ |
||
70 | 70 | $now = time(); |
71 | 71 | $post->update("signature=$add_signature, content='$content', modified=$now"); |
72 | 72 | |
73 | - if ($can_edit_title){ |
|
73 | + if ($can_edit_title) { |
|
74 | 74 | $title = trim($title); |
75 | 75 | $title = sanitize_tags($title); |
76 | 76 | $title = BoincDb::escape_string($title); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | function mod_comment() { |
28 | 28 | $x = ""; |
29 | 29 | $reason = post_str('reason', true); |
30 | - if ($reason){ |
|
30 | + if ($reason) { |
|
31 | 31 | $x .= "\nModerator comment: $reason |
32 | 32 | "; |
33 | 33 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | // See if "action" is provided - either through post or get |
64 | 64 | if (!post_str('action', true)) { |
65 | - if (!get_str('action', true)){ |
|
65 | + if (!get_str('action', true)) { |
|
66 | 66 | error_page(tra("You must specify an action...")); |
67 | 67 | } else { |
68 | 68 | $action = get_str('action'); |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | $explanation = null; |
75 | -if ($action=="hide"){ |
|
75 | +if ($action=="hide") { |
|
76 | 76 | $result = hide_post($post, $thread, $forum); |
77 | 77 | $action_name = "hidden"; |
78 | 78 | $explanation = hide_explanation(); |
79 | -} elseif ($action=="unhide"){ |
|
79 | +} elseif ($action=="unhide") { |
|
80 | 80 | $result = unhide_post($post, $thread, $forum); |
81 | 81 | $action_name = "unhidden"; |
82 | -} elseif ($action=="delete"){ |
|
82 | +} elseif ($action=="delete") { |
|
83 | 83 | $result = delete_post($post, $thread, $forum); |
84 | 84 | if (!$result) error_page("Can't delete post"); |
85 | 85 | page_head("Post deleted"); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | page_tail(); |
98 | 98 | exit; |
99 | -} elseif ($action=="move"){ |
|
99 | +} elseif ($action=="move") { |
|
100 | 100 | $destid = post_int('threadid'); |
101 | 101 | $new_thread = BoincThread::lookup_id($destid); |
102 | 102 | if (!$new_thread) error_page("No such thread"); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | "; |
118 | 118 | $explanation .= mod_comment(); |
119 | 119 | $action_name = "moved to another thread"; |
120 | -} elseif ($action=="banish_user"){ |
|
120 | +} elseif ($action=="banish_user") { |
|
121 | 121 | $auth = false; |
122 | 122 | if (defined("MODERATORS_CAN_BANISH") && $user->prefs->privilege(S_MODERATOR)) { |
123 | 123 | $auth = true; |
@@ -36,7 +36,8 @@ |
||
36 | 36 | $port = null; |
37 | 37 | } |
38 | 38 | //if (version_compare(PHP_VERSION, '5.3.0') < 0) { |
39 | - if (1) { // don't use persistent connections for now |
|
39 | + if (1) { |
|
40 | +// don't use persistent connections for now |
|
40 | 41 | $this->db_conn = @new mysqli($host, $user, $passwd, $name, $port); |
41 | 42 | } else { |
42 | 43 | $this->db_conn = @new mysqli("p:".$host, $user, $passwd, $name, $port); |
@@ -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( |
@@ -31,8 +31,7 @@ |
||
31 | 31 | |
32 | 32 | if ((1.0-$weight)>0.000001) { |
33 | 33 | $avg += (1.0-$weight)*($work/$diff_days); |
34 | - } |
|
35 | - else { |
|
34 | + } else { |
|
36 | 35 | $avg += M_LN2*$work*86400/CREDIT_HALF_LIFE; |
37 | 36 | } |
38 | 37 | } else if ($work) { |
@@ -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,7 +49,7 @@ 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 | 54 | $in[]="<b>";$out[]="[b]"; |
55 | 55 | $in[]="</b>";$out[]="[/b]"; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | // check cache size every once in a while, purge if too big |
109 | 109 | // |
110 | -function cache_check_diskspace(){ |
|
110 | +function cache_check_diskspace() { |
|
111 | 111 | if ((rand() % CACHE_SIZE_CHECK_FREQ)) return; |
112 | 112 | if (disk_usage("../cache") < MAX_CACHE_USAGE) return; |
113 | 113 | $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL, |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | clean_cache($x, "../cache"); |
117 | 117 | } |
118 | 118 | |
119 | -function cache_need_to_regenerate($path, $max_age){ |
|
119 | +function cache_need_to_regenerate($path, $max_age) { |
|
120 | 120 | $regenerate = false; |
121 | 121 | $request = apache_request_headers(); |
122 | 122 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | // Returns cached data or false if nothing was found |
142 | -function get_cached_data($max_age, $params=""){ |
|
142 | +function get_cached_data($max_age, $params="") { |
|
143 | 143 | global $no_cache; |
144 | 144 | |
145 | 145 | if ($no_cache) return; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | // DEPRECATED |
168 | -function start_cache($max_age, $params=""){ |
|
168 | +function start_cache($max_age, $params="") { |
|
169 | 169 | global $no_cache, $caching, $memcache; |
170 | 170 | |
171 | 171 | if ($no_cache) return; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $regenerate = cache_need_to_regenerate($path, $max_age); |
189 | 189 | } |
190 | 190 | //Is the stored version too old, do we need to regenerate it? |
191 | - if ($regenerate){ |
|
191 | + if ($regenerate) { |
|
192 | 192 | // If cached version is too old (or non-existent) |
193 | 193 | // generate the page and write to cache |
194 | 194 | // |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | // write output buffer both to client and to cache |
230 | 230 | // DEPRECATED |
231 | -function end_cache($max_age,$params=""){ |
|
231 | +function end_cache($max_age,$params="") { |
|
232 | 232 | global $no_cache; |
233 | 233 | if ($no_cache) return; |
234 | 234 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | -function set_cached_data($max_age, $data, $params=""){ |
|
256 | +function set_cached_data($max_age, $data, $params="") { |
|
257 | 257 | // for the benefit of hackers |
258 | 258 | if (strstr($params, "..")) { |
259 | 259 | return "bad params"; |
@@ -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,7 +173,7 @@ 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(){ |
|
176 | +function count_uotd_candidates() { |
|
177 | 177 | $n = -1; // negative value returned on error |
178 | 178 | if (function_exists('uotd_candidates_query')) { |
179 | 179 | $query = uotd_candidates_query(); |
@@ -196,16 +196,16 @@ discard block |
||
196 | 196 | function generate_uotd_gadget($profile, $user) { |
197 | 197 | $x = "<font size='2'>\n"; |
198 | 198 | $gadget = PROFILE_PATH."uotd_gadget.html"; |
199 | - if( $h = fopen($gadget, "w") ){ |
|
199 | + if( $h = fopen($gadget, "w") ) { |
|
200 | 200 | $age = time()-$profile->uotd_time; |
201 | 201 | echo "age: $age"; |
202 | - if($age <= 86400+3600) { // allow for slop |
|
202 | + if($age <= 86400+3600) { |
|
203 | +// allow for slop |
|
203 | 204 | $x .= uotd_thumbnail($profile, $user); |
204 | 205 | $x .= user_links($user, BADGE_HEIGHT_MEDIUM); |
205 | 206 | $resp = sanitize_tags(output_transform($profile->response1)); |
206 | 207 | $x .= " ". sub_sentence($resp, ' ', 250, true); |
207 | - } |
|
208 | - else { |
|
208 | + } else { |
|
209 | 209 | $x .= "<font color='fuscia'> |
210 | 210 | There is no User of the Day today. |
211 | 211 | Only volunteers who have created a Profile |
@@ -46,7 +46,7 @@ discard block |
||
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); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 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); |