@@ -12,7 +12,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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']; |
@@ -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); |
@@ -5,7 +5,7 @@ discard block |
||
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 = 'newcachesrest'; |
11 | 11 | $tpl->menuitem = MNU_START_NEWCACHES; |
@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | $tpl->caching = true; |
15 | 15 | $tpl->cache_lifetime = 3600; |
16 | 16 | |
17 | -$country = isset($_REQUEST['usercountry']) ? $_REQUEST['usercountry'] : |
|
18 | - (isset($_REQUEST['country']) ? $_REQUEST['country'] : $opt['page']['main_country']); |
|
17 | +$country = isset($_REQUEST['usercountry']) ? $_REQUEST['usercountry'] : (isset($_REQUEST['country']) ? $_REQUEST['country'] : $opt['page']['main_country']); |
|
19 | 18 | |
20 | 19 | if (!$tpl->is_cached()) { |
21 | 20 | $newCaches = array(); |
@@ -27,7 +26,7 @@ discard block |
||
27 | 26 | FROM `caches` |
28 | 27 | INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id` |
29 | 28 | WHERE `cache_status`.`allow_user_view`=1 |
30 | - AND `country`!='" . sql_escape($country) . "' |
|
29 | + AND `country`!='" . sql_escape($country)."' |
|
31 | 30 | ORDER BY `date_created` DESC LIMIT 200" |
32 | 31 | ); |
33 | 32 |