@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | function boinc_recaptcha_get_html($publickey) { |
| 34 | 34 | if ($publickey) { |
| 35 | - return '<div class="g-recaptcha" data-sitekey="' . $publickey . '"></div>'; |
|
| 35 | + return '<div class="g-recaptcha" data-sitekey="'.$publickey.'"></div>'; |
|
| 36 | 36 | } else { |
| 37 | 37 | return ''; |
| 38 | 38 | } |
@@ -164,7 +164,7 @@ |
||
| 164 | 164 | $user->prefs = $prefs; |
| 165 | 165 | } |
| 166 | 166 | function privilege($specialbit) { |
| 167 | - return (substr($this->special_user, $specialbit,1)==1); |
|
| 167 | + return (substr($this->special_user, $specialbit,1)==1); |
|
| 168 | 168 | } |
| 169 | 169 | function update($clause) { |
| 170 | 170 | $db = BoincDb::get(); |
@@ -215,7 +215,7 @@ |
||
| 215 | 215 | // |
| 216 | 216 | $fl = BoincForumLogging::lookup(0, 0); |
| 217 | 217 | if ($fl) { |
| 218 | - if ($fl->timestamp<time()-MAX_FORUM_LOGGING_TIME){ |
|
| 218 | + if ($fl->timestamp<time()-MAX_FORUM_LOGGING_TIME) { |
|
| 219 | 219 | BoincForumLogging::delete_aux("timestamp<'".(time()-MAX_FORUM_LOGGING_TIME)."' and userid != 0"); |
| 220 | 220 | BoincForumLogging::replace(0, 0, time()); |
| 221 | 221 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $db = BoincDb::get(); |
| 28 | 28 | return $db->lookup('category', 'BoincCategory', $clause); |
| 29 | 29 | } |
| 30 | - static function enum($clause=null) { |
|
| 30 | + static function enum($clause = null) { |
|
| 31 | 31 | $db = BoincDb::get(); |
| 32 | 32 | return $db->enum('category', 'BoincCategory', $clause); |
| 33 | 33 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $db = BoincDb::get(); |
| 79 | 79 | return $db->update($this, 'thread', $clause); |
| 80 | 80 | } |
| 81 | - static function enum($clause="") { |
|
| 81 | + static function enum($clause = "") { |
|
| 82 | 82 | $db = BoincDb::get(); |
| 83 | 83 | return $db->enum('thread', 'BoincThread', $clause); |
| 84 | 84 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $db = BoincDb::get(); |
| 143 | 143 | $ret = $db->insert('forum_preferences', $clause); |
| 144 | 144 | } |
| 145 | - static function lookup(&$user, $nocache=false) { |
|
| 145 | + static function lookup(&$user, $nocache = false) { |
|
| 146 | 146 | if (!$user) return; |
| 147 | 147 | if (isset($user->prefs)) return; |
| 148 | 148 | if (!$nocache && isset(self::$cache[$user->id])) { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $user->prefs = $prefs; |
| 165 | 165 | } |
| 166 | 166 | function privilege($specialbit) { |
| 167 | - return (substr($this->special_user, $specialbit,1)==1); |
|
| 167 | + return (substr($this->special_user, $specialbit, 1) == 1); |
|
| 168 | 168 | } |
| 169 | 169 | function update($clause) { |
| 170 | 170 | $db = BoincDb::get(); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $db = BoincDb::get(); |
| 176 | 176 | return $db->delete_aux('forum_preferences', "userid=$this->userid"); |
| 177 | 177 | } |
| 178 | - static function enum($clause=null) { |
|
| 178 | + static function enum($clause = null) { |
|
| 179 | 179 | $db = BoincDb::get(); |
| 180 | 180 | return $db->enum('forum_preferences', 'BoincForumPrefs', $clause); |
| 181 | 181 | } |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | // |
| 216 | 216 | $fl = BoincForumLogging::lookup(0, 0); |
| 217 | 217 | if ($fl) { |
| 218 | - if ($fl->timestamp<time()-MAX_FORUM_LOGGING_TIME){ |
|
| 219 | - BoincForumLogging::delete_aux("timestamp<'".(time()-MAX_FORUM_LOGGING_TIME)."' and userid != 0"); |
|
| 218 | + if ($fl->timestamp < time() - MAX_FORUM_LOGGING_TIME) { |
|
| 219 | + BoincForumLogging::delete_aux("timestamp<'".(time() - MAX_FORUM_LOGGING_TIME)."' and userid != 0"); |
|
| 220 | 220 | BoincForumLogging::replace(0, 0, time()); |
| 221 | 221 | } |
| 222 | 222 | } else { |
@@ -326,10 +326,10 @@ discard block |
||
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | -define ('NOTIFY_FRIEND_REQ', 1); |
|
| 330 | -define ('NOTIFY_FRIEND_ACCEPT', 2); |
|
| 331 | -define ('NOTIFY_PM', 3); |
|
| 332 | -define ('NOTIFY_SUBSCRIBED_THREAD', 4); |
|
| 333 | -define ('NOTIFY_SUBSCRIBED_FORUM', 5); |
|
| 329 | +define('NOTIFY_FRIEND_REQ', 1); |
|
| 330 | +define('NOTIFY_FRIEND_ACCEPT', 2); |
|
| 331 | +define('NOTIFY_PM', 3); |
|
| 332 | +define('NOTIFY_SUBSCRIBED_THREAD', 4); |
|
| 333 | +define('NOTIFY_SUBSCRIBED_FORUM', 5); |
|
| 334 | 334 | |
| 335 | 335 | ?> |
@@ -24,13 +24,13 @@ |
||
| 24 | 24 | function update_average($now, $work_start_time, $work, &$avg, &$avg_time) { |
| 25 | 25 | if ($avg_time) { |
| 26 | 26 | $diff = $now - $avg_time; |
| 27 | - if ($diff <0) $diff = 0; |
|
| 27 | + if ($diff < 0) $diff = 0; |
|
| 28 | 28 | $diff_days = $diff/86400; |
| 29 | 29 | $weight = exp(-$diff*M_LN2/CREDIT_HALF_LIFE); |
| 30 | 30 | $avg *= $weight; |
| 31 | 31 | |
| 32 | - if ((1.0-$weight)>0.000001) { |
|
| 33 | - $avg += (1.0-$weight)*($work/$diff_days); |
|
| 32 | + if ((1.0 - $weight) > 0.000001) { |
|
| 33 | + $avg += (1.0 - $weight)*($work/$diff_days); |
|
| 34 | 34 | } |
| 35 | 35 | else { |
| 36 | 36 | $avg += M_LN2*$work*86400/CREDIT_HALF_LIFE; |
@@ -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) { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | function print_text_field($text,$name,$value) { |
| 64 | 64 | echo "$text <input type=\"text\" size=\"10\" name=\"$name\" value=\"$value\">\n" |
| 65 | - . "<p>\n"; |
|
| 65 | + . "<p>\n"; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | function row($x, $y) { |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $db->do_query($q4); |
| 379 | 379 | return 2; |
| 380 | 380 | } else if (!$db->do_query($q3)) { |
| 381 | - echo "MySQL command '$q3' failed:<br/>unable to cancel workunits and trigger transitioner.<br>\n"; |
|
| 381 | + echo "MySQL command '$q3' failed:<br/>unable to cancel workunits and trigger transitioner.<br>\n"; |
|
| 382 | 382 | $db->do_query($q4); |
| 383 | 383 | return 3; |
| 384 | 384 | } |
@@ -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) { |
@@ -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'> |
@@ -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 |
@@ -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 | } |
@@ -22,7 +22,7 @@ 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){ |
|
| 25 | + if ($diff<0) { |
|
| 26 | 26 | $pre="In "; |
| 27 | 27 | $post=""; |
| 28 | 28 | $diff=-$diff; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | return $pre.$x.$post; |
| 64 | 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 | } |
@@ -11,10 +11,10 @@ |
||
| 11 | 11 | |
| 12 | 12 | spl_autoload_register(function ($class) { |
| 13 | 13 | if (substr($class, 0, 10) !== 'ReCaptcha\\') { |
| 14 | - /* If the class does not lie under the "ReCaptcha" namespace, |
|
| 14 | + /* If the class does not lie under the "ReCaptcha" namespace, |
|
| 15 | 15 | * then we can exit immediately. |
| 16 | 16 | */ |
| 17 | - return; |
|
| 17 | + return; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /* All of the classes have names like "ReCaptcha\Foo", so we need |
@@ -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 | } |
@@ -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]"; |
@@ -358,10 +358,10 @@ |
||
| 358 | 358 | $db = BoincDb::get(); |
| 359 | 359 | return $db->enum('result', 'BoincResult', $where_clause); |
| 360 | 360 | } |
| 361 | - static function enum_fields($fields, $where_clause, $order_clause) { |
|
| 361 | + static function enum_fields($fields, $where_clause, $order_clause) { |
|
| 362 | 362 | $db = BoincDb::get(); |
| 363 | - return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause); |
|
| 364 | - } |
|
| 363 | + return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause); |
|
| 364 | + } |
|
| 365 | 365 | function update($clause) { |
| 366 | 366 | $db = BoincDb::get(); |
| 367 | 367 | return $db->update($this, 'result', $clause); |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | // close() closes the connection. |
| 45 | 45 | |
| 46 | 46 | class BoincDb { |
| 47 | - static $instance; // a DbConn object, or null |
|
| 48 | - static $dbnum; // which replica we're connected to |
|
| 47 | + static $instance; // a DbConn object, or null |
|
| 48 | + static $dbnum; // which replica we're connected to |
|
| 49 | 49 | |
| 50 | 50 | // connect to DB $dbnum (0, 1, ...) |
| 51 | 51 | // If the requested DB doesn't exist or connection fails, connect to DB 0. |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | self::$instance = null; |
| 57 | 57 | $config = get_config(); |
| 58 | 58 | if ($dbnum) { |
| 59 | - $r = $dbnum==1?'':strval($dbnum); |
|
| 59 | + $r = $dbnum == 1 ? '' : strval($dbnum); |
|
| 60 | 60 | $host = parse_config($config, sprintf('<replica%s_db_host>', $r)); |
| 61 | 61 | $name = parse_config($config, sprintf('<replica%s_db_name>', $r)); |
| 62 | 62 | $user = parse_config($config, sprintf('<replica%s_db_user>', $r)); |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | $db = BoincDb::get(); |
| 202 | 202 | return $db->update($this, 'user', $clause); |
| 203 | 203 | } |
| 204 | - static function enum($where_clause, $order_clause=null) { |
|
| 204 | + static function enum($where_clause, $order_clause = null) { |
|
| 205 | 205 | $db = BoincDb::get(); |
| 206 | 206 | return $db->enum('user', 'BoincUser', $where_clause, $order_clause); |
| 207 | 207 | } |
| 208 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
| 208 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
| 209 | 209 | $db = BoincDb::get(); |
| 210 | 210 | return $db->enum_fields( |
| 211 | 211 | 'user', 'BoincUser', $fields, $where_clause, $order_clause |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $db = BoincDb::get(); |
| 256 | 256 | return $db->update($this, 'team', $clause); |
| 257 | 257 | } |
| 258 | - static function enum($where_clause, $order_clause=null) { |
|
| 258 | + static function enum($where_clause, $order_clause = null) { |
|
| 259 | 259 | $db = BoincDb::get(); |
| 260 | 260 | return $db->enum('team', 'BoincTeam', $where_clause, $order_clause); |
| 261 | 261 | } |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $db = BoincDb::get(); |
| 281 | 281 | return $db->max('team', $field); |
| 282 | 282 | } |
| 283 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
| 283 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
| 284 | 284 | $db = BoincDb::get(); |
| 285 | 285 | return $db->enum_fields( |
| 286 | 286 | 'team', 'BoincTeam', $fields, $where_clause, $order_clause |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | $db = BoincDb::get(); |
| 319 | 319 | return $db->delete($this, 'host'); |
| 320 | 320 | } |
| 321 | - static function enum($where_clause, $order_clause=null) { |
|
| 321 | + static function enum($where_clause, $order_clause = null) { |
|
| 322 | 322 | $db = BoincDb::get(); |
| 323 | 323 | return $db->enum('host', 'BoincHost', $where_clause, $order_clause); |
| 324 | 324 | } |
| 325 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
| 325 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
| 326 | 326 | $db = BoincDb::get(); |
| 327 | 327 | return $db->enum_fields( |
| 328 | 328 | 'host', 'BoincHost', $fields, $where_clause, $order_clause |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $db = BoincDb::get(); |
| 445 | 445 | return $db->update($this, 'app', $clause); |
| 446 | 446 | } |
| 447 | - static function sum($field, $clause=null) { |
|
| 447 | + static function sum($field, $clause = null) { |
|
| 448 | 448 | $db = BoincDb::get(); |
| 449 | 449 | return $db->sum('app', $field, $clause); |
| 450 | 450 | } |
@@ -502,11 +502,11 @@ discard block |
||
| 502 | 502 | $db = BoincDb::get(); |
| 503 | 503 | return $db->insert('profile', $clause); |
| 504 | 504 | } |
| 505 | - static function enum($where_clause=null, $order_clause=null) { |
|
| 505 | + static function enum($where_clause = null, $order_clause = null) { |
|
| 506 | 506 | $db = BoincDb::get(); |
| 507 | 507 | return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause); |
| 508 | 508 | } |
| 509 | - static function enum_fields($fields, $where_clause=null, $order_clause=null) { |
|
| 509 | + static function enum_fields($fields, $where_clause = null, $order_clause = null) { |
|
| 510 | 510 | $db = BoincDb::get(); |
| 511 | 511 | return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause); |
| 512 | 512 | } |
@@ -901,12 +901,12 @@ discard block |
||
| 901 | 901 | return $db->enum('consent', 'BoincConsent', $where_clause); |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | - static function insert ($clause) { |
|
| 904 | + static function insert($clause) { |
|
| 905 | 905 | $db = BoincDb::get(); |
| 906 | 906 | return $db->insert('consent', $clause); |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | - static function update ($clause) { |
|
| 909 | + static function update($clause) { |
|
| 910 | 910 | $db = BoincDb::get(); |
| 911 | 911 | return $db->update_aux('consent', $clause); |
| 912 | 912 | } |
@@ -931,17 +931,17 @@ discard block |
||
| 931 | 931 | return $db->lookup('consent_type', 'BoincConsentType', $clause); |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | - static function enum($where_clause, $order_clause=null) { |
|
| 934 | + static function enum($where_clause, $order_clause = null) { |
|
| 935 | 935 | $db = BoincDb::get(); |
| 936 | 936 | return $db->enum('consent_type', 'BoincConsentType', $where_clause, $order_clause); |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | - static function insert ($clause) { |
|
| 939 | + static function insert($clause) { |
|
| 940 | 940 | $db = BoincDb::get(); |
| 941 | 941 | return $db->insert('consent_type', $clause); |
| 942 | 942 | } |
| 943 | 943 | |
| 944 | - static function update ($clause) { |
|
| 944 | + static function update($clause) { |
|
| 945 | 945 | $db = BoincDb::get(); |
| 946 | 946 | return $db->update_aux('consent_type', $clause); |
| 947 | 947 | } |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | return $db->lookup('latest_consent', 'BoincLatestConsent', $clause); |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | - static function enum($where_clause, $order_clause=null) { |
|
| 970 | + static function enum($where_clause, $order_clause = null) { |
|
| 971 | 971 | $db = BoincDb::get(); |
| 972 | 972 | return $db->enum('latest_consent', 'BoincLatestConsent', $where_clause, $order_clause); |
| 973 | 973 | } |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | // apply this to any user-supplied strings used in queries |
| 979 | 979 | // |
| 980 | 980 | function boinc_real_escape_string($x) { |
| 981 | - if (version_compare(phpversion(),"4.3.0")>=0) { |
|
| 981 | + if (version_compare(phpversion(), "4.3.0") >= 0) { |
|
| 982 | 982 | return BoincDb::escape_string($x); |
| 983 | 983 | } else { |
| 984 | 984 | $x = str_replace("'", "\'", $x); |