Completed
Pull Request — master (#300)
by
unknown
07:10
created
htdocs/util2/cron/modules/picture_cleanup.class.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@
 block discarded – undo
42 42
             }
43 43
 
44 44
             for ($n = 1; $n < count($instances); ++ $n) {
45
-                if ($instances[$n]['filesize'] !== false) {// ensure that pic is stored locally
45
+                if ($instances[$n]['filesize'] !== false) {
46
+// ensure that pic is stored locally
46 47
                     for ($nn = $n - 1; $nn >= 0; -- $nn) {
47 48
                         if ($instances[$nn]['filesize'] === $instances[$n]['filesize']) {
48 49
                             if (file_get_contents($instances[$nn]['pic']->getFilename())
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@
 block discarded – undo
51 51
                                 $picture = $instances[$n]['pic'];
52 52
                                 echo
53 53
                                     'deleting duplicate picture '
54
-                                    . $picture->getPictureId() . ' ("' . $picture->getTitle() . '")'
55
-                                    . ' from log ' . $rDuplicatePic['object_id']
56
-                                    . ' of cache ' . $instances[$n]['cache_id'] . "\n";
54
+                                    . $picture->getPictureId().' ("'.$picture->getTitle().'")'
55
+                                    . ' from log '.$rDuplicatePic['object_id']
56
+                                    . ' of cache '.$instances[$n]['cache_id']."\n";
57 57
                                 $picture->delete(false);
58 58
                                 $instances[$n]['filesize'] = false;
59 59
                                 break;
Please login to merge, or discard this patch.
htdocs/util2/cron/modules/push_waypoint_reports.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@
 block discarded – undo
27 27
                     $result = 'ok';
28 28
                 } else {
29 29
                     $result = @file_get_contents(
30
-                        $opt['cron']['gcwp']['report'] .
31
-                        '?ocwp=' . urlencode($r['wp_oc']) .
32
-                        '&gcwp=' . urlencode($r['wp_external']) .
33
-                        '&source=' . urlencode($r['source'])
30
+                        $opt['cron']['gcwp']['report'].
31
+                        '?ocwp='.urlencode($r['wp_oc']).
32
+                        '&gcwp='.urlencode($r['wp_external']).
33
+                        '&source='.urlencode($r['source'])
34 34
                     );
35 35
                     $result = trim($result);
36 36
                 }
37 37
                 if ($result != 'ok') {
38
-                    echo "could not push GC waypoint report (id " . $r['report_id'] . "): " . $result . "\n";
38
+                    echo "could not push GC waypoint report (id ".$r['report_id']."): ".$result."\n";
39 39
                     break;
40 40
                 } else {
41 41
                     sql(
Please login to merge, or discard this patch.
htdocs/util2/cron/modules/cache_location.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@
 block discarded – undo
41 41
                 "SELECT `level`, `code`, AsText(`shape`) AS `geometry`
42 42
                 FROM `nuts_layer`
43 43
                 WHERE MBRWITHIN(GeomFromText('&1'), `shape`) ORDER BY `level` DESC",
44
-                'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')'
44
+                'POINT('.$rCache['longitude'].' '.$rCache['latitude'].')'
45 45
             );
46 46
             while ($rLayers = sql_fetch_assoc($rsLayers)) {
47 47
                 if (gis::ptInLineRing(
48 48
                     $rLayers['geometry'],
49
-                    'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')'
49
+                    'POINT('.$rCache['longitude'].' '.$rCache['latitude'].')'
50 50
                 )
51 51
                 ) {
52 52
                     $sCode = $rLayers['code'];
Please login to merge, or discard this patch.
htdocs/util2/cron/modules/replication_monitor.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 
26 26
         foreach ($opt['db']['slaves'] as $k => $v) {
27 27
             $this->check_slave($k);
28
-            $known_ids[] = "'" . sql_escape($k) . "'";
28
+            $known_ids[] = "'".sql_escape($k)."'";
29 29
         }
30 30
 
31 31
         if (count($known_ids) > 0) {
32
-            sql("DELETE FROM `sys_repl_slaves` WHERE `id` NOT IN (" . implode(',', $known_ids) . ")");
32
+            sql("DELETE FROM `sys_repl_slaves` WHERE `id` NOT IN (".implode(',', $known_ids).")");
33 33
         } else {
34 34
             sql("DELETE FROM `sys_repl_slaves`");
35 35
         }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         if ($nOnline != sql_value("SELECT `online` FROM `sys_repl_slaves` WHERE `id`='&1'", 0, $id)) {
89 89
             mail(
90 90
                 $opt['db']['error']['mail'],
91
-                "MySQL Slave Server Id " . $id . " (" . $slave['server'] . ") is now " . (($nOnline != 0) ? 'Online' : 'Offline'),
91
+                "MySQL Slave Server Id ".$id." (".$slave['server'].") is now ".(($nOnline != 0) ? 'Online' : 'Offline'),
92 92
                 ''
93 93
             );
94 94
         }
Please login to merge, or discard this patch.
htdocs/util2/cron/modules/replicate.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@
 block discarded – undo
24 24
 
25 25
             $hidden_caches = file_get_contents($opt['cron']['replicate']['delete_hidden_caches']['url']);
26 26
             $hc = explode("\n", trim($hidden_caches));
27
-            $hc_imploded_and_escaped = "'" . implode("','", array_map('sql_escape', $hc)) . "'";
27
+            $hc_imploded_and_escaped = "'".implode("','", array_map('sql_escape', $hc))."'";
28 28
             sql("SET @allowdelete = 1");
29
-            sql("DELETE FROM `caches` WHERE `wp_oc` IN (" . $hc_imploded_and_escaped . ")");
29
+            sql("DELETE FROM `caches` WHERE `wp_oc` IN (".$hc_imploded_and_escaped.")");
30 30
             // All dependent data in other tables is deleted via trigger.
31 31
         }
32 32
     }
Please login to merge, or discard this patch.
htdocs/util2/cron/modules/maillog.class.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 class maillog
13 13
 {
14 14
     public $name = 'maillog';
15
-    public $interval = 600;  // every 10 minutes
15
+    public $interval = 600; // every 10 minutes
16 16
 
17 17
 
18 18
     public function run()
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
             $opt['system']['maillog']['syslog_db_user'],
34 34
             $opt['system']['maillog']['syslog_db_password'],
35 35
             true
36
-        );  // use separate connection even if on same DB host
36
+        ); // use separate connection even if on same DB host
37 37
         if ($dbc === false) {
38
-            echo $this->name . ": could not connect to syslog database\n";
38
+            echo $this->name.": could not connect to syslog database\n";
39 39
 
40 40
             return;
41 41
         }
42
-        if (@mysql_query("USE " . $opt['system']['maillog']['syslog_db_name'], $dbc) === false) {
43
-            echo $this->name . ": could not open syslog database: " . mysql_error() . "\n";
42
+        if (@mysql_query("USE ".$opt['system']['maillog']['syslog_db_name'], $dbc) === false) {
43
+            echo $this->name.": could not open syslog database: ".mysql_error()."\n";
44 44
 
45 45
             return;
46 46
         }
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
         $col_program = mysql_real_escape_string($opt['system']['maillog']['column']['program']);
53 53
 
54 54
         $maillog_where =
55
-            "`" . $col_hostname . "`='" . mysql_real_escape_string($opt['system']['maillog']['syslog_oc_host']) . "' AND
56
-            `" . $col_program . "` like '" . mysql_real_escape_string($opt['system']['maillog']['syslog_mta']) . "'";
55
+            "`".$col_hostname."`='".mysql_real_escape_string($opt['system']['maillog']['syslog_oc_host'])."' AND
56
+            `" . $col_program."` like '".mysql_real_escape_string($opt['system']['maillog']['syslog_mta'])."'";
57 57
 
58 58
         $rs = @mysql_query(
59 59
             "
60
-            SELECT TIMESTAMPDIFF(DAY, MAX(" . $col_created . "), NOW())
61
-            FROM `" . mysql_real_escape_string($opt['system']['maillog']['syslog_db_table']) . "`
60
+            SELECT TIMESTAMPDIFF(DAY, MAX(" . $col_created."), NOW())
61
+            FROM `" . mysql_real_escape_string($opt['system']['maillog']['syslog_db_table'])."`
62 62
             WHERE " . $maillog_where
63 63
         );
64 64
         $r = mysql_fetch_row($rs);
@@ -80,26 +80,26 @@  discard block
 block discarded – undo
80 80
         // case some entries with same timestamp as $last_date will be processed redundantly.
81 81
 
82 82
         $rs = @mysql_query(
83
-            "SELECT `" . $col_id . "` `id`,
84
-                      `" . $col_message . "` `message`,
85
-                      `" . $col_created . "` `created`
86
-                 FROM `" . mysql_real_escape_string($opt['system']['maillog']['syslog_db_table']) . "`
87
-                WHERE `" . $col_created . "`>='" . mysql_real_escape_string($last_date) . "'
88
-                  AND (`" . $col_id . "`>'" . mysql_real_escape_string(
83
+            "SELECT `".$col_id."` `id`,
84
+                      `" . $col_message."` `message`,
85
+                      `" . $col_created."` `created`
86
+                 FROM `" . mysql_real_escape_string($opt['system']['maillog']['syslog_db_table'])."`
87
+                WHERE `" . $col_created."`>='".mysql_real_escape_string($last_date)."'
88
+                  AND (`" . $col_id."`>'".mysql_real_escape_string(
89 89
                 $last_id
90
-            ) . "' OR `" . $col_created . "`>'" . mysql_real_escape_string($last_date) . "')
91
-                  AND  " . $maillog_where . "
92
-             ORDER BY `" . $col_created . "`,`" . $col_id . "`",
90
+            )."' OR `".$col_created."`>'".mysql_real_escape_string($last_date)."')
91
+                  AND  " . $maillog_where."
92
+             ORDER BY `" . $col_created."`,`".$col_id."`",
93 93
             $dbc
94 94
         );
95 95
         if ($rs === false) {
96
-            echo $this->name . ": syslog query error (" . mysql_errno() . "): " . mysql_error() . "\n";
96
+            echo $this->name.": syslog query error (".mysql_errno()."): ".mysql_error()."\n";
97 97
 
98 98
             return;
99 99
         }
100 100
 
101 101
         while ($logentry = mysql_fetch_assoc($rs)) {
102
-            $message = $logentry['message'];   // latin-1 charset
102
+            $message = $logentry['message']; // latin-1 charset
103 103
             $delivered = strpos($message, 'status=sent') > 0;
104 104
             $bounced = strpos($message, 'status=bounced') > 0;
105 105
             if ($delivered || $bounced) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                         }
124 124
                     }
125 125
                 } else {
126
-                    echo $this->name . ": no email address found for record ID " . $logentry['id'] . "\n";
126
+                    echo $this->name.": no email address found for record ID ".$logentry['id']."\n";
127 127
                 }
128 128
             }
129 129
             $last_id = $logentry['id'];
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,8 @@
 block discarded – undo
112 112
                             $emailadr
113 113
                         );
