Completed
Pull Request — master (#313)
by Thomas
09:55
created
htdocs/okapi/services/oauth/authorize.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,13 +21,17 @@
 block discarded – undo
21 21
     public static function call(OkapiRequest $request)
22 22
     {
23 23
         $token_key = $request->get_parameter('oauth_token');
24
-        if (!$token_key)
25
-            throw new ParamMissing("oauth_token");
24
+        if (!$token_key) {
25
+                    throw new ParamMissing("oauth_token");
26
+        }
26 27
         $langpref = $request->get_parameter('langpref');
27 28
         $interactivity = $request->get_parameter('interactivity');
28
-        if (!$interactivity) $interactivity = 'minimal';
29
-        if (!in_array($interactivity, array('minimal', 'confirm_user')))
30
-            throw new InvalidParam('interactivity', $interactivity);
29
+        if (!$interactivity) {
30
+            $interactivity = 'minimal';
31
+        }
32
+        if (!in_array($interactivity, array('minimal', 'confirm_user'))) {
33
+                    throw new InvalidParam('interactivity', $interactivity);
34
+        }
31 35
 
32 36
         # Redirect to the "apps" folder. This is done there (not here)
33 37
         # because: 1) we don't want any cookie or session-handling
Please login to merge, or discard this patch.
htdocs/okapi/services/attrs/attribute.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
         $acode = $request->get_parameter('acode');
32 32
         if ($acode === null) throw new ParamMissing('acode');
33
-        if (strstr($acode,'|')) throw new InvalidParam('acode', "Only a single A-code must be supplied.");
33
+        if (strstr($acode, '|')) throw new InvalidParam('acode', "Only a single A-code must be supplied.");
34 34
 
35 35
         $langpref = $request->get_parameter('langpref');
36 36
         if (!$langpref) $langpref = "en";
Please login to merge, or discard this patch.
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,17 +29,27 @@  discard block
 block discarded – undo
29 29
         # Read the parameters.
30 30
 
31 31
         $acode = $request->get_parameter('acode');
32
-        if ($acode === null) throw new ParamMissing('acode');
33
-        if (strstr($acode,'|')) throw new InvalidParam('acode', "Only a single A-code must be supplied.");
32
+        if ($acode === null) {
33
+            throw new ParamMissing('acode');
34
+        }
35
+        if (strstr($acode,'|')) {
36
+            throw new InvalidParam('acode', "Only a single A-code must be supplied.");
37
+        }
34 38
 
35 39
         $langpref = $request->get_parameter('langpref');
36
-        if (!$langpref) $langpref = "en";
40
+        if (!$langpref) {
41
+            $langpref = "en";
42
+        }
37 43
 
38 44
         $fields = $request->get_parameter('fields');
39
-        if (!$fields) $fields = "name";
45
+        if (!$fields) {
46
+            $fields = "name";
47
+        }
40 48
 
41 49
         $forward_compatible = $request->get_parameter('forward_compatible');
42
-        if (!$forward_compatible) $forward_compatible = "true";
50
+        if (!$forward_compatible) {
51
+            $forward_compatible = "true";
52
+        }
43 53
 
44 54
         # Pass them all to the attributes method.
45 55
 
@@ -52,8 +62,7 @@  discard block
 block discarded – undo
52 62
         $results = OkapiServiceRunner::call('services/attrs/attributes',
53 63
             new OkapiInternalRequest($request->consumer, $request->token, $params));
54 64
         $result = $results[$acode];
55
-        if ($result === null)
56
-        {
65
+        if ($result === null) {
57 66
             /* Note, this can happen only when $forward_compatible is false. */
58 67
             throw new InvalidParam('acode', "Unknown A-code.");
59 68
         }
Please login to merge, or discard this patch.
htdocs/okapi/facade.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,8 +78,9 @@  discard block
 block discarded – undo
78 78
         );
79 79
         $request->i_want_OkapiResponse = true;
80 80
         $request->perceive_as_http_request = true;
81
-        if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
82
-            $request->etag = $_SERVER['HTTP_IF_NONE_MATCH'];
81
+        if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
82
+                    $request->etag = $_SERVER['HTTP_IF_NONE_MATCH'];
83
+        }
83 84
         $response = OkapiServiceRunner::call($service_name, $request);
84 85
         $response->display();
85 86
     }
@@ -118,8 +119,9 @@  discard block
 block discarded – undo
118 119
      */
119 120
     public static function schedule_geocache_check($cache_codes)
