Passed
Push — master ( 7a5289...3d9538 )
by Kevin
09:32
created
html/inc/ReCaptcha/Response.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * The response returned from the service.
31 31
  */
32
-class Response
33
-{
32
+class Response {
34 33
     /**
35 34
      * Succes or failure.
36 35
      * @var boolean
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
      * @param string $json
50 49
      * @return \ReCaptcha\Response
51 50
      */
52
-    public static function fromJson($json)
53
-    {
51
+    public static function fromJson($json) {
54 52
         $responseData = json_decode($json, true);
55 53
 
56 54
         if (!$responseData) {
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
      * @param boolean $success
75 73
      * @param array $errorCodes
76 74
      */
77
-    public function __construct($success, array $errorCodes = array())
78
-    {
75
+    public function __construct($success, array $errorCodes = array()) {
79 76
         $this->success = $success;
80 77
         $this->errorCodes = $errorCodes;
81 78
     }
@@ -85,8 +82,7 @@  discard block
 block discarded – undo
85 82
      *
86 83
      * @return boolean
87 84
      */
88
-    public function isSuccess()
89
-    {
85
+    public function isSuccess() {
90 86
         return $this->success;
91 87
     }
92 88
 
@@ -95,8 +91,7 @@  discard block
 block discarded – undo
95 91
      *
96 92
      * @return array
97 93
      */
98
-    public function getErrorCodes()
99
-    {
94
+    public function getErrorCodes() {
100 95
         return $this->errorCodes;
101 96
     }
102 97
 }
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestParameters.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Stores and formats the parameters for the request to the reCAPTCHA service.
31 31
  */
32
-class RequestParameters
33
-{
32
+class RequestParameters {
34 33
     /**
35 34
      * Site secret.
36 35
      * @var string
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
      * @param string $remoteIp User's IP address.
64 63
      * @param string $version Version of this client library.
65 64
      */
66
-    public function __construct($secret, $response, $remoteIp = null, $version = null)
67
-    {
65
+    public function __construct($secret, $response, $remoteIp = null, $version = null) {
68 66
         $this->secret = $secret;
69 67
         $this->response = $response;
70 68
         $this->remoteIp = $remoteIp;
@@ -76,8 +74,7 @@  discard block
 block discarded – undo
76 74
      *
77 75
      * @return array Array formatted parameters.
78 76
      */
79
-    public function toArray()
80
-    {
77
+    public function toArray() {
81 78
         $params = array('secret' => $this->secret, 'response' => $this->response);
82 79
 
83 80
         if (!is_null($this->remoteIp)) {
@@ -96,8 +93,7 @@  discard block
 block discarded – undo
96 93
      *
97 94
      * @return string Query string formatted parameters.
98 95
      */
99
-    public function toQueryString()
100
-    {
96
+    public function toQueryString() {
101 97
         return http_build_query($this->toArray(), '', '&');
102 98
     }
103 99
 }
Please login to merge, or discard this patch.
html/inc/time.inc 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
html/inc/forum_db.inc 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
html/inc/sandbox.inc 1 patch
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 // Return path of sandbox directory for the given user.
26 26
 // Create dir if not present.
27 27
 //
28
-if (!function_exists("sandbox_dir")){
28
+if (!function_exists("sandbox_dir")) {
29 29
 function sandbox_dir($user) {
30 30
     $dir = parse_config(get_config(), "<sandbox_dir>");
31 31
     if (!$dir) { $dir = "../../sandbox/"; }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     foreach ($files as $file) {
55 55
         $path = $dir."/".$file;
56 56
         list($err, $file_size, $file_md5) = sandbox_parse_link_file($path);
57
-        if (!$err){
57
+        if (!$err) {
58 58
             if (strcmp($md5, $file_md5) == 0) {
59 59
                 //echo "this file with $md5 already exisits with another name $file";
60 60
                 $exist = 1;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     }
126 126
     $files = sandbox_file_names($user);
127 127
     foreach ($files as $f) {
128
-        if(preg_match("/$regexp/",$f)){
128
+        if(preg_match("/$regexp/",$f)) {
129 129
             $x .= "<option value=\"$f\">$f</option>\n";
130 130
         }
131 131
     }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 //check if a file is still being used by a unfinished batch
138 138
 //
139
-function sandbox_file_in_use($user, $file){
139
+function sandbox_file_in_use($user, $file) {
140 140
     $ufiles = array();
141 141
 
142 142
     // batch status: 2(completed), 3(aborted)
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
     $pbatches = BoincBatch::enum("user_id = $user->id and state != 2 and state != 3");
145 145
     if (!$pbatches) return false;
146 146
 
147
-    foreach ($pbatches as $batch){
147
+    foreach ($pbatches as $batch) {
148 148
         $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" );
149
-        if ($wus == null){
149
+        if ($wus == null) {
150 150
             //echo " no workunit for this batch<br/>"; 
151 151
             continue;
152 152
         }
153
-        foreach($wus as $wu){
153
+        foreach($wus as $wu) {
154 154
             $x = "<in>".$wu->xml_doc."</in>";
155 155
             $x = simplexml_load_string($x);
156 156
             global $fanout;
157
-            foreach($x->workunit->file_ref as $fr){
157
+            foreach($x->workunit->file_ref as $fr) {
158 158
                 $pname = (string)$fr->file_name;
159 159
                 $ufiles[] = $pname;
160 160
             }
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
     $dir = sandbox_dir($user);
166 166
     $path = $dir."/".$file;
167 167
     list($err, $size, $md5) = sandbox_parse_link_file($path);
168
-    if (!$err){
168
+    if (!$err) {
169 169
         $f = sandbox_file_name($user, $md5);
170 170
         foreach($ufiles as $uf) {
171
-            if (strcmp($f,$uf) == 0){
171
+            if (strcmp($f,$uf) == 0) {
172 172
                 return true;
173 173
             }
174 174
             
Please login to merge, or discard this patch.
html/inc/team_types.inc 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     return 0;
60 60
 }
61 61
 
62
-function team_type_select($selected_type, $allow_none=false){
62
+function team_type_select($selected_type, $allow_none=false) {
63 63
     global $team_types;
64 64
 
65 65
     $types = $team_types;
Please login to merge, or discard this patch.
html/inc/prefs.inc 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -556,7 +556,7 @@
 block discarded – undo
556 556
 function print_prefs_form(
557 557
     $action, $subset, $venue, $user, $prefs, $cols, $error=false,
558 558
     $project_error=false
559
-){
559
+) {
560 560
     if ($action == "add") {
561 561
         $script = "add_venue.php";
562 562
         $submit_value = tra("Add preferences");
Please login to merge, or discard this patch.
html/inc/translation.inc 1 patch
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             continue;
69 69
         }
70 70
         // only do files ending in .po
71
-        if (substr($file,-3) != ".po"){
71
+        if (substr($file,-3) != ".po") {
72 72
             //debug("File $file with unknown extension found in $info_dir");
73 73
             continue;
74 74
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             "-------------Compiling $transdir$file------------", 0
77 77
         );
78 78
         $language = parse_po_file($langdir.$transdir.$file);
79
-        if (!$language){
79
+        if (!$language) {
80 80
             language_log(
81 81
                 "WARNING: Could not parse language ".$file
82 82
             );
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             );
96 96
             exit;
97 97
         }
98
-        foreach ($language as $key => $value){
98
+        foreach ($language as $key => $value) {
99 99
             if ($value !== "") {
100 100
                 // Skip if the msgstr is empty
101 101
                 fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n");
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
     $parsing_token = false;
121 121
     $parsing_text = false;
122 122
     $output = array();
123
-    for ($i=0; $i<sizeof($translation_file); $i++){
123
+    for ($i=0; $i<sizeof($translation_file); $i++) {
124 124
         $entry = trim($translation_file[$i]);
125 125
         //echo "line $i: $entry\n";
126 126
         if (substr($entry, 0, 1)=="#") {
127 127
             continue;
128 128
         } elseif (strpos($entry, "msgid") !== false) {
129
-            if (!$first_entry){
129
+            if (!$first_entry) {
130 130
                 //If this is not the first, save the previous entry
131 131
                 $output[$current_token]=$current_token_text;
132 132
             }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     
149 149
     // Get the last token
150 150
     //
151
-    if ($current_token && $current_token_text){
151
+    if ($current_token && $current_token_text) {
152 152
         $output[$current_token] = $current_token_text;
153 153
     }
154 154
     return $output;
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
     
180 180
     // Find the string in the user's language
181 181
     //
182
-    foreach ($languages_in_use as $language){
182
+    foreach ($languages_in_use as $language) {
183 183
         if (isset($language_lookup_array[$language][$text])) {
184 184
             $text = $language_lookup_array[$language][$text];
185 185
             break;
186
-        } else if ($language=="en"){ 
186
+        } else if ($language=="en") {
187 187
             // This language is defined in the code and is always available
188 188
             break;
189 189
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     // Replace relevant substrings with given arguments.
193 193
     // Use strtr to avoid problems if an argument contains %n.
194 194
     $replacements = array();
195
-    for ($i=1; $i<func_num_args(); $i++){
195
+    for ($i=1; $i<func_num_args(); $i++) {
196 196
         $replacements["%".$i] = func_get_arg($i);
197 197
     }
198 198
     $text = strtr($text, $replacements);
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     if ($loglevel==1) $msg = "[ Warning  ]";
217 217
     if ($loglevel==2) $msg = "[ CRITICAL ]";
218 218
 
219
-    if ($loglevel >= $lang_log_level){
219
+    if ($loglevel >= $lang_log_level) {
220 220
         echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n";
221 221
     }
222 222
 }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 // (by looking at cookies and browser settings)
226 226
 // cookies have highest priority.
227 227
 
228
-if (isset($_COOKIE['lang'])){
228
+if (isset($_COOKIE['lang'])) {
229 229
     $language_string = $_COOKIE['lang'].",";
230 230
 } else {
231 231
     $language_string = '';
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 for ($i=0; $i<sizeof($client_languages); $i++) {
259 259
     if ((strlen($client_languages[$i])>2)
260 260
         && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")
261
-    ){
261
+    ) {
262 262
         // If this is defined as primary-secondary, represent it as xx_YY
263 263
         //
264 264
         $language = substr(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     //
286 286
     $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc";
287 287
     if (file_exists($file_name)) {
288
-        if (!in_array($language, $languages_in_use)){
288
+        if (!in_array($language, $languages_in_use)) {
289 289
             require_once($file_name);
290 290
             $languages_in_use[] = $language;
291 291
         }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     if ($language2) {
294 294
         $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc";
295 295
         if (file_exists($file_name)) {
296
-            if (!in_array($language2, $languages_in_use)){
296
+            if (!in_array($language2, $languages_in_use)) {
297 297
                 require_once($file_name);
298 298
                 $languages_in_use[] = $language2;
299 299
             }
Please login to merge, or discard this patch.
html/inc/geoip.inc 1 patch
Braces   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
   shmop_close ($shmid);
230 230
 }
231 231
 
232
-function _setup_segments($gi){
232
+function _setup_segments($gi) {
233 233
   $gi->databaseType = GEOIP_COUNTRY_EDITION;
234 234
   $gi->record_length = STANDARD_RECORD_LENGTH;
235 235
   if ($gi->flags & GEOIP_SHARED_MEMORY) {
@@ -241,18 +241,18 @@  discard block
 block discarded – undo
241 241
             $gi->databaseType = ord(@shmop_read ($gi->shmid, $offset, 1));
242 242
             $offset++;
243 243
 
244
-            if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){
244
+            if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) {
245 245
                 $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0;
246
-            } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){
246
+            } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) {
247 247
                 $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1;
248 248
 	    } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0)||
249 249
                      ($gi->databaseType == GEOIP_CITY_EDITION_REV1) 
250 250
                     || ($gi->databaseType == GEOIP_ORG_EDITION)
251 251
 		    || ($gi->databaseType == GEOIP_ISP_EDITION)
252
-		    || ($gi->databaseType == GEOIP_ASNUM_EDITION)){
252
+		    || ($gi->databaseType == GEOIP_ASNUM_EDITION)) {
253 253
                 $gi->databaseSegments = 0;
254 254
                 $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH);
255
-                for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){
255
+                for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++) {
256 256
                     $gi->databaseSegments += (ord($buf[$j]) << ($j * 8));
257 257
                 }
258 258
 	            if (($gi->databaseType == GEOIP_ORG_EDITION)||
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     }
268 268
     if (($gi->databaseType == GEOIP_COUNTRY_EDITION)||
269 269
         ($gi->databaseType == GEOIP_PROXY_EDITION)||
270
-        ($gi->databaseType == GEOIP_NETSPEED_EDITION)){
270
+        ($gi->databaseType == GEOIP_NETSPEED_EDITION)) {
271 271
         $gi->databaseSegments = GEOIP_COUNTRY_BEGIN;
272 272
     }
273 273
   } else {
@@ -275,21 +275,20 @@  discard block
 block discarded – undo
275 275
     fseek($gi->filehandle, -3, SEEK_END);
276 276
     for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) {
277 277
         $delim = fread($gi->filehandle,3);
278
-        if ($delim == (chr(255).chr(255).chr(255))){
278
+        if ($delim == (chr(255).chr(255).chr(255))) {
279 279
         $gi->databaseType = ord(fread($gi->filehandle,1));
280
-        if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){
280
+        if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) {
281 281
             $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0;
282
-        }
283
-        else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){
282
+        } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) {
284 283
 	    $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1;
285
-                }  else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) ||
284
+                } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) ||
286 285
                  ($gi->databaseType == GEOIP_CITY_EDITION_REV1) || 
287 286
                  ($gi->databaseType == GEOIP_ORG_EDITION) || 
288 287
 		 ($gi->databaseType == GEOIP_ISP_EDITION) || 
289
-                 ($gi->databaseType == GEOIP_ASNUM_EDITION)){
288
+                 ($gi->databaseType == GEOIP_ASNUM_EDITION)) {
290 289
             $gi->databaseSegments = 0;
291 290
             $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH);
292
-            for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){
291
+            for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++) {
293 292
             $gi->databaseSegments += (ord($buf[$j]) << ($j * 8));
294 293
             }
295 294
 	    if ($gi->databaseType == GEOIP_ORG_EDITION) {
@@ -303,7 +302,7 @@  discard block
 block discarded – undo
303 302
     }
304 303
     if (($gi->databaseType == GEOIP_COUNTRY_EDITION)||
305 304
         ($gi->databaseType == GEOIP_PROXY_EDITION)||
306
-        ($gi->databaseType == GEOIP_NETSPEED_EDITION)){
305
+        ($gi->databaseType == GEOIP_NETSPEED_EDITION)) {
307 306
          $gi->databaseSegments = GEOIP_COUNTRY_BEGIN;
308 307
     }
309 308
     fseek($gi->filehandle,$filepos,SEEK_SET);
@@ -419,7 +418,7 @@  discard block
 block discarded – undo
419 418
   return false;
420 419
 }
421 420
 
422
-function _get_org($gi,$ipnum){
421
+function _get_org($gi,$ipnum) {
423 422
   $seek_org = _geoip_seek_country($gi,$ipnum);
424 423
   if ($seek_org == $gi->databaseSegments) {
425 424
     return NULL;
@@ -443,10 +442,10 @@  discard block
 block discarded – undo
443 442
   return _get_org($gi, $ipnum);
444 443
 }
445 444
 
446
-function _get_region($gi,$ipnum){
447
-  if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){
445
+function _get_region($gi,$ipnum) {
446
+  if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) {
448 447
     $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0;
449
-    if ($seek_region >= 1000){
448
+    if ($seek_region >= 1000) {
450 449
       $country_code = "US";
451 450
       $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65);
452 451
     } else {
@@ -454,10 +453,10 @@  discard block
 block discarded – undo
454 453
       $region = "";
455 454
     }
456 455
   return array ($country_code,$region);
457
-    }  else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) {
456
+    } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) {
458 457
     $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1;
459 458
     //print $seek_region;
460
-    if ($seek_region < US_OFFSET){
459
+    if ($seek_region < US_OFFSET) {
461 460
       $country_code = "";
462 461
       $region = "";  
463 462
         } else if ($seek_region < CANADA_OFFSET) {
@@ -482,7 +481,7 @@  discard block
 block discarded – undo
482 481
   return _get_region($gi, $ipnum);
483 482
 }
484 483
 
485
-function getdnsattributes ($l,$ip){
484
+function getdnsattributes ($l,$ip) {
486 485
   $r = new Net_DNS_Resolver();
487 486
   $r->nameservers = array("ws1.maxmind.com");
488 487
   $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN");
Please login to merge, or discard this patch.