114 114
                     } else {
115
-                        if ($bounced) {  // maximum one bounce per day is counted, to filter out temporary problems
115
+                        if ($bounced) {
116
+// maximum one bounce per day is counted, to filter out temporary problems
116 117
                             sql(
117 118
                                 "UPDATE `user` SET `email_problems`=`email_problems`+1, `last_email_problem`='&2'
118 119
                               WHERE `email`='&1' AND IFNULL(`last_email_problem`,'') < '&2'",
Please login to merge, or discard this patch.
htdocs/util2/cron/modules/cache_waypoint_pool.class.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                            ORDER BY `free_wp` ASC
57 57
                               LIMIT 250",
58 58
                 $opt['logic']['waypoint_pool']['prefix'],
59
-                '^' . $opt['logic']['waypoint_pool']['prefix'] . '[' . $opt['logic']['waypoint_pool']['valid_chars'] . ']{1,}$'
59
+                '^'.$opt['logic']['waypoint_pool']['prefix'].'['.$opt['logic']['waypoint_pool']['valid_chars'].']{1,}$'
60 60
             );
61 61
         } else {
62 62
             // query the last used waypoint
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                                    SELECT MAX(WPTODEC(`wp_oc`, '&2')) AS dec_wp
71 71
                                      FROM `cache_waypoint_pool`
72 72
                                  ) AS tbl",
73
-                '^' . $opt['logic']['waypoint_pool']['prefix'] . '[' . $opt['logic']['waypoint_pool']['valid_chars'] . ']{1,}$',
73
+                '^'.$opt['logic']['waypoint_pool']['prefix'].'['.$opt['logic']['waypoint_pool']['valid_chars'].']{1,}$',
74 74
                 $opt['logic']['waypoint_pool']['prefix']
75 75
             );
76 76
         }
