Completed
Pull Request — master (#312)
by
unknown
26:01 queued 18:06
created
htdocs/lib2/logic/cracklib.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 
35 35
     // min. 4 different chars
36 36
     $chars = array();
37
-    for ($i = 0; $i < mb_strlen($pw); $i ++) {
37
+    for ($i = 0; $i < mb_strlen($pw); $i++) {
38 38
         $chars[mb_substr($pw, $i, 1)] = true;
39 39
     }
40 40
 
Please login to merge, or discard this patch.
htdocs/lib2/search/search.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
     }
157 157
 
158 158
     // doppelte chars ersetzen
159
-    for ($c = ord('a'); $c <= ord('z'); $c ++) {
159
+    for ($c = ord('a'); $c <= ord('z'); $c++) {
160 160
         $str = mb_ereg_replace(chr($c) . chr($c), chr($c), $str);
161 161
     }
162 162
 
Please login to merge, or discard this patch.
htdocs/lib2/error.inc.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -7,34 +7,34 @@
 block discarded – undo
7 7
  *  Common error messages
8 8
  ***************************************************************************/
9 9
 
10
- define('ERROR_UNKNOWN', 1000);
11
- define('ERROR_TEMPLATE_NOT_FOUND', 1001);
12
- define('ERROR_COMPILATION_FAILED', 1002);
13
- define('ERROR_NO_ACCESS', 1003);
14
- define('ERROR_INVALID_OPERATION', 1004);
15
- define('ERROR_LOGIN_REQUIRED', 1005);
16
- define('ERROR_MAIL_TEMPLATE_NOT_FOUND', 1006);
17
- define('ERROR_NO_COOKIES', 1007);
18
- define('ERROR_ALREADY_LOGGEDIN', 1008);
19
- define('ERROR_USER_NOT_ACTIVE', 1009);
20
- define('ERROR_USER_NO_EMAIL', 1010);
21
- define('ERROR_CACHE_NOT_PUBLISHED', 1011);
22
- define('ERROR_CACHE_LOCKED', 1012);
10
+    define('ERROR_UNKNOWN', 1000);
11
+    define('ERROR_TEMPLATE_NOT_FOUND', 1001);
12
+    define('ERROR_COMPILATION_FAILED', 1002);
13
+    define('ERROR_NO_ACCESS', 1003);
14
+    define('ERROR_INVALID_OPERATION', 1004);
15
+    define('ERROR_LOGIN_REQUIRED', 1005);
16
+    define('ERROR_MAIL_TEMPLATE_NOT_FOUND', 1006);
17
+    define('ERROR_NO_COOKIES', 1007);
18
+    define('ERROR_ALREADY_LOGGEDIN', 1008);
19
+    define('ERROR_USER_NOT_ACTIVE', 1009);
20
+    define('ERROR_USER_NO_EMAIL', 1010);
21
+    define('ERROR_CACHE_NOT_PUBLISHED', 1011);
22
+    define('ERROR_CACHE_LOCKED', 1012);
23 23
 
24
- define('ERROR_SEARCHPLUGIN_WAYPOINT_FORMAT', 1013);
25
- define('ERROR_SEARCHPLUGIN_WAYPOINT_MANY', 1014);
26
- define('ERROR_SEARCHPLUGIN_WAYPOINT_NOTFOUND', 1015);
24
+    define('ERROR_SEARCHPLUGIN_WAYPOINT_FORMAT', 1013);
25
+    define('ERROR_SEARCHPLUGIN_WAYPOINT_MANY', 1014);
26
+    define('ERROR_SEARCHPLUGIN_WAYPOINT_NOTFOUND', 1015);
27 27
  
28
- define('ERROR_DB_COULD_NOT_RECONNECT', 1016);
29
- define('ERROR_DB_NO_ROOT', 1017);
28
+    define('ERROR_DB_COULD_NOT_RECONNECT', 1016);
29
+    define('ERROR_DB_NO_ROOT', 1017);
30 30
 
31
- define('ERROR_USER_NOT_EXISTS', 1018);
32
- define('ERROR_CACHE_NOT_EXISTS', 1019);
33
- define('ERROR_CACHELOG_NOT_EXISTS', 1020);
34
- define('ERROR_PICTURE_NOT_EXISTS', 1021);
31
+    define('ERROR_USER_NOT_EXISTS', 1018);
32
+    define('ERROR_CACHE_NOT_EXISTS', 1019);
33
+    define('ERROR_CACHELOG_NOT_EXISTS', 1020);
34
+    define('ERROR_PICTURE_NOT_EXISTS', 1021);
35 35
 
36
- define('ERROR_UPLOAD_ERR_NO_FILE', 1022);
37
- define('ERROR_UPLOAD_ERR_SIZE', 1023);
38
- define('ERROR_UPLOAD_ERR_TYPE', 1024);
39
- define('ERROR_UPLOAD_UNKNOWN', 1025);
40
- define('ERROR_UPLOAD_ERR_BAD_FORMAT', 1026);
36
+    define('ERROR_UPLOAD_ERR_NO_FILE', 1022);
37
+    define('ERROR_UPLOAD_ERR_SIZE', 1023);
38
+    define('ERROR_UPLOAD_ERR_TYPE', 1024);
39
+    define('ERROR_UPLOAD_UNKNOWN', 1025);
40
+    define('ERROR_UPLOAD_ERR_BAD_FORMAT', 1026);
Please login to merge, or discard this patch.
htdocs/lib2/login.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@
 block discarded – undo
20 20
  *
21 21
  ***************************************************************************/
22 22
 
23
-define('LOGIN_UNKNOWN_ERROR', - 1);     // unkown error occured
24
-define('LOGIN_OK', 0);                 // login succeeded
25
-define('LOGIN_BADUSERPW', 1);          // bad username or password
26
-define('LOGIN_TOOMUCHLOGINS', 2);      // too many logins in short time
27
-define('LOGIN_USERNOTACTIVE', 3);      // the useraccount locked
23
+define('LOGIN_UNKNOWN_ERROR', - 1); // unkown error occured
24
+define('LOGIN_OK', 0); // login succeeded
25
+define('LOGIN_BADUSERPW', 1); // bad username or password
26
+define('LOGIN_TOOMUCHLOGINS', 2); // too many logins in short time
27
+define('LOGIN_USERNOTACTIVE', 3); // the useraccount locked
28 28
 define('LOGIN_EMPTY_USERPASSWORD', 4); // given username/password was empty
29
-define('LOGIN_LOGOUT_OK', 5);          // logout was successfull
29
+define('LOGIN_LOGOUT_OK', 5); // logout was successfull
30 30
 
31 31
 // login times in seconds
32 32
 define('LOGIN_TIME', 60 * 60);
Please login to merge, or discard this patch.
htdocs/lib2/html2text.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
         if (substr($link, 0, 7) == 'http://' || substr($link, 0, 8) == 'https://' ||
535 535
             substr($link, 0, 7) == 'mailto:'
536 536
         ) {
537
-            $this->_link_count ++;
537
+            $this->_link_count++;
538 538
             $this->_link_list .= "[" . $this->_link_count . "] $link\n";
539 539
             $additional = ' [' . $this->_link_count . ']';
540 540
         } elseif (substr($link, 0, 11) == 'javascript:') {
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
             $additional = '';
543 543
             // what about href="#anchor" ?
544 544
         } else {
545
-            $this->_link_count ++;
545
+            $this->_link_count++;
546 546
             $this->_link_list .= "[" . $this->_link_count . "] " . $this->url;
547 547
             if (substr($link, 0, 1) != '/') {
548 548
                 $this->_link_list .= '/';
Please login to merge, or discard this patch.
htdocs/okapi/services/replicate/changelog.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,13 +29,18 @@
 block discarded – undo
29 29
         require_once('replicate_common.inc.php');
30 30
 
31 31
         $since = $request->get_parameter('since');
32
-        if ($since === null) throw new ParamMissing('since');
33
-        if ((int)$since != $since) throw new InvalidParam('since');
32
+        if ($since === null) {
33
+            throw new ParamMissing('since');
34
+        }
35
+        if ((int)$since != $since) {
36
+            throw new InvalidParam('since');
37
+        }
34 38
 
35 39
         # Let's check the $since parameter.
36 40
 
37
-        if (!ReplicateCommon::check_since_param($since))
38
-            throw new BadRequest("The 'since' parameter is too old. You must update your database more frequently.");
41
+        if (!ReplicateCommon::check_since_param($since)) {
42
+                    throw new BadRequest("The 'since' parameter is too old. You must update your database more frequently.");
43
+        }
39 44
 
40 45
         # Select a best chunk for the given $since, get the chunk from the database (or cache).
41 46
 
Please login to merge, or discard this patch.
htdocs/okapi/services/replicate/fulldump.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
                 select count(*)
29 29
                 from okapi_stats_temp
30 30
                 where
31
-                    consumer_key = '".Db::escape_string($consumer_key)."'
31
+                    consumer_key = '".Db::escape_string($consumer_key) . "'
32 32
                     and service_name='services/replicate/fulldump'
33 33
             ")
34 34
             +
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
                 select sum(total_calls)
37 37
                 from okapi_stats_hourly
38 38
                 where
39
-                    consumer_key = '".Db::escape_string($consumer_key)."'
39
+                    consumer_key = '".Db::escape_string($consumer_key) . "'
40 40
                     and service_name='services/replicate/fulldump'
41 41
                     and period_start > date_add(now(), interval -$days day)
42 42
                 limit 1
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
         $data = Cache::get("last_fulldump");
52 52
         if ($data == null)
53
-            throw new BadRequest("No fulldump found. Try again later. If this doesn't help ".
53
+            throw new BadRequest("No fulldump found. Try again later. If this doesn't help " .
54 54
                 "contact site administrator and/or OKAPI developers.");
55 55
 
56 56
         # Check consumer's quota
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
         $response = new OkapiHttpResponse();
73 73
         $response->content_type = $data['meta']['content_type'];
74
-        $response->content_disposition = 'attachment; filename="'.$data['meta']['public_filename'].'"';
74
+        $response->content_disposition = 'attachment; filename="' . $data['meta']['public_filename'] . '"';
75 75
         $response->stream_length = $data['meta']['compressed_size'];
76 76
         $response->body = fopen($data['meta']['filepath'], "rb");
77 77
         $response->allow_gzip = false;
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,9 +49,10 @@  discard block
 block discarded – undo
49 49
         require_once('replicate_common.inc.php');
50 50
 
51 51
         $data = Cache::get("last_fulldump");
52
-        if ($data == null)
53
-            throw new BadRequest("No fulldump found. Try again later. If this doesn't help ".
52
+        if ($data == null) {
53
+                    throw new BadRequest("No fulldump found. Try again later. If this doesn't help ".
54 54
                 "contact site administrator and/or OKAPI developers.");
55
+        }
55 56
 
56 57
         # Check consumer's quota
57 58
 
@@ -59,14 +60,15 @@  discard block
 block discarded – undo
59 60
         if ($please != 'true')
60 61
         {
61 62
             $not_good = 3 < self::count_calls($request->consumer->key, 30);
62
-            if ($not_good)
63
-                throw new BadRequest("Consumer's monthly quota exceeded. Try later or call with '&pleeaase=true'.");
64
-        }
65
-        else
63
+            if ($not_good) {
64
+                            throw new BadRequest("Consumer's monthly quota exceeded. Try later or call with '&pleeaase=true'.");
65
+            }
66
+        } else
66 67
         {
67 68
             $not_good = 5 < self::count_calls($request->consumer->key, 1);
68
-            if ($not_good)
69
-                throw new BadRequest("No more please. Seriously, dude...");
69
+            if ($not_good) {
70
+                            throw new BadRequest("No more please. Seriously, dude...");
71
+            }
70 72
         }
71 73
 
72 74
         $response = new OkapiHttpResponse();
Please login to merge, or discard this patch.
htdocs/okapi/services/caches/formatters/gpx.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -465,7 +465,7 @@
 block discarded – undo
465 465
                 $ggz_entry['ratings'] = array();
466 466
                 $ratings_ref = &$ggz_entry['ratings'];
467 467
                 if (isset($cache_ref['rating'])){
468
-                   $ratings_ref['awesomeness'] = $cache_ref['rating'];
468
+                    $ratings_ref['awesomeness'] = $cache_ref['rating'];
469 469
                 }
470 470
                 $ratings_ref['difficulty'] = $cache_ref['difficulty'];
471 471
                 if (!isset($cache_ref['size'])) {
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
         $langpref = $request->get_parameter('langpref');
98 98
         if (!$langpref) $langpref = "en";
99
-        $langpref .= "|".Settings::get('SITELANG');
99
+        $langpref .= "|" . Settings::get('SITELANG');
100 100
         foreach (array('ns_ground', 'ns_gsak', 'ns_ox', 'latest_logs', 'alt_wpts', 'mark_found') as $param)
101 101
         {
102 102
             $val = $request->get_parameter($param);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             else $protection_areas = 'none';
165 165
         }
166 166
         if (!in_array($protection_areas, array('none', 'desc:text')))
167
-            throw new InvalidParam('protection_areas',"'$protection_areas'");
167
+            throw new InvalidParam('protection_areas', "'$protection_areas'");
168 168
         $vars['protection_areas'] = $protection_areas;
169 169
 
170 170
         $tmp = $request->get_parameter('trackables');
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         # Make sure location_source has prefix alt_wpt:
195 195
         if ($location_source != 'default-coords' && strncmp($location_source, 'alt_wpt:', 8) != 0)
196 196
         {
197
-            throw new InvalidParam('location_source', '\''.$location_source.'\'');
197
+            throw new InvalidParam('location_source', '\'' . $location_source . '\'');
198 198
         }
199 199
 
200 200
         # Make sure we have sufficient authorization
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 
206 206
         # Which fields of the services/caches/geocaches method do we need?
207 207
 
208
-        $fields = 'code|name|location|date_created|url|type|status|size|size2|oxsize'.
209
-            '|difficulty|terrain|description|hint2|rating|owner|url|internal_id'.
208
+        $fields = 'code|name|location|date_created|url|type|status|size|size2|oxsize' .
209
+            '|difficulty|terrain|description|hint2|rating|owner|url|internal_id' .
210 210
             '|protection_areas|short_description';
211 211
         if ($vars['images'] != 'none')
212 212
             $fields .= "|images";
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                     # database; OCPL stores attribute names in a different way and may use
291 291
                     # different names for equivalent attributes.
292 292
 
293
-                    $ocde_attrnames = Db::select_group_by('id',"
293
+                    $ocde_attrnames = Db::select_group_by('id', "
294 294
                         select id, name
295 295
                         from cache_attrib
296 296
                     ");
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         $rs = Db::query("
374 374
             select uuid, user_id
375 375
             from user
376
-            where uuid in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($dict)))."')
376
+            where uuid in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($dict))) . "')
377 377
         ");
378 378
         while ($row = Db::fetch_assoc($rs))
379 379
             $dict[$row['uuid']] = $row['user_id'];
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
             {
394 394
                 foreach ($cache_ref['alt_wpts'] as $alt_wpt_key => $alt_wpt)
395 395
                 {
396
-                    if ('alt_wpt:'.$alt_wpt['type'] == $location_source)
396
+                    if ('alt_wpt:' . $alt_wpt['type'] == $location_source)
397 397
                     {
398 398
                         # Switch locations between primary wpt and alternate wpt.
399 399
                         # Also alter the cache name and make sure to append a proper
@@ -401,17 +401,17 @@  discard block
 block discarded – undo
401 401
 
402 402
                         $original_location = $cache_ref['location'];
403 403
                         $cache_ref['location'] = $alt_wpt['location'];
404
-                        $cache_ref['name_2'] = $location_change_prefix.$cache_ref['name'];
404
+                        $cache_ref['name_2'] = $location_change_prefix . $cache_ref['name'];
405 405
                         if ($location_source == "alt_wpt:user-coords") {
406 406
                             # In case of "user-coords", replace the default warning with a custom-tailored one.
407 407
                             $cache_ref['warning_prefix'] = _(
408
-                                "<b>Geocache coordinates have been changed.</b> They have been replaced with ".
408
+                                "<b>Geocache coordinates have been changed.</b> They have been replaced with " .
409 409
                                 "your own custom coordinates which you have provided for this geocache."
410 410
                             );
411 411
                         } else {
412 412
                             # Default warning
413 413
                             $cache_ref['warning_prefix'] = _(
414
-                                "<b>Geocache coordinates have been changed.</b> Currently they ".
414
+                                "<b>Geocache coordinates have been changed.</b> Currently they " .
415 415
                                 "point to one of the alternate waypoints originally described as:"
416 416
                             ) . " " . $alt_wpt['description'];
417 417
                         }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                         if ($vars['alt_wpts'])
422 422
                         {
423 423
                             $cache_ref['alt_wpts'][] = array(
424
-                                'name' => $cache_ref['code'].'-DEFAULT-COORDS',
424
+                                'name' => $cache_ref['code'] . '-DEFAULT-COORDS',
425 425
                                 'location' => $original_location,
426 426
                                 'type' => 'default-coords',
427 427
                                 'type_name' => _("Original geocache location"),
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
                 $ggz_entry['ratings'] = array();
466 466
                 $ratings_ref = &$ggz_entry['ratings'];
467
-                if (isset($cache_ref['rating'])){
467
+                if (isset($cache_ref['rating'])) {
468 468
                    $ratings_ref['awesomeness'] = $cache_ref['rating'];
469 469
                 }
470 470
                 $ratings_ref['difficulty'] = $cache_ref['difficulty'];
Please login to merge, or discard this patch.
Braces   +87 added lines, -50 removed lines patch added patch discarded remove patch
@@ -89,24 +89,31 @@  discard block
 block discarded – undo
89 89
         # $vars variable which we will use later in the GPS template.
90 90
 
91 91
         $cache_codes = $request->get_parameter('cache_codes');
92
-        if ($cache_codes === null) throw new ParamMissing('cache_codes');
92
+        if ($cache_codes === null) {
93
+            throw new ParamMissing('cache_codes');
94
+        }
93 95
 
94 96
         # Issue 106 requires us to allow empty list of cache codes to be passed into this method.
95 97
         # All of the queries below have to be ready for $cache_codes to be empty!
96 98
 
97 99
         $langpref = $request->get_parameter('langpref');
98
-        if (!$langpref) $langpref = "en";
100
+        if (!$langpref) {
101
+            $langpref = "en";
102
+        }
99 103
         $langpref .= "|".Settings::get('SITELANG');
100 104
         foreach (array('ns_ground', 'ns_gsak', 'ns_ox', 'latest_logs', 'alt_wpts', 'mark_found') as $param)
101 105
         {
102 106
             $val = $request->get_parameter($param);
103
-            if (!$val) $val = "false";
104
-            elseif (!in_array($val, array("true", "false")))
105
-                throw new InvalidParam($param);
107
+            if (!$val) {
108
+                $val = "false";
109
+            } elseif (!in_array($val, array("true", "false"))) {
110
+                            throw new InvalidParam($param);
111
+            }
106 112
             $vars[$param] = ($val == "true");
107 113
         }
108
-        if ($vars['latest_logs'] && (!$vars['ns_ground']))
109
-            throw new BadRequest("In order for 'latest_logs' to work you have to also include 'ns_ground' extensions.");
114
+        if ($vars['latest_logs'] && (!$vars['ns_ground'])) {
115
+                    throw new BadRequest("In order for 'latest_logs' to work you have to also include 'ns_ground' extensions.");
116
+        }
110 117
 
111 118
         $tmp = $request->get_parameter('my_notes');
112 119
         $vars['my_notes'] = array();
@@ -134,13 +141,18 @@  discard block
 block discarded – undo
134 141
         }
135 142
 
136 143
         $images = $request->get_parameter('images');
137
-        if (!$images) $images = 'descrefs:nonspoilers';
138
-        if (!in_array($images, array('none', 'descrefs:thumblinks', 'descrefs:nonspoilers', 'descrefs:all', 'ox:all')))
139
-            throw new InvalidParam('images', "'$images'");
144
+        if (!$images) {
145
+            $images = 'descrefs:nonspoilers';
146
+        }
147
+        if (!in_array($images, array('none', 'descrefs:thumblinks', 'descrefs:nonspoilers', 'descrefs:all', 'ox:all'))) {
148
+                    throw new InvalidParam('images', "'$images'");
149
+        }
140 150
         $vars['images'] = $images;
141 151
 
142 152
         $tmp = $request->get_parameter('attrs');
143
-        if (!$tmp) $tmp = 'desc:text';
153
+        if (!$tmp) {
154
+            $tmp = 'desc:text';
155
+        }
144 156
         $tmp = explode("|", $tmp);
145 157
         $vars['attrs'] = array();
146 158
         foreach ($tmp as $elem)
@@ -148,10 +160,11 @@  discard block
 block discarded – undo
148 160
             if ($elem == 'none') {
149 161
                 /* pass */
150 162
             } elseif (in_array($elem, array('desc:text', 'ox:tags', 'gc:attrs', 'gc_ocde:attrs'))) {
151
-                if ($elem == 'gc_ocde:attrs' && Settings::get('OC_BRANCH') != 'oc.de')
152
-                    $vars['attrs'][] = 'gc:attrs';
153
-                else
154
-                    $vars['attrs'][] = $elem;
163
+                if ($elem == 'gc_ocde:attrs' && Settings::get('OC_BRANCH') != 'oc.de') {
164
+                                    $vars['attrs'][] = 'gc:attrs';
165
+                } else {
166
+                                    $vars['attrs'][] = $elem;
167
+                }
155 168
             } else {
156 169
                 throw new InvalidParam('attrs', "Invalid list entry: '$elem'");
157 170
             }
@@ -160,27 +173,40 @@  discard block
 block discarded – undo
160 173
         $protection_areas = $request->get_parameter('protection_areas');
161 174
         if (!$protection_areas || $protection_areas == 'desc:auto')
162 175
         {
163
-            if (Settings::get('OC_BRANCH') == 'oc.de') $protection_areas = 'desc:text';
164
-            else $protection_areas = 'none';
176
+            if (Settings::get('OC_BRANCH') == 'oc.de') {
177
+                $protection_areas = 'desc:text';
178
+            } else {
179
+                $protection_areas = 'none';
180
+            }
181
+        }
182
+        if (!in_array($protection_areas, array('none', 'desc:text'))) {
183
+                    throw new InvalidParam('protection_areas',"'$protection_areas'");
165 184
         }
166
-        if (!in_array($protection_areas, array('none', 'desc:text')))
167
-            throw new InvalidParam('protection_areas',"'$protection_areas'");
168 185
         $vars['protection_areas'] = $protection_areas;
169 186
 
170 187
         $tmp = $request->get_parameter('trackables');
171
-        if (!$tmp) $tmp = 'none';
172
-        if (!in_array($tmp, array('none', 'desc:list', 'desc:count')))
173
-            throw new InvalidParam('trackables', "'$tmp'");
188
+        if (!$tmp) {
189
+            $tmp = 'none';
190
+        }
191
+        if (!in_array($tmp, array('none', 'desc:list', 'desc:count'))) {
192
+                    throw new InvalidParam('trackables', "'$tmp'");
193
+        }
174 194
         $vars['trackables'] = $tmp;
175 195
 
176 196
         $tmp = $request->get_parameter('recommendations');
177
-        if (!$tmp) $tmp = 'none';
178
-        if (!in_array($tmp, array('none', 'desc:count')))
179
-            throw new InvalidParam('recommendations', "'$tmp'");
197
+        if (!$tmp) {
198
+            $tmp = 'none';
199
+        }
200
+        if (!in_array($tmp, array('none', 'desc:count'))) {
201
+                    throw new InvalidParam('recommendations', "'$tmp'");
202
+        }
180 203
         $vars['recommendations'] = $tmp;
181 204
 
182 205
         $lpc = $request->get_parameter('lpc');
183
-        if ($lpc === null) $lpc = 10; # will be checked in services/caches/geocaches call
206
+        if ($lpc === null) {
207
+            $lpc = 10;
208
+        }
209
+        # will be checked in services/caches/geocaches call
184 210
 
185 211
         $user_uuid = $request->get_parameter('user_uuid');
186 212
 
@@ -208,24 +234,32 @@  discard block
 block discarded – undo
208 234
         $fields = 'code|name|location|date_created|url|type|status|size|size2|oxsize'.
209 235
             '|difficulty|terrain|description|hint2|rating|owner|url|internal_id'.
210 236
             '|protection_areas|short_description';
211
-        if ($vars['images'] != 'none')
212
-            $fields .= "|images";
213
-        if (count($vars['attrs']) > 0)
214
-            $fields .= "|attrnames|attr_acodes|needs_maintenance";
215
-        if ($vars['trackables'] == 'desc:list')
216
-            $fields .= "|trackables";
217
-        elseif ($vars['trackables'] == 'desc:count')
218
-            $fields .= "|trackables_count";
219
-        if ($vars['alt_wpts'] == 'true' || $location_source != 'default-coords')
220
-            $fields .= "|alt_wpts";
221
-        if ($vars['recommendations'] != 'none')
222
-            $fields .= "|recommendations|founds";
223
-        if (count($vars['my_notes']) > 0)
224
-            $fields .= "|my_notes";
225
-        if ($vars['latest_logs'])
226
-            $fields .= "|latest_logs";
227
-        if ($vars['mark_found'])
228
-            $fields .= "|is_found";
237
+        if ($vars['images'] != 'none') {
238
+                    $fields .= "|images";
239
+        }
240
+        if (count($vars['attrs']) > 0) {
241
+                    $fields .= "|attrnames|attr_acodes|needs_maintenance";
242
+        }
243
+        if ($vars['trackables'] == 'desc:list') {
244
+                    $fields .= "|trackables";
245
+        } elseif ($vars['trackables'] == 'desc:count') {
246
+                    $fields .= "|trackables_count";
247
+        }
248
+        if ($vars['alt_wpts'] == 'true' || $location_source != 'default-coords') {
249
+                    $fields .= "|alt_wpts";
250
+        }
251
+        if ($vars['recommendations'] != 'none') {
252
+                    $fields .= "|recommendations|founds";
253
+        }
254
+        if (count($vars['my_notes']) > 0) {
255
+                    $fields .= "|my_notes";
256
+        }
257
+        if ($vars['latest_logs']) {
258
+                    $fields .= "|latest_logs";
259
+        }
260
+        if ($vars['mark_found']) {
261
+                    $fields .= "|is_found";
262
+        }
229 263
 
230 264
         $vars['caches'] = OkapiServiceRunner::call(
231 265
             'services/caches/geocaches', new OkapiInternalRequest(
@@ -346,8 +380,9 @@  discard block
 block discarded – undo
346 380
             {
347 381
                 foreach ($vars['caches'] as &$cache_ref)
348 382
                 {
349
-                    if ($cache_ref['needs_maintenance'])
350
-                        $cache_ref['attrnames'][] = 'Needs maintenance';
383
+                    if ($cache_ref['needs_maintenance']) {
384
+                                            $cache_ref['attrnames'][] = 'Needs maintenance';
385
+                    }
351 386
                 }
352 387
             }
353 388
         }
@@ -366,17 +401,19 @@  discard block
 block discarded – undo
366 401
         foreach ($vars['caches'] as &$cache_ref)
367 402
         {
368 403
             $dict[$cache_ref['owner']['uuid']] = true;
369
-            if (isset($cache_ref['latest_logs']))
370
-                foreach ($cache_ref['latest_logs'] as &$log_ref)
404
+            if (isset($cache_ref['latest_logs'])) {
405
+                            foreach ($cache_ref['latest_logs'] as &$log_ref)
371 406
                     $dict[$log_ref['user']['uuid']] = true;
407
+            }
372 408
         }
373 409
         $rs = Db::query("
374 410
             select uuid, user_id
375 411
             from user
376 412
             where uuid in ('".implode("','", array_map('\okapi\Db::escape_string', array_keys($dict)))."')
377 413
         ");
378
-        while ($row = Db::fetch_assoc($rs))
379
-            $dict[$row['uuid']] = $row['user_id'];
414
+        while ($row = Db::fetch_assoc($rs)) {
415
+                    $dict[$row['uuid']] = $row['user_id'];
416
+        }
380 417
         $vars['user_uuid_to_internal_id'] = &$dict;
381 418
         unset($dict);
382 419
 
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,6 @@
 block discarded – undo
13 13
 use okapi\BadRequest;
14 14
 use okapi\OkapiInternalRequest;
15 15
 use okapi\OkapiServiceRunner;
16
-use okapi\OkapiAccessToken;
17
-use okapi\services\caches\search\SearchAssistant;
18 16
 use okapi\services\attrs\AttrHelper;
19 17
 
20 18
 class WebService
Please login to merge, or discard this patch.
htdocs/okapi/services/caches/formatters/ggz.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 use \ZipArchive;
20 20
 use \Exception;
21 21
 
22
-require_once($GLOBALS['rootpath']."okapi/services/caches/formatters/gpx.php");
22
+require_once($GLOBALS['rootpath'] . "okapi/services/caches/formatters/gpx.php");
23 23
 
24 24
 class WebService
25 25
 {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         # Geocaching.com (groundspeak:) and Opencaching.com (ox:) extensions. It will
44 44
         # also include personal data (if the method was invoked using Level 3 Authentication).
45 45
 
46
-        $file_item_name = "data_".time()."_".rand(100000,999999).".gpx";
46
+        $file_item_name = "data_" . time() . "_" . rand(100000, 999999) . ".gpx";
47 47
         $ggz_file = array(
48 48
             'name' => $file_item_name,
49 49
             'crc32' => sprintf('%08X', crc32($gpx_result['gpx'])),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $index_content = ob_get_clean();
59 59
 
60 60
         $response->zip->FileAdd("index/com/garmin/geocaches/v0/index.xml", $index_content);
61
-        $response->zip->FileAdd("data/".$file_item_name, $gpx_result['gpx']);
61
+        $response->zip->FileAdd("data/" . $file_item_name, $gpx_result['gpx']);
62 62
 
63 63
         unset($gpx_result);
64 64
         unset($index_content);
Please login to merge, or discard this patch.