120 121
     {
121
-        if (!is_array($cache_codes))
122
-            $cache_codes = array($cache_codes);
122
+        if (!is_array($cache_codes)) {
123
+                    $cache_codes = array($cache_codes);
124
+        }
123 125
         Db::execute("
124 126
             update caches
125 127
             set okapi_syncbase = now()
Please login to merge, or discard this patch.
htdocs/okapi/lib/oc_session.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,18 +12,22 @@
 block discarded – undo
12 12
     public static function get_user_id()
13 13
     {
14 14
         static $cached_result = false;
15
-        if ($cached_result !== false)
16
-            return $cached_result;
15
+        if ($cached_result !== false) {
16
+                    return $cached_result;
17
+        }
17 18
 
18 19
         $cookie_name = Settings::get('OC_COOKIE_NAME');
19
-        if (!isset($_COOKIE[$cookie_name]))
20
-            return null;
20
+        if (!isset($_COOKIE[$cookie_name])) {
21
+                    return null;
22
+        }
21 23
         $OC_data = unserialize(base64_decode($_COOKIE[$cookie_name]));
22
-        if (!isset($OC_data['sessionid']))
23
-            return null;
24
+        if (!isset($OC_data['sessionid'])) {
25
+                    return null;
26
+        }
24 27
         $OC_sessionid = $OC_data['sessionid'];
25
-        if (!$OC_sessionid)
26
-            return null;
28
+        if (!$OC_sessionid) {
29
+                    return null;
30
+        }
27 31
 
28 32
         return Db::select_value("select user_id from sys_sessions where uuid='".Db::escape_string($OC_sessionid)."'");
29 33
     }
Please login to merge, or discard this patch.
htdocs/okapi/views/changelog_helper.inc.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
                 );
35 35
                 $context = stream_context_create($opts);
36 36
                 $changes_xml = file_get_contents(
37
-                     # TODO: load from OKAPI repo
37
+                        # TODO: load from OKAPI repo
38 38
                     'https://raw.githubusercontent.com/opencaching/okapi/master/etc/changes.xml',
39 39
                     false, $context
40 40
                 );
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                     throw new ErrorException();
44 44
                 }
45 45
                 Cache::set($cache_key, $changes_xml, 3600);
46
-                Cache::set($cache_backup_key, $changes_xml, 3600*24*30);
46
+                Cache::set($cache_backup_key, $changes_xml, 3600 * 24 * 30);
47 47
             }
48 48
             catch (Exception $e)
49 49
             {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
                 $changes_xml = Cache::get($cache_backup_key);
53 53
                 if ($changes_xml) {
54
-                    Cache::set($cache_key, $changes_xml, 3600*12);
54
+                    Cache::set($cache_key, $changes_xml, 3600 * 12);
55 55
                 }
56 56
             }
57 57
         }
Please login to merge, or discard this patch.
Braces   +5 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,12 +20,10 @@  discard block
 block discarded – undo
20 20
         $changes_xml = Cache::get($cache_key);
21 21
         $changelog = null;
22 22
 