@@ -78,16 +78,16 @@  discard block
 block discarded – undo
78 78
         while (($rStartWp = sql_fetch_assoc($rsStartWp)) && ($nInsertCount < $max_inserts_count)) {
79 79
             $free_wp = $rStartWp['free_wp'];
80 80
             if ($free_wp == '') {
81
-                $free_wp = $opt['logic']['waypoint_pool']['prefix'] . '0001';
81
+                $free_wp = $opt['logic']['waypoint_pool']['prefix'].'0001';
82 82
             }
83 83
             $nInsertCount += $this->fill_turn($free_wp, $max_inserts_count - $nInsertCount);
84
-            $rowCount ++;
84
+            $rowCount++;
85 85
         }
86 86
         sql_free_result($rsStartWp);
87 87
 
88 88
         if ($rowCount == 0) {
89 89
             // new database ...
90
-            $nInsertCount += $this->fill_turn($opt['logic']['waypoint_pool']['prefix'] . '0001', $max_inserts_count);
90
+            $nInsertCount += $this->fill_turn($opt['logic']['waypoint_pool']['prefix'].'0001', $max_inserts_count);
91 91
         }
92 92
 
93 93
         return $nInsertCount;
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
                                      FROM `cache_waypoint_pool`
112 112
                                     WHERE WPTODEC(`wp_oc`, '&3')>WPTODEC('&1', '&3')
