@@ -1461,6 +1461,10 @@ |
||
1461 | 1461 | } |
1462 | 1462 | |
1463 | 1463 | // helper function for output modules |
1464 | + |
|
1465 | + /** |
|
1466 | + * @param string $str |
|
1467 | + */ |
|
1464 | 1468 | function append_output($str) |
1465 | 1469 | { |
1466 | 1470 | global $db, $content, $bUseZip; |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * - wtf is "expert mode"? |
56 | 56 | ****************************************************************************/ |
57 | 57 | |
58 | -require __DIR__ . '/lib2/web.inc.php'; |
|
59 | -require __DIR__ . '/lib2/logic/data-license.inc.php'; |
|
60 | -require __DIR__ . '/lib2/search/search.inc.php'; |
|
61 | -require __DIR__ . '/templates2/' . $opt['template']['style'] . '/search.tpl.inc.php'; |
|
58 | +require __DIR__.'/lib2/web.inc.php'; |
|
59 | +require __DIR__.'/lib2/logic/data-license.inc.php'; |
|
60 | +require __DIR__.'/lib2/search/search.inc.php'; |
|
61 | +require __DIR__.'/templates2/'.$opt['template']['style'].'/search.tpl.inc.php'; |
|
62 | 62 | |
63 | 63 | |
64 | 64 | //========================================================= |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | -$queryid += 0; // safety measure: force $queryid to be numeric |
|
131 | +$queryid += 0; // safety measure: force $queryid to be numeric |
|
132 | 132 | |
133 | 133 | |
134 | 134 | //========================================================= |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | if (sql_num_rows($query_rs) == 0) { |
150 | 150 | // can happen if logged out after query was created (fix for RT #3915) |
151 | 151 | $queryid = 0; |
152 | - goto newquery; // goto needs PHP 5.3 |
|
152 | + goto newquery; // goto needs PHP 5.3 |
|
153 | 153 | /* |
154 | 154 | $tpl->error($error_query_not_found); |
155 | 155 | */ |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | // get findername from finderid |
188 | - $options['finderid'] = isset($options['finderid']) ? $options['finderid'] + 0 : 0; // Ocprop |
|
188 | + $options['finderid'] = isset($options['finderid']) ? $options['finderid'] + 0 : 0; // Ocprop |
|
189 | 189 | if (isset($options['finder']) && $options['finderid'] > 0) { |
190 | 190 | $rs_name = sql("SELECT `username` FROM `user` WHERE `user_id`='&1'", $options['finderid']); |
191 | 191 | if (sql_num_rows($rs_name) == 1) { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | // get ownername from ownerid |
200 | - $options['ownerid'] = isset($options['ownerid']) ? $options['ownerid'] + 0 : 0; // Ocprop |
|
200 | + $options['ownerid'] = isset($options['ownerid']) ? $options['ownerid'] + 0 : 0; // Ocprop |
|
201 | 201 | if (isset($options['owner']) && $options['ownerid'] > 0) { |
202 | 202 | $rs_name = sql("SELECT `username` FROM `user` WHERE `user_id`='&1'", $options['ownerid']); |
203 | 203 | if (sql_num_rows($rs_name) == 1) { |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | // get the search options parameters and store them in the queries table (to view "the next page") |
229 | - $options['f_userowner'] = isset($_REQUEST['f_userowner']) ? $_REQUEST['f_userowner'] : 0; // Ocprop |
|
230 | - $options['f_userfound'] = isset($_REQUEST['f_userfound']) ? $_REQUEST['f_userfound'] : 0; // Ocprop |
|
229 | + $options['f_userowner'] = isset($_REQUEST['f_userowner']) ? $_REQUEST['f_userowner'] : 0; // Ocprop |
|
230 | + $options['f_userfound'] = isset($_REQUEST['f_userfound']) ? $_REQUEST['f_userfound'] : 0; // Ocprop |
|
231 | 231 | $options['f_disabled'] = isset($_REQUEST['f_disabled']) ? $_REQUEST['f_disabled'] : 0; |
232 | - $options['f_inactive'] = isset($_REQUEST['f_inactive']) ? $_REQUEST['f_inactive'] : 1; // Ocprop |
|
232 | + $options['f_inactive'] = isset($_REQUEST['f_inactive']) ? $_REQUEST['f_inactive'] : 1; // Ocprop |
|
233 | 233 | // f_inactive formerly was used for both, archived and disabled caches. |
234 | 234 | // After adding the separate f_disabled option, it is used only for archived |
235 | 235 | // caches, but keeps its name for compatibility with existing stored or |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | $options['f_ignored'] = isset($_REQUEST['f_ignored']) ? $_REQUEST['f_ignored'] : 1; |
238 | 238 | $options['f_otherPlatforms'] = isset($_REQUEST['f_otherPlatforms']) ? $_REQUEST['f_otherPlatforms'] : 0; |
239 | 239 | $options['f_geokrets'] = isset($_REQUEST['f_geokrets']) ? $_REQUEST['f_geokrets'] : 0; |
240 | - $options['expert'] = isset($_REQUEST['expert']) ? $_REQUEST['expert'] : 0; // Ocprop: 0 |
|
240 | + $options['expert'] = isset($_REQUEST['expert']) ? $_REQUEST['expert'] : 0; // Ocprop: 0 |
|
241 | 241 | $options['showresult'] = isset($_REQUEST['showresult']) ? $_REQUEST['showresult'] : 0; |
242 | - $options['output'] = isset($_REQUEST['output']) ? $_REQUEST['output'] : 'HTML'; // Ocprop: HTML |
|
242 | + $options['output'] = isset($_REQUEST['output']) ? $_REQUEST['output'] : 'HTML'; // Ocprop: HTML |
|
243 | 243 | $options['bbox'] = isset($_REQUEST['bbox']) ? $_REQUEST['bbox'] : false; |
244 | 244 | |
245 | 245 | if (isset($_REQUEST['cache_attribs'])) { |
246 | 246 | if ($_REQUEST['cache_attribs'] != '') { |
247 | 247 | $aAttribs = mb_split(';', $_REQUEST['cache_attribs']); |
248 | - for ($i = 0; $i < count($aAttribs); $i ++) { |
|
248 | + for ($i = 0; $i < count($aAttribs); $i++) { |
|
249 | 249 | $options['cache_attribs'][$aAttribs[$i] + 0] = $aAttribs[$i] + 0; |
250 | 250 | } |
251 | 251 | unset($aAttribs); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | if (isset($_REQUEST['cache_attribs_not'])) { |
260 | 260 | if ($_REQUEST['cache_attribs_not'] != '') { |
261 | 261 | $aAttribs = mb_split(';', $_REQUEST['cache_attribs_not']); |
262 | - for ($i = 0; $i < count($aAttribs); $i ++) { |
|
262 | + for ($i = 0; $i < count($aAttribs); $i++) { |
|
263 | 263 | $options['cache_attribs_not'][$aAttribs[$i] + 0] = $aAttribs[$i] + 0; |
264 | 264 | } |
265 | 265 | unset($aAttribs); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | $options['finderid'] = isset($_REQUEST['finderid']) ? $_REQUEST['finderid'] : 0; |
299 | 299 | $options['finder'] = isset($_REQUEST['finder']) ? stripslashes($_REQUEST['finder']) : ''; |
300 | - $options['logtype'] = isset($_REQUEST['logtype']) ? $_REQUEST['logtype'] : '1,7'; // Ocprop |
|
300 | + $options['logtype'] = isset($_REQUEST['logtype']) ? $_REQUEST['logtype'] : '1,7'; // Ocprop |
|
301 | 301 | } elseif (isset($_REQUEST['searchbyortplz'])) { |
302 | 302 | $onlydigits = is_numeric($_REQUEST['ortplz']); |
303 | 303 | if ($onlydigits == true) { |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | if (!$list->allowView($password)) { |
364 | 364 | $tpl->redirect("cachelists.php"); |
365 | 365 | } |
366 | - $options['cachelist'] = cachelist::getListById($options['listid']); // null for invalid ID |
|
366 | + $options['cachelist'] = cachelist::getListById($options['listid']); // null for invalid ID |
|
367 | 367 | $options['cachelist_pw'] = $password; |
368 | 368 | } elseif (isset($_REQUEST['searchall'])) { |
369 | 369 | if (!$login->logged_in() && |
@@ -538,17 +538,17 @@ discard block |
||
538 | 538 | if ($options['searchtype'] == 'byname') { |
539 | 539 | $sql_select[] = '`caches`.`cache_id` `cache_id`'; |
540 | 540 | $sql_from = '`caches`'; |
541 | - $sql_where[] = '`caches`.`name` LIKE \'%' . sql_escape($options['cachename']) . '%\''; |
|
541 | + $sql_where[] = '`caches`.`name` LIKE \'%'.sql_escape($options['cachename']).'%\''; |
|
542 | 542 | } elseif ($options['searchtype'] == 'byowner') { |
543 | 543 | if ($options['ownerid'] != 0) { |
544 | 544 | $sql_select[] = '`caches`.`cache_id` `cache_id`'; |
545 | 545 | $sql_from = '`caches`'; |
546 | - $sql_where[] = '`user_id`=\'' . sql_escape($options['ownerid']) . '\''; |
|
546 | + $sql_where[] = '`user_id`=\''.sql_escape($options['ownerid']).'\''; |
|
547 | 547 | } else { |
548 | 548 | $sql_select[] = '`caches`.`cache_id` `cache_id`'; |
549 | 549 | $sql_from = '`caches`'; |
550 | 550 | $sql_innerjoin[] = '`user` ON `caches`.`user_id`=`user`.`user_id`'; |
551 | - $sql_where[] = '`user`.`username`=\'' . sql_escape($options['owner']) . '\''; |
|
551 | + $sql_where[] = '`user`.`username`=\''.sql_escape($options['owner']).'\''; |
|
552 | 552 | } |
553 | 553 | } elseif (($options['searchtype'] == 'byplz') || ($options['searchtype'] == 'byort')) { |
554 | 554 | $locid = $options['locid']; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | $sql = |
564 | 564 | "SELECT `loc_id` |
565 | 565 | FROM `geodb_textdata` |
566 | - WHERE `text_type`=500300000 AND `text_val`='" . sql_escape($plz) . "'"; |
|
566 | + WHERE `text_type`=500300000 AND `text_val`='" . sql_escape($plz)."'"; |
|
567 | 567 | $rs = sql($sql); |
568 | 568 | if (sql_num_rows($rs) == 0) { |
569 | 569 | sql_free_result($rs); |
@@ -638,9 +638,9 @@ discard block |
||
638 | 638 | if ($sqlhashes != '') { |
639 | 639 | $sqlhashes .= ' OR '; |
640 | 640 | } |
641 | - $sqlhashes .= '`gns_search`.`simplehash`=' . sprintf("%u", crc32($searchstring)); |
|
641 | + $sqlhashes .= '`gns_search`.`simplehash`='.sprintf("%u", crc32($searchstring)); |
|
642 | 642 | |
643 | - $wordscount ++; |
|
643 | + $wordscount++; |
|
644 | 644 | } |
645 | 645 | } |
646 | 646 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | // needs distinct because there can be multiple matching logs per cache |
923 | 923 | $sql_from = '`caches`'; |
924 | 924 | $sql_innerjoin[] = '`cache_logs` ON `caches`.`cache_id`=`cache_logs`.`cache_id`'; |
925 | - $sql_where[] = '`cache_logs`.`user_id`=\'' . sql_escape($finder_id) . '\''; |
|
925 | + $sql_where[] = '`cache_logs`.`user_id`=\''.sql_escape($finder_id).'\''; |
|
926 | 926 | |
927 | 927 | if ($options['logtype'] != '0') { // 0 = all types |
928 | 928 | $ids = explode(',', $options['logtype']); |
@@ -933,18 +933,18 @@ discard block |
||
933 | 933 | } |
934 | 934 | $idNumbers .= ($id + 0); |
935 | 935 | } |
936 | - $sql_where[] = '`cache_logs`.`type` IN (' . $idNumbers . ')'; |
|
936 | + $sql_where[] = '`cache_logs`.`type` IN ('.$idNumbers.')'; |
|
937 | 937 | } |
938 | 938 | } elseif ($options['searchtype'] == 'bycacheid') { |
939 | 939 | $sql_select[] = '`caches`.`cache_id` `cache_id`'; |
940 | 940 | $sql_from = '`caches`'; |
941 | - $sql_where[] = '`caches`.`cache_id`=\'' . sql_escape($options['cacheid']) . '\''; |
|
941 | + $sql_where[] = '`caches`.`cache_id`=\''.sql_escape($options['cacheid']).'\''; |
|
942 | 942 | } elseif ($options['searchtype'] == 'bywp') { |
943 | 943 | $sql_select[] = '`caches`.`cache_id` `cache_id`'; |
944 | 944 | $sql_from = '`caches`'; |
945 | - $sql_where[] = '`caches`.`wp_oc`=\'' . sql_escape($options['wp']) . '\''; |
|
945 | + $sql_where[] = '`caches`.`wp_oc`=\''.sql_escape($options['wp']).'\''; |
|
946 | 946 | } elseif ($options['searchtype'] == 'byfulltext') { |
947 | - require_once $opt['rootpath'] . 'lib2/search/ftsearch.inc.php'; |
|
947 | + require_once $opt['rootpath'].'lib2/search/ftsearch.inc.php'; |
|
948 | 948 | |
949 | 949 | $fulltext = $options['fulltext']; |
950 | 950 | $hashes = ftsearch_hash($fulltext); |
@@ -982,27 +982,27 @@ discard block |
||
982 | 982 | $n = 1; |
983 | 983 | foreach ($hashes as $k => $h) { |
984 | 984 | if ($n > 1) { |
985 | - $sql_innerjoin[] = '`search_index` AS `s' . $n . '` ON `s' . ($n - 1) . '`.`cache_id`=`s' . $n . '`.`cache_id`'; |
|
985 | + $sql_innerjoin[] = '`search_index` AS `s'.$n.'` ON `s'.($n - 1).'`.`cache_id`=`s'.$n.'`.`cache_id`'; |
|
986 | 986 | } else { |
987 | 987 | $sql_innerjoin[] = '`search_index` AS `s1` ON `s1`.`cache_id`=`caches`.`cache_id`'; |
988 | 988 | } |
989 | 989 | |
990 | - $sql_where[] = '`s' . $n . '`.`hash`=\'' . sql_escape($h) . '\''; |
|
991 | - $sql_where[] = '`s' . $n . '`.`object_type` IN (' . implode(',', $ft_types) . ')'; |
|
990 | + $sql_where[] = '`s'.$n.'`.`hash`=\''.sql_escape($h).'\''; |
|
991 | + $sql_where[] = '`s'.$n.'`.`object_type` IN ('.implode(',', $ft_types).')'; |
|
992 | 992 | |
993 | - $n ++; |
|
993 | + $n++; |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | $sqlFilter = |
997 | - 'SELECT DISTINCT ' . implode(',', $sql_select) . |
|
998 | - ' FROM ' . $sql_from . |
|
999 | - ' INNER JOIN ' . implode(' INNER JOIN ', $sql_innerjoin) . |
|
1000 | - ' WHERE ' . implode(' AND ', $sql_where); |
|
997 | + 'SELECT DISTINCT '.implode(',', $sql_select). |
|
998 | + ' FROM '.$sql_from. |
|
999 | + ' INNER JOIN '.implode(' INNER JOIN ', $sql_innerjoin). |
|
1000 | + ' WHERE '.implode(' AND ', $sql_where); |
|
1001 | 1001 | |
1002 | 1002 | sql_drop_temp_table_slave('tmpFTCaches'); |
1003 | 1003 | sql_temp_table_slave('tmpFTCaches'); |
1004 | 1004 | sql_slave( |
1005 | - "CREATE TEMPORARY TABLE &tmpFTCaches (`cache_id` int (11) PRIMARY KEY) " . $sqlFilter |
|
1005 | + "CREATE TEMPORARY TABLE &tmpFTCaches (`cache_id` int (11) PRIMARY KEY) ".$sqlFilter |
|
1006 | 1006 | ); |
1007 | 1007 | |
1008 | 1008 | $sql_select = []; |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | SELECT `cache_id` |
1027 | 1027 | FROM `cache_list_items` |
1028 | 1028 | LEFT JOIN `cache_lists` ON `cache_lists`.`id`=`cache_list_items`.`cache_list_id` |
1029 | - WHERE `cache_list_id`='" . sql_escape($options['listid']) . "'"; |
|
1029 | + WHERE `cache_list_id`='" . sql_escape($options['listid'])."'"; |
|
1030 | 1030 | sql_slave($cachesFilter); |
1031 | 1031 | sql_slave('ALTER TABLE &result_caches ADD PRIMARY KEY (`cache_id`)'); |
1032 | 1032 | |
@@ -1054,7 +1054,7 @@ discard block |
||
1054 | 1054 | $options['f_userowner'] = '0'; |
1055 | 1055 | } // Ocprop |
1056 | 1056 | if ($options['f_userowner'] != 0) { |
1057 | - $sql_where[] = '`caches`.`user_id`!=\'' . $login->userid . '\''; |
|
1057 | + $sql_where[] = '`caches`.`user_id`!=\''.$login->userid.'\''; |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | if (!isset($options['f_userfound'])) { |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | (SELECT `cache_logs`.`cache_id` |
1067 | 1067 | FROM `cache_logs` |
1068 | 1068 | WHERE |
1069 | - `cache_logs`.`user_id`='" . sql_escape($login->userid) . "' |
|
1069 | + `cache_logs`.`user_id`='" . sql_escape($login->userid)."' |
|
1070 | 1070 | AND `cache_logs`.`type` IN (1, 7))"; |
1071 | 1071 | } |
1072 | 1072 | if (!isset($options['f_inactive'])) { |
@@ -1093,14 +1093,14 @@ discard block |
||
1093 | 1093 | if ($options['f_ignored'] != 0) { |
1094 | 1094 | // only use this filter, if it is realy needed - this enables better caching in map2.php with ignored-filter |
1095 | 1095 | if (sql_value_slave( |
1096 | - "SELECT COUNT(*) FROM `cache_ignore` WHERE `user_id`='" . sql_escape($login->userid) . "'", |
|
1096 | + "SELECT COUNT(*) FROM `cache_ignore` WHERE `user_id`='".sql_escape($login->userid)."'", |
|
1097 | 1097 | 0 |
1098 | 1098 | ) > 0) { |
1099 | 1099 | $sql_where[] = |
1100 | 1100 | "`caches`.`cache_id` NOT IN |
1101 | 1101 | (SELECT `cache_ignore`.`cache_id` |
1102 | 1102 | FROM `cache_ignore` |
1103 | - WHERE `cache_ignore`.`user_id`='" . sql_escape($login->userid) . "')"; |
|
1103 | + WHERE `cache_ignore`.`user_id`='" . sql_escape($login->userid)."')"; |
|
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | } |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | $options['country'] = ''; |
1123 | 1123 | } |
1124 | 1124 | if ($options['country'] != '') { |
1125 | - $sql_where[] = '`caches`.`country`=\'' . sql_escape($options['country']) . '\''; |
|
1125 | + $sql_where[] = '`caches`.`country`=\''.sql_escape($options['country']).'\''; |
|
1126 | 1126 | } |
1127 | 1127 | |
1128 | 1128 | if (!isset($options['language'])) { |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | $sql_where[] = '`cache_desc`.`language`=\'' . sql_escape($options['language']) . '\''; |
1135 | 1135 | */ |
1136 | 1136 | // optimized query: |
1137 | - $sql_where[] = 'INSTR(`caches`.`desc_languages`,\'' . sql_escape($options['language']) . '\')'; |
|
1137 | + $sql_where[] = 'INSTR(`caches`.`desc_languages`,\''.sql_escape($options['language']).'\')'; |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | if (!isset($options['adm2'])) { |
@@ -1142,50 +1142,50 @@ discard block |
||
1142 | 1142 | } |
1143 | 1143 | if ($options['adm2'] != '') { |
1144 | 1144 | $sql_innerjoin[] = '`cache_location` ON `cache_location`.`cache_id`=`caches`.`cache_id`'; |
1145 | - $sql_where[] = '`cache_location`.`code2`=\'' . sql_escape($options['adm2']) . '\''; |
|
1145 | + $sql_where[] = '`cache_location`.`code2`=\''.sql_escape($options['adm2']).'\''; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | if ($options['cachetype'] != '') { |
1149 | 1149 | $types = explode(';', $options['cachetype']); |
1150 | 1150 | if (count($types) < sql_value_slave("SELECT COUNT(*) FROM `cache_type`", 0)) { |
1151 | - for ($i = 0; $i < count($types); $i ++) { |
|
1152 | - $types[$i] = "'" . sql_escape($types[$i]) . "'"; |
|
1151 | + for ($i = 0; $i < count($types); $i++) { |
|
1152 | + $types[$i] = "'".sql_escape($types[$i])."'"; |
|
1153 | 1153 | } |
1154 | - $sql_where[] = '`caches`.`type` IN (' . implode(',', $types) . ')'; |
|
1154 | + $sql_where[] = '`caches`.`type` IN ('.implode(',', $types).')'; |
|
1155 | 1155 | } |
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | if ($options['cachesize'] != '') { |
1159 | 1159 | $sizes = explode(';', $options['cachesize']); |
1160 | 1160 | if (count($sizes) < sql_value_slave("SELECT COUNT(*) FROM `cache_size`", 0)) { |
1161 | - for ($i = 0; $i < count($sizes); $i ++) { |
|
1162 | - $sizes[$i] = "'" . sql_escape($sizes[$i]) . "'"; |
|
1161 | + for ($i = 0; $i < count($sizes); $i++) { |
|
1162 | + $sizes[$i] = "'".sql_escape($sizes[$i])."'"; |
|
1163 | 1163 | } |
1164 | - $sql_where[] = '`caches`.`size` IN (' . implode(',', $sizes) . ')'; |
|
1164 | + $sql_where[] = '`caches`.`size` IN ('.implode(',', $sizes).')'; |
|
1165 | 1165 | } |
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | if ($options['difficultymin'] != 0) { |
1169 | - $sql_where[] = '`caches`.`difficulty`>=\'' . sql_escape($options['difficultymin']) . '\''; |
|
1169 | + $sql_where[] = '`caches`.`difficulty`>=\''.sql_escape($options['difficultymin']).'\''; |
|
1170 | 1170 | } |
1171 | 1171 | if ($options['difficultymax'] != 0) { |
1172 | - $sql_where[] = '`caches`.`difficulty`<=\'' . sql_escape($options['difficultymax']) . '\''; |
|
1172 | + $sql_where[] = '`caches`.`difficulty`<=\''.sql_escape($options['difficultymax']).'\''; |
|
1173 | 1173 | } |
1174 | 1174 | if ($options['terrainmin'] != 0) { |
1175 | - $sql_where[] = '`caches`.`terrain`>=\'' . sql_escape($options['terrainmin']) . '\''; |
|
1175 | + $sql_where[] = '`caches`.`terrain`>=\''.sql_escape($options['terrainmin']).'\''; |
|
1176 | 1176 | } |
1177 | 1177 | if ($options['terrainmax'] != 0) { |
1178 | - $sql_where[] = '`caches`.`terrain`<=\'' . sql_escape($options['terrainmax']) . '\''; |
|
1178 | + $sql_where[] = '`caches`.`terrain`<=\''.sql_escape($options['terrainmax']).'\''; |
|
1179 | 1179 | } |
1180 | 1180 | if ($options['recommendationmin'] > 0) { |
1181 | 1181 | $sql_innerjoin[] = '`stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id`'; |
1182 | - $sql_where[] = '`stat_caches`.`toprating`>=\'' . sql_escape($options['recommendationmin']) . '\''; |
|
1182 | + $sql_where[] = '`stat_caches`.`toprating`>=\''.sql_escape($options['recommendationmin']).'\''; |
|
1183 | 1183 | } |
1184 | 1184 | |
1185 | 1185 | if (isset($options['cache_attribs']) && count($options['cache_attribs']) > 0) { |
1186 | 1186 | foreach ($options['cache_attribs'] as $attr) { |
1187 | - $sql_innerjoin[] = '`caches_attributes` AS `a' . ($attr + 0) . '` ON `a' . ($attr + 0) . '`.`cache_id`=`caches`.`cache_id`'; |
|
1188 | - $sql_where[] = '`a' . ($attr + 0) . '`.`attrib_id`=' . ($attr + 0); |
|
1187 | + $sql_innerjoin[] = '`caches_attributes` AS `a'.($attr + 0).'` ON `a'.($attr + 0).'`.`cache_id`=`caches`.`cache_id`'; |
|
1188 | + $sql_where[] = '`a'.($attr + 0).'`.`attrib_id`='.($attr + 0); |
|
1189 | 1189 | } |
1190 | 1190 | } |
1191 | 1191 | |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | FROM `caches_attributes` |
1198 | 1198 | WHERE |
1199 | 1199 | `caches_attributes`.`cache_id`=`caches`.`cache_id` |
1200 | - AND `caches_attributes`.`attrib_id`='" . sql_escape($attr + 0) . "' |
|
1200 | + AND `caches_attributes`.`attrib_id`='" . sql_escape($attr + 0)."' |
|
1201 | 1201 | )"; |
1202 | 1202 | } |
1203 | 1203 | } |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | // bbox=<lon_from>,<lat_from>,<lon_to>,<lat_to> |
1207 | 1207 | $coords = explode(',', $options['bbox']); |
1208 | 1208 | if (count($coords) == 4) { |
1209 | - $sql_where[] = '`caches`.`longitude`>=' . ($coords[0] + 0) . ' AND `caches`.`latitude`>=' . ($coords[1] + 0) . ' AND `caches`.`longitude`<=' . ($coords[2] + 0) . ' AND `caches`.`latitude`<=' . ($coords[3] + 0); |
|
1209 | + $sql_where[] = '`caches`.`longitude`>='.($coords[0] + 0).' AND `caches`.`latitude`>='.($coords[1] + 0).' AND `caches`.`longitude`<='.($coords[2] + 0).' AND `caches`.`latitude`<='.($coords[3] + 0); |
|
1210 | 1210 | } |
1211 | 1211 | } |
1212 | 1212 | |
@@ -1215,23 +1215,23 @@ discard block |
||
1215 | 1215 | $sql_where[] = |
1216 | 1216 | '(`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`=' |
1217 | 1217 | . sql_escape($login->userid) |
1218 | - . ' OR (`caches`.`status`<>5 AND ' . ($login->hasAdminPriv(ADMIN_USER) ? '1' : '0') . '))'; |
|
1218 | + . ' OR (`caches`.`status`<>5 AND '.($login->hasAdminPriv(ADMIN_USER) ? '1' : '0').'))'; |
|
1219 | 1219 | } else { |
1220 | 1220 | $sql_where[] = '`cache_status`.`allow_user_view`=1'; |
1221 | 1221 | } |
1222 | 1222 | |
1223 | 1223 | //do the search |
1224 | - $innerjoin = sizeof($sql_innerjoin) ? ' INNER JOIN ' . implode(' INNER JOIN ', $sql_innerjoin) : ''; |
|
1225 | - $leftjoin = sizeof($sql_leftjoin) ? ' LEFT JOIN ' . implode(' LEFT JOIN ', $sql_leftjoin) : ''; |
|
1226 | - $group = sizeof($sql_group) ? ' GROUP BY ' . implode(', ', $sql_group) : ''; |
|
1227 | - $having = sizeof($sql_having) ? ' HAVING ' . implode(' AND ', $sql_having) : ''; |
|
1228 | - |
|
1229 | - $sqlFilter = 'SELECT ' . implode(',', $sql_select) . |
|
1230 | - ' FROM ' . $sql_from . |
|
1231 | - $innerjoin . |
|
1232 | - $leftjoin . |
|
1233 | - ' WHERE ' . implode(' AND ', $sql_where) . |
|
1234 | - $group . |
|
1224 | + $innerjoin = sizeof($sql_innerjoin) ? ' INNER JOIN '.implode(' INNER JOIN ', $sql_innerjoin) : ''; |
|
1225 | + $leftjoin = sizeof($sql_leftjoin) ? ' LEFT JOIN '.implode(' LEFT JOIN ', $sql_leftjoin) : ''; |
|
1226 | + $group = sizeof($sql_group) ? ' GROUP BY '.implode(', ', $sql_group) : ''; |
|
1227 | + $having = sizeof($sql_having) ? ' HAVING '.implode(' AND ', $sql_having) : ''; |
|
1228 | + |
|
1229 | + $sqlFilter = 'SELECT '.implode(',', $sql_select). |
|
1230 | + ' FROM '.$sql_from. |
|
1231 | + $innerjoin. |
|
1232 | + $leftjoin. |
|
1233 | + ' WHERE '.implode(' AND ', $sql_where). |
|
1234 | + $group. |
|
1235 | 1235 | $having; |
1236 | 1236 | |
1237 | 1237 | // echo "DEBUG ".$sqlFilter." DEBUG<br>"; |
@@ -1243,7 +1243,7 @@ discard block |
||
1243 | 1243 | // X6. load output module and output-dependent options |
1244 | 1244 | //================================================================= |
1245 | 1245 | |
1246 | - $output_module = mb_strtolower($options['output']); // Ocprop: HTML, gpx |
|
1246 | + $output_module = mb_strtolower($options['output']); // Ocprop: HTML, gpx |
|
1247 | 1247 | |
1248 | 1248 | $map2_bounds = ($output_module == 'map2bounds'); |
1249 | 1249 | if ($map2_bounds) { |
@@ -1252,7 +1252,7 @@ discard block |
||
1252 | 1252 | |
1253 | 1253 | if ($map2_bounds && $options['queryid'] == 0) { |
1254 | 1254 | $tpl->error('map2bounds requires queryid'); |
1255 | - } elseif (!file_exists($opt['rootpath'] . 'lib2/search/search.' . $output_module . '.inc.php')) { |
|
1255 | + } elseif (!file_exists($opt['rootpath'].'lib2/search/search.'.$output_module.'.inc.php')) { |
|
1256 | 1256 | $tpl->error($outputformat_notexist); |
1257 | 1257 | } |
1258 | 1258 | |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | // (map2 module will execute and exit; it will use the variables |
1279 | 1279 | // $cachesFilter, $sqlFilter and $map2_bounds and $options['queryid'].) |
1280 | 1280 | |
1281 | - require $opt['rootpath'] . 'lib2/search/search.' . $output_module . '.inc.php'; |
|
1281 | + require $opt['rootpath'].'lib2/search/search.'.$output_module.'.inc.php'; |
|
1282 | 1282 | |
1283 | 1283 | if (!isset($search_output_file_download)) { |
1284 | 1284 | die("search_output_file_download flag not set for '$output_module' search"); |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | $lat_rad * 180 / 3.14159, |
1304 | 1304 | 0, |
1305 | 1305 | $multiplier[$distance_unit] |
1306 | - ) . ' `distance`, '; |
|
1306 | + ).' `distance`, '; |
|
1307 | 1307 | } else { |
1308 | 1308 | if (!$login->logged_in()) { |
1309 | 1309 | $sql .= 'NULL distance, '; |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | $record_coords['latitude'], |
1327 | 1327 | 0, |
1328 | 1328 | $multiplier[$distance_unit] |
1329 | - ) . ' `distance`, '; |
|
1329 | + ).' `distance`, '; |
|
1330 | 1330 | } |
1331 | 1331 | sql_free_result($rs_coords); |
1332 | 1332 | } |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | $sAddFields .= ', MAX(`cache_logs`.`date`) AS `lastLog`'; |
1337 | 1337 | $sAddJoin .= ' LEFT JOIN `cache_logs` ON `caches`.`cache_id`=`cache_logs`.`cache_id`'; |
1338 | 1338 | if ($options['sort'] == 'bymylastlog') { |
1339 | - $sAddJoin .= ' AND `cache_logs`.`user_id`=' . sql_escape($login->userid); |
|
1339 | + $sAddJoin .= ' AND `cache_logs`.`user_id`='.sql_escape($login->userid); |
|
1340 | 1340 | } |
1341 | 1341 | $sGroupBy .= ' GROUP BY `caches`.`cache_id`'; |
1342 | 1342 | } |
@@ -1352,8 +1352,8 @@ discard block |
||
1352 | 1352 | . ' FROM `caches` |
1353 | 1353 | LEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id`' . |
1354 | 1354 | $sAddJoin |
1355 | - . ' WHERE `caches`.`cache_id` IN (' . $sqlFilter . ')' . |
|
1356 | - $sAddWhere . ' ' . |
|
1355 | + . ' WHERE `caches`.`cache_id` IN ('.$sqlFilter.')'. |
|
1356 | + $sAddWhere.' '. |
|
1357 | 1357 | $sGroupBy; |
1358 | 1358 | $sortby = $options['sort']; |
1359 | 1359 | |
@@ -1418,7 +1418,7 @@ discard block |
||
1418 | 1418 | $count = 500; |
1419 | 1419 | } |
1420 | 1420 | |
1421 | - $sqlLimit = ' LIMIT ' . $startat . ', ' . $count; |
|
1421 | + $sqlLimit = ' LIMIT '.$startat.', '.$count; |
|
1422 | 1422 | |
1423 | 1423 | if ($search_output_file_download) { |
1424 | 1424 | //=================================================================== |
@@ -1429,7 +1429,7 @@ discard block |
||
1429 | 1429 | // for the case something went wrong and it was not propery cleaned up |
1430 | 1430 | |
1431 | 1431 | sql_temp_table_slave('searchtmp'); |
1432 | - sql_slave("CREATE TEMPORARY TABLE &searchtmp SELECT " . $sql . $sqlLimit); |
|
1432 | + sql_slave("CREATE TEMPORARY TABLE &searchtmp SELECT ".$sql.$sqlLimit); |
|
1433 | 1433 | |
1434 | 1434 | $count = sql_value_slave("SELECT COUNT(*) FROM &searchtmp", 0); |
1435 | 1435 | if ($count == 1) { |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | '?' |
1442 | 1442 | ); |
1443 | 1443 | } else { |
1444 | - $sFilebasename = 'ocde' . $options['queryid']; |
|
1444 | + $sFilebasename = 'ocde'.$options['queryid']; |
|
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | $bUseZip = ($count > $zip_threshold) || |
@@ -1452,11 +1452,11 @@ discard block |
||
1452 | 1452 | |
1453 | 1453 | if (!$db['debug']) { |
1454 | 1454 | if ($bUseZip) { |
1455 | - header('Content-type: ' . $content_type_zipped); |
|
1456 | - header('Content-disposition: attachment; filename="' . $sFilebasename . '.zip"'); |
|
1455 | + header('Content-type: '.$content_type_zipped); |
|
1456 | + header('Content-disposition: attachment; filename="'.$sFilebasename.'.zip"'); |
|
1457 | 1457 | } else { |
1458 | - header('Content-type: ' . $content_type_plain); |
|
1459 | - header('Content-disposition: attachment; filename="' . $sFilebasename . '.' . $output_module . '"'); |
|
1458 | + header('Content-type: '.$content_type_plain); |
|
1459 | + header('Content-disposition: attachment; filename="'.$sFilebasename.'.'.$output_module.'"'); |
|
1460 | 1460 | } |
1461 | 1461 | } |
1462 | 1462 | |
@@ -1489,9 +1489,9 @@ discard block |
||
1489 | 1489 | // output zip file |
1490 | 1490 | if ($bUseZip && !$db['debug']) { |
1491 | 1491 | if ($add_to_zipfile) { |
1492 | - $phpzip->add_data($sFilebasename . '.' . $output_module, $content); |
|
1492 | + $phpzip->add_data($sFilebasename.'.'.$output_module, $content); |
|
1493 | 1493 | } |
1494 | - echo $phpzip->save($sFilebasename . '.zip', 'r'); |
|
1494 | + echo $phpzip->save($sFilebasename.'.zip', 'r'); |
|
1495 | 1495 | } |
1496 | 1496 | } else { |
1497 | 1497 | //=================================================================== |
@@ -1565,14 +1565,14 @@ discard block |
||
1565 | 1565 | $cachesFilter = |
1566 | 1566 | "CREATE TEMPORARY TABLE &result_caches ENGINE=MEMORY |
1567 | 1567 | SELECT |
1568 | - (" . geomath::getSqlDistanceFormula($lon, $lat, $distance, $multiplier[$distance_unit]) . ") `distance`, |
|
1568 | + (" . geomath::getSqlDistanceFormula($lon, $lat, $distance, $multiplier[$distance_unit]).") `distance`, |
|
1569 | 1569 | `caches`.`cache_id` `cache_id` |
1570 | 1570 | FROM `caches` FORCE INDEX (`latitude`) |
1571 | 1571 | WHERE |
1572 | - `longitude` > " . ($lon - $max_lon_diff) . " |
|
1573 | - AND `longitude` < " . ($lon + $max_lon_diff) . " |
|
1574 | - AND `latitude` > " . ($lat - $max_lat_diff) . " |
|
1575 | - AND `latitude` < " . ($lat + $max_lat_diff) . " |
|
1572 | + `longitude` > " . ($lon - $max_lon_diff)." |
|
1573 | + AND `longitude` < " . ($lon + $max_lon_diff)." |
|
1574 | + AND `latitude` > " . ($lat - $max_lat_diff)." |
|
1575 | + AND `latitude` < " . ($lat + $max_lat_diff)." |
|
1576 | 1576 | HAVING `distance` < " . ($distance + 0); |
1577 | 1577 | sql_slave($cachesFilter); |
1578 | 1578 | sql_slave("ALTER TABLE &result_caches ADD PRIMARY KEY ( `cache_id` )"); |
@@ -1687,7 +1687,7 @@ discard block |
||
1687 | 1687 | $rs = sql( |
1688 | 1688 | "SELECT `latitude`, `longitude` |
1689 | 1689 | FROM `user` |
1690 | - WHERE `user_id`='" . sql_escape($login->userid) . "'" |
|
1690 | + WHERE `user_id`='" . sql_escape($login->userid)."'" |
|
1691 | 1691 | ); |
1692 | 1692 | $record = sql_fetch_array($rs); |
1693 | 1693 | $lon = $record['longitude']; |
@@ -1785,9 +1785,9 @@ discard block |
||
1785 | 1785 | } |
1786 | 1786 | $tpl->assign('ortplz', $ortplz); |
1787 | 1787 | if ($options['searchtype'] == 'byplz') { |
1788 | - $dByOrtPlzChecked = ($options['searchtype'] == 'byplz'); // Ocprop |
|
1788 | + $dByOrtPlzChecked = ($options['searchtype'] == 'byplz'); // Ocprop |
|
1789 | 1789 | } elseif ($options['searchtype'] == 'byort') { |
1790 | - $dByOrtPlzChecked = ($options['searchtype'] == 'byort'); // Ocprop |
|
1790 | + $dByOrtPlzChecked = ($options['searchtype'] == 'byort'); // Ocprop |
|
1791 | 1791 | } else { |
1792 | 1792 | $dByOrtPlzChecked = false; |
1793 | 1793 | } |
@@ -1856,8 +1856,8 @@ discard block |
||
1856 | 1856 | $rCachetype['checked'] = |
1857 | 1857 | ($options['cachetype'] == '') |
1858 | 1858 | || (strpos( |
1859 | - ';' . $options['cachetype'] . ';', |
|
1860 | - ';' . $rCachetype['id'] . ';' |
|
1859 | + ';'.$options['cachetype'].';', |
|
1860 | + ';'.$rCachetype['id'].';' |
|
1861 | 1861 | ) !== false); |
1862 | 1862 | $rCachetype['unchecked'] = !$rCachetype['checked']; |
1863 | 1863 | } |
@@ -1870,8 +1870,8 @@ discard block |
||
1870 | 1870 | while ($r = sql_fetch_assoc($rs)) { |
1871 | 1871 | $cachesizes[$r['id']]['checked'] = |
1872 | 1872 | (strpos( |
1873 | - ';' . $options['cachesize'] . ';', |
|
1874 | - ';' . $r['id'] . ';' |
|
1873 | + ';'.$options['cachesize'].';', |
|
1874 | + ';'.$r['id'].';' |
|
1875 | 1875 | ) !== false) |
1876 | 1876 | || ($options['cachesize'] == ''); |
1877 | 1877 | } |
@@ -2022,7 +2022,7 @@ discard block |
||
2022 | 2022 | $line = mb_ereg_replace('{color}', $rAttrGroup['color'], $line); |
2023 | 2023 | |
2024 | 2024 | $group_line .= $line; |
2025 | - $nLineAttrCount2 ++; |
|
2025 | + $nLineAttrCount2++; |
|
2026 | 2026 | } |
2027 | 2027 | sql_free_result($rs); |
2028 | 2028 | |
@@ -2133,7 +2133,7 @@ discard block |
||
2133 | 2133 | $line = mb_ereg_replace('{color}', $rAttrGroup['color'], $line); |
2134 | 2134 | |
2135 | 2135 | $group_line .= $line; |
2136 | - $nLineAttrCount1 ++; |
|
2136 | + $nLineAttrCount1++; |
|
2137 | 2137 | } |
2138 | 2138 | sql_free_result($rs); |
2139 | 2139 | |
@@ -2255,7 +2255,7 @@ discard block |
||
2255 | 2255 | $pnew = ''; |
2256 | 2256 | foreach ($param as $p) { |
2257 | 2257 | if ($pnew != '') { |
2258 | - $pnew .= ';' . $p; |
|
2258 | + $pnew .= ';'.$p; |
|
2259 | 2259 | } else { |
2260 | 2260 | $pnew .= $p; |
2261 | 2261 | } |
@@ -2265,9 +2265,9 @@ discard block |
||
2265 | 2265 | } |
2266 | 2266 | |
2267 | 2267 | if ($urlparamString != '') { |
2268 | - $urlparamString .= '&' . $name . '=' . urlencode($param); |
|
2268 | + $urlparamString .= '&'.$name.'='.urlencode($param); |
|
2269 | 2269 | } else { |
2270 | - $urlparamString = $name . '=' . urlencode($param); |
|
2270 | + $urlparamString = $name.'='.urlencode($param); |
|
2271 | 2271 | } |
2272 | 2272 | } |
2273 | 2273 | $urlparamString .= ''; |
@@ -2278,13 +2278,13 @@ discard block |
||
2278 | 2278 | |
2279 | 2279 | function outputUniidSelectionForm($uniSql, $options) |
2280 | 2280 | { |
2281 | - global $tpl; // settings |
|
2281 | + global $tpl; // settings |
|
2282 | 2282 | global $locline, $secondlocationname; |
2283 | 2283 | |
2284 | 2284 | $urlparamString = prepareLocSelectionForm($options); |
2285 | 2285 | |
2286 | 2286 | sql_temp_table_slave('uniids'); |
2287 | - sql_slave("CREATE TEMPORARY TABLE &uniids ENGINE=MEMORY " . $uniSql); |
|
2287 | + sql_slave("CREATE TEMPORARY TABLE &uniids ENGINE=MEMORY ".$uniSql); |
|
2288 | 2288 | sql_slave("ALTER TABLE &uniids ADD PRIMARY KEY (`uni_id`)"); |
2289 | 2289 | |
2290 | 2290 | // locidsite |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | $tpl->assign('resultscount', $count); |
2298 | 2298 | |
2299 | 2299 | // create page browser |
2300 | - $pager = new pager('search.php?' . $urlparamString . '&locidsite={offset}'); |
|
2300 | + $pager = new pager('search.php?'.$urlparamString.'&locidsite={offset}'); |
|
2301 | 2301 | $pager->make_from_offset($locidsite, ceil($count / 20), 1); |
2302 | 2302 | |
2303 | 2303 | // create locations list |
@@ -2317,7 +2317,7 @@ discard block |
||
2317 | 2317 | FROM `gns_locations`, &uniids |
2318 | 2318 | WHERE &uniids.`uni_id`=`gns_locations`.`uni` |
2319 | 2319 | ORDER BY `gns_locations`.`full_name` ASC |
2320 | - LIMIT " . ($locidsite * 20) . ", 20" |
|
2320 | + LIMIT " . ($locidsite * 20).", 20" |
|
2321 | 2321 | ); |
2322 | 2322 | |
2323 | 2323 | $nr = $locidsite * 20 + 1; |
@@ -2354,7 +2354,7 @@ discard block |
||
2354 | 2354 | $thislocation = mb_ereg_replace('{parentlocations}', $locString, $thislocation); |
2355 | 2355 | |
2356 | 2356 | // koordinaten ermitteln |
2357 | - $coordString = help_latToDegreeStr($r['lat']) . ' ' . help_lonToDegreeStr($r['lon']); |
|
2357 | + $coordString = help_latToDegreeStr($r['lat']).' '.help_lonToDegreeStr($r['lon']); |
|
2358 | 2358 | $thislocation = mb_ereg_replace('{coords}', htmlspecialchars($coordString, ENT_COMPAT, 'UTF-8'), $thislocation); |
2359 | 2359 | |
2360 | 2360 | if ($r['olduni'] != 0) { |
@@ -2384,12 +2384,12 @@ discard block |
||
2384 | 2384 | htmlspecialchars($r['full_name'], ENT_COMPAT, 'UTF-8'), |
2385 | 2385 | $thislocation |
2386 | 2386 | ); |
2387 | - $thislocation = mb_ereg_replace('{urlparams}', $urlparamString . '&locid={locid}', $thislocation); |
|
2387 | + $thislocation = mb_ereg_replace('{urlparams}', $urlparamString.'&locid={locid}', $thislocation); |
|
2388 | 2388 | $thislocation = mb_ereg_replace('{locid}', urlencode($r['uni_id']), $thislocation); |
2389 | 2389 | $thislocation = mb_ereg_replace('{nr}', $nr, $thislocation); |
2390 | 2390 | |
2391 | - $nr ++; |
|
2392 | - $locations .= $thislocation . "\n"; |
|
2391 | + $nr++; |
|
2392 | + $locations .= $thislocation."\n"; |
|
2393 | 2393 | } |
2394 | 2394 | sql_free_result($rs); |
2395 | 2395 | sql_drop_temp_table_slave('uniids'); |
@@ -2406,12 +2406,12 @@ discard block |
||
2406 | 2406 | global $tpl; |
2407 | 2407 | global $locline, $bgcolor1, $bgcolor2; |
2408 | 2408 | |
2409 | - require_once __DIR__ . '/lib2/logic/geodb.inc.php'; |
|
2409 | + require_once __DIR__.'/lib2/logic/geodb.inc.php'; |
|
2410 | 2410 | |
2411 | - $urlparamString = prepareLocSelectionForm($options) . '&locid={locid}'; |
|
2411 | + $urlparamString = prepareLocSelectionForm($options).'&locid={locid}'; |
|
2412 | 2412 | |
2413 | 2413 | sql_temp_table_slave('locids'); |
2414 | - sql_slave("CREATE TEMPORARY TABLE &locids ENGINE=MEMORY " . $locSql); |
|
2414 | + sql_slave("CREATE TEMPORARY TABLE &locids ENGINE=MEMORY ".$locSql); |
|
2415 | 2415 | sql_slave("ALTER TABLE &locids ADD PRIMARY KEY (`loc_id`)"); |
2416 | 2416 | |
2417 | 2417 | $rs = sql_slave( |
@@ -2439,12 +2439,12 @@ discard block |
||
2439 | 2439 | |
2440 | 2440 | $rb = GeoDb::regierungsbezirkFromLocid($r['loc_id']); |
2441 | 2441 | if ($rb != '') { |
2442 | - $locString .= ' > ' . htmlspecialchars($rb, ENT_COMPAT, 'UTF-8'); |
|
2442 | + $locString .= ' > '.htmlspecialchars($rb, ENT_COMPAT, 'UTF-8'); |
|
2443 | 2443 | } |
2444 | 2444 | |
2445 | 2445 | $lk = GeoDb::landkreisFromLocid($r['loc_id']); |
2446 | 2446 | if ($lk != '') { |
2447 | - $locString .= ' > ' . htmlspecialchars($lk, ENT_COMPAT, 'UTF-8'); |
|
2447 | + $locString .= ' > '.htmlspecialchars($lk, ENT_COMPAT, 'UTF-8'); |
|
2448 | 2448 | } |
2449 | 2449 | |
2450 | 2450 | $thislocation = mb_ereg_replace('{parentlocations}', $locString, $thislocation); |
@@ -2459,9 +2459,9 @@ discard block |
||
2459 | 2459 | $r['loc_id'] |
2460 | 2460 | ); |
2461 | 2461 | if ($rCoords = sql_fetch_array($rsCoords)) { |
2462 | - $coordString = help_latToDegreeStr($rCoords['lat']) . ' ' . help_lonToDegreeStr($rCoords['lon']); |
|
2462 | + $coordString = help_latToDegreeStr($rCoords['lat']).' '.help_lonToDegreeStr($rCoords['lon']); |
|
2463 | 2463 | } else { |
2464 | - $coordString = '[' . $no_location_coords . ']'; |
|
2464 | + $coordString = '['.$no_location_coords.']'; |
|
2465 | 2465 | } |
2466 | 2466 | |
2467 | 2467 | $thislocation = mb_ereg_replace('{coords}', htmlspecialchars($coordString, ENT_COMPAT, 'UTF-8'), $thislocation); |
@@ -2481,8 +2481,8 @@ discard block |
||
2481 | 2481 | $thislocation = mb_ereg_replace('{bgcolor}', $bgcolor2, $thislocation); |
2482 | 2482 | } |
2483 | 2483 | |
2484 | - $nr ++; |
|
2485 | - $locations .= $thislocation . "\n"; |
|
2484 | + $nr++; |
|
2485 | + $locations .= $thislocation."\n"; |
|
2486 | 2486 | } |
2487 | 2487 | |
2488 | 2488 | $tpl->assign('locations', $locations); |
@@ -84,7 +84,8 @@ discard block |
||
84 | 84 | $called_by_search = isset($_REQUEST['calledbysearch']) ? $_REQUEST['calledbysearch'] <> 0 : true; |
85 | 85 | $called_by_profile_query = false; |
86 | 86 | |
87 | -if (isset($_REQUEST['queryid']) || isset($_REQUEST['showresult'])) { // Ocprop: showresult, queryid |
|
87 | +if (isset($_REQUEST['queryid']) || isset($_REQUEST['showresult'])) { |
|
88 | +// Ocprop: showresult, queryid |
|
88 | 89 | $bCookieQueryid = false; |
89 | 90 | $queryid = isset($_REQUEST['queryid']) ? $_REQUEST['queryid'] : 0; |
90 | 91 | if ($queryid && |
@@ -208,7 +209,8 @@ discard block |
||
208 | 209 | sql_free_result($rs_name); |
209 | 210 | } |
210 | 211 | } |
211 | -} else { // $queryid == 0 |
|
212 | +} else { |
|
213 | +// $queryid == 0 |
|
212 | 214 | // build search options from GET/POST parameters or default values |
213 | 215 | |
214 | 216 | // hack |
@@ -287,12 +289,14 @@ discard block |
||
287 | 289 | if (!isset($_REQUEST['utf8'])) { |
288 | 290 | $options['cachename'] = iconv("ISO-8859-1", "UTF-8", $options['cachename']); |
289 | 291 | } |
290 | - } elseif (isset($_REQUEST['searchbyowner'])) { // Ocprop |
|
292 | + } elseif (isset($_REQUEST['searchbyowner'])) { |
|
293 | +// Ocprop |
|
291 | 294 | $options['searchtype'] = 'byowner'; |
292 | 295 | |
293 | 296 | $options['ownerid'] = isset($_REQUEST['ownerid']) ? $_REQUEST['ownerid'] : 0; |
294 | 297 | $options['owner'] = isset($_REQUEST['owner']) ? stripslashes($_REQUEST['owner']) : ''; |
295 | - } elseif (isset($_REQUEST['searchbyfinder'])) { // Ocprop |
|
298 | + } elseif (isset($_REQUEST['searchbyfinder'])) { |
|
299 | +// Ocprop |
|
296 | 300 | $options['searchtype'] = 'byfinder'; |
297 | 301 | |
298 | 302 | $options['finderid'] = isset($_REQUEST['finderid']) ? $_REQUEST['finderid'] : 0; |
@@ -437,7 +441,8 @@ discard block |
||
437 | 441 | $bRememberQuery = isset($_REQUEST['skipqueryid']) ? !$_REQUEST['skipqueryid'] : true; |
438 | 442 | // This is used by the map, which implements its own query-caching. |
439 | 443 | if ($bRememberQuery) { |
440 | - if ($queryid == 0 && $options['showresult'] != 0) { // 'showresult' = "execute query" |
|
444 | + if ($queryid == 0 && $options['showresult'] != 0) { |
|
445 | +// 'showresult' = "execute query" |
|
441 | 446 | sql( |
442 | 447 | "INSERT INTO `queries` (`user_id`, `options`, `last_queried`) VALUES (0, '&1', NOW())", |
443 | 448 | serialize($options) |
@@ -854,7 +859,8 @@ discard block |
||
854 | 859 | outputSearchForm($options); |
855 | 860 | exit; |
856 | 861 | } |
857 | - } elseif ($options['searchtype'] == 'bydistance') { // Ocprop |
|
862 | + } elseif ($options['searchtype'] == 'bydistance') { |
|
863 | +// Ocprop |
|
858 | 864 | //check the entered data |
859 | 865 | if (isset($options['lat']) && isset($options['lon'])) { |
860 | 866 | $lat = $options['lat'] + 0; |
@@ -924,7 +930,8 @@ discard block |
||
924 | 930 | $sql_innerjoin[] = '`cache_logs` ON `caches`.`cache_id`=`cache_logs`.`cache_id`'; |
925 | 931 | $sql_where[] = '`cache_logs`.`user_id`=\'' . sql_escape($finder_id) . '\''; |
926 | 932 | |
927 | - if ($options['logtype'] != '0') { // 0 = all types |
|
933 | + if ($options['logtype'] != '0') { |
|
934 | +// 0 = all types |
|
928 | 935 | $ids = explode(',', $options['logtype']); |
929 | 936 | $idNumbers = '0'; |
930 | 937 | foreach ($ids as $id) { |
@@ -1405,7 +1412,8 @@ discard block |
||
1405 | 1412 | } |
1406 | 1413 | |
1407 | 1414 | $count = $caches_per_page; |
1408 | - if (isset($_REQUEST['count'])) { // Ocprop |
|
1415 | + if (isset($_REQUEST['count'])) { |
|
1416 | +// Ocprop |
|
1409 | 1417 | $count = floor($_REQUEST['count'] + 0); |
1410 | 1418 | } |
1411 | 1419 | if ($count == 'max') { |
@@ -1525,7 +1533,8 @@ discard block |
||
1525 | 1533 | } else { |
1526 | 1534 | exit; |
1527 | 1535 | } |
1528 | -} else { // $options['showresult'] == 0 |
|
1536 | +} else { |
|
1537 | +// $options['showresult'] == 0 |
|
1529 | 1538 | //============================================================= |
1530 | 1539 | // F5. present search options form to the user |
1531 | 1540 | //============================================================= |
@@ -1597,7 +1606,8 @@ discard block |
||
1597 | 1606 | |
1598 | 1607 | if (isset($options['sort'])) { |
1599 | 1608 | $bBynameChecked = ($options['sort'] == 'byname'); |
1600 | - } else { // Ocprop |
|
1609 | + } else { |
|
1610 | +// Ocprop |
|
1601 | 1611 | $bBynameChecked = (!$login->logged_in()); |
1602 | 1612 | } |
1603 | 1613 | $tpl->assign('byname_checked', $bBynameChecked); |
@@ -1759,7 +1769,8 @@ discard block |
||
1759 | 1769 | } |
1760 | 1770 | if ($options['searchtype'] == 'bydistance') { |
1761 | 1771 | $dByDistanceChecked = ($options['searchtype'] == 'bydistance'); |
1762 | - } else { // Ocprop |
|
1772 | + } else { |
|
1773 | +// Ocprop |
|
1763 | 1774 | $dByDistanceChecked = false; |
1764 | 1775 | } |
1765 | 1776 | $tpl->assign('dbydistance_checked', $dByDistanceChecked); |
@@ -1800,7 +1811,8 @@ discard block |
||
1800 | 1811 | ); |
1801 | 1812 | if ($options['searchtype'] == 'bywaypoint') { |
1802 | 1813 | $dByWaypointChecked = ($options['searchtype'] == 'bywaypoint'); |
1803 | - } else { // Ocprop |
|
1814 | + } else { |
|
1815 | +// Ocprop |
|
1804 | 1816 | $dByWaypointChecked = false; |
1805 | 1817 | } |
1806 | 1818 | $tpl->assign('dbywaypoint_checked', $dByWaypointChecked); |
@@ -54,6 +54,9 @@ discard block |
||
54 | 54 | $this->onDoSubmit($this->coordinate->getCoordinate(), $this->getDesc()); |
55 | 55 | } |
56 | 56 | |
57 | + /** |
|
58 | + * @param \Oc\Libse\Coordinate\CoordinateCoordinate $coordinate |
|
59 | + */ |
|
57 | 60 | abstract protected function onDoSubmit($coordinate, $description); |
58 | 61 | |
59 | 62 | protected function getType() |
@@ -74,6 +77,9 @@ discard block |
||
74 | 77 | $this->typeImages = $childWpHandler->getChildNamesAndImages(); |
75 | 78 | } |
76 | 79 | |
80 | + /** |
|
81 | + * @param \Oc\Libse\Coordinate\CoordinateCoordinate $coords |
|
82 | + */ |
|
77 | 83 | public function initCoordinate($coords) |
78 | 84 | { |
79 | 85 | $this->coordinate->init($coords->latitude(), $coords->longitude()); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | use Oc\Libse\Validator\AlwaysValidValidator; |
12 | 12 | use Oc\Libse\Validator\ArrayValidator; |
13 | 13 | |
14 | -require_once __DIR__ . '/../../../../lib2/error.inc.php'; |
|
14 | +require_once __DIR__.'/../../../../lib2/error.inc.php'; |
|
15 | 15 | |
16 | 16 | abstract class PresenterChildWp |
17 | 17 | { |
@@ -35,6 +35,9 @@ discard block |
||
35 | 35 | $this->init(0, 0); |
36 | 36 | } |
37 | 37 | |
38 | + /** |
|
39 | + * @param boolean $request |
|
40 | + */ |
|
38 | 41 | private function initRequest($request) |
39 | 42 | { |
40 | 43 | if ($request) { |
@@ -44,6 +47,9 @@ discard block |
||
44 | 47 | return new RequestHttp(); |
45 | 48 | } |
46 | 49 | |
50 | + /** |
|
51 | + * @param boolean $translator |
|
52 | + */ |
|
47 | 53 | private function initTranslator($translator) |
48 | 54 | { |
49 | 55 | if ($translator) { |
@@ -84,6 +84,11 @@ discard block |
||
84 | 84 | /* $block ... {t[ a=$a|nbsp b="a" ...]} |
85 | 85 | * |
86 | 86 | */ |
87 | +/** |
|
88 | + * @param string $block |
|
89 | + * @param string $message |
|
90 | + * @param integer $line |
|
91 | + */ |
|
87 | 92 | function smarty_prefilter_t_process_block($block, $message, &$smarty, $line) |
88 | 93 | { |
89 | 94 | if ($message != '') { |
@@ -252,6 +257,9 @@ discard block |
||
252 | 257 | return $attrs; |
253 | 258 | } |
254 | 259 | |
260 | +/** |
|
261 | + * @param string[] $needles |
|
262 | + */ |
|
255 | 263 | function smarty_prefilter_t_strpos_multi($haystack, $needles) |
256 | 264 | { |
257 | 265 | $arg = func_get_args(); |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $end = 0; |
58 | 58 | while (($start = smarty_prefilter_t_strpos_multi( |
59 | 59 | $source, |
60 | - [$smarty->left_delimiter . 't ', $smarty->left_delimiter . 't' . $smarty->right_delimiter], |
|
60 | + [$smarty->left_delimiter.'t ', $smarty->left_delimiter.'t'.$smarty->right_delimiter], |
|
61 | 61 | $end |
62 | 62 | )) !== false) { |
63 | - $end = mb_strpos($source, $smarty->left_delimiter . '/t' . $smarty->right_delimiter, $start); |
|
63 | + $end = mb_strpos($source, $smarty->left_delimiter.'/t'.$smarty->right_delimiter, $start); |
|
64 | 64 | $block_t = mb_substr($source, $start, $end - $start); |
65 | 65 | |
66 | 66 | $messgage_start = mb_strrpos($block_t, '}') + 1; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | ); |
73 | 73 | |
74 | 74 | $output .= mb_substr($source, $output_start, $start - $output_start); |
75 | - $output_start = $end + mb_strlen($smarty->left_delimiter . $smarty->right_delimiter) + 2; |
|
75 | + $output_start = $end + mb_strlen($smarty->left_delimiter.$smarty->right_delimiter) + 2; |
|
76 | 76 | |
77 | 77 | $output .= $block_t; |
78 | 78 | } |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | if ($block != '') { |
117 | 117 | $block .= ' '; |
118 | 118 | } |
119 | - $block .= $k . '=' . $v; |
|
119 | + $block .= $k.'='.$v; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // pass it to block.t |
123 | - return $smarty->left_delimiter . 't ' . $block . $smarty->right_delimiter . $message . $smarty->left_delimiter . '/t' . $smarty->right_delimiter; |
|
123 | + return $smarty->left_delimiter.'t '.$block.$smarty->right_delimiter.$message.$smarty->left_delimiter.'/t'.$smarty->right_delimiter; |
|
124 | 124 | } |
125 | 125 | unset($attrs['plural']); |
126 | 126 | unset($attrs['count']); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | /* Tokenize tag attributes. */ |
150 | 150 | preg_match_all( |
151 | - '~(?:' . $smarty->_obj_call_regexp . '|' . $smarty->_qstr_regexp . ' | (?>[^"\'=\s]+) |
|
151 | + '~(?:'.$smarty->_obj_call_regexp.'|'.$smarty->_qstr_regexp.' | (?>[^"\'=\s]+) |
|
152 | 152 | )+ | |
153 | 153 | [=] |
154 | 154 | ~x', |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | if ($token == 'null') { |
207 | 207 | $token = 'null'; |
208 | 208 | } else { |
209 | - if (preg_match('~^' . $smarty->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) { |
|
209 | + if (preg_match('~^'.$smarty->_num_const_regexp.'|0[xX][0-9a-fA-F]+$~', $token)) { |
|
210 | 210 | /* treat integer literally */ |
211 | 211 | } else { |
212 | 212 | if (!preg_match( |
213 | - '~^' . $smarty->_obj_call_regexp . '|' . $smarty->_var_regexp . '(?:' . $smarty->_mod_regexp . ')*$~', |
|
213 | + '~^'.$smarty->_obj_call_regexp.'|'.$smarty->_var_regexp.'(?:'.$smarty->_mod_regexp.')*$~', |
|
214 | 214 | $token |
215 | 215 | ) |
216 | 216 | ) { |
217 | 217 | /* treat as a string, double-quote it escaping quotes */ |
218 | - $token = '"' . addslashes($token) . '"'; |
|
218 | + $token = '"'.addslashes($token).'"'; |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | } |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | $number = 1; |
300 | 300 | foreach ($attrs as $attr) { |
301 | 301 | if (is_numeric($attr)) { |
302 | - $trans = mb_ereg_replace('%' . $number, $attr, $trans); |
|
302 | + $trans = mb_ereg_replace('%'.$number, $attr, $trans); |
|
303 | 303 | } else { |
304 | - $trans = mb_ereg_replace('%' . $number, $smarty->left_delimiter . $attr . $smarty->right_delimiter, $trans); |
|
304 | + $trans = mb_ereg_replace('%'.$number, $smarty->left_delimiter.$attr.$smarty->right_delimiter, $trans); |
|
305 | 305 | } |
306 | 306 | |
307 | - $number ++; |
|
307 | + $number++; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | return $trans; |
@@ -112,7 +112,7 @@ |
||
112 | 112 | |
113 | 113 | // rebuild block with replaced plural |
114 | 114 | $block = ''; |
115 | - foreach ($attrs AS $k => $v) { |
|
115 | + foreach ($attrs as $k => $v) { |
|
116 | 116 | if ($block != '') { |
117 | 117 | $block .= ' '; |
118 | 118 | } |
@@ -245,6 +245,9 @@ discard block |
||
245 | 245 | /* $truncatLastInsert = true for downloaded file |
246 | 246 | * $truncatLastInsert = false to sign self generated file (in function export) |
247 | 247 | */ |
248 | +/** |
|
249 | + * @param boolean $truncateLastInsert |
|
250 | + */ |
|
248 | 251 | function calcDataSqlChecksum($truncateLastInsert) |
249 | 252 | { |
250 | 253 | global $opt; |
@@ -390,6 +393,10 @@ discard block |
||
390 | 393 | $tpl->redirect('translate.php?translang=' . $translang); |
391 | 394 | } |
392 | 395 | |
396 | +/** |
|
397 | + * @param string $relbasedir |
|
398 | + * @param string $ext |
|
399 | + */ |
|
393 | 400 | function unlinkFiles($relbasedir, $ext) |
394 | 401 | { |
395 | 402 | global $opt; |
@@ -481,6 +488,9 @@ discard block |
||
481 | 488 | $tpl->redirect('translate.php?translang=' . $translang); |
482 | 489 | } |
483 | 490 | |
491 | +/** |
|
492 | + * @param integer $freeId |
|
493 | + */ |
|
484 | 494 | function useId($freeId) |
485 | 495 | { |
486 | 496 | $lastId = sql_value("SELECT MAX(`id`) FROM `sys_trans`", 0); |
@@ -490,6 +500,9 @@ discard block |
||
490 | 500 | setId($lastId, $freeId); |
491 | 501 | } |
492 | 502 | |
503 | +/** |
|
504 | + * @param integer $oldId |
|
505 | + */ |
|
493 | 506 | function setId($oldId, $newId) |
494 | 507 | { |
495 | 508 | global $transIdCols; |
@@ -568,6 +581,9 @@ discard block |
||
568 | 581 | $tpl->redirect('translate.php?translang=' . $translang); |
569 | 582 | } |
570 | 583 | |
584 | +/** |
|
585 | + * @param string $dir |
|
586 | + */ |
|
571 | 587 | function enumSqlFiles($dir) |
572 | 588 | { |
573 | 589 | $retval = []; |
@@ -86,69 +86,69 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | switch ($action) { |
89 | - case 'selectlang': |
|
90 | - break; |
|
89 | + case 'selectlang': |
|
90 | + break; |
|
91 | 91 | |
92 | - case 'verify': |
|
93 | - verify(); |
|
94 | - break; |
|
92 | + case 'verify': |
|
93 | + verify(); |
|
94 | + break; |
|
95 | 95 | |
96 | - case 'resetids': |
|
97 | - resetIds(); |
|
98 | - break; |
|
96 | + case 'resetids': |
|
97 | + resetIds(); |
|
98 | + break; |
|
99 | 99 | |
100 | - case 'clearcache': |
|
101 | - clearCache(); |
|
102 | - break; |
|
100 | + case 'clearcache': |
|
101 | + clearCache(); |
|
102 | + break; |
|
103 | 103 | |
104 | - case 'export': |
|
105 | - export(); |
|
106 | - break; |
|
104 | + case 'export': |
|
105 | + export(); |
|
106 | + break; |
|
107 | 107 | |
108 | - case 'xmlexport': |
|
109 | - xmlexport(); |
|
110 | - break; |
|
108 | + case 'xmlexport': |
|
109 | + xmlexport(); |
|
110 | + break; |
|
111 | 111 | |
112 | - case 'xmlimport': |
|
113 | - break; |
|
112 | + case 'xmlimport': |
|
113 | + break; |
|
114 | 114 | |
115 | - case 'xmlimport2': |
|
116 | - xmlimport2(); |
|
117 | - break; |
|
115 | + case 'xmlimport2': |
|
116 | + xmlimport2(); |
|
117 | + break; |
|
118 | 118 | |
119 | - case 'xmlimport3': |
|
120 | - xmlimport3(); |
|
121 | - break; |
|
119 | + case 'xmlimport3': |
|
120 | + xmlimport3(); |
|
121 | + break; |
|
122 | 122 | |
123 | - case 'textexportnew': |
|
124 | - textexport($translang, false); |
|
125 | - break; |
|
123 | + case 'textexportnew': |
|
124 | + textexport($translang, false); |
|
125 | + break; |
|
126 | 126 | |
127 | - case 'textexportall': |
|
128 | - textexport($translang, true); |
|
129 | - break; |
|
127 | + case 'textexportall': |
|
128 | + textexport($translang, true); |
|
129 | + break; |
|
130 | 130 | |
131 | - case 'textimport': |
|
132 | - break; |
|
131 | + case 'textimport': |
|
132 | + break; |
|
133 | 133 | |
134 | - case 'textimport2': |
|
135 | - textimport($translang); |
|
136 | - break; |
|
134 | + case 'textimport2': |
|
135 | + textimport($translang); |
|
136 | + break; |
|
137 | 137 | |
138 | - case 'edit': |
|
139 | - if (!$access->mayTranslate($translang)) { |
|
140 | - $tpl->error(ERROR_NO_ACCESS); |
|
141 | - } |
|
142 | - edit(); |
|
143 | - break; |
|
138 | + case 'edit': |
|
139 | + if (!$access->mayTranslate($translang)) { |
|
140 | + $tpl->error(ERROR_NO_ACCESS); |
|
141 | + } |
|
142 | + edit(); |
|
143 | + break; |
|
144 | 144 | |
145 | - case 'copy_en': |
|
146 | - copy_english_texts(); |
|
147 | - break; |
|
145 | + case 'copy_en': |
|
146 | + copy_english_texts(); |
|
147 | + break; |
|
148 | 148 | |
149 | - case 'listfaults': |
|
150 | - $trans = sql( |
|
151 | - "SELECT |
|
149 | + case 'listfaults': |
|
150 | + $trans = sql( |
|
151 | + "SELECT |
|
152 | 152 | `sys_trans`.`id`, |
153 | 153 | `sys_trans`.`text` |
154 | 154 | FROM `sys_trans` |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | ON `sys_trans`.`id`=`sys_trans_ref`.`trans_id` |
157 | 157 | WHERE ISNULL(`sys_trans_ref`.`trans_id`) |
158 | 158 | ORDER BY `sys_trans`.`id` DESC" |
159 | - ); |
|
160 | - $tpl->assign_rs('trans', $trans); |
|
161 | - sql_free_result($trans); |
|
162 | - break; |
|
159 | + ); |
|
160 | + $tpl->assign_rs('trans', $trans); |
|
161 | + sql_free_result($trans); |
|
162 | + break; |
|
163 | 163 | |
164 | - case 'listall': |
|
165 | - $trans = sql( |
|
166 | - "SELECT |
|
164 | + case 'listall': |
|
165 | + $trans = sql( |
|
166 | + "SELECT |
|
167 | 167 | `sys_trans`.`id`, |
168 | 168 | `sys_trans`.`text`, |
169 | 169 | `sys_trans_text`.`text` AS `trans` |
@@ -172,48 +172,48 @@ discard block |
||
172 | 172 | ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` |
173 | 173 | AND `sys_trans_text`.`lang`='&1' |
174 | 174 | ORDER BY `sys_trans`.`id` DESC", |
175 | - $translang |
|
176 | - ); |
|
177 | - $tpl->assign_rs('trans', $trans); |
|
178 | - sql_free_result($trans); |
|
179 | - break; |
|
175 | + $translang |
|
176 | + ); |
|
177 | + $tpl->assign_rs('trans', $trans); |
|
178 | + sql_free_result($trans); |
|
179 | + break; |
|
180 | 180 | |
181 | - case 'remove': |
|
182 | - if (!$access->mayTranslate($translang)) { |
|
183 | - $tpl->error(ERROR_NO_ACCESS); |
|
184 | - } |
|
185 | - remove(); |
|
186 | - break; |
|
187 | - |
|
188 | - case 'scan': |
|
189 | - scan(); |
|
190 | - break; |
|
191 | - |
|
192 | - case 'scanstart': |
|
193 | - scanStart(); |
|
194 | - break; |
|
195 | - |
|
196 | - case 'scanfile': |
|
197 | - $filename = isset($_REQUEST['filename']) ? $_REQUEST['filename'] : ''; |
|
198 | - scanFile($filename); |
|
199 | - exit; |
|
200 | - |
|
201 | - case 'quicknone': |
|
202 | - $cookie->un_set('translate_mode'); |
|
203 | - break; |
|
204 | - |
|
205 | - case 'quicknew': |
|
206 | - $cookie->set('translate_mode', 'new'); |
|
207 | - break; |
|
208 | - |
|
209 | - case 'quickall': |
|
210 | - $cookie->set('translate_mode', 'all'); |
|
211 | - break; |
|
212 | - |
|
213 | - default: |
|
214 | - $action = 'listnew'; |
|
215 | - $trans = sql( |
|
216 | - "SELECT DISTINCT |
|
181 | + case 'remove': |
|
182 | + if (!$access->mayTranslate($translang)) { |
|
183 | + $tpl->error(ERROR_NO_ACCESS); |
|
184 | + } |
|
185 | + remove(); |
|
186 | + break; |
|
187 | + |
|
188 | + case 'scan': |
|
189 | + scan(); |
|
190 | + break; |
|
191 | + |
|
192 | + case 'scanstart': |
|
193 | + scanStart(); |
|
194 | + break; |
|
195 | + |
|
196 | + case 'scanfile': |
|
197 | + $filename = isset($_REQUEST['filename']) ? $_REQUEST['filename'] : ''; |
|
198 | + scanFile($filename); |
|
199 | + exit; |
|
200 | + |
|
201 | + case 'quicknone': |
|
202 | + $cookie->un_set('translate_mode'); |
|
203 | + break; |
|
204 | + |
|
205 | + case 'quicknew': |
|
206 | + $cookie->set('translate_mode', 'new'); |
|
207 | + break; |
|
208 | + |
|
209 | + case 'quickall': |
|
210 | + $cookie->set('translate_mode', 'all'); |
|
211 | + break; |
|
212 | + |
|
213 | + default: |
|
214 | + $action = 'listnew'; |
|
215 | + $trans = sql( |
|
216 | + "SELECT DISTINCT |
|
217 | 217 | `sys_trans`.`id`, |
218 | 218 | `sys_trans`.`text` |
219 | 219 | FROM `sys_trans` |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | ON `sys_trans`.`id`=`sys_trans_ref`.`trans_id` |
225 | 225 | WHERE ISNULL(`sys_trans_text`.`trans_id`) OR `sys_trans_text`.`text`='' |
226 | 226 | ORDER BY `sys_trans`.`id` DESC", |
227 | - $translang |
|
228 | - ); |
|
229 | - $tpl->assign_rs('trans', $trans); |
|
230 | - sql_free_result($trans); |
|
227 | + $translang |
|
228 | + ); |
|
229 | + $tpl->assign_rs('trans', $trans); |
|
230 | + sql_free_result($trans); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $languages = []; |
@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | * Unicode Reminder メモ |
6 | 6 | ***************************************************************************/ |
7 | 7 | |
8 | -require __DIR__ . '/lib2/web.inc.php'; |
|
9 | -require_once __DIR__ . '/lib2/translate.class.php'; |
|
10 | -require_once __DIR__ . '/lib2/translationHandler.class.php'; |
|
8 | +require __DIR__.'/lib2/web.inc.php'; |
|
9 | +require_once __DIR__.'/lib2/translate.class.php'; |
|
10 | +require_once __DIR__.'/lib2/translationHandler.class.php'; |
|
11 | 11 | |
12 | 12 | /* config section |
13 | 13 | */ |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | { |
250 | 250 | global $opt; |
251 | 251 | |
252 | - if (!file_exists($opt['rootpath'] . '../sql/static-data/data.sql')) { |
|
252 | + if (!file_exists($opt['rootpath'].'../sql/static-data/data.sql')) { |
|
253 | 253 | return ''; |
254 | 254 | } |
255 | 255 | |
256 | - $content = file_get_contents($opt['rootpath'] . '../sql/static-data/data.sql'); |
|
256 | + $content = file_get_contents($opt['rootpath'].'../sql/static-data/data.sql'); |
|
257 | 257 | |
258 | 258 | // at the end is an INSERT of the current checksum |
259 | 259 | // to calculate this checksum, we have to trim the end before that statement and the linefeed before |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | sql("DELETE FROM `sys_trans_text` WHERE `trans_id`='&1'", $id); |
283 | 283 | sql("DELETE FROM `sys_trans_ref` WHERE `trans_id`='&1'", $id); |
284 | 284 | |
285 | - $tpl->redirect('translate.php?translang=' . $translang); |
|
285 | + $tpl->redirect('translate.php?translang='.$translang); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | function edit() |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | ); |
312 | 312 | } |
313 | 313 | sql_free_result($rs); |
314 | - $tpl->redirect('translate.php?translang=' . $translang . '&action=edit&id=' . $id); |
|
314 | + $tpl->redirect('translate.php?translang='.$translang.'&action=edit&id='.$id); |
|
315 | 315 | } else { |
316 | 316 | if (isset($_REQUEST['submit'])) { |
317 | 317 | $transText = isset($_REQUEST['transText']) ? $_REQUEST['transText'] : ''; |
@@ -347,14 +347,14 @@ discard block |
||
347 | 347 | |
348 | 348 | // built sql string to search for texts with little difference (levensthein() would be better, but not available in MYSQL) |
349 | 349 | $sWhereSql = |
350 | - "SOUNDEX('" . sql_escape($r['text']) . "')=SOUNDEX(`sys_trans`.`text`) |
|
351 | - OR SOUNDEX('" . sql_escape($r['text']) . "')=SOUNDEX(`sys_trans_text`.`text`)"; |
|
350 | + "SOUNDEX('".sql_escape($r['text'])."')=SOUNDEX(`sys_trans`.`text`) |
|
351 | + OR SOUNDEX('" . sql_escape($r['text'])."')=SOUNDEX(`sys_trans_text`.`text`)"; |
|
352 | 352 | |
353 | 353 | $trans = sql( |
354 | 354 | "SELECT DISTINCT `sys_trans`.`id`, `sys_trans`.`text` |
355 | 355 | FROM `sys_trans` |
356 | 356 | INNER JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` |
357 | - WHERE `sys_trans`.`id`!='&1' AND (" . $sWhereSql . ")", |
|
357 | + WHERE `sys_trans`.`id`!='&1' AND (" . $sWhereSql.")", |
|
358 | 358 | $id |
359 | 359 | ); |
360 | 360 | $tpl->assign_rs('trans', $trans); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | $translationHandler->createMessageFiles(); |
389 | 389 | |
390 | - $tpl->redirect('translate.php?translang=' . $translang); |
|
390 | + $tpl->redirect('translate.php?translang='.$translang); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | function unlinkFiles($relbasedir, $ext) |
@@ -398,12 +398,12 @@ discard block |
||
398 | 398 | $relbasedir .= '/'; |
399 | 399 | } |
400 | 400 | |
401 | - if ($opt['rootpath'] . $relbasedir) { |
|
402 | - if ($dh = opendir($opt['rootpath'] . $relbasedir)) { |
|
401 | + if ($opt['rootpath'].$relbasedir) { |
|
402 | + if ($dh = opendir($opt['rootpath'].$relbasedir)) { |
|
403 | 403 | while (($file = readdir($dh)) !== false) { |
404 | - if ($file != '.' && $file != '..' && is_file($opt['rootpath'] . $relbasedir . $file)) { |
|
405 | - if (substr($file, - (strlen($ext) + 1), strlen($ext) + 1) == '.' . $ext) { |
|
406 | - unlink($opt['rootpath'] . $relbasedir . $file); |
|
404 | + if ($file != '.' && $file != '..' && is_file($opt['rootpath'].$relbasedir.$file)) { |
|
405 | + if (substr($file, - (strlen($ext) + 1), strlen($ext) + 1) == '.'.$ext) { |
|
406 | + unlink($opt['rootpath'].$relbasedir.$file); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | $lastId = sql_value("SELECT MAX(`id`) FROM `sys_trans`", 0); |
479 | 479 | sql("ALTER TABLE `sys_trans` AUTO_INCREMENT = &1", $lastId + 1); |
480 | 480 | |
481 | - $tpl->redirect('translate.php?translang=' . $translang); |
|
481 | + $tpl->redirect('translate.php?translang='.$translang); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | function useId($freeId) |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | |
501 | 501 | foreach ($transIdCols as $col) { |
502 | 502 | sql( |
503 | - "UPDATE `" . $col['table'] . "` |
|
504 | - SET `" . $col['trans_id'] . "`='&1' |
|
505 | - WHERE `" . $col['trans_id'] . "`='&2'", |
|
503 | + "UPDATE `".$col['table']."` |
|
504 | + SET `" . $col['trans_id']."`='&1' |
|
505 | + WHERE `" . $col['trans_id']."`='&2'", |
|
506 | 506 | $newId, |
507 | 507 | $oldId |
508 | 508 | ); |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | { |
514 | 514 | global $opt, $tpl, $translang; |
515 | 515 | |
516 | - $structure = enumSqlFiles($opt['rootpath'] . '../sql/tables'); |
|
516 | + $structure = enumSqlFiles($opt['rootpath'].'../sql/tables'); |
|
517 | 517 | foreach ($structure AS $sTable) { |
518 | - sql_export_structure_to_file($opt['rootpath'] . '../sql/tables/' . $sTable . '.sql', $sTable); |
|
518 | + sql_export_structure_to_file($opt['rootpath'].'../sql/tables/'.$sTable.'.sql', $sTable); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | // static data tables |
@@ -551,21 +551,21 @@ discard block |
||
551 | 551 | $stab[] = 'towns'; |
552 | 552 | $stab[] = 'watches_waitingtypes'; |
553 | 553 | |
554 | - sql_export_tables_to_file($opt['rootpath'] . '../sql/static-data/data.sql', $stab); |
|
554 | + sql_export_tables_to_file($opt['rootpath'].'../sql/static-data/data.sql', $stab); |
|
555 | 555 | |
556 | 556 | $checksum = calcDataSqlChecksum(false); |
557 | - $f = fopen($opt['rootpath'] . '../sql/static-data/data.sql', 'a'); |
|
557 | + $f = fopen($opt['rootpath'].'../sql/static-data/data.sql', 'a'); |
|
558 | 558 | fwrite( |
559 | 559 | $f, |
560 | 560 | "INSERT INTO `sysconfig` (`name`, `value`)" |
561 | - . " VALUES ('datasql_checksum', '" . sql_escape($checksum) . "')" |
|
562 | - . " ON DUPLICATE KEY UPDATE `value`='" . sql_escape($checksum) . "';\n" |
|
561 | + . " VALUES ('datasql_checksum', '".sql_escape($checksum)."')" |
|
562 | + . " ON DUPLICATE KEY UPDATE `value`='".sql_escape($checksum)."';\n" |
|
563 | 563 | ); |
564 | 564 | fclose($f); |
565 | 565 | |
566 | 566 | setSysConfig('datasql_checksum', $checksum); |
567 | 567 | |
568 | - $tpl->redirect('translate.php?translang=' . $translang); |
|
568 | + $tpl->redirect('translate.php?translang='.$translang); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | function enumSqlFiles($dir) |
@@ -594,9 +594,9 @@ discard block |
||
594 | 594 | $hDir = opendir($dir); |
595 | 595 | if ($hDir !== false) { |
596 | 596 | while (($file = readdir($hDir)) !== false) { |
597 | - if (is_file($dir . '/' . $file)) { |
|
597 | + if (is_file($dir.'/'.$file)) { |
|
598 | 598 | if ((substr($file, - 4) == '.tpl') || (substr($file, - 4) == '.php')) { |
599 | - $files[] = $dir . '/' . $file; |
|
599 | + $files[] = $dir.'/'.$file; |
|
600 | 600 | } |
601 | 601 | } |
602 | 602 | } |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | $writer->writeAttribute('id', $r['id']); |
691 | 691 | |
692 | 692 | $writer->writeElement('code', $r['text']); |
693 | - for ($n = 0; $n < count($lang); $n ++) { |
|
693 | + for ($n = 0; $n < count($lang); $n++) { |
|
694 | 694 | $writer->writeElement( |
695 | 695 | $lang[$n], |
696 | 696 | sql_value( |
@@ -712,9 +712,9 @@ discard block |
||
712 | 712 | while ($rUsage = sql_fetch_assoc($rsUsage)) { |
713 | 713 | $line = ''; |
714 | 714 | if ($rUsage['line'] != 0) { |
715 | - $line = ' (' . $rUsage['line'] . ')'; |
|
715 | + $line = ' ('.$rUsage['line'].')'; |
|
716 | 716 | } |
717 | - $writer->writeElement('usage', $rUsage['resource_name'] . $line); |
|
717 | + $writer->writeElement('usage', $rUsage['resource_name'].$line); |
|
718 | 718 | } |
719 | 719 | sql_free_result($rsUsage); |
720 | 720 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | |
739 | 739 | $scanlang = []; |
740 | 740 | foreach ($opt['locale'] AS $k => $v) { |
741 | - if (isset($_REQUEST['lang' . $k]) && ($_REQUEST['lang' . $k] == '1')) { |
|
741 | + if (isset($_REQUEST['lang'.$k]) && ($_REQUEST['lang'.$k] == '1')) { |
|
742 | 742 | $scanlang[] = $k; |
743 | 743 | } |
744 | 744 | } |
@@ -818,15 +818,15 @@ discard block |
||
818 | 818 | |
819 | 819 | $nCount = isset($_REQUEST['count']) ? $_REQUEST['count'] + 0 : 0; |
820 | 820 | |
821 | - for ($nIndex = 1; $nIndex <= $nCount; $nIndex ++) { |
|
822 | - if (isset($_REQUEST['useitem' . $nIndex]) && ($_REQUEST['useitem' . $nIndex] == '1')) { |
|
823 | - $sCode = base64_decode($_REQUEST['code' . $nIndex]); |
|
821 | + for ($nIndex = 1; $nIndex <= $nCount; $nIndex++) { |
|
822 | + if (isset($_REQUEST['useitem'.$nIndex]) && ($_REQUEST['useitem'.$nIndex] == '1')) { |
|
823 | + $sCode = base64_decode($_REQUEST['code'.$nIndex]); |
|
824 | 824 | $transId = sql_value("SELECT `id` FROM `sys_trans` WHERE `text`='&1'", 0, $sCode); |
825 | 825 | |
826 | 826 | if ($transId != 0) { |
827 | 827 | foreach ($opt['locale'] AS $k => $v) { |
828 | - if (isset($_REQUEST[$k . $nIndex . 'new'])) { |
|
829 | - $sText = base64_decode($_REQUEST[$k . $nIndex . 'new']); |
|
828 | + if (isset($_REQUEST[$k.$nIndex.'new'])) { |
|
829 | + $sText = base64_decode($_REQUEST[$k.$nIndex.'new']); |
|
830 | 830 | |
831 | 831 | sql( |
832 | 832 | "INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`) |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | } |
843 | 843 | } |
844 | 844 | |
845 | - $tpl->redirect('translate.php?translang=' . $translang); |
|
845 | + $tpl->redirect('translate.php?translang='.$translang); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | function textexport($translang, $all) |
@@ -872,9 +872,9 @@ discard block |
||
872 | 872 | $translang |
873 | 873 | ); |
874 | 874 | if (($all) || (mb_strlen($translated) == 0)) { |
875 | - $thisline = $r['id'] . "\r\n"; |
|
876 | - $thisline .= $r['text'] . "\r\n"; |
|
877 | - $thisline .= $translated . "\r\n"; |
|
875 | + $thisline = $r['id']."\r\n"; |
|
876 | + $thisline .= $r['text']."\r\n"; |
|
877 | + $thisline .= $translated."\r\n"; |
|
878 | 878 | $thisline .= "\r\n"; |
879 | 879 | echo($thisline); |
880 | 880 | } |
@@ -1010,8 +1010,8 @@ discard block |
||
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | while (($file = readdir($hDir)) !== false) { |
1013 | - if ($file != '.' && $file != '..' && is_dir($basedir . $file)) { |
|
1014 | - addClassesDirectoriesToDirlist($basedir . $file); |
|
1013 | + if ($file != '.' && $file != '..' && is_dir($basedir.$file)) { |
|
1014 | + addClassesDirectoriesToDirlist($basedir.$file); |
|
1015 | 1015 | } |
1016 | 1016 | } |
1017 | 1017 | closedir($hDir); |
@@ -1026,9 +1026,9 @@ discard block |
||
1026 | 1026 | if (!isset($col['verify']) || $col['verify']) { |
1027 | 1027 | $rs = sql( |
1028 | 1028 | "SELECT |
1029 | - `" . $col['text'] . "` `text`, |
|
1030 | - `" . $col['trans_id'] . "` `trans_id` |
|
1031 | - FROM `" . $col['table'] . "`" |
|
1029 | + `" . $col['text']."` `text`, |
|
1030 | + `" . $col['trans_id']."` `trans_id` |
|
1031 | + FROM `" . $col['table']."`" |
|
1032 | 1032 | ); |
1033 | 1033 | while ($r = sql_fetch_assoc($rs)) { |
1034 | 1034 | $st = sql_value( |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | if ($en != $r['text'] || $st != $r['text']) { |
1049 | 1049 | $inconsistencies[] = [ |
1050 | 1050 | 'id' => $r['trans_id'], |
1051 | - 'col' => $col['table'] . '.' . $col['text'], |
|
1051 | + 'col' => $col['table'].'.'.$col['text'], |
|
1052 | 1052 | 'org_text' => $r['text'], |
1053 | 1053 | 'sys_trans' => $st, |
1054 | 1054 | 'en_text' => $en, |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | $languages = []; |
234 | -foreach ($opt['locale'] AS $k => $v) { |
|
234 | +foreach ($opt['locale'] as $k => $v) { |
|
235 | 235 | if ($access->mayTranslate($k)) { |
236 | 236 | $languages[] = $k; |
237 | 237 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | global $opt, $tpl, $translang; |
515 | 515 | |
516 | 516 | $structure = enumSqlFiles($opt['rootpath'] . '../sql/tables'); |
517 | - foreach ($structure AS $sTable) { |
|
517 | + foreach ($structure as $sTable) { |
|
518 | 518 | sql_export_structure_to_file($opt['rootpath'] . '../sql/tables/' . $sTable . '.sql', $sTable); |
519 | 519 | } |
520 | 520 | |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | global $tpl, $msDirlist; |
591 | 591 | |
592 | 592 | $files = []; |
593 | - foreach ($msDirlist AS $dir) { |
|
593 | + foreach ($msDirlist as $dir) { |
|
594 | 594 | $hDir = opendir($dir); |
595 | 595 | if ($hDir !== false) { |
596 | 596 | while (($file = readdir($hDir)) !== false) { |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | /* check if supplied filename is within allowed path! |
626 | 626 | */ |
627 | 627 | $bFound = false; |
628 | - foreach ($msDirlist AS $dir) { |
|
628 | + foreach ($msDirlist as $dir) { |
|
629 | 629 | if (substr($dir, - 1) != '/') { |
630 | 630 | $dir .= '/'; |
631 | 631 | } |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $transFileScan = new translate_filescan($filename); |
652 | 652 | $transFileScan->parse(); |
653 | 653 | |
654 | - foreach ($transFileScan->textlist AS $item) { |
|
654 | + foreach ($transFileScan->textlist as $item) { |
|
655 | 655 | $translationHandler->addText($item['text'], $filename, $item['line']); |
656 | 656 | } |
657 | 657 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | header('Content-Disposition:attachment;filename="translation.xml"'); |
667 | 667 | |
668 | 668 | $lang = []; |
669 | - foreach ($opt['template']['locales'] AS $k => $v) { |
|
669 | + foreach ($opt['template']['locales'] as $k => $v) { |
|
670 | 670 | $lang[] = $k; |
671 | 671 | } |
672 | 672 | |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | } |
738 | 738 | |
739 | 739 | $scanlang = []; |
740 | - foreach ($opt['locale'] AS $k => $v) { |
|
740 | + foreach ($opt['locale'] as $k => $v) { |
|
741 | 741 | if (isset($_REQUEST['lang' . $k]) && ($_REQUEST['lang' . $k] == '1')) { |
742 | 742 | $scanlang[] = $k; |
743 | 743 | } |
@@ -758,10 +758,10 @@ discard block |
||
758 | 758 | */ |
759 | 759 | $saTexts = []; |
760 | 760 | |
761 | - foreach ($doc->documentElement->childNodes AS $textnode) { |
|
761 | + foreach ($doc->documentElement->childNodes as $textnode) { |
|
762 | 762 | if ($textnode->nodeType == XML_ELEMENT_NODE) { |
763 | 763 | $codeElements = $textnode->getElementsByTagName('code'); |
764 | - foreach ($scanlang AS $lang) { |
|
764 | + foreach ($scanlang as $lang) { |
|
765 | 765 | $langElements = $textnode->getElementsByTagName($lang); |
766 | 766 | |
767 | 767 | $sCodeText = $codeElements->item(0)->nodeValue; |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | $transId = sql_value("SELECT `id` FROM `sys_trans` WHERE `text`='&1'", 0, $sCode); |
825 | 825 | |
826 | 826 | if ($transId != 0) { |
827 | - foreach ($opt['locale'] AS $k => $v) { |
|
827 | + foreach ($opt['locale'] as $k => $v) { |
|
828 | 828 | if (isset($_REQUEST[$k . $nIndex . 'new'])) { |
829 | 829 | $sText = base64_decode($_REQUEST[$k . $nIndex . 'new']); |
830 | 830 |
@@ -197,6 +197,9 @@ |
||
197 | 197 | return 0; |
198 | 198 | } |
199 | 199 | |
200 | +/** |
|
201 | + * @param string $domain |
|
202 | + */ |
|
200 | 203 | function is_existent_maildomain($domain) |
201 | 204 | { |
202 | 205 | $smtp_serverlist = []; |
@@ -10,15 +10,15 @@ discard block |
||
10 | 10 | ***************************************************************************/ |
11 | 11 | |
12 | 12 | // needs absolute rootpath because called as cronjob |
13 | -$rootpath = __DIR__ . '/../../'; |
|
13 | +$rootpath = __DIR__.'/../../'; |
|
14 | 14 | |
15 | -require_once $rootpath . 'lib/clicompatbase.inc.php'; |
|
16 | -require_once $rootpath . 'lib2/translate.class.php'; |
|
17 | -require_once __DIR__ . '/settings.inc.php'; |
|
18 | -require_once $rootpath . 'lib/consts.inc.php'; |
|
19 | -require_once $rootpath . 'lib2/ProcessSync.class.php'; |
|
20 | -require_once $rootpath . 'lib/logic.inc.php'; |
|
21 | -require_once $rootpath . 'lib2/logic/geomath.class.php'; |
|
15 | +require_once $rootpath.'lib/clicompatbase.inc.php'; |
|
16 | +require_once $rootpath.'lib2/translate.class.php'; |
|
17 | +require_once __DIR__.'/settings.inc.php'; |
|
18 | +require_once $rootpath.'lib/consts.inc.php'; |
|
19 | +require_once $rootpath.'lib2/ProcessSync.class.php'; |
|
20 | +require_once $rootpath.'lib/logic.inc.php'; |
|
21 | +require_once $rootpath.'lib2/logic/geomath.class.php'; |
|
22 | 22 | |
23 | 23 | if (!cronjobs_enabled()) { |
24 | 24 | exit; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | switch ($notify['type']) { |
87 | 87 | case notify_new_cache: // Type: new cache |
88 | 88 | $mailbody = fetch_email_template('notify_newcache', $notify['recp_lang'], $notify['recp_domain']); |
89 | - $mailsubject = '[' . $maildomain . '] ' . |
|
89 | + $mailsubject = '['.$maildomain.'] '. |
|
90 | 90 | $translate->t( |
91 | 91 | $notify['oconly'] ? 'New OConly cache:' : 'New cache:', |
92 | 92 | '', |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | '', |
96 | 96 | 1, |
97 | 97 | $notify['recp_lang'] |
98 | - ) . |
|
99 | - ' ' . $notify['cachename']; |
|
98 | + ). |
|
99 | + ' '.$notify['cachename']; |
|
100 | 100 | break; |
101 | 101 | |
102 | 102 | case notify_new_oconly: // Type: new OConly flag |
103 | 103 | $mailbody = fetch_email_template('notify_newoconly', $notify['recp_lang'], $notify['recp_domain']); |
104 | - $mailsubject = '[' . $maildomain . '] ' . |
|
104 | + $mailsubject = '['.$maildomain.'] '. |
|
105 | 105 | $translate->t( |
106 | 106 | 'Cache was marked as OConly:', |
107 | 107 | '', |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | '', |
111 | 111 | 1, |
112 | 112 | $notify['recp_lang'] |
113 | - ) . |
|
114 | - ' ' . $notify['cachename']; |
|
113 | + ). |
|
114 | + ' '.$notify['cachename']; |
|
115 | 115 | break; |
116 | 116 | |
117 | 117 | default: |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | ); |
176 | 176 | |
177 | 177 | /* begin send out everything that has to be sent */ |
178 | - $email_headers = 'From: "' . $mailfrom . '" <' . $mailfrom . '>'; |
|
178 | + $email_headers = 'From: "'.$mailfrom.'" <'.$mailfrom.'>'; |
|
179 | 179 | |
180 | 180 | // send email |
181 | 181 | if ($debug == true) { |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | mb_send_mail($mailadr, $mailsubject, $mailbody, $email_headers); |
189 | 189 | } |
190 | 190 | } else { |
191 | - echo "Unknown notification type: " . $notify['type'] . "<br />"; |
|
191 | + echo "Unknown notification type: ".$notify['type']."<br />"; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | // logentry($module, $eventid, $userid, $objectid1, $objectid2, $logtext, $details) |
195 | - logentry('notify_newcache', 8, $notify['recid'], $notify['cache_id'], 0, 'Sending mail to ' . $mailadr, []); |
|
195 | + logentry('notify_newcache', 8, $notify['recid'], $notify['cache_id'], 0, 'Sending mail to '.$mailadr, []); |
|
196 | 196 | |
197 | 197 | return 0; |
198 | 198 | } |
@@ -484,6 +484,9 @@ discard block |
||
484 | 484 | ); |
485 | 485 | } |
486 | 486 | |
487 | +/** |
|
488 | + * @param string $watchtext |
|
489 | + */ |
|
487 | 490 | function insert_maintenance_flags($rLog, $language, $watchtext) |
488 | 491 | { |
489 | 492 | global $translate; |
@@ -510,6 +513,9 @@ discard block |
||
510 | 513 | return mb_ereg_replace('{maintenance_flags}', $flagtext, $watchtext); |
511 | 514 | } |
512 | 515 | |
516 | +/** |
|
517 | + * @param string $domain |
|
518 | + */ |
|
513 | 519 | function is_existent_maildomain($domain) |
514 | 520 | { |
515 | 521 | $smtp_serverlist = []; |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | ***************************************************************************/ |
13 | 13 | |
14 | 14 | // needs absolute rootpath because called as cronjob |
15 | -$rootpath = __DIR__ . '/../../'; |
|
16 | -require_once $rootpath . 'lib/clicompatbase.inc.php'; |
|
17 | -require_once $rootpath . 'lib2/translate.class.php'; |
|
18 | -require_once __DIR__ . '/settings.inc.php'; |
|
19 | -require_once $rootpath . 'lib/consts.inc.php'; |
|
20 | -require_once $rootpath . 'lib/logic.inc.php'; |
|
21 | -require_once $rootpath . 'lib2/edithelper.inc.php'; |
|
15 | +$rootpath = __DIR__.'/../../'; |
|
16 | +require_once $rootpath.'lib/clicompatbase.inc.php'; |
|
17 | +require_once $rootpath.'lib2/translate.class.php'; |
|
18 | +require_once __DIR__.'/settings.inc.php'; |
|
19 | +require_once $rootpath.'lib/consts.inc.php'; |
|
20 | +require_once $rootpath.'lib/logic.inc.php'; |
|
21 | +require_once $rootpath.'lib2/edithelper.inc.php'; |
|
22 | 22 | |
23 | 23 | if (!cronjobs_enabled()) { |
24 | 24 | exit; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | WHERE cache_logs.cache_id=caches.cache_id |
52 | 52 | AND cache_logs.owner_notified=0" |
53 | 53 | ); |
54 | -for ($i = 0; $i < mysql_num_rows($rsNewLogs); $i ++) { |
|
54 | +for ($i = 0; $i < mysql_num_rows($rsNewLogs); $i++) { |
|
55 | 55 | $rNewLog = sql_fetch_array($rsNewLogs); |
56 | 56 | |
57 | 57 | $rsNotified = sql( |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | // See http://forum.opencaching.de/index.php?topic=3123.0 on AOL. |
103 | 103 | if (sqlValue( |
104 | 104 | "SELECT `email_problems` = 0 OR DATEDIFF(NOW(),`last_email_problem`) > 1+DATEDIFF(`last_email_problem`,`first_email_problem`) |
105 | - FROM `user` WHERE `user_id`='" . sql_escape($rcw['user_id']) . "'", |
|
105 | + FROM `user` WHERE `user_id`='" . sql_escape($rcw['user_id'])."'", |
|
106 | 106 | 1 |
107 | 107 | )) { |
108 | 108 | process_log_watch($rcw['user_id'], $rcw['log_id']); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | /* begin send out everything that has to be sent */ |
117 | 117 | |
118 | -$email_headers = 'From: "' . $mailfrom . '" <' . $mailfrom . '>'; |
|
118 | +$email_headers = 'From: "'.$mailfrom.'" <'.$mailfrom.'>'; |
|
119 | 119 | |
120 | 120 | $rsUsers = sql( |
121 | 121 | "SELECT |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | WHERE `user`.`watchmail_nextmail`<NOW()", |
135 | 135 | $opt['template']['default']['locale'] |
136 | 136 | ); |
137 | -for ($i = 0; $i < mysql_num_rows($rsUsers); $i ++) { |
|
137 | +for ($i = 0; $i < mysql_num_rows($rsUsers); $i++) { |
|
138 | 138 | $rUser = sql_fetch_array($rsUsers); |
139 | 139 | |
140 | 140 | if ($rUser['watchmail_nextmail'] != '0000-00-00 00:00:00') { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | ); |
159 | 159 | if (mysql_num_rows($rsWatchesOwner) > 0) { |
160 | 160 | $logtexts = ''; |
161 | - for ($j = 0; $j < mysql_num_rows($rsWatchesOwner); $j ++) { |
|
161 | + for ($j = 0; $j < mysql_num_rows($rsWatchesOwner); $j++) { |
|
162 | 162 | $rWatch = sql_fetch_array($rsWatchesOwner); |
163 | 163 | $logtexts .= $rWatch['watchtext']; |
164 | 164 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ); |
184 | 184 | if (mysql_num_rows($rsWatchesLog) > 0) { |
185 | 185 | $logtexts = ''; |
186 | - for ($j = 0; $j < mysql_num_rows($rsWatchesLog); $j ++) { |
|
186 | + for ($j = 0; $j < mysql_num_rows($rsWatchesLog); $j++) { |
|
187 | 187 | $rWatch = sql_fetch_array($rsWatchesLog); |
188 | 188 | $logtexts .= $rWatch['watchtext']; |
189 | 189 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if ($mailadr != '') { |
209 | 209 | if (is_existent_maildomain(getToMailDomain($mailadr))) { |
210 | 210 | $language = $rUser['language'] ? $rUser['language'] : $opt['template']['default']['locale']; |
211 | - $mailsubject = '[' . $maildomain . '] ' . $translate->t( |
|
211 | + $mailsubject = '['.$maildomain.'] '.$translate->t( |
|
212 | 212 | 'Your watchlist of', |
213 | 213 | '', |
214 | 214 | basename(__FILE__), |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | '', |
217 | 217 | 1, |
218 | 218 | $language |
219 | - ) . ' ' . date($opt['locale'][$language]['format']['phpdate']); |
|
219 | + ).' '.date($opt['locale'][$language]['format']['phpdate']); |
|
220 | 220 | mb_send_mail($mailadr, $mailsubject, $mailbody, $email_headers); |
221 | 221 | |
222 | 222 | // logentry($module, $eventid, $userid, $objectid1, $objectid2, $logtext, $details) |
223 | - logentry('watchlist', 2, $rUser['user_id'], 0, 0, 'Sending mail to ' . $mailadr, []); |
|
223 | + logentry('watchlist', 2, $rUser['user_id'], 0, 0, 'Sending mail to '.$mailadr, []); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | $logtext = html2plaintext($rLog['text'], $rLog['text_html'] == 0, EMAIL_LINEWRAP); |
321 | 321 | |
322 | - $language = sqlValue("SELECT `language` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null); |
|
322 | + $language = sqlValue("SELECT `language` FROM `user` WHERE `user_id`='".sql_escape($user_id)."'", null); |
|
323 | 323 | if (!$language) { |
324 | 324 | $language = $opt['template']['default']['locale']; |
325 | 325 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $dateformat = $opt['locale'][$language]['format']['phpdatetime']; |
330 | 330 | } |
331 | 331 | |
332 | - $watchtext = '{date} ' . $translate->t( |
|
332 | + $watchtext = '{date} '.$translate->t( |
|
333 | 333 | '{user} has logged your cache "{cachename}":', |
334 | 334 | '', |
335 | 335 | basename(__FILE__), |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | '', |
338 | 338 | 1, |
339 | 339 | $language |
340 | - ) . ' {action}{maintenance_flags}' . "\n" . '{shortlink_url}{wp_oc}' . "\n\n" . '{text}' . "\n\n\n\n"; |
|
340 | + ).' {action}{maintenance_flags}'."\n".'{shortlink_url}{wp_oc}'."\n\n".'{text}'."\n\n\n\n"; |
|
341 | 341 | |
342 | 342 | $watchtext = mb_ereg_replace('{date}', date($dateformat, strtotime($rLog['logdate'])), $watchtext); |
343 | 343 | $watchtext = mb_ereg_replace('{wp_oc}', $rLog['wp_oc'], $watchtext); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $watchtext = mb_ereg_replace('{action}', get_logtype_name($rLog['type'], $language), $watchtext); |
348 | 348 | $watchtext = insert_maintenance_flags($rLog, $language, $watchtext); |
349 | 349 | |
350 | - $domain = sqlValue("SELECT `domain` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null); |
|
350 | + $domain = sqlValue("SELECT `domain` FROM `user` WHERE `user_id`='".sql_escape($user_id)."'", null); |
|
351 | 351 | $urls = get_site_urls($domain); |
352 | 352 | if ($urls['shortlink_url']) { |
353 | 353 | $watchtext = mb_ereg_replace("{shortlink_url}", $urls['shortlink_url'], $watchtext); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | |
402 | 402 | $logtext = html2plaintext($rLog['text'], $rLog['text_html'] == 0, EMAIL_LINEWRAP); |
403 | 403 | |
404 | - $language = sqlValue("SELECT `language` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null); |
|
404 | + $language = sqlValue("SELECT `language` FROM `user` WHERE `user_id`='".sql_escape($user_id)."'", null); |
|
405 | 405 | if (!$language) { |
406 | 406 | $language = $opt['template']['default']['locale']; |
407 | 407 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $dateformat = $opt['locale'][$language]['format']['phpdatetime']; |
412 | 412 | } |
413 | 413 | |
414 | - $watchtext = '{date} ' . $translate->t( |
|
414 | + $watchtext = '{date} '.$translate->t( |
|
415 | 415 | '{user} has logged the cache "{cachename}":', |
416 | 416 | '', |
417 | 417 | basename(__FILE__), |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | '', |
420 | 420 | 1, |
421 | 421 | $language |
422 | - ) . ' {action}{maintenance_flags}' . "\n" . '{shortlink_url}{wp_oc}' . "\n{cachelists}\n" . '{text}' . "\n\n\n\n"; |
|
422 | + ).' {action}{maintenance_flags}'."\n".'{shortlink_url}{wp_oc}'."\n{cachelists}\n".'{text}'."\n\n\n\n"; |
|
423 | 423 | |
424 | 424 | $watchtext = mb_ereg_replace('{date}', date($dateformat, strtotime($rLog['logdate'])), $watchtext); |
425 | 425 | $watchtext = mb_ereg_replace('{wp_oc}', $rLog['wp_oc'], $watchtext); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | '', |
452 | 452 | 1, |
453 | 453 | $language |
454 | - ) . ' ' . $cachelist_names[0] . "\n"; |
|
454 | + ).' '.$cachelist_names[0]."\n"; |
|
455 | 455 | break; |
456 | 456 | default: |
457 | 457 | $cachelists = $translate->t( |
@@ -462,11 +462,11 @@ discard block |
||
462 | 462 | '', |
463 | 463 | 1, |
464 | 464 | $language |
465 | - ) . ' ' . implode(', ', $cachelist_names) . "\n"; |
|
465 | + ).' '.implode(', ', $cachelist_names)."\n"; |
|
466 | 466 | } |
467 | 467 | $watchtext = mb_ereg_replace('{cachelists}', $cachelists, $watchtext); |
468 | 468 | |
469 | - $domain = sqlValue("SELECT `domain` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null); |
|
469 | + $domain = sqlValue("SELECT `domain` FROM `user` WHERE `user_id`='".sql_escape($user_id)."'", null); |
|
470 | 470 | $urls = get_site_urls($domain); |
471 | 471 | if ($urls['shortlink_url']) { |
472 | 472 | $watchtext = mb_ereg_replace("{shortlink_url}", $urls['shortlink_url'], $watchtext); |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | } |
558 | 558 | |
559 | 559 | if (file_exists($PidFile)) { |
560 | - echo "Error: Pidfile (" . $PidFile . ") already present at " . __FILE__ . ":" . __LINE__ . "!\n"; |
|
560 | + echo "Error: Pidfile (".$PidFile.") already present at ".__FILE__.":".__LINE__."!\n"; |
|
561 | 561 | |
562 | 562 | return false; |
563 | 563 | } else { |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | |
568 | 568 | return true; |
569 | 569 | } else { |
570 | - echo "can't create Pidfile $PidFile at " . __FILE__ . ":" . __LINE__ . "!\n"; |
|
570 | + echo "can't create Pidfile $PidFile at ".__FILE__.":".__LINE__."!\n"; |
|
571 | 571 | |
572 | 572 | return false; |
573 | 573 | } |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | $pid_daemon = fgets($pidfile, 20); |
584 | 584 | fclose($pidfile); |
585 | 585 | |
586 | - $pid_daemon = (int) $pid_daemon; |
|
586 | + $pid_daemon = (int)$pid_daemon; |
|
587 | 587 | |
588 | 588 | // process running? |
589 | 589 | if (posix_kill($pid_daemon, 0)) { |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | false; |
593 | 593 | } else { |
594 | 594 | // no, remove pid_file |
595 | - echo "process not running, removing old pid_file (" . $PidFile . ")\n"; |
|
595 | + echo "process not running, removing old pid_file (".$PidFile.")\n"; |
|
596 | 596 | unlink($PidFile); |
597 | 597 | |
598 | 598 | return true; |
@@ -614,10 +614,10 @@ discard block |
||
614 | 614 | unlink($PidFile); |
615 | 615 | } |
616 | 616 | } else { |
617 | - echo "Error: can't delete own pidfile (" . $PidFile . ") at " . __FILE__ . ":" . __LINE__ . "!\n"; |
|
617 | + echo "Error: can't delete own pidfile (".$PidFile.") at ".__FILE__.":".__LINE__."!\n"; |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | if ($message) { |
621 | - echo $message . "\n"; |
|
621 | + echo $message."\n"; |
|
622 | 622 | } |
623 | 623 | } |
@@ -61,6 +61,10 @@ discard block |
||
61 | 61 | |
62 | 62 | /* remove given file |
63 | 63 | */ |
64 | + |
|
65 | + /** |
|
66 | + * @param string $file |
|
67 | + */ |
|
64 | 68 | public function removeXML($file) |
65 | 69 | { |
66 | 70 | @unlink($file); |
@@ -68,6 +72,10 @@ discard block |
||
68 | 72 | |
69 | 73 | /* import the given XML file |
70 | 74 | */ |
75 | + |
|
76 | + /** |
|
77 | + * @param string $file |
|
78 | + */ |
|
71 | 79 | public function importXML($file) |
72 | 80 | { |
73 | 81 | global $opt; |
@@ -124,6 +132,9 @@ discard block |
||
124 | 132 | setSysConfig('geokrety_lastupdate', date($opt['db']['dateformat'], strtotime($startupdate))); |
125 | 133 | } |
126 | 134 | |
135 | + /** |
|
136 | + * @param DOMNode $element |
|
137 | + */ |
|
127 | 138 | public function importGeoKret($element) |
128 | 139 | { |
129 | 140 | global $opt; |
@@ -204,6 +215,9 @@ discard block |
||
204 | 215 | } |
205 | 216 | |
206 | 217 | |
218 | + /** |
|
219 | + * @param DOMNode $element |
|
220 | + */ |
|
207 | 221 | public function importMove($element) |
208 | 222 | { |
209 | 223 | global $opt; |
@@ -292,6 +306,9 @@ discard block |
||
292 | 306 | } |
293 | 307 | |
294 | 308 | |
309 | + /** |
|
310 | + * @param integer $id |
|
311 | + */ |
|
295 | 312 | public function checkGeoKretType($id, $name) |
296 | 313 | { |
297 | 314 | sql( |
@@ -302,6 +319,9 @@ discard block |
||
302 | 319 | } |
303 | 320 | |
304 | 321 | |
322 | + /** |
|
323 | + * @param integer $id |
|
324 | + */ |
|
305 | 325 | public function checkUser($id, $name) |
306 | 326 | { |
307 | 327 | if ($id == 0) { |
@@ -312,6 +332,9 @@ discard block |
||
312 | 332 | } |
313 | 333 | |
314 | 334 | |
335 | + /** |
|
336 | + * @param integer $id |
|
337 | + */ |
|
315 | 338 | public function checkMoveType($id, $name) |
316 | 339 | { |
317 | 340 | sql( |
@@ -322,6 +345,9 @@ discard block |
||
322 | 345 | } |
323 | 346 | |
324 | 347 | |
348 | + /** |
|
349 | + * @param string $element |
|
350 | + */ |
|
325 | 351 | public function GetNodeValue(&$domnode, $element) |
326 | 352 | { |
327 | 353 | $subnode = $domnode->getElementsByTagName($element); |
@@ -333,6 +359,12 @@ discard block |
||
333 | 359 | } |
334 | 360 | |
335 | 361 | |
362 | + /** |
|
363 | + * @param string $element |
|
364 | + * @param string $attr |
|
365 | + * |
|
366 | + * @return string |
|
367 | + */ |
|
336 | 368 | public function GetNodeAttribute(&$domnode, $element, $attr) |
337 | 369 | { |
338 | 370 | $subnode = $domnode->getElementsByTagName($element); |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | { |
43 | 43 | global $opt; |
44 | 44 | |
45 | - if (!@mkdir(__DIR__ . '/../../../cache2/geokrety')) { |
|
45 | + if (!@mkdir(__DIR__.'/../../../cache2/geokrety')) { |
|
46 | 46 | // die('can\'t create geogrety cache dir'); |
47 | 47 | } |
48 | - $path = __DIR__ . '/../../../cache2/geokrety/import-' . date('Ymd-His') . '.xml'; |
|
48 | + $path = __DIR__.'/../../../cache2/geokrety/import-'.date('Ymd-His').'.xml'; |
|
49 | 49 | |
50 | 50 | // Changed default-value for getSysConfig() from '2005-01-01 00:00:00' to 'NOW - 9d 12h' |
51 | 51 | // to safely stay in api-limit, even when client and server are in different time zones. |
52 | 52 | $modifiedsince = strtotime( |
53 | 53 | getSysConfig('geokrety_lastupdate', date($opt['db']['dateformat'], time() - 60 * 60 * 24 * 9.5)) |
54 | 54 | ); |
55 | - if (!@copy('http://geokrety.org/export.php?modifiedsince=' . date('YmdHis', $modifiedsince - 1), $path)) { |
|
55 | + if (!@copy('http://geokrety.org/export.php?modifiedsince='.date('YmdHis', $modifiedsince - 1), $path)) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | |
@@ -81,19 +81,19 @@ discard block |
||
81 | 81 | |
82 | 82 | $xr->read(); |
83 | 83 | if ($xr->nodeType != XMLReader::ELEMENT) { |
84 | - echo 'error: First element expected, aborted' . "\n"; |
|
84 | + echo 'error: First element expected, aborted'."\n"; |
|
85 | 85 | |
86 | 86 | return; |
87 | 87 | } |
88 | 88 | if ($xr->name != 'gkxml') { |
89 | - echo 'error: First element not valid, aborted' . "\n"; |
|
89 | + echo 'error: First element not valid, aborted'."\n"; |
|
90 | 90 | |
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $startupdate = $xr->getAttribute('date'); |
95 | 95 | if ($startupdate == '') { |
96 | - echo 'error: Date attribute not valid, aborted' . "\n"; |
|
96 | + echo 'error: Date attribute not valid, aborted'."\n"; |
|
97 | 97 | |
98 | 98 | return; |
99 | 99 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | break; |
116 | 116 | } |
117 | 117 | |
118 | - $nRecordsCount ++; |
|
118 | + $nRecordsCount++; |
|
119 | 119 | } |
120 | 120 | } while ($xr->next()); |
121 | 121 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $waypoints = $element->getElementsByTagName('waypoints'); |
254 | 254 | if ($waypoints->length > 0) { |
255 | 255 | $wpItems = $waypoints->item(0)->getElementsByTagName('waypoint'); |
256 | - for ($i = 0; $i < $wpItems->length; $i ++) { |
|
256 | + for ($i = 0; $i < $wpItems->length; $i++) { |
|
257 | 257 | $wp = mb_trim($wpItems->item($i)->nodeValue); |
258 | 258 | if ($wp != '') { |
259 | 259 | sql("INSERT INTO `gk_move_waypoint` (`id`, `wp`) VALUES ('&1', '&2')", $id, $wp); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | WHERE `id`='&2' AND `wp`!=''", |
286 | 286 | $gkid, |
287 | 287 | $r['id'] |
288 | - ); // "late log" bugfix: replaced $id paramter by $r['id'] |
|
288 | + ); // "late log" bugfix: replaced $id paramter by $r['id'] |
|
289 | 289 | } else { |
290 | 290 | // do nothing |
291 | 291 | } |
@@ -61,6 +61,9 @@ |
||
61 | 61 | $this->ping_searchengine('http://www.bing.com/webmaster/ping.aspx?siteMap=' . $url); |
62 | 62 | } |
63 | 63 | |
64 | + /** |
|
65 | + * @param string $url |
|
66 | + */ |
|
64 | 67 | public function ping_searchengine($url) |
65 | 68 | { |
66 | 69 | $curl = curl_init($url); |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | global $opt; |
51 | 51 | |
52 | 52 | $url = urlencode( |
53 | - ($opt['page']['https']['mode'] == HTTPS_ENFORCED ? $opt['page']['absolute_https_url'] : $opt['page']['absolute_http_url']) . 'sitemap.xml' |
|
53 | + ($opt['page']['https']['mode'] == HTTPS_ENFORCED ? $opt['page']['absolute_https_url'] : $opt['page']['absolute_http_url']).'sitemap.xml' |
|
54 | 54 | ); |
55 | 55 | |
56 | - $this->ping_searchengine('http://www.google.com/webmasters/tools/ping?sitemap=' . $url); |
|
56 | + $this->ping_searchengine('http://www.google.com/webmasters/tools/ping?sitemap='.$url); |
|
57 | 57 | $this->ping_searchengine( |
58 | - 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=USERID&url=' . $url |
|
58 | + 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=USERID&url='.$url |
|
59 | 59 | ); |
60 | - $this->ping_searchengine('http://submissions.ask.com/ping?sitemap=' . $url); |
|
61 | - $this->ping_searchengine('http://www.bing.com/webmaster/ping.aspx?siteMap=' . $url); |
|
60 | + $this->ping_searchengine('http://submissions.ask.com/ping?sitemap='.$url); |
|
61 | + $this->ping_searchengine('http://www.bing.com/webmaster/ping.aspx?siteMap='.$url); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function ping_searchengine($url) |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $nCount = sql_value("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1", 0); |
91 | 91 | $nIndex = 0; |
92 | 92 | while ($nIndex < $nCount) { |
93 | - $this->oSitemapXML->write('newcaches.php?startat=' . $nIndex, time(), 'always'); |
|
93 | + $this->oSitemapXML->write('newcaches.php?startat='.$nIndex, time(), 'always'); |
|
94 | 94 | $nIndex += 100; |
95 | 95 | } |
96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | $rs = sql("SELECT SQL_BUFFER_RESULT `user_id` FROM `user`"); |
101 | 101 | while ($r = sql_fetch_assoc($rs)) { |
102 | - $this->oSitemapXML->write('viewprofile.php?userid=' . $r['user_id'], time() - 31 * 24 * 60 * 60); |
|
102 | + $this->oSitemapXML->write('viewprofile.php?userid='.$r['user_id'], time() - 31 * 24 * 60 * 60); |
|
103 | 103 | } |
104 | 104 | sql_free_result($rs); |
105 | 105 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | "SELECT SQL_BUFFER_RESULT MAX(`last_modified`) AS `d`, `cache_id` FROM `cache_logs` GROUP BY `cache_id`" |
111 | 111 | ); |
112 | 112 | while ($r = sql_fetch_assoc($rs)) { |
113 | - $this->oSitemapXML->write('viewlogs.php?cacheid=' . $r['cache_id'], strtotime($r['d'])); |
|
113 | + $this->oSitemapXML->write('viewlogs.php?cacheid='.$r['cache_id'], strtotime($r['d'])); |
|
114 | 114 | } |
115 | 115 | sql_free_result($rs); |
116 | 116 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $r['cache_id'] |
143 | 143 | ); |
144 | 144 | $this->oSitemapXML->write( |
145 | - 'viewcache.php?wp=' . $r['wp_oc'] . '&desclang=' . $r['language'], |
|
145 | + 'viewcache.php?wp='.$r['wp_oc'].'&desclang='.$r['language'], |
|
146 | 146 | strtotime($dLastMod) |
147 | 147 | ); |
148 | 148 | } |