@@ -25,11 +25,11 @@ discard block |
||
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 |
||
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 | } |
@@ -24,9 +24,9 @@ |
||
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 | } |
@@ -56,7 +56,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -11,16 +11,16 @@ discard block |
||
11 | 11 | * |
12 | 12 | ***************************************************************************/ |
13 | 13 | |
14 | -$opt['rootpath'] = __DIR__ . '/../../'; |
|
15 | -require $opt['rootpath'] . 'lib2/cli.inc.php'; |
|
14 | +$opt['rootpath'] = __DIR__.'/../../'; |
|
15 | +require $opt['rootpath'].'lib2/cli.inc.php'; |
|
16 | 16 | |
17 | 17 | // test for user who runs the cronjob |
18 | 18 | $processUser = posix_getpwuid(posix_geteuid()); |
19 | 19 | if ($processUser['name'] != $opt['cron']['username']) { |
20 | 20 | die( |
21 | - "ERROR: runcron must be run by '" . $opt['cron']['username'] |
|
22 | - . "' but was called by '" . $processUser['name'] . "'\n" . |
|
23 | - "Try something like 'sudo -u " . $opt['cron']['username'] . " php runcron.php'.\n"); |
|
21 | + "ERROR: runcron must be run by '".$opt['cron']['username'] |
|
22 | + . "' but was called by '".$processUser['name']."'\n". |
|
23 | + "Try something like 'sudo -u ".$opt['cron']['username']." php runcron.php'.\n"); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | // ensure that we do not run concurrently |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - $modules_dir = $opt['rootpath'] . 'util2/cron/modules/'; |
|
37 | + $modules_dir = $opt['rootpath'].'util2/cron/modules/'; |
|
38 | 38 | $param = count($argv) > 1 ? $argv[1] : ''; |
39 | 39 | |
40 | 40 | if ($param != '' && substr($param, 0, 1) != '-' && !strstr('/', $param)) { |
41 | 41 | // run one job manually for debugging purpose |
42 | 42 | $ignore_interval = true; |
43 | - require $modules_dir . $argv[1] . '.class.php'; |
|
43 | + require $modules_dir.$argv[1].'.class.php'; |
|
44 | 44 | } else { |
45 | 45 | if (cronjobs_enabled()) { |
46 | 46 | $ignore_interval = false; |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | while (false !== ($file = readdir($hDir))) { |
49 | 49 | if (substr($file, -10) == '.class.php') { |
50 | 50 | if ($param == '--show') { |
51 | - echo 'running ' . $file . "\n"; |
|
51 | + echo 'running '.$file."\n"; |
|
52 | 52 | } |
53 | - require $modules_dir . $file; |
|
53 | + require $modules_dir.$file; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -10,17 +10,17 @@ |
||
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 |
@@ -10,8 +10,8 @@ discard block |
||
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 |
||
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 | } |
@@ -8,23 +8,23 @@ discard block |
||
8 | 8 | * creates backups of gk_ tables and initializes archive directory. |
9 | 9 | ***************************************************************************/ |
10 | 10 | |
11 | -$opt['rootpath'] = __DIR__ . '/../../'; |
|
12 | -require_once $opt['rootpath'] . 'lib2/cli.inc.php'; |
|
11 | +$opt['rootpath'] = __DIR__.'/../../'; |
|
12 | +require_once $opt['rootpath'].'lib2/cli.inc.php'; |
|
13 | 13 | |
14 | 14 | if (count($argv) != 2 || ($argv[1] != 'init' && $argv[1] != 'discard')) { |
15 | - die("\n" . |
|
16 | - "Please verify that runcron.php is disabled in crontab;\n" . |
|
17 | - "then run this script with\n" . |
|
18 | - "\n" . |
|
19 | - " php save-gkstate.php init to initialize or reset GK archive\n" . |
|
20 | - " php save-gkstate.php discard to discard GK archive\n" . |
|
21 | - "\n" . |
|
22 | - "Don't forget to re-enable cronjobs afterwards!\n" . |
|
15 | + die("\n". |
|
16 | + "Please verify that runcron.php is disabled in crontab;\n". |
|
17 | + "then run this script with\n". |
|
18 | + "\n". |
|
19 | + " php save-gkstate.php init to initialize or reset GK archive\n". |
|
20 | + " php save-gkstate.php discard to discard GK archive\n". |
|
21 | + "\n". |
|
22 | + "Don't forget to re-enable cronjobs afterwards!\n". |
|
23 | 23 | "\n"); |
24 | 24 | } |
25 | 25 | |
26 | 26 | if ($opt['cron']['geokrety']['xml_archive'] != ($argv[1] == 'init')) { |
27 | - die("Error: Geokrety XML archiving is " . ($opt['cron']['geokrety']['xml_archive'] ? 'enabled' : 'disabled') . " in settings\n"); |
|
27 | + die("Error: Geokrety XML archiving is ".($opt['cron']['geokrety']['xml_archive'] ? 'enabled' : 'disabled')." in settings\n"); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | echo "deleting old archive if exists\n"; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | sql("DROP TABLE IF EXISTS _backup_gk_move_waypoint"); |
36 | 36 | sql("DROP TABLE IF EXISTS _backup_gk_user"); |
37 | 37 | |
38 | -foreach (glob($opt['rootpath'] . "cache2/geokrety/import-*.xml") as $f) { |
|
38 | +foreach (glob($opt['rootpath']."cache2/geokrety/import-*.xml") as $f) { |
|
39 | 39 | unlink($f); |
40 | 40 | } |
41 | 41 |
@@ -10,14 +10,14 @@ |
||
10 | 10 | * version 9 on, as newcache.php and editcache.php now trim the names. |
11 | 11 | ***************************************************************************/ |
12 | 12 | |
13 | -$opt['rootpath'] = __DIR__ . '/../../'; |
|
14 | -require __DIR__ . '/../../lib2/cli.inc.php'; |
|
13 | +$opt['rootpath'] = __DIR__.'/../../'; |
|
14 | +require __DIR__.'/../../lib2/cli.inc.php'; |
|
15 | 15 | |
16 | 16 | $rs = sql("SELECT `cache_id`, `name` FROM `caches` WHERE `name`<'\"' ORDER BY `name` ASC"); |
17 | 17 | while ($r = sql_fetch_array($rs)) { |
18 | 18 | $name = trim($r['name']); |
19 | 19 | if ($name != $r['name'] && $name != "") { |
20 | - echo "ID " . $r['cache_id'] . ": trimmed cache name to '" . $name . "'\n"; |
|
20 | + echo "ID ".$r['cache_id'].": trimmed cache name to '".$name."'\n"; |
|
21 | 21 | sql("UPDATE `caches` SET `name`='&1' WHERE `cache_id`=&2", $name, $r['cache_id']); |
22 | 22 | } |
23 | 23 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use Oc\Libse\ChildWp\ControllerChildWp; |
10 | 10 | use Oc\Libse\ChildWp\HandlerChildWp; |
11 | 11 | |
12 | -require __DIR__ . '/lib2/web.inc.php'; |
|
12 | +require __DIR__.'/lib2/web.inc.php'; |
|
13 | 13 | |
14 | 14 | $tpl->name = 'childwp'; |
15 | 15 | $tpl->menuitem = MNU_CACHES_HIDE; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | if ($redirect) { |
37 | - $tpl->redirect('editcache.php?cacheid=' . $presenter->getCacheId()); |
|
37 | + $tpl->redirect('editcache.php?cacheid='.$presenter->getCacheId()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $presenter->prepare($tpl); |