113 113
                                  ) AS tbl",
114
-            $opt['logic']['waypoint_pool']['prefix'] . '100000',
114
+            $opt['logic']['waypoint_pool']['prefix'].'100000',
115 115
             $start_wp,
116
-            '^' . $opt['logic']['waypoint_pool']['prefix'] . '[' . $opt['logic']['waypoint_pool']['valid_chars'] . ']{1,}$',
116
+            '^'.$opt['logic']['waypoint_pool']['prefix'].'['.$opt['logic']['waypoint_pool']['valid_chars'].']{1,}$',
117 117
             $opt['logic']['waypoint_pool']['prefix']
118 118
         );
119 119
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $nWaypointsGenerated = 0;
122 122
         while (($nWaypointsGenerated < $max_inserts_count) && ($start_wp != $end_wp)) {
123 123
             sql("INSERT INTO `cache_waypoint_pool` (`wp_oc`) VALUES ('&1')", $start_wp);
124
-            $nWaypointsGenerated ++;
124
+            $nWaypointsGenerated++;
125 125
             $start_wp = $this->increment_waypoint($start_wp, $opt['logic']['waypoint_pool']['prefix']);
126 126
         }
127 127
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
         $wp_value = substr($wp, 2);
144 144
         $b36_value = '';
145
-        for ($i = 0; $i < strlen($wp_value); $i ++) {
145
+        for ($i = 0; $i < strlen($wp_value); $i++) {
146 146
             $b36_value .= substr($b36_chars, strpos($wp_chars, substr($wp_value, $i, 1)), 1);
147 147
         }
148 148
 
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
         $b36_value = strtoupper(base_convert($dec_value, 10, strlen($wp_chars)));
151 151
 
152 152
         $wp_value = '';
153
-        for ($i = 0; $i < strlen($b36_value); $i ++) {
153
+        for ($i = 0; $i < strlen($b36_value); $i++) {
154 154
             $wp_value .= substr($wp_chars, strpos($b36_chars, substr($b36_value, $i, 1)), 1);
155 155
         }
156 156
 
157 157
         if (strlen($wp_value) < 4) {
158
-            return $prefix . substr('0000' . $wp_value, - 4);
158
+            return $prefix.substr('0000'.$wp_value, - 4);
159 159
         } else {
160
-            return $prefix . $wp_value;
160
+            return $prefix.$wp_value;
161 161
         }
162 162
     }
163 163
 }
