Passed
Pull Request — master (#2712)
by Christian
13:50 queued 06:33
created
html/inc/db_ops.inc 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -96,7 +96,9 @@  discard block
 block discarded – undo
96 96
     if (!isset($types)) {
97 97
         $types = array();
98 98
         $constants = get_defined_constants(true);
99
-        foreach ($constants['mysqli'] as $c => $n) if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
99
+        foreach ($constants['mysqli'] as $c => $n) {
100
+            if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
101
+        }
100 102
     }
101 103
     return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown";
102 104
 }
@@ -376,13 +378,13 @@  discard block
 block discarded – undo
376 378
 
377 379
 
378 380
 function link_results($n, $mq, $query, $clauses) {
379
-    if ($n == '0') { // intentional compare by string
381
+    if ($n == '0') {
382
+// intentional compare by string
380 383
         return "0";
381 384
     } else {
382 385
         if(strlen($clauses)) {
383 386
             return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>";
384
-        }
385
-        else {
387
+        } else {
386 388
             return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>";
387 389
         }
388 390
         
@@ -392,7 +394,7 @@  discard block
 block discarded – undo
392 394
 // Determines if in stderr_out is an error reported and prints as human readable String
393 395
 // @return String A human readable string if error otherwise FALSE
394 396
 // @param String $stderr_out the stderr_out value to parse
395
-function stderr_error_string($stderr_out){
397
+function stderr_error_string($stderr_out) {
396 398
     $y = parse_element($stderr_out, "<error_code>");
397 399
     $x = 0;
398 400
     if ($y) {
@@ -1146,7 +1148,7 @@  discard block
 block discarded – undo
1146 1148
         // result has not been received yet, so show report deadline either
1147 1149
         // in green if in the future or in red if in the past.
1148 1150
         $timenow=time();
1149
-        if ($result->report_deadline==0)  {
1151
+        if ($result->report_deadline==0) {
1150 1152
             // not sent -- show create time in purple 
1151 1153
             $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1152 1154
         } else if ($result->report_deadline>=$timenow) {
Please login to merge, or discard this patch.
html/inc/cache.inc 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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";
Please login to merge, or discard this patch.
html/inc/text_transform.inc 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
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
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     $i=0;
284 284
     $linkpos=true;
285 285
     $out = "";
286
-    while (true){
286
+    while (true) {
287 287
         //Find a link
288 288
         //
289 289
         $linkpos=strpos($text, "<a ", $i);
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
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';
@@ -318,7 +318,8 @@  discard block
 block discarded – undo
318 318
     foreach ($search as $key => $value) {
319 319
         $replace[$key] = "<span class=\"mark\">".$value."</span>";
320 320
     }
321
-    if (substr(phpversion(), 0, 1) > 4) {   // PHP 4.x doesn't support str_ireplace
321
+    if (substr(phpversion(), 0, 1) > 4) {
322
+// PHP 4.x doesn't support str_ireplace
322 323
         return str_ireplace($search, $replace, $text);
323 324
     } else {
324 325
         return str_replace($search, $replace, $text);
Please login to merge, or discard this patch.
html/inc/uotd.inc 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 .= "&nbsp;&nbsp;". 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
Please login to merge, or discard this patch.
html/inc/image.inc 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
html/inc/akismet.inc 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
         $response = akismet_request($request, "$key.rest.akismet.com", "/1.1/comment-check");
44 44
 
45
-        if ("true" == $response[1]) { // Akismet says it's spam
45
+        if ("true" == $response[1]) {
46
+// Akismet says it's spam
46 47
             return false;
47 48
         } else {
48 49
             return true;
@@ -64,8 +65,10 @@  discard block
 block discarded – undo
64 65
     $response = '';
65 66
     if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) {
66 67
         fwrite($fs, $http_request);
67
-        while ( !feof($fs) )
68
-            $response .= fgets($fs, 1160); // One TCP-IP packet
68
+        while ( !feof($fs) ) {
69
+                    $response .= fgets($fs, 1160);
70
+        }
71
+        // One TCP-IP packet
69 72
         fclose($fs);
70 73
         $response = explode("\r\n\r\n", $response, 2);
71 74
     }
Please login to merge, or discard this patch.
html/inc/ReCaptcha/ReCaptcha.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * reCAPTCHA client.
31 31
  */
32
-class ReCaptcha
33
-{
32
+class ReCaptcha {
34 33
     /**
35 34
      * Version of this client library.
36 35
      * @const string
@@ -55,8 +54,7 @@  discard block
 block discarded – undo
55 54
      * @param string $secret shared secret between site and reCAPTCHA server.
56 55
      * @param RequestMethod $requestMethod method used to send the request. Defaults to POST.
57 56
      */
58
-    public function __construct($secret, RequestMethod $requestMethod = null)
59
-    {
57
+    public function __construct($secret, RequestMethod $requestMethod = null) {
60 58
         if (empty($secret)) {
61 59
             throw new \RuntimeException('No secret provided');
62 60
         }
@@ -82,8 +80,7 @@  discard block
 block discarded – undo
82 80
      * @param string $remoteIp The end user's IP address.
83 81
      * @return Response Response from the service.
84 82
      */
85
-    public function verify($response, $remoteIp = null)
86
-    {
83
+    public function verify($response, $remoteIp = null) {
87 84
         // Discard empty solution submissions
88 85
         if (empty($response)) {
89 86
             $recaptchaResponse = new Response(false, array('missing-input-response'));
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
 /**
30 30
  * Method used to send the request to the service.
31 31
  */
32
-interface RequestMethod
33
-{
32
+interface RequestMethod {
34 33
 
35 34
     /**
36 35
      * Submit the request with the specified parameters.
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/CurlPost.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
  * Note: this requires the cURL extension to be enabled in PHP
35 35
  * @see http://php.net/manual/en/book.curl.php
36 36
  */
37
-class CurlPost implements RequestMethod
38
-{
37
+class CurlPost implements RequestMethod {
39 38
     /**
40 39
      * URL to which requests are sent via cURL.
41 40
      * @const string
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
      */
49 48
     private $curl;
50 49
 
51
-    public function __construct(Curl $curl = null)
52
-    {
50
+    public function __construct(Curl $curl = null) {
53 51
         if (!is_null($curl)) {
54 52
             $this->curl = $curl;
55 53
         } else {
@@ -63,8 +61,7 @@  discard block
 block discarded – undo
63 61
      * @param RequestParameters $params Request parameters
64 62
      * @return string Body of the reCAPTCHA response
65 63
      */
66
-    public function submit(RequestParameters $params)
67
-    {
64
+    public function submit(RequestParameters $params) {
68 65
         $handle = $this->curl->init(self::SITE_VERIFY_URL);
69 66
 
70 67
         $options = array(
Please login to merge, or discard this patch.