Completed
Pull Request — master (#313)
by Thomas
09:55
created
htdocs/okapi/views/changelog.tpl.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
                         foreach ($vars['changes'] as $type => $changes) {
47 47
                             if (count($changes)) {
48 48
                                 if ($type == 'unavailable') {
49
-                                    echo "<p>The following changes are not available yet at " . $vars['site_name'] . ":</p>";
49
+                                    echo "<p>The following changes are not available yet at ".$vars['site_name'].":</p>";
50 50
                                     $br = '<br />';
51 51
                                 } else {
52
-                                    echo "<p>".$br."The following changes are available at " . $vars['site_name'] . ":</p>";
52
+                                    echo "<p>".$br."The following changes are available at ".$vars['site_name'].":</p>";
53 53
                                 } ?>
54 54
 
55 55
                                 <table cellspacing='1px' class='changelog'>
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
                                         <th>Date</th>
59 59
                                         <th>Change</th>
60 60
                                     </th>
61
-                                <?php foreach($changes as $change) { ?>
61
+                                <?php foreach ($changes as $change) { ?>
62 62
                                     <tr id="v<?= $change['version'] ?>">
63 63
                                         <td><a href="https://github.com/opencaching/okapi/tree/<?= $change['commit'] ?>"><?= $change['version'] ?></a></td>
64 64
                                         <td><?= substr($change['time'], 0, 10) ?></td>
65
-                                        <td><?= ($change['type'] == 'bugfix' ? 'Fixed: ' : '') . $change['comment'] ?></td>
65
+                                        <td><?= ($change['type'] == 'bugfix' ? 'Fixed: ' : '').$change['comment'] ?></td>
66 66
                                     </tr>
67 67
                                 <?php } ?>
68 68
                                 </table>
Please login to merge, or discard this patch.
htdocs/okapi/lib/ocpl_access_logs.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
         // traverse PHP call stack to find out who originally called us
23 23
         // first, find first service_runner.php invocation
24 24
         // then, find previous class invocation
25
-        for($i = count($trace)-1; $i >= 0; $i--)
25
+        for ($i = count($trace) - 1; $i >= 0; $i--)
26 26
         {
27 27
             $frame = $trace[$i];
28 28
             if ($break_next && isset($frame['class']))
29 29
             {
30 30
                 $class_elems = explode('\\', $frame['class']);
31 31
                 if (count($class_elems) >= 2)
32
-                    $org_caller = $class_elems[count($class_elems)-2];
32
+                    $org_caller = $class_elems[count($class_elems) - 2];
33 33
                 break;
34 34
             }
35 35
             if (isset($frame['file']) &&
@@ -51,40 +51,40 @@  discard block
 block discarded – undo
51 51
     public static function log_geocache_access(OkapiRequest $request, $cache_ids)
52 52
     {
53 53
         if (Settings::get('OCPL_ENABLE_GEOCACHE_ACCESS_LOGS') !== true)
54
-            return ;
54
+            return;
55 55
 
56 56
         if (Settings::get('OC_BRANCH') == 'oc.pl')
57 57
         {
58 58
             // TODO: can we use the _SERVER global here? or should we make them abstract, and
59 59
             // pass along with request object?
60
-            $remote_addr_escaped = "'" . Db::escape_string($_SERVER['REMOTE_ADDR']) . "'";
60
+            $remote_addr_escaped = "'".Db::escape_string($_SERVER['REMOTE_ADDR'])."'";
61 61
             $user_agent_escaped = isset($_SERVER['HTTP_USER_AGENT']) ?
62
-                "'" . Db::escape_string($_SERVER['HTTP_USER_AGENT']) . "'" : "null";
62
+                "'".Db::escape_string($_SERVER['HTTP_USER_AGENT'])."'" : "null";
63 63
             $forwarded_for_escaped = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?
64
-                "'" . Db::escape_string($_SERVER['HTTP_X_FORWARDED_FOR']) . "'" : "null";
64
+                "'".Db::escape_string($_SERVER['HTTP_X_FORWARDED_FOR'])."'" : "null";
65 65
 
66
-            $consumer_key_escaped = "'" . Db::escape_string($request->consumer->key) . "'";
67
-            $original_caller_escaped = "'" . Db::escape_string(self::get_original_caller()) . "'";
66
+            $consumer_key_escaped = "'".Db::escape_string($request->consumer->key)."'";
67
+            $original_caller_escaped = "'".Db::escape_string(self::get_original_caller())."'";
68 68
 
69 69
             $user_id = null;
70 70
             if ($request->token != null)
71 71
                 $user_id = $request->token->user_id;
72
-            $user_id_escaped = $user_id === null ? "null" : "'" . Db::escape_string($user_id) . "'";
73
-            if (is_array($cache_ids)){
72
+            $user_id_escaped = $user_id === null ? "null" : "'".Db::escape_string($user_id)."'";
73
+            if (is_array($cache_ids)) {
74 74
                 if (count($cache_ids) == 1)
75
-                    $cache_ids_where = "= '" . Db::escape_string($cache_ids[0]) . "'";
75
+                    $cache_ids_where = "= '".Db::escape_string($cache_ids[0])."'";
76 76
                 else
77
-                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids)) . "')";
77
+                    $cache_ids_where = "in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_ids))."')";
78 78
             } else {
79
-                $cache_ids_where = "= '" . Db::escape_string($cache_ids) . "'";
79
+                $cache_ids_where = "= '".Db::escape_string($cache_ids)."'";
80 80
             }
81 81
 
82 82
             $sql = "
83 83
                 select cache_id
84 84
                 from CACHE_ACCESS_LOGS cal
85 85
                 where
86
-                    cache_id $cache_ids_where" .
87
-                    ($user_id === null ? " and cal.user_id is null" : " and cal.user_id = $user_id_escaped") . "
86
+                    cache_id $cache_ids_where".
87
+                    ($user_id === null ? " and cal.user_id is null" : " and cal.user_id = $user_id_escaped")."
88 88
                     and cal.source = 'O'
89 89
                     and cal.event = $original_caller_escaped
90 90
                     and cal.okapi_consumer_key = $consumer_key_escaped
@@ -101,30 +101,30 @@  discard block
 block discarded – undo
101 101
             if (is_array($cache_ids) && count($already_logged_cache_ids) == count($cache_ids)
102 102
                 || !is_array($cache_ids) && count($already_logged_cache_ids) == 1)
103 103
             {
104
-                return ;
104
+                return;
105 105
             }
106 106
 
107
-            if (is_array($cache_ids)){
107
+            if (is_array($cache_ids)) {
108 108
                 $tmp = array();
109 109
                 foreach ($cache_ids as $cache_id)
110 110
                     $tmp[$cache_id] = true;
111 111
                 foreach ($already_logged_cache_ids as $cache_id)
112 112
                     unset($tmp[$cache_id]);
113 113
                 if (count($tmp) <= 0)
114
-                    return ;
114
+                    return;
115 115
                 $cache_ids_filterd = array_keys($tmp);
116 116
                 unset($tmp);
117 117
             } else {
118 118
                 $cache_ids_filterd = $cache_ids;
119 119
             }
120 120
 
121
-            if (is_array($cache_ids_filterd)){
121
+            if (is_array($cache_ids_filterd)) {
122 122
                 if (count($cache_ids_filterd) == 1)
123
-                    $cache_ids_where = "= '" . Db::escape_string($cache_ids_filterd[0]) . "'";
123
+                    $cache_ids_where = "= '".Db::escape_string($cache_ids_filterd[0])."'";
124 124
                 else
125
-                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids_filterd)) . "')";
125
+                    $cache_ids_where = "in ('".implode("','", array_map('\okapi\Db::escape_string', $cache_ids_filterd))."')";
126 126
             } else {
127
-                $cache_ids_where = "= '" . Db::escape_string($cache_ids_filterd) . "'";
127
+                $cache_ids_where = "= '".Db::escape_string($cache_ids_filterd)."'";
128 128
             }
129 129
 
130 130
             Db::execute("
Please login to merge, or discard this patch.
Braces   +36 added lines, -33 removed lines patch added patch discarded remove patch
@@ -22,20 +22,18 @@  discard block
 block discarded – undo
22 22
         // traverse PHP call stack to find out who originally called us
23 23
         // first, find first service_runner.php invocation
24 24
         // then, find previous class invocation
25
-        for($i = count($trace)-1; $i >= 0; $i--)
26
-        {
25
+        for($i = count($trace)-1; $i >= 0; $i--) {
27 26
             $frame = $trace[$i];
28
-            if ($break_next && isset($frame['class']))
29
-            {
27
+            if ($break_next && isset($frame['class'])) {
30 28
                 $class_elems = explode('\\', $frame['class']);
31
-                if (count($class_elems) >= 2)
32
-                    $org_caller = $class_elems[count($class_elems)-2];
29
+                if (count($class_elems) >= 2) {
30
+                                    $org_caller = $class_elems[count($class_elems)-2];
31
+                }
33 32
                 break;
34 33
             }
35 34
             if (isset($frame['file']) &&
36 35
                     // test if file ends with service_runner.php
37
-                    substr($frame['file'], -strlen('service_runner.php')) === 'service_runner.php')
38
-            {
36
+                    substr($frame['file'], -strlen('service_runner.php')) === 'service_runner.php') {
39 37
                 $break_next = true;
40 38
             }
41 39
         }
@@ -50,11 +48,11 @@  discard block
 block discarded – undo
50 48
      */
51 49
     public static function log_geocache_access(OkapiRequest $request, $cache_ids)
52 50
     {
53
-        if (Settings::get('OCPL_ENABLE_GEOCACHE_ACCESS_LOGS') !== true)
54
-            return ;
51
+        if (Settings::get('OCPL_ENABLE_GEOCACHE_ACCESS_LOGS') !== true) {
52
+                    return ;
53
+        }
55 54
 
56
-        if (Settings::get('OC_BRANCH') == 'oc.pl')
57
-        {
55
+        if (Settings::get('OC_BRANCH') == 'oc.pl') {
58 56
             // TODO: can we use the _SERVER global here? or should we make them abstract, and
59 57
             // pass along with request object?
60 58
             $remote_addr_escaped = "'" . Db::escape_string($_SERVER['REMOTE_ADDR']) . "'";
@@ -67,14 +65,16 @@  discard block
 block discarded – undo
67 65
             $original_caller_escaped = "'" . Db::escape_string(self::get_original_caller()) . "'";
68 66
 
69 67
             $user_id = null;
70
-            if ($request->token != null)
71
-                $user_id = $request->token->user_id;
68
+            if ($request->token != null) {
69
+                            $user_id = $request->token->user_id;
70
+            }
72 71
             $user_id_escaped = $user_id === null ? "null" : "'" . Db::escape_string($user_id) . "'";
73
-            if (is_array($cache_ids)){
74
-                if (count($cache_ids) == 1)
75
-                    $cache_ids_where = "= '" . Db::escape_string($cache_ids[0]) . "'";
76
-                else
77
-                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids)) . "')";
72
+            if (is_array($cache_ids)) {
73
+                if (count($cache_ids) == 1) {
74
+                                    $cache_ids_where = "= '" . Db::escape_string($cache_ids[0]) . "'";
75
+                } else {
76
+                                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids)) . "')";
77
+                }
78 78
             } else {
79 79
                 $cache_ids_where = "= '" . Db::escape_string($cache_ids) . "'";
80 80
             }
@@ -99,30 +99,33 @@  discard block
 block discarded – undo
99 99
 
100 100
             // check, if all the geocaches has already been logged
101 101
             if (is_array($cache_ids) && count($already_logged_cache_ids) == count($cache_ids)
102
-                || !is_array($cache_ids) && count($already_logged_cache_ids) == 1)
103
-            {
102
+                || !is_array($cache_ids) && count($already_logged_cache_ids) == 1) {
104 103
                 return ;
105 104
             }
106 105
 
107
-            if (is_array($cache_ids)){
106
+            if (is_array($cache_ids)) {
108 107
                 $tmp = array();
109
-                foreach ($cache_ids as $cache_id)
110
-                    $tmp[$cache_id] = true;
111
-                foreach ($already_logged_cache_ids as $cache_id)
112
-                    unset($tmp[$cache_id]);
113
-                if (count($tmp) <= 0)
114
-                    return ;
108
+                foreach ($cache_ids as $cache_id) {
109
+                                    $tmp[$cache_id] = true;
110
+                }
111
+                foreach ($already_logged_cache_ids as $cache_id) {
112
+                                    unset($tmp[$cache_id]);
113
+                }
114
+                if (count($tmp) <= 0) {
115
+                                    return ;
116
+                }
115 117
                 $cache_ids_filterd = array_keys($tmp);
116 118
                 unset($tmp);
117 119
             } else {
118 120
                 $cache_ids_filterd = $cache_ids;
119 121
             }
120 122
 
121
-            if (is_array($cache_ids_filterd)){
122
-                if (count($cache_ids_filterd) == 1)
123
-                    $cache_ids_where = "= '" . Db::escape_string($cache_ids_filterd[0]) . "'";
124
-                else
125
-                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids_filterd)) . "')";
123
+            if (is_array($cache_ids_filterd)) {
124
+                if (count($cache_ids_filterd) == 1) {
125
+                                    $cache_ids_where = "= '" . Db::escape_string($cache_ids_filterd[0]) . "'";
126
+                } else {
127
+                                    $cache_ids_where = "in ('" . implode("','", array_map('\okapi\Db::escape_string', $cache_ids_filterd)) . "')";
128
+                }
126 129
             } else {
127 130
                 $cache_ids_where = "= '" . Db::escape_string($cache_ids_filterd) . "'";
128 131
             }
Please login to merge, or discard this patch.
htdocs/ownlogs.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  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
 $tpl->name = 'ownlogs';
11 11
 $tpl->menuitem = MNU_MYPROFILE_OWNLOGS;
@@ -18,4 +18,4 @@  discard block
 block discarded – undo
18 18
 
19 19
 $tpl->assign('ownlogs', true);
20 20
 
21
-require __DIR__ . '/newlogs.php';
21
+require __DIR__.'/newlogs.php';
Please login to merge, or discard this patch.
htdocs/404.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  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
 $sUserCountry = $login->getUserCountry();
11 11
 
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 if ($isRedirect404) {
28 28
     // check length
29 29
     $uril = 70;
30
-    $uri = 'http://' . strtolower($_SERVER['SERVER_NAME']) . $_SERVER['REQUEST_URI'];
30
+    $uri = 'http://'.strtolower($_SERVER['SERVER_NAME']).$_SERVER['REQUEST_URI'];
31 31
     // limit to $uril
32 32
     if (strlen($uri) > $uril) {
33
-        $uri = substr($uri, 0, $uril - 3) . '...';
33
+        $uri = substr($uri, 0, $uril - 3).'...';
34 34
     }
35 35
 
36 36
     // assign uri
Please login to merge, or discard this patch.
htdocs/api/user_inactivity.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
  *  Unicode Reminder メモ
6 6
  ***************************************************************************/
7 7
 
8
-$opt['rootpath'] = __DIR__ . '/../';
9
-require $opt['rootpath'] . 'lib2/web.inc.php';
8
+$opt['rootpath'] = __DIR__.'/../';
9
+require $opt['rootpath'].'lib2/web.inc.php';
10 10
 
11 11
 header('Content-type: text/plain; charset=utf-8');
12 12
 
Please login to merge, or discard this patch.
htdocs/api/email_problems.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
  *  Unicode Reminder メモ
6 6
  ***************************************************************************/
7 7
 
8
-$opt['rootpath'] = __DIR__ . '/../';
9
-require $opt['rootpath'] . 'lib2/web.inc.php';
8
+$opt['rootpath'] = __DIR__.'/../';
9
+require $opt['rootpath'].'lib2/web.inc.php';
10 10
 
11 11
 header('Content-type: text/plain; charset=utf-8');
12 12
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 ) {
17 17
     $rs = sql('SELECT `user_id`, `email_problems` FROM `user` WHERE `email_problems`');
18 18
     while ($r = sql_fetch_assoc($rs)) {
19
-        echo $r['user_id'] . ' ' . $r['email_problems'] . "\n";
19
+        echo $r['user_id'].' '.$r['email_problems']."\n";
20 20
     }
21 21
     sql_free_result($rs);
22 22
 }
Please login to merge, or discard this patch.
htdocs/api/hidden_caches.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
  *  replicated system than the XML interface.
10 10
  ***************************************************************************/
11 11
 
12
-$opt['rootpath'] = __DIR__ . '/../';
13
-require $opt['rootpath'] . 'lib2/web.inc.php';
12
+$opt['rootpath'] = __DIR__.'/../';
13
+require $opt['rootpath'].'lib2/web.inc.php';
14 14
 
15 15
 header('Content-type: text/plain; charset=utf-8');
16 16
 
@@ -24,5 +24,5 @@  discard block
 block discarded – undo
24 24
 );
25 25
 $wp_ocs = sql_fetch_column($rs);
26 26
 foreach ($wp_ocs as $wp_oc) {
27
-    echo $wp_oc . "\n";
27
+    echo $wp_oc."\n";
28 28
 }
Please login to merge, or discard this patch.
htdocs/api/ping.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
  *  Unicode Reminder メモ
6 6
  ***************************************************************************/
7 7
 
8
-$opt['rootpath'] = __DIR__ . '/../';
9
-require $opt['rootpath'] . 'lib2/web.inc.php';
8
+$opt['rootpath'] = __DIR__.'/../';
9
+require $opt['rootpath'].'lib2/web.inc.php';
10 10
 
11 11
 header('Content-type: text/plain; charset=utf-8');
12 12
 echo sql_value('SELECT NOW()', '');
Please login to merge, or discard this patch.
htdocs/api/gc2oc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
  *
14 14
  ***************************************************************************/
15 15
 
16
-$opt['rootpath'] = __DIR__ . '/../';
17
-require $opt['rootpath'] . 'lib2/web.inc.php';
16
+$opt['rootpath'] = __DIR__.'/../';
17
+require $opt['rootpath'].'lib2/web.inc.php';
18 18
 
19 19
 if (isset($_REQUEST['report']) && $_REQUEST['report']) {
20 20
     header('Content-type: text/plain');
Please login to merge, or discard this patch.