23
-        if (!$changes_xml)
24
-        {
23
+        if (!$changes_xml) {
25 24
             # Download the current changelog.
26 25
 
27
-            try
28
-            {
26
+            try {
29 27
                 $opts = array(
30 28
                     'http' => array(
31 29
                         'method' => "GET",
@@ -44,9 +42,7 @@  discard block
 block discarded – undo
44 42
                 }
45 43
                 Cache::set($cache_key, $changes_xml, 3600);
46 44
                 Cache::set($cache_backup_key, $changes_xml, 3600*24*30);
47
-            }
48
-            catch (Exception $e)
49
-            {
45
+            } catch (Exception $e) {
50 46
                 # GitHub failed on us. User backup list, if available.
51 47
 
52 48
                 $changes_xml = Cache::get($cache_backup_key);
@@ -64,14 +60,11 @@  discard block
 block discarded – undo
64 60
         $this->unavailable_changes = array();
65 61
         $this->available_changes = array();
66 62
 
67
-        if (!$changelog)
68
-        {
63
+        if (!$changelog) {
69 64
             # We could not retreive the changelog from Github, and there was
70 65
             # no backup key or it expired. Probably we are on a developer
71 66
             # machine. The template will output some error message.
72
-        }
73
-        else
74
-        {
67
+        } else {
75 68
             $commits = array();
76 69
             $versions = array();
77 70
 
Please login to merge, or discard this patch.
htdocs/okapi/views/method_call.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,10 @@
 block discarded – undo
20 20
     {
21 21
         require_once($GLOBALS['rootpath'].'okapi/service_runner.php');
22 22
 
23
-        if (!OkapiServiceRunner::exists($methodname))
24
-            throw new BadRequest("Method '$methodname' does not exist. ".
23
+        if (!OkapiServiceRunner::exists($methodname)) {
24
+                    throw new BadRequest("Method '$methodname' does not exist. ".
25 25
                 "See OKAPI docs at ".Settings::get('SITE_URL')."okapi/");
26
+        }
26 27
         $options = OkapiServiceRunner::options($methodname);
27 28
         $request = new OkapiHttpRequest($options);
28 29
         return OkapiServiceRunner::call($methodname, $request);
Please login to merge, or discard this patch.
htdocs/templates2/ocstyle/search.tpl.inc.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
  ****************************************************************************/
9 9
 
10 10
     // search.php -> $tpl->error
11
-     $outputformat_notexist = _('The selected output format is unknown!');
12
-     $error_query_not_found = _('The search operation could not be executed, please reenter the search data.');
11
+        $outputformat_notexist = _('The selected output format is unknown!');
12
+        $error_query_not_found = _('The search operation could not be executed, please reenter the search data.');
13 13
     $unknown_searchoption = _('unknown search option');
14 14
     $unknown_searchtype = _('unknown search type');
15 15
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
     $unknown_searchtype = _('unknown search type');
15 15
 
16 16
     // search.php -> search.tpl
17
-    $error_plz = '<tr><td colspan="3"><span class="errormsg">' . _('The postal code could not be found') . '</span></td></tr>';
18
-    $error_ort = '<tr><td colspan="3"><span class="errormsg">' . _('There does no city exist with this name') . '</span></td></tr>';
19
-    $error_locidnocoords = '<tr><td colspan="3"><span class="errormsg">' . _('There are no Koordinates available for the selected city') . '</span></td></tr>';
20
-    $error_noort = '<tr><td colspan="3"><span class="errormsg">' . _('The entered city is not valid.') . '</span></td></tr>';
21
-    $error_nowaypointfound = '<tr><td colspan="3"><span class="errormsg">' . _('There does no cache exist with this waypoint') . '</span></td></tr>';
22
-    $error_nocoords = '<tr><td colspan="3"><span class="errormsg">' . _('The entered coordinates are no valid.') . '</span></td></tr>';
23
-    $error_nofulltext = '<tr><td colspan="3"><span class="errormsg">' . _('The entered text is invalid.') . '</span></td></tr>';
24
-    $error_fulltexttoolong = '<tr><td colspan="3"><span class="errormsg">' . _('The entered text contains more than 50 words.') . '</span></td></tr>';
17
+    $error_plz = '<tr><td colspan="3"><span class="errormsg">'._('The postal code could not be found').'</span></td></tr>';
18
+    $error_ort = '<tr><td colspan="3"><span class="errormsg">'._('There does no city exist with this name').'</span></td></tr>';
19
+    $error_locidnocoords = '<tr><td colspan="3"><span class="errormsg">'._('There are no Koordinates available for the selected city').'</span></td></tr>';
20
+    $error_noort = '<tr><td colspan="3"><span class="errormsg">'._('The entered city is not valid.').'</span></td></tr>';
21
+    $error_nowaypointfound = '<tr><td colspan="3"><span class="errormsg">'._('There does no cache exist with this waypoint').'</span></td></tr>';
22
+    $error_nocoords = '<tr><td colspan="3"><span class="errormsg">'._('The entered coordinates are no valid.').'</span></td></tr>';
23
+    $error_nofulltext = '<tr><td colspan="3"><span class="errormsg">'._('The entered text is invalid.').'</span></td></tr>';
24
+    $error_fulltexttoolong = '<tr><td colspan="3"><span class="errormsg">'._('The entered text contains more than 50 words.').'</span></td></tr>';
25 25
 
26 26
     // search.php -> selectlocid.tpl
27 27
     $locline = '<tr><td width="50px"><p>{nr}.&nbsp;</p></td><td><p><b><a href="search.php?{urlparams}">{locationname}</a>{secondlocationname}</b></p></td></tr>
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     $no_location_coords = _('no coordinates available');
33 33
 
34 34
     // search.html.inc.php -> search.result.caches.tpl
35
-    $caches_newstring = '<b class="newsymbol">&nbsp;' . _('NEW') . '&nbsp;</b>&nbsp;';
35
+    $caches_newstring = '<b class="newsymbol">&nbsp;'._('NEW').'&nbsp;</b>&nbsp;';
36 36
     $caches_oconlystring = '<img src="resource2/ocstyle/images/misc/is_oconly.png" alt="OConly" title="OConly" style="margin:0px; padding:0px" width="64" height="35" />';
37 37
 
38 38
     $cache_attrib_group =
Please login to merge, or discard this patch.
htdocs/ignore.php 2 patches
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@
 block discarded – undo
29 29
 }
30 30
 
31 31
 switch ($action) {
32
-    case 'addignore':
33
-        sql("INSERT IGNORE INTO `cache_ignore` (`cache_id`, `user_id`) VALUES ('&1', '&2')", $cache_id, $login->userid);
34
-        break;
35
-    case 'removeignore':
36
-        sql("DELETE FROM `cache_ignore` WHERE `cache_id`='&1' AND `user_id`='&2'", $cache_id, $login->userid);
37
-        break;
32
+        case 'addignore':
33
+            sql("INSERT IGNORE INTO `cache_ignore` (`cache_id`, `user_id`) VALUES ('&1', '&2')", $cache_id, $login->userid);
34
+            break;
35
+        case 'removeignore':
36
+            sql("DELETE FROM `cache_ignore` WHERE `cache_id`='&1' AND `user_id`='&2'", $cache_id, $login->userid);
37
+            break;
38 38
 }
39 39
 
40 40
 // clear cached map result, so that the change directly appears on the map
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
  *  Unicode Reminder メモ
6 6
  ***************************************************************************/
7 7
 
8
-require __DIR__ . '/lib2/web.inc.php';
8
+require __DIR__.'/lib2/web.inc.php';
9 9
 
10 10
 $cache_id = isset($_GET['cacheid']) ? $_GET['cacheid'] + 0 : 0;
11 11
 $action = isset($_GET['action']) ? $_GET['action'] : '';
12
-$target = isset($_GET['target']) ? $_GET['target'] : 'viewcache.php?cacheid=' . $cache_id;
12
+$target = isset($_GET['target']) ? $_GET['target'] : 'viewcache.php?cacheid='.$cache_id;
13 13
 
14 14
 $login->verify();
15 15
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $map_result_id = sql_value(
42 42
     "SELECT `result_id`
43 43
      FROM `map2_result`
44
-     WHERE INSTR(sqlquery,\"`user_id`='" . sql_escape($login->userid) . "'\")
44
+     WHERE INSTR(sqlquery,\"`user_id`='" . sql_escape($login->userid)."'\")
45 45
      LIMIT 1",
46 46
     0
47 47
 );
Please login to merge, or discard this patch.
htdocs/editcache.php 3 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,10 +76,12 @@  discard block
 block discarded – undo
76 76
 if ($error == false) {
77 77
     //cacheid
78 78
     $cache_id = 0;
79
-    if (isset($_REQUEST['cacheid']))  // Ocprop
79
+    if (isset($_REQUEST['cacheid'])) {
80
+        // Ocprop
80 81
     {
81 82
         $cache_id = $_REQUEST['cacheid'];
82 83
     }
84
+    }
83 85
 
84 86
     if ($usr === false) {
85 87
         $tplname = 'login';
@@ -197,9 +199,11 @@  discard block
 block discarded – undo
197 199
                 $way_length = isset($_POST['way_length']) ? $_POST['way_length'] : $cache_record['way_length'];
198 200
 
199 201
                 if ($status_old == 5 && $status == 5) {
200
-                    if (isset($_POST['publish']))  // Ocprop
202
+                    if (isset($_POST['publish'])) {
203
+                        // Ocprop
201 204
                     {
202 205
                         $publish = $_POST['publish'];
206
+                    }
203 207
                         if (!($publish == 'now' || $publish == 'later' || $publish == 'notnow')) {
204 208
                             // somebody messed up the POST-data, so we do not publish the cache, since he isn't published right now (status=5)
205 209
                             $publish = 'notnow';
@@ -228,12 +232,14 @@  discard block
 block discarded – undo
228 232
                     $status = $status_old;
229 233
                 }
230 234
 
231
-                if ($status_old == 7) // cache is locked
235
+                if ($status_old == 7) {
236
+                    // cache is locked
232 237
                 {
233 238
                     // only admins can change status of locked caches
234 239
                     if (($bAdmin & ADMIN_USER) != ADMIN_USER) {
235 240
                         // no status change allowed for normal user
236 241
                         $status = $status_old;
242
+                }
237 243
                     }
238 244
                 }
239 245
 
@@ -439,11 +445,13 @@  discard block
 block discarded – undo
439 445
                 }
440 446
 
441 447
                 //try to save to DB?
442
-                if (isset($_POST['submit']))  // Ocprop
448
+                if (isset($_POST['submit'])) {
449
+                    // Ocprop
443 450
                 {
444 451
                     //all validations ok?
445 452
                     if (!($hidden_date_not_ok || $lat_not_ok || $lon_not_ok || $name_not_ok || $time_not_ok || $way_length_not_ok || $size_not_ok || $activate_date_not_ok || $status_not_ok || $diff_not_ok || $attribs_not_ok || $wpgc_not_ok)) {
446 453
                         $cache_lat = $coords_lat_h + $coords_lat_min / 60;
454
+                }
447 455
                         if ($coords_latNS == 'S') {
448 456
                             $cache_lat = - $cache_lat;
449 457
                         }
@@ -931,9 +939,11 @@  discard block
 block discarded – undo
931 939
                 tpl_set_var('statuschange', $status_old == 5 ? '' : mb_ereg_replace('%1', $cache_id, $status_change));
932 940
 
933 941
                 // show activation form?
934
-                if ($status_old == 5) // status = not yet published
942
+                if ($status_old == 5) {
943
+                    // status = not yet published
935 944
                 {
936 945
                     $tmp = $activation_form;
946
+                }
937 947
 
938 948
                     $tmp = mb_ereg_replace(
939 949
                         '{activate_day}',
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 use Oc\Libse\ChildWp\HandlerChildWp;
14 14
 use Oc\Libse\Coordinate\FormatterCoordinate;
15 15
 
16
-require_once __DIR__ . '/lib/consts.inc.php';
16
+require_once __DIR__.'/lib/consts.inc.php';
17 17
 $opt['gui'] = GUI_HTML;
18
-require_once __DIR__ . '/lib/common.inc.php';
18
+require_once __DIR__.'/lib/common.inc.php';
19 19
 
20 20
 function getWaypoints($cacheid)
21 21
 {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $tplname = 'login';
86 86
 
87 87
         tpl_set_var('username', '');
88
-        tpl_set_var('target', 'editcache.php?cacheid=' . urlencode($cache_id));
88
+        tpl_set_var('target', 'editcache.php?cacheid='.urlencode($cache_id));
89 89
         tpl_set_var('message_start', "");
90 90
         tpl_set_var('message_end', "");
91 91
         tpl_set_var('message', $login_required);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             if ($cache_record['user_id'] == $usr['userid'] || $login->listingAdmin()) {
132 132
                 $tplname = 'editcache';
133 133
 
134
-                require $stylepath . '/editcache.inc.php';
134
+                require $stylepath.'/editcache.inc.php';
135 135
 
136 136
                 if ($cache_record['node'] != $oc_nodeid) {
137 137
                     tpl_errorMsg('editcache', $error_wrong_node);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 }
140 140
 
141 141
                 //here we read all used information from the form if submitted, otherwise from DB
142
-                $cache_name = trim(isset($_POST['name']) ? $_POST['name'] : $cache_record['name']);  // Ocprop
142
+                $cache_name = trim(isset($_POST['name']) ? $_POST['name'] : $cache_record['name']); // Ocprop
143 143
                 $cache_type = isset($_POST['type']) ? $_POST['type'] : $cache_record['type'];
144 144
                 if (!isset($_POST['size'])) {
145 145
                     if ($cache_type == 4 || $cache_type == 5) {
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
                 $cache_hidden_day = isset($_POST['hidden_day']) ? $_POST['hidden_day'] : date(
154 154
                     'd',
155 155
                     strtotime($cache_record['date_hidden'])
156
-                );  // Ocprop
156
+                ); // Ocprop
157 157
                 $cache_hidden_month = isset($_POST['hidden_month']) ? $_POST['hidden_month'] : date(
158 158
                     'm',
159 159
                     strtotime($cache_record['date_hidden'])
160
-                );  // Ocprop
160
+                ); // Ocprop
161 161
                 $cache_hidden_year = isset($_POST['hidden_year']) ? $_POST['hidden_year'] : date(
162 162
                     'Y',
163 163
                     strtotime($cache_record['date_hidden'])
164
-                );  // Ocprop
164
+                ); // Ocprop
165 165
 
166 166
                 if (is_null($cache_record['date_activate'])) {
167 167
                     $cache_activate_day = isset($_POST['activate_day']) ? $_POST['activate_day'] : date('d');
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
                     );
188 188
                 }
189 189
 
190
-                $cache_difficulty = isset($_POST['difficulty']) ? $_POST['difficulty'] : $cache_record['difficulty'];  // Ocprop
191
-                $cache_terrain = isset($_POST['terrain']) ? $_POST['terrain'] : $cache_record['terrain'];  // Ocprop
192
-                $cache_country = isset($_POST['country']) ? $_POST['country'] : $cache_record['country'];  // Ocprop
190
+                $cache_difficulty = isset($_POST['difficulty']) ? $_POST['difficulty'] : $cache_record['difficulty']; // Ocprop
191
+                $cache_terrain = isset($_POST['terrain']) ? $_POST['terrain'] : $cache_record['terrain']; // Ocprop
192
+                $cache_country = isset($_POST['country']) ? $_POST['country'] : $cache_record['country']; // Ocprop
193 193
                 $show_all_countries = isset($_POST['show_all_countries']) ? $_POST['show_all_countries'] : 0;
194
-                $status = isset($_POST['status']) ? $_POST['status'] : $cache_record['status'];  // Ocprop
194
+                $status = isset($_POST['status']) ? $_POST['status'] : $cache_record['status']; // Ocprop
195 195
                 $status_old = $cache_record['status'];
196 196
                 $search_time = isset($_POST['search_time']) ? $_POST['search_time'] : $cache_record['search_time'];
197 197
                 $way_length = isset($_POST['way_length']) ? $_POST['way_length'] : $cache_record['way_length'];
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
                 $log_pw = isset($_POST['log_pw']) ? mb_substr($_POST['log_pw'], 0, 20) : $cache_record['logpw'];
255 255
                 // fix #4356: gc waypoints are frequently copy&pasted with leading spaces
256
-                $wp_gc = isset($_POST['wp_gc']) ? strtoupper(trim($_POST['wp_gc'])) : $cache_record['wp_gc'];  // Ocprop
256
+                $wp_gc = isset($_POST['wp_gc']) ? strtoupper(trim($_POST['wp_gc'])) : $cache_record['wp_gc']; // Ocprop
257 257
                 $showlists = isset($_POST['showlists']) ? 1 : $cache_record['show_cachelists'] + 0;
258 258
                 $protect_old_coords = isset($_POST['protect_old_coords']) ? 1 : $cache_record['protect_old_coords'] + 0;
259 259
 
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
 
266 266
                 if (isset($_POST['latNS'])) {
267 267
                     //get coords from post-form
268
-                    $coords_latNS = $_POST['latNS'];  // Ocprop
269
-                    $coords_lonEW = $_POST['lonEW'];  // Ocprop
270
-                    $coords_lat_h = $_POST['lat_h'];  // Ocprop
271
-                    $coords_lon_h = $_POST['lon_h'];  // Ocprop
272
-                    $coords_lat_min = $_POST['lat_min'];  // Ocprop
273
-                    $coords_lon_min = $_POST['lon_min'];  // Ocprop
268
+                    $coords_latNS = $_POST['latNS']; // Ocprop
269
+                    $coords_lonEW = $_POST['lonEW']; // Ocprop
270
+                    $coords_lat_h = $_POST['lat_h']; // Ocprop
271
+                    $coords_lon_h = $_POST['lon_h']; // Ocprop
272
+                    $coords_lat_min = $_POST['lat_min']; // Ocprop
273
+                    $coords_lon_min = $_POST['lon_min']; // Ocprop
274 274
                 } else {
275 275
                     //get coords from DB
276 276
                     $coords_lon = $cache_record['longitude'];
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
                             $activation_date = 'NULL';
458 458
                         } elseif ($publish == 'later') {
459 459
                             $status = 5;
460
-                            $activation_date = "'" . sql_escape(
460
+                            $activation_date = "'".sql_escape(
461 461
                                     date(
462 462
                                         'Y-m-d H:i:s',
463 463
                                         mktime(
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
                                             $cache_activate_year
470 470
                                         )
471 471
                                     )
472
-                                ) . "'";
472
+                                )."'";
473 473
                         } elseif ($publish == 'notnow') {
474 474
                             $status = 5;
475 475
                             $activation_date = 'NULL';
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                                     $logtype = 13;
565 565
                                     break;
566 566
                                 default:
567
-                                    $logtype = 0;  // ???
567
+                                    $logtype = 0; // ???
568 568
                             }
569 569
                             if ($logtype > 0) {
570 570
                                 sql(
@@ -585,25 +585,25 @@  discard block
 block discarded – undo
585 585
 
586 586
                         // update cache attributes
587 587
                         $attriblist = "999";
588
-                        for ($i = 0; $i < count($cache_attribs); $i ++) {
588
+                        for ($i = 0; $i < count($cache_attribs); $i++) {
589 589
                             if ($cache_attribs[$i] + 0 > 0) {
590 590
                                 sql(
591 591
                                     "INSERT IGNORE INTO `caches_attributes` (`cache_id`, `attrib_id`) VALUES('&1', '&2')",
592 592
                                     $cache_id,
593 593
                                     $cache_attribs[$i] + 0
594 594
                                 );
595
-                                $attriblist .= "," . ($cache_attribs[$i] + 0);
595
+                                $attriblist .= ",".($cache_attribs[$i] + 0);
596 596
                             }
597 597
                         }
598 598
 
599 599
                         sql(
600
-                            "DELETE FROM `caches_attributes` WHERE `cache_id`='&1' AND `attrib_id` NOT IN (" . $attriblist . ")",
600
+                            "DELETE FROM `caches_attributes` WHERE `cache_id`='&1' AND `attrib_id` NOT IN (".$attriblist.")",
601 601
                             // SQL injections in $attriblist prevented by adding 0 above
602 602
                             $cache_id
603 603
                         );
604 604
 
605 605
                         //call eventhandler
606
-                        require_once $opt['rootpath'] . 'lib/eventhandler.inc.php';
606
+                        require_once $opt['rootpath'].'lib/eventhandler.inc.php';
607 607
                         event_edit_cache($cache_id, $usr['userid'] + 0);
608 608
 
609 609
                         // if old status is not yet published and new status is published => notify-event
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
                         }
613 613
 
614 614
                         //display cache-page
615
-                        tpl_redirect('viewcache.php?cacheid=' . urlencode($cache_id));
615
+                        tpl_redirect('viewcache.php?cacheid='.urlencode($cache_id));
616 616
                         // Ocprop: Location:\s*$viewcacheUrl\?cacheid=([0-9]+)
617 617
                         // (s.a. tpl_redirect() in common.inc.php
618 618
                         exit;
@@ -654,15 +654,15 @@  discard block
 block discarded – undo
654 654
 
655 655
                 while ($record = sql_fetch_assoc($rs)) {
656 656
                     $sSelected = ($record['short'] == $cache_country) ? ' selected="selected"' : '';
657
-                    $countriesoptions .= '<option value="' . htmlspecialchars(
657
+                    $countriesoptions .= '<option value="'.htmlspecialchars(
658 658
                             $record['short'],
659 659
                             ENT_COMPAT,
660 660
                             'UTF-8'
661
-                        ) . '"' . $sSelected . '>' . htmlspecialchars(
661
+                        ).'"'.$sSelected.'>'.htmlspecialchars(
662 662
                             $record['name'],
663 663
                             ENT_COMPAT,
664 664
                             'UTF-8'
665
-                        ) . '</option>' . "\n";
665
+                        ).'</option>'."\n";
666 666
                 }
667 667
                 tpl_set_var('countryoptions', $countriesoptions);
668 668
                 sql_free_result($rs);
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
                         $line = mb_ereg_replace('{name}', escape_javascript($record['name']), $line);
720 720
                         $line = mb_ereg_replace('{color}', $rAttrGroup['color'], $line);
721 721
                         $group_line .= $line;
722
-                        $nLineAttrCount ++;
722
+                        $nLineAttrCount++;
723 723
 
724 724
                         $line = $cache_attrib_js;
725 725
                         $line = mb_ereg_replace('{id}', $record['id'], $line);
@@ -776,11 +776,11 @@  discard block
 block discarded – undo
776 776
 
777 777
                 //difficulty
778 778
                 $difficulty_options = '';
779
-                for ($i = 2; $i <= 10; $i ++) {
779
+                for ($i = 2; $i <= 10; $i++) {
780 780
                     if ($cache_difficulty == $i) {
781
-                        $difficulty_options .= '<option value="' . $i . '" selected="selected">' . $i / 2 . '</option>';
781
+                        $difficulty_options .= '<option value="'.$i.'" selected="selected">'.$i / 2.'</option>';
782 782
                     } else {
783
-                        $difficulty_options .= '<option value="' . $i . '">' . $i / 2 . '</option>';
783
+                        $difficulty_options .= '<option value="'.$i.'">'.$i / 2.'</option>';
784 784
                     }
785 785
                     $difficulty_options .= "\n";
786 786
                 }
@@ -788,11 +788,11 @@  discard block
 block discarded – undo
788 788
 
789 789
                 //build terrain options
790 790
                 $terrain_options = '';
791
-                for ($i = 2; $i <= 10; $i ++) {
791
+                for ($i = 2; $i <= 10; $i++) {
792 792
                     if ($cache_terrain == $i) {
793
-                        $terrain_options .= '<option value="' . $i . '" selected="selected">' . $i / 2 . '</option>';
793
+                        $terrain_options .= '<option value="'.$i.'" selected="selected">'.$i / 2.'</option>';
794 794
                     } else {
795
-                        $terrain_options .= '<option value="' . $i . '">' . $i / 2 . '</option>';
795
+                        $terrain_options .= '<option value="'.$i.'">'.$i / 2.'</option>';
796 796
                     }
797 797
                     $terrain_options .= "\n";
798 798
                 }
@@ -805,16 +805,16 @@  discard block
 block discarded – undo
805 805
                                                         FROM `cache_type`
806 806
                                              LEFT JOIN `sys_trans` ON `cache_type`.`trans_id`=`sys_trans`.`id`
807 807
                                              LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND
808
-                                                                 `sys_trans_text`.`lang`='" . sql_escape($locale) . "'
808
+                                                                 `sys_trans_text`.`lang`='" . sql_escape($locale)."'
809 809
                                                 ORDER BY `cache_type`.`ordinal` ASC"
810 810
                 );
811 811
                 while ($rType = sql_fetch_assoc($rsTypes)) {
812 812
                     $sSelected = ($rType['id'] == $cache_type) ? ' selected="selected"' : '';
813
-                    $types .= '<option value="' . $rType['id'] . '"' . $sSelected . '>' . htmlspecialchars(
813
+                    $types .= '<option value="'.$rType['id'].'"'.$sSelected.'>'.htmlspecialchars(
814 814
                             $rType['name'],
815 815
                             ENT_COMPAT,
816 816
                             'UTF-8'
817
-                        ) . '</option>';
817
+                        ).'</option>';
818 818
                 }
819 819
                 sql_free_result($rsTypes);
820 820
                 tpl_set_var('typeoptions', $types);
@@ -826,16 +826,16 @@  discard block
 block discarded – undo
826 826
                                                         FROM `cache_size`
827 827
                                              LEFT JOIN `sys_trans` ON `cache_size`.`trans_id`=`sys_trans`.`id`
828 828
                                              LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND
829
-                                                                 `sys_trans_text`.`lang`='" . sql_escape($locale) . "'
829
+                                                                 `sys_trans_text`.`lang`='" . sql_escape($locale)."'
830 830
                                                 ORDER BY `cache_size`.`ordinal` ASC"
831 831
                 );
832 832
                 while ($rSize = sql_fetch_assoc($rsSizes)) {
833 833
                     $sSelected = ($rSize['id'] == $sel_size) ? ' selected="selected"' : '';
834
-                    $sizes .= '<option value="' . $rSize['id'] . '"' . $sSelected . '>' . htmlspecialchars(
834
+                    $sizes .= '<option value="'.$rSize['id'].'"'.$sSelected.'>'.htmlspecialchars(
835 835
                             $rSize['name'],
836 836
                             ENT_COMPAT,
837 837
                             'UTF-8'
838
-                        ) . '</option>';
838
+                        ).'</option>';
839 839
                 }
840 840
                 sql_free_result($rsSizes);
841 841
                 tpl_set_var('sizeoptions', $sizes);
@@ -846,14 +846,14 @@  discard block
 block discarded – undo
846 846
                 $gc_com_refs = false;
847 847
                 foreach ($desclangs AS $desclang) {
848 848
                     if (count($desclangs) > 1) {
849
-                        $remove_url = 'removedesc.php?cacheid=' . urlencode($cache_id) . '&desclang=' . urlencode(
849
+                        $remove_url = 'removedesc.php?cacheid='.urlencode($cache_id).'&desclang='.urlencode(
850 850
                                 $desclang
851 851
                             );
852
-                        $removedesc = '&nbsp;[<a href="' . htmlspecialchars(
852
+                        $removedesc = '&nbsp;[<a href="'.htmlspecialchars(
853 853
                                 $remove_url,
854 854
                                 ENT_COMPAT,
855 855
                                 'UTF-8'
856
-                            ) . '">' . $remove . '</a>]';
856
+                            ).'">'.$remove.'</a>]';
857 857
                     } else {
858 858
                         $removedesc = '';
859 859
                     }
@@ -869,17 +869,17 @@  discard block
 block discarded – undo
869 869
                     }
870 870
                     sql_free_result($resp);
871 871
 
872
-                    $edit_url = 'editdesc.php?cacheid=' . urlencode($cache_id) . '&desclang=' . urlencode($desclang);
872
+                    $edit_url = 'editdesc.php?cacheid='.urlencode($cache_id).'&desclang='.urlencode($desclang);
873 873
 
874
-                    $cache_descs .= '<tr><td colspan="2">' . htmlspecialchars(
874
+                    $cache_descs .= '<tr><td colspan="2">'.htmlspecialchars(
875 875
                             db_LanguageFromShort($desclang),
876 876
                             ENT_COMPAT,
877 877
                             'UTF-8'
878
-                        ) . ' [<a href="' . htmlspecialchars(
878
+                        ).' [<a href="'.htmlspecialchars(
879 879
                             $edit_url,
880 880
                             ENT_COMPAT,
881 881
                             'UTF-8'
882
-                        ) . '">' . $edit . '</a>]' . $removedesc . '</td></tr>';
882
+                        ).'">'.$edit.'</a>]'.$removedesc.'</td></tr>';
883 883
                 }
884 884
                 tpl_set_var('cache_descs', $cache_descs);
885 885
 
@@ -899,33 +899,33 @@  discard block
 block discarded – undo
899 899
                                                              FROM `cache_status`
900 900
                                                   LEFT JOIN `sys_trans` ON `cache_status`.`trans_id`=`sys_trans`.`id`
901 901
                                                   LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND
902
-                                                                      `sys_trans_text`.`lang`='" . sql_escape($locale) . "'
902
+                                                                      `sys_trans_text`.`lang`='" . sql_escape($locale)."'
903 903
                                                           WHERE `cache_status`.`id` NOT IN (4, 5, 7) OR `cache_status`.`id`='" . sql_escape(
904 904
                             $status_old + 0
905
-                        ) . "'
905
+                        )."'
906 906
                                                      ORDER BY `cache_status`.`id` ASC"
907 907
                     );
908 908
                     while ($rStatus = sql_fetch_assoc($rsStatus)) {
909 909
                         $sSelected = ($rStatus['id'] == $status) ? ' selected="selected"' : '';
910 910
                         if ($sSelected != '' || $status_old == 5) {
911
-                            $statusoptions .= '<option value="' . htmlspecialchars(
911
+                            $statusoptions .= '<option value="'.htmlspecialchars(
912 912
                                     $rStatus['id'],
913 913
                                     ENT_COMPAT,
914 914
                                     'UTF-8'
915
-                                ) . '"' . $sSelected . '>' . htmlspecialchars(
915
+                                ).'"'.$sSelected.'>'.htmlspecialchars(
916 916
                                     $rStatus['name'],
917 917
                                     ENT_COMPAT,
918 918
                                     'UTF-8'
919
-                                ) . '</option>';
919
+                                ).'</option>';
920 920
                         }
921 921
                     }
922 922
                     sql_free_result($rsStatus);
923 923
                 } else {
924
-                    $statusoptions .= '<option value="7" selected="selected">' . htmlspecialchars(
924
+                    $statusoptions .= '<option value="7" selected="selected">'.htmlspecialchars(
925 925
                             t("Locked, invisible"),
926 926
                             ENT_COMPAT,
927 927
                             'UTF-8'
928
-                        ) . '</option>';
928
+                        ).'</option>';
929 929
                 }
930 930
                 tpl_set_var('statusoptions', $statusoptions);
931 931
                 tpl_set_var('statuschange', $status_old == 5 ? '' : mb_ereg_replace('%1', $cache_id, $status_change));
@@ -955,11 +955,11 @@  discard block
 block discarded – undo
955 955
                     $tmp = mb_ereg_replace('{publish_notnow_checked}', ($publish == 'notnow') ? 'checked' : '', $tmp);
956 956
 
957 957
                     $activation_hours = '';
958
-                    for ($i = 0; $i <= 23; $i ++) {
958
+                    for ($i = 0; $i <= 23; $i++) {
959 959
                         if ($cache_activate_hour == $i) {
960
-                            $activation_hours .= '<option value="' . $i . '" selected="selected">' . $i . '</option>';
960
+                            $activation_hours .= '<option value="'.$i.'" selected="selected">'.$i.'</option>';
961 961
                         } else {
962
-                            $activation_hours .= '<option value="' . $i . '">' . $i . '</option>';
962
+                            $activation_hours .= '<option value="'.$i.'">'.$i.'</option>';
963 963
                         }
964 964
                         $activation_hours .= "\n";
965 965
                     }
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
                         $cache_id
984 984
                     );
985 985
 
986
-                    for ($i = 0; $i < mysql_num_rows($rspictures); $i ++) {
986
+                    for ($i = 0; $i < mysql_num_rows($rspictures); $i++) {
987 987
                         $tmpline = ($i == 0 ? $pictureline0 : $pictureline);
988 988
                         $pic_record = sql_fetch_array($rspictures);
989 989
 
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
                 $st_hours = floor($search_time);
1059 1059
                 $st_minutes = sprintf('%02.0F', ($search_time - $st_hours) * 60);
1060 1060
 
1061
-                tpl_set_var('search_time', $st_hours . ':' . $st_minutes);
1061
+                tpl_set_var('search_time', $st_hours.':'.$st_minutes);
1062 1062
 
1063 1063
                 tpl_set_var('way_length', $way_length);
1064 1064
                 tpl_set_var('log_pw', htmlspecialchars($log_pw, ENT_COMPAT, 'UTF-8'));
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
                 tpl_set_var('showlists_checked', $showlists ? 'checked="checked"' : '');
1067 1067
                 tpl_set_var('protectcoords_checked', $protect_old_coords ? 'checked="checked"' : '');
1068 1068
 
1069
-                tpl_set_var('reset', $reset);  // obsolete
1069
+                tpl_set_var('reset', $reset); // obsolete
1070 1070
                 tpl_set_var('submit', $submit);
1071 1071
             } else {
1072 1072
                 //TODO: not the owner
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -844,7 +844,7 @@
 block discarded – undo
844 844
                 $desclangs = mb_split(',', $cache_record['desc_languages']);
845 845
                 $cache_descs = '';
846 846
                 $gc_com_refs = false;
847
-                foreach ($desclangs AS $desclang) {
847
+                foreach ($desclangs as $desclang) {
848 848
                     if (count($desclangs) > 1) {
849 849
                         $remove_url = 'removedesc.php?cacheid=' . urlencode($cache_id) . '&desclang=' . urlencode(
850 850
                                 $desclang
Please login to merge, or discard this patch.