Beispiel #1
0
require_once './lib/search.inc.php';
require_once './lib/search-signatures.inc.php';
global $dbcSearch, $lang, $TestStartTime, $usr;
//4test
$TestStartTime = new DateTime('now');
$dbcSearch = new dataBase();
$dbc = new dataBase();
// SQL-Debug?
$sqldebug = false;
$sql_debug = $sqldebug;
if ($sql_debug == true) {
    require_once './lib/sqldebugger.inc.php';
    sqldbg_begin();
}
// extract user data for KML search
$usr = requestSigner::extract_user($usr);
if ($usr == false) {
    $target = urlencode(tpl_get_current_page());
    tpl_redirect('login.php?target=' . $target);
    exit;
}
//Preprocessing
if ($error == false) {
    $tplname = 'search';
    require $stylepath . '/search.inc.php';
    require $rootpath . 'lib/caches.inc.php';
    common::sanitize($_REQUEST);
    //km => target-unit
    $multiplier['km'] = 1;
    $multiplier['sm'] = 0.62137;
    $multiplier['nm'] = 0.53996;
//else
//tpl_set_var('endat', $startat + 500);
// kompatibilität!
if ($distance_unit == 'sm') {
    tpl_set_var('distanceunit', 'mi');
} else {
    if ($distance_unit == 'nm') {
        tpl_set_var('distanceunit', 'sm');
    } else {
        tpl_set_var('distanceunit', $distance_unit);
    }
}
if ($usr !== false) {
    $queryid = $options['queryid'];
    $google_kml_link = $absolute_server_URI . "search.php?queryid={$queryid}&output=kml&startat={$startat}";
    $google_kml_link .= requestSigner::get_signature_text();
    $google_kml_link_all = $google_kml_link . '&count=max&zip=1';
    $domain = substr(trim($absolute_server_URI, '/'), -2, 2);
    // It should be done better
    $google_maps_link = "http://maps.google.{$domain}/maps?f=q&hl={$lang}&geocode=&q=";
    $google_maps_link_all = "http://maps.google.{$domain}/maps?f=q&hl={$lang}&geocode=&ie=UTF8&z=7&q=";
    $google_maps_link = htmlentities($google_maps_link) . urlencode($google_kml_link);
    $google_maps_link_all = htmlentities($google_maps_link_all) . urlencode($google_kml_link_all);
    tpl_set_var('google_maps_link', $google_maps_link);
    tpl_set_var('google_maps_link_all', $google_maps_link_all);
}
if ($sqldebug == true) {
    sqldbg_end();
} else {
    tpl_BuildTemplate();
}