Please login to merge, or discard this patch.
htdocs/util2/geokrety/fix-waypoints.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 block discarded – undo
10 10
  *  Data import functions are in util2/cron/modules/geokrety.class.php.
11 11
  ***************************************************************************/
12 12
 
13
-$opt['rootpath'] = __DIR__ . '/../../';
14
-require_once $opt['rootpath'] . 'lib2/cli.inc.php';
13
+$opt['rootpath'] = __DIR__.'/../../';
14
+require_once $opt['rootpath'].'lib2/cli.inc.php';
15 15
 
16 16
 if (count($argv) != 2 || $argv[1] != 'run') {
17
-    die("\n" .
18
-        "Please verify that runcron.php is disabled in crontab;\n" .
19
-        "then run this script with\n" .
20
-        "\n" .
21
-        "   php fix-waypoints.php run\n" .
22
-        "\n" .
23
-        "Don't forget to re-enable cronjobs afterwards!\n" .
17
+    die("\n".
18
+        "Please verify that runcron.php is disabled in crontab;\n".
19
+        "then run this script with\n".
20
+        "\n".
21
+        "   php fix-waypoints.php run\n".
22
+        "\n".
23
+        "Don't forget to re-enable cronjobs afterwards!\n".
24 24
         "\n");
25 25
 }
26 26
 
Please login to merge, or discard this patch.
htdocs/util2/geokrety/check-waypoints.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
  *  Data import functions are in util2/cron/modules/geokrety.class.php.
11 11
  ***************************************************************************/
12 12
 
13
-$opt['rootpath'] = __DIR__ . '/../../';
14
-require_once $opt['rootpath'] . 'lib2/cli.inc.php';
13
+$opt['rootpath'] = __DIR__.'/../../';
14
+require_once $opt['rootpath'].'lib2/cli.inc.php';
15 15
 
16 16
 $itemwps = [];
17 17
 
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
                     $wp
64 64
                 ) == 0
65 65
             ) {
66
-                echo "item " . $itemid . ": " . $wp . " is missing in gk_move_waypoint\n";
66
+                echo "item ".$itemid.": ".$wp." is missing in gk_move_waypoint\n";
67 67
             } else {
68
-                echo "item " . $itemid . ": " . $wp . " is not the current wp in gk_move_waypoint\n";
68
+                echo "item ".$itemid.": ".$wp." is not the current wp in gk_move_waypoint\n";
69 69
             }
70 70
         } elseif (isset($flags['movewp']) && !isset($flags['itemwp'])) {
71
-            echo "item " . $itemid . ": " . $wp . " is missing in gk_item_waypoint\n";
71
+            echo "item ".$itemid.": ".$wp." is missing in gk_item_waypoint\n";
72 72
         }
73 73
     }
74 74
 }
Please login to merge, or discard this patch.