@@ -246,11 +246,21 @@ discard block |
||
| 246 | 246 | return $ret; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | +/** |
|
| 250 | + * @param string $name |
|
| 251 | + * @param string $default |
|
| 252 | + * |
|
| 253 | + * @return string |
|
| 254 | + */ |
|
| 249 | 255 | function getSysConfig($name, $default) |
| 250 | 256 | { |
| 251 | 257 | return sql_value("SELECT `value` FROM `sysconfig` WHERE `name`='&1'", $default, $name); |
| 252 | 258 | } |
| 253 | 259 | |
| 260 | +/** |
|
| 261 | + * @param string $name |
|
| 262 | + * @param string $value |
|
| 263 | + */ |
|
| 254 | 264 | function setSysConfig($name, $value) |
| 255 | 265 | { |
| 256 | 266 | sql( |
@@ -333,6 +343,9 @@ discard block |
||
| 333 | 343 | } |
| 334 | 344 | |
| 335 | 345 | |
| 346 | +/** |
|
| 347 | + * @return string |
|
| 348 | + */ |
|
| 336 | 349 | function escape_javascript($text) |
| 337 | 350 | { |
| 338 | 351 | return str_replace('\'', '\\\'', str_replace('"', '"', $text)); |
@@ -229,7 +229,7 @@ |
||
| 229 | 229 | |
| 230 | 230 | while ($nCurPos < mb_strlen($str)) { |
| 231 | 231 | $nNextSep = mb_strlen($str); |
| 232 | - for ($nSepPos = 0; $nSepPos < mb_strlen($sep); $nSepPos ++) { |
|
| 232 | + for ($nSepPos = 0; $nSepPos < mb_strlen($sep); $nSepPos++) { |
|
| 233 | 233 | $nThisPos = mb_strpos($str, mb_substr($sep, $nSepPos, 1), $nCurPos); |
| 234 | 234 | if ($nThisPos !== false) { |
| 235 | 235 | if ($nNextSep > $nThisPos) { |
@@ -128,6 +128,9 @@ |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
| 131 | +/** |
|
| 132 | + * @param boolean $include_editor |
|
| 133 | + */ |
|
| 131 | 134 | function assignFromDB($userid, $include_editor) |
| 132 | 135 | { |
| 133 | 136 | global $tpl, $opt, $smilies, $_REQUEST; |
@@ -182,6 +182,9 @@ |
||
| 182 | 182 | $tpl->display(); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | +/** |
|
| 186 | + * @param user $user |
|
| 187 | + */ |
|
| 185 | 188 | function assignFromUser($user) |
| 186 | 189 | { |
| 187 | 190 | global $tpl; |
@@ -675,7 +675,7 @@ |
||
| 675 | 675 | * @param $admins |
| 676 | 676 | * @param $wp_oc |
| 677 | 677 | * @param $r |
| 678 | - * @param $field |
|
| 678 | + * @param string $field |
|
| 679 | 679 | * @param $oldvalue |
| 680 | 680 | * @param $newvalue |
| 681 | 681 | */ |
@@ -1011,7 +1011,7 @@ |
||
| 1011 | 1011 | } |
| 1012 | 1012 | $logs_restored = true; |
| 1013 | 1013 | } |
| 1014 | - // if it was not already restored by a later restore operation ... |
|
| 1014 | + // if it was not already restored by a later restore operation ... |
|
| 1015 | 1015 | } elseif (sql_value("SELECT `id` FROM `cache_logs` WHERE `id`='&1'", 0, $revert_logid) == 0) { |
| 1016 | 1016 | // id, uuid, date_created and last_modified are set automatically; |
| 1017 | 1017 | // picture will be updated automatically on picture-restore |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $rs = sql("SELECT * FROM `caches` WHERE `cache_id` IN " . $cachelist); |
| 368 | 368 | while ($r = sql_fetch_assoc($rs)) { |
| 369 | 369 | $nextcd[$r['wp_oc']] = $r; |
| 370 | - $user_id = $r['user_id']; // is used later for logs |
|
| 370 | + $user_id = $r['user_id']; // is used later for logs |
|
| 371 | 371 | } |
| 372 | 372 | sql_free_result($rs); |
| 373 | 373 | |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | "SELECT * FROM `caches_attributes_modified` |
| 468 | 468 | WHERE `cache_id` IN " . $cachelist . " /* OConly attrib is shown, but not restorable */ |
| 469 | 469 | ORDER BY `date_modified` ASC" |
| 470 | - ); // order doesn't matter as long it is date only |
|
| 470 | + ); // order doesn't matter as long it is date only |
|
| 471 | 471 | while ($r = sql_fetch_assoc($rs)) { |
| 472 | 472 | append_data( |
| 473 | 473 | $data, |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | "SELECT *, " . $piccacheid . "AS `cache_id` FROM `pictures_modified` |
| 624 | 624 | WHERE " . $piccacheid . " IN " . $cachelist . " |
| 625 | 625 | ORDER BY `date_modified` ASC" |
| 626 | - ); // order is relevant for the case of restore-reverts |
|
| 626 | + ); // order is relevant for the case of restore-reverts |
|
| 627 | 627 | while ($r = sql_fetch_assoc($rs)) { |
| 628 | 628 | $r['date_modified'] = substr($r['date_modified'], 0, 10); |
| 629 | 629 | switch ($r['operation']) { |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | { |
| 728 | 728 | global $opt, $login; |
| 729 | 729 | |
| 730 | - sql("SET @restoredby='&1'", $login->userid); // is evaluated by trigger functions |
|
| 730 | + sql("SET @restoredby='&1'", $login->userid); // is evaluated by trigger functions |
|
| 731 | 731 | sql_slave("SET @restoredby='&1'", $login->userid); |
| 732 | 732 | |
| 733 | 733 | $restored = array(); |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | // id, uuid, date_created and last_modified are set automatically; |
| 1020 | 1020 | // picture will be updated automatically on picture-restore |
| 1021 | 1021 | $log = new cachelog(); |
| 1022 | - $log->setNode($r['node']); // cachelog class currently does not initialize node field |
|
| 1022 | + $log->setNode($r['node']); // cachelog class currently does not initialize node field |
|
| 1023 | 1023 | $log->setCacheId($r['cache_id']); |
| 1024 | 1024 | $log->setUserId($r['user_id']); |
| 1025 | 1025 | $log->setType($r['type'], true); |
@@ -1071,7 +1071,7 @@ discard block |
||
| 1071 | 1071 | } // not already processed |
| 1072 | 1072 | |
| 1073 | 1073 | if ($error != "") { |
| 1074 | - $restored[$wp]['internal error - could not $error log ' + $r['id'] + "/" + $logid]; |
|
| 1074 | + $restored[$wp]['internal error - could not $error log ' +$r['id'] + "/" +$logid]; |
|
| 1075 | 1075 | } |
| 1076 | 1076 | if ($logs_restored) { |
| 1077 | 1077 | $restored[$wp]['logs'] = true; |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | } // not already processed |
| 1204 | 1204 | |
| 1205 | 1205 | if ($error != "") { |
| 1206 | - $restored[$wp]['internal error - could not $error picture ' . $r['id'] + "/" + $picid] = true; |
|
| 1206 | + $restored[$wp]['internal error - could not $error picture ' . $r['id'] + "/" +$picid] = true; |
|
| 1207 | 1207 | } |
| 1208 | 1208 | if ($pics_restored) { |
| 1209 | 1209 | $restored[$wp]['pictures'] = true; |
@@ -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; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -$queryid += 0; // safety measure: force $queryid to be numeric |
|
| 148 | +$queryid += 0; // safety measure: force $queryid to be numeric |
|
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | //========================================================= |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | if (sql_num_rows($query_rs) == 0) { |
| 167 | 167 | // can happen if logged out after query was created (fix for RT #3915) |
| 168 | 168 | $queryid = 0; |
| 169 | - goto newquery; // goto needs PHP 5.3 |
|
| 169 | + goto newquery; // goto needs PHP 5.3 |
|
| 170 | 170 | /* |
| 171 | 171 | $tpl->error($error_query_not_found); |
| 172 | 172 | */ |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // get findername from finderid |
| 205 | - $options['finderid'] = isset($options['finderid']) ? $options['finderid'] + 0 : 0; // Ocprop |
|
| 205 | + $options['finderid'] = isset($options['finderid']) ? $options['finderid'] + 0 : 0; // Ocprop |
|
| 206 | 206 | if (isset($options['finder']) && $options['finderid'] > 0) { |
| 207 | 207 | $rs_name = sql("SELECT `username` FROM `user` WHERE `user_id`='&1'", $options['finderid']); |
| 208 | 208 | if (sql_num_rows($rs_name) == 1) { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | // get ownername from ownerid |
| 217 | - $options['ownerid'] = isset($options['ownerid']) ? $options['ownerid'] + 0 : 0; // Ocprop |
|
| 217 | + $options['ownerid'] = isset($options['ownerid']) ? $options['ownerid'] + 0 : 0; // Ocprop |
|
| 218 | 218 | if (isset($options['owner']) && $options['ownerid'] > 0) { |
| 219 | 219 | $rs_name = sql("SELECT `username` FROM `user` WHERE `user_id`='&1'", $options['ownerid']); |
| 220 | 220 | if (sql_num_rows($rs_name) == 1) { |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // get the search options parameters and store them in the queries table (to view "the next page") |
| 254 | - $options['f_userowner'] = isset($_REQUEST['f_userowner']) ? $_REQUEST['f_userowner'] : 0; // Ocprop |
|
| 255 | - $options['f_userfound'] = isset($_REQUEST['f_userfound']) ? $_REQUEST['f_userfound'] : 0; // Ocprop |
|
| 254 | + $options['f_userowner'] = isset($_REQUEST['f_userowner']) ? $_REQUEST['f_userowner'] : 0; // Ocprop |
|
| 255 | + $options['f_userfound'] = isset($_REQUEST['f_userfound']) ? $_REQUEST['f_userfound'] : 0; // Ocprop |
|
| 256 | 256 | $options['f_disabled'] = isset($_REQUEST['f_disabled']) ? $_REQUEST['f_disabled'] : 0; |
| 257 | - $options['f_inactive'] = isset($_REQUEST['f_inactive']) ? $_REQUEST['f_inactive'] : 1; // Ocprop |
|
| 257 | + $options['f_inactive'] = isset($_REQUEST['f_inactive']) ? $_REQUEST['f_inactive'] : 1; // Ocprop |
|
| 258 | 258 | // f_inactive formerly was used for both, archived and disabled caches. |
| 259 | 259 | // After adding the separate f_disabled option, it is used only for archived |
| 260 | 260 | // caches, but keeps its name for compatibility with existing stored or |
@@ -262,15 +262,15 @@ discard block |
||
| 262 | 262 | $options['f_ignored'] = isset($_REQUEST['f_ignored']) ? $_REQUEST['f_ignored'] : 1; |
| 263 | 263 | $options['f_otherPlatforms'] = isset($_REQUEST['f_otherPlatforms']) ? $_REQUEST['f_otherPlatforms'] : 0; |
| 264 | 264 | $options['f_geokrets'] = isset($_REQUEST['f_geokrets']) ? $_REQUEST['f_geokrets'] : 0; |
| 265 | - $options['expert'] = isset($_REQUEST['expert']) ? $_REQUEST['expert'] : 0; // Ocprop: 0 |
|
| 265 | + $options['expert'] = isset($_REQUEST['expert']) ? $_REQUEST['expert'] : 0; // Ocprop: 0 |
|
| 266 | 266 | $options['showresult'] = isset($_REQUEST['showresult']) ? $_REQUEST['showresult'] : 0; |
| 267 | - $options['output'] = isset($_REQUEST['output']) ? $_REQUEST['output'] : 'HTML'; // Ocprop: HTML |
|
| 267 | + $options['output'] = isset($_REQUEST['output']) ? $_REQUEST['output'] : 'HTML'; // Ocprop: HTML |
|
| 268 | 268 | $options['bbox'] = isset($_REQUEST['bbox']) ? $_REQUEST['bbox'] : false; |
| 269 | 269 | |
| 270 | 270 | if (isset($_REQUEST['cache_attribs'])) { |
| 271 | 271 | if ($_REQUEST['cache_attribs'] != '') { |
| 272 | 272 | $aAttribs = mb_split(';', $_REQUEST['cache_attribs']); |
| 273 | - for ($i = 0; $i < count($aAttribs); $i ++) { |
|
| 273 | + for ($i = 0; $i < count($aAttribs); $i++) { |
|
| 274 | 274 | $options['cache_attribs'][$aAttribs[$i] + 0] = $aAttribs[$i] + 0; |
| 275 | 275 | } |
| 276 | 276 | unset($aAttribs); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | if (isset($_REQUEST['cache_attribs_not'])) { |
| 285 | 285 | if ($_REQUEST['cache_attribs_not'] != '') { |
| 286 | 286 | $aAttribs = mb_split(';', $_REQUEST['cache_attribs_not']); |
| 287 | - for ($i = 0; $i < count($aAttribs); $i ++) { |
|
| 287 | + for ($i = 0; $i < count($aAttribs); $i++) { |
|
| 288 | 288 | $options['cache_attribs_not'][$aAttribs[$i] + 0] = $aAttribs[$i] + 0; |
| 289 | 289 | } |
| 290 | 290 | unset($aAttribs); |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | $options['finderid'] = isset($_REQUEST['finderid']) ? $_REQUEST['finderid'] : 0; |
| 324 | 324 | $options['finder'] = isset($_REQUEST['finder']) ? stripslashes($_REQUEST['finder']) : ''; |
| 325 | - $options['logtype'] = isset($_REQUEST['logtype']) ? $_REQUEST['logtype'] : '1,7'; // Ocprop |
|
| 325 | + $options['logtype'] = isset($_REQUEST['logtype']) ? $_REQUEST['logtype'] : '1,7'; // Ocprop |
|
| 326 | 326 | } elseif ((isset($_REQUEST['searchbyortplz']) && is_numeric($_REQUEST['ortplz'])) |
| 327 | 327 | || isset($_REQUEST['searchbyplz'])) { |
| 328 | 328 | $options['searchtype'] = 'byplz'; |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | if (!$list->allowView($password)) { |
| 396 | 396 | $tpl->redirect("cachelists.php"); |
| 397 | 397 | } |
| 398 | - $options['cachelist'] = cachelist::getListById($options['listid']); // null for invalid ID |
|
| 398 | + $options['cachelist'] = cachelist::getListById($options['listid']); // null for invalid ID |
|
| 399 | 399 | $options['cachelist_pw'] = $password; |
| 400 | 400 | } elseif (isset($_REQUEST['searchall'])) { |
| 401 | 401 | if (!$login->logged_in() && |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | } |
| 674 | 674 | $sqlhashes .= '`gns_search`.`simplehash`=' . sprintf("%u", crc32($searchstring)); |
| 675 | 675 | |
| 676 | - $wordscount ++; |
|
| 676 | + $wordscount++; |
|
| 677 | 677 | } |
| 678 | 678 | } |
| 679 | 679 | |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | $sql_where[] = '`s' . $n . '`.`hash`=\'' . sql_escape($h) . '\''; |
| 1016 | 1016 | $sql_where[] = '`s' . $n . '`.`object_type` IN (' . implode(',', $ft_types) . ')'; |
| 1017 | 1017 | |
| 1018 | - $n ++; |
|
| 1018 | + $n++; |
|
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | $sqlFilter = |
@@ -1173,7 +1173,7 @@ discard block |
||
| 1173 | 1173 | if ($options['cachetype'] != '') { |
| 1174 | 1174 | $types = explode(';', $options['cachetype']); |
| 1175 | 1175 | if (count($types) < sql_value_slave("SELECT COUNT(*) FROM `cache_type`", 0)) { |
| 1176 | - for ($i = 0; $i < count($types); $i ++) { |
|
| 1176 | + for ($i = 0; $i < count($types); $i++) { |
|
| 1177 | 1177 | $types[$i] = "'" . sql_escape($types[$i]) . "'"; |
| 1178 | 1178 | } |
| 1179 | 1179 | $sql_where[] = '`caches`.`type` IN (' . implode(',', $types) . ')'; |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | if ($options['cachesize'] != '') { |
| 1184 | 1184 | $sizes = explode(';', $options['cachesize']); |
| 1185 | 1185 | if (count($sizes) < sql_value_slave("SELECT COUNT(*) FROM `cache_size`", 0)) { |
| 1186 | - for ($i = 0; $i < count($sizes); $i ++) { |
|
| 1186 | + for ($i = 0; $i < count($sizes); $i++) { |
|
| 1187 | 1187 | $sizes[$i] = "'" . sql_escape($sizes[$i]) . "'"; |
| 1188 | 1188 | } |
| 1189 | 1189 | $sql_where[] = '`caches`.`size` IN (' . implode(',', $sizes) . ')'; |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | // X6. load output module and output-dependent options |
| 1269 | 1269 | //================================================================= |
| 1270 | 1270 | |
| 1271 | - $output_module = mb_strtolower($options['output']); // Ocprop: HTML, gpx |
|
| 1271 | + $output_module = mb_strtolower($options['output']); // Ocprop: HTML, gpx |
|
| 1272 | 1272 | |
| 1273 | 1273 | $map2_bounds = ($output_module == 'map2bounds'); |
| 1274 | 1274 | if ($map2_bounds) { |
@@ -1612,7 +1612,7 @@ discard block |
||
| 1612 | 1612 | global $tpl, $login, $opt; |
| 1613 | 1613 | global $error_ort, $error_plz, $error_locidnocoords, $error_nowaypointfound, $error_nocoords, $error_nofulltext, $error_fulltexttoolong; |
| 1614 | 1614 | global $cache_attrib_jsarray_line, $cache_attrib_group, $cache_attrib_img_line1, $cache_attrib_img_line2; |
| 1615 | - global $load_query, $show_lastsearchbutton ; |
|
| 1615 | + global $load_query, $show_lastsearchbutton; |
|
| 1616 | 1616 | |
| 1617 | 1617 | $tpl->assign('formmethod', 'get'); |
| 1618 | 1618 | |
@@ -1818,7 +1818,7 @@ discard block |
||
| 1818 | 1818 | $dfromwaypoint_checked = ($options['searchtype'] == 'bywaypoint'); |
| 1819 | 1819 | $dfromcoords_checked = ($options['searchtype'] == 'bycoords'); |
| 1820 | 1820 | if (!$dfromortplz_checked && !$dfromwaypoint_checked && !$dfromcoords_checked) { |
| 1821 | - $dfromcoords_checked = true; // default |
|
| 1821 | + $dfromcoords_checked = true; // default |
|
| 1822 | 1822 | } |
| 1823 | 1823 | $tpl->assign('dfromortplz_checked', $dfromortplz_checked); |
| 1824 | 1824 | $tpl->assign('dfromwaypoint_checked', $dfromwaypoint_checked); |
@@ -2047,7 +2047,7 @@ discard block |
||
| 2047 | 2047 | $line = mb_ereg_replace('{color}', $rAttrGroup['color'], $line); |
| 2048 | 2048 | |
| 2049 | 2049 | $group_line .= $line; |
| 2050 | - $nLineAttrCount2 ++; |
|
| 2050 | + $nLineAttrCount2++; |
|
| 2051 | 2051 | } |
| 2052 | 2052 | sql_free_result($rs); |
| 2053 | 2053 | |
@@ -2158,7 +2158,7 @@ discard block |
||
| 2158 | 2158 | $line = mb_ereg_replace('{color}', $rAttrGroup['color'], $line); |
| 2159 | 2159 | |
| 2160 | 2160 | $group_line .= $line; |
| 2161 | - $nLineAttrCount1 ++; |
|
| 2161 | + $nLineAttrCount1++; |
|
| 2162 | 2162 | } |
| 2163 | 2163 | sql_free_result($rs); |
| 2164 | 2164 | |
@@ -2305,7 +2305,7 @@ discard block |
||
| 2305 | 2305 | |
| 2306 | 2306 | function outputUniidSelectionForm($uniSql, $options) |
| 2307 | 2307 | { |
| 2308 | - global $tpl; // settings |
|
| 2308 | + global $tpl; // settings |
|
| 2309 | 2309 | global $locline, $secondlocationname; |
| 2310 | 2310 | |
| 2311 | 2311 | $urlparamString = prepareLocSelectionForm($options); |
@@ -2415,7 +2415,7 @@ discard block |
||
| 2415 | 2415 | $thislocation = mb_ereg_replace('{locid}', urlencode($r['uni_id']), $thislocation); |
| 2416 | 2416 | $thislocation = mb_ereg_replace('{nr}', $nr, $thislocation); |
| 2417 | 2417 | |
| 2418 | - $nr ++; |
|
| 2418 | + $nr++; |
|
| 2419 | 2419 | $locations .= $thislocation . "\n"; |
| 2420 | 2420 | } |
| 2421 | 2421 | sql_free_result($rs); |
@@ -2508,7 +2508,7 @@ discard block |
||
| 2508 | 2508 | $thislocation = mb_ereg_replace('{bgcolor}', $bgcolor2, $thislocation); |
| 2509 | 2509 | } |
| 2510 | 2510 | |
| 2511 | - $nr ++; |
|
| 2511 | + $nr++; |
|
| 2512 | 2512 | $locations .= $thislocation . "\n"; |
| 2513 | 2513 | } |
| 2514 | 2514 | |
@@ -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()); |
@@ -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(); |
@@ -304,7 +304,7 @@ |
||
| 304 | 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; |
@@ -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 = []; |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | $writer->writeElement('code', $r['text']); |
| 691 | 691 | $countLang = count($lang); |
| 692 | - for ($n = 0; $n < $countLang; $n ++) { |
|
| 692 | + for ($n = 0; $n < $countLang; $n++) { |
|
| 693 | 693 | $writer->writeElement( |
| 694 | 694 | $lang[$n], |
| 695 | 695 | sql_value( |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | $nCount = isset($_REQUEST['count']) ? $_REQUEST['count'] + 0 : 0; |
| 819 | 819 | |
| 820 | - for ($nIndex = 1; $nIndex <= $nCount; $nIndex ++) { |
|
| 820 | + for ($nIndex = 1; $nIndex <= $nCount; $nIndex++) { |
|
| 821 | 821 | if (isset($_REQUEST['useitem' . $nIndex]) && ($_REQUEST['useitem' . $nIndex] == '1')) { |
| 822 | 822 | $sCode = base64_decode($_REQUEST['code' . $nIndex]); |
| 823 | 823 | $transId = sql_value("SELECT `id` FROM `sys_trans` WHERE `text`='&1'", 0, $sCode); |