Exemplo n.º 1
0
function geodb_setCacheLocation($cache_id)
{
    echo $cache_id . "\n";
    $rs = sqll("SELECT `latitude`, `longitude`, `last_modified` FROM `caches` WHERE `cache_id`='&1'", $cache_id);
    if ($r = sql_fetch_array($rs)) {
        $nLocId = geodb_locidFromCoords($r['longitude'], $r['latitude']);
        if ($nLocId != 0) {
            $sAdm1 = geodb_landFromLocid($nLocId);
            $sAdm2 = geodb_regierungsbezirkFromLocid($nLocId);
            $sAdm3 = geodb_landkreisFromLocid($nLocId);
        } else {
            $sAdm1 = null;
            $sAdm2 = null;
            $sAdm3 = null;
        }
        if ($sAdm1 == '') {
            $sAdm1 = null;
        }
        if ($sAdm2 == '') {
            $sAdm2 = null;
        }
        if ($sAdm3 == '') {
            $sAdm3 = null;
        }
        sqll("INSERT INTO `cache_location` (`cache_id`, `last_modified`, `adm1`, `adm2`, `adm3`) VALUES ('&1', '&2', '&3', '&4', '&5') ON DUPLICATE KEY UPDATE `cache_id`='&1', `last_modified`='&2', `adm1`='&3', `adm2`='&4', `adm3`='&5'", $cache_id, $r['last_modified'], $sAdm1, $sAdm2, $sAdm3);
    }
    sql_free_result($rs);
}
Exemplo n.º 2
0
function outputLocidSelectionForm($locSql, $options)
{
    global $tpl;
    global $locline, $bgcolor1, $bgcolor2;
    require_once "lib2/logic/geodb.inc.php";
    $urlparamString = prepareLocSelectionForm($options) . '&locid={locid}';
    sql_temp_table_slave('locids');
    sql_slave('CREATE TEMPORARY TABLE &locids ENGINE=MEMORY ' . $locSql);
    sql_slave('ALTER TABLE &locids ADD PRIMARY KEY (`loc_id`)');
    $rs = sql_slave('SELECT `geodb_textdata`.`loc_id` `loc_id`, `geodb_textdata`.`text_val` `text_val` FROM `geodb_textdata`, &locids WHERE &locids.`loc_id`=`geodb_textdata`.`loc_id` AND `geodb_textdata`.`text_type`=500100000 ORDER BY `text_val`');
    $nr = 1;
    $locations = '';
    while ($r = sql_fetch_array($rs)) {
        $thislocation = $locline;
        // locationsdings zusammenbauen
        $locString = '';
        $land = geodb_landFromLocid($r['loc_id']);
        if ($land != '') {
            $locString .= htmlspecialchars($land, ENT_COMPAT, 'UTF-8');
        }
        $rb = geodb_regierungsbezirkFromLocid($r['loc_id']);
        if ($rb != '') {
            $locString .= ' > ' . htmlspecialchars($rb, ENT_COMPAT, 'UTF-8');
        }
        $lk = geodb_landkreisFromLocid($r['loc_id']);
        if ($lk != '') {
            $locString .= ' > ' . htmlspecialchars($lk, ENT_COMPAT, 'UTF-8');
        }
        $thislocation = mb_ereg_replace('{parentlocations}', $locString, $thislocation);
        // koordinaten ermitteln
        $r['loc_id'] = $r['loc_id'] + 0;
        $rsCoords = sql_slave('SELECT `lon`, `lat` FROM `geodb_coordinates` WHERE loc_id=' . $r['loc_id'] . ' LIMIT 1');
        if ($rCoords = sql_fetch_array($rsCoords)) {
            $coordString = help_latToDegreeStr($rCoords['lat']) . ' ' . help_lonToDegreeStr($rCoords['lon']);
        } else {
            $coordString = '[' . $no_location_coords . ']';
        }
        $thislocation = mb_ereg_replace('{coords}', htmlspecialchars($coordString, ENT_COMPAT, 'UTF-8'), $thislocation);
        $thislocation = mb_ereg_replace('{locationname}', htmlspecialchars($r['text_val'], ENT_COMPAT, 'UTF-8'), $thislocation);
        $thislocation = mb_ereg_replace('{urlparams}', $urlparamString, $thislocation);
        $thislocation = mb_ereg_replace('{locid}', urlencode($r['loc_id']), $thislocation);
        $thislocation = mb_ereg_replace('{nr}', $nr, $thislocation);
        $thislocation = mb_ereg_replace('{secondlocationname}', '', $thislocation);
        if ($nr % 2) {
            $thislocation = mb_ereg_replace('{bgcolor}', $bgcolor1, $thislocation);
        } else {
            $thislocation = mb_ereg_replace('{bgcolor}', $bgcolor2, $thislocation);
        }
        $nr++;
        $locations .= $thislocation . "\n";
    }
    $tpl->assign('locations', $locations);
    $tpl->assign('resultscount', sql_num_rows($rs));
    $tpl->assign('pages', '');
    sql_free_result($rs);
    sql_drop_temp_table_slave('locids');
    $tpl->display();
    exit;
}
Exemplo n.º 3
0
        mysql_free_result($rs);
        $locid = $r['loc_id'];
        $admtxt1 = geodb_landFromLocid($locid);
        if ($admtxt1 == '0') {
            $admtxt1 = '';
        }
        // bundesland ermitteln
        $rsAdm2 = sql("SELECT `full_name`, `short_form`\n            FROM `gns_locations`\n            WHERE `rc`='&1'\n            AND `fc`='A'\n            AND `dsg`='ADM1'\n            AND `cc1`='&2'\n            AND `adm1`='&3'\n            AND `nt`='N'\n            LIMIT 1", $rLocations['rc'], $rLocations['cc1'], $rLocations['adm1']);
        if (mysql_num_rows($rsAdm2) == 1) {
            $rAdm2 = sql_fetch_array($rsAdm2);
            $admtxt2 = $rAdm2['short_form'];
            if ($admtxt2 == '') {
                $admtxt2 = $rAdm2['full_name'];
            }
        } else {
            $admtxt3 = '';
        }
        $admtxt3 = geodb_regierungsbezirkFromLocid($locid);
        if ($admtxt3 == '0') {
            $admtxt3 = '';
        }
        $admtxt4 = geodb_landkreisFromLocid($locid);
        if ($admtxt4 == '0') {
            $admtxt4 = '';
        }
        sql("UPDATE `gns_locations` SET `admtxt1`='&1', `admtxt2`='&2', `admtxt3`='&3', `admtxt4`='&4' \n            WHERE uni='&5'", $admtxt1, $admtxt2, $admtxt3, $admtxt4, $rLocations['uni']);
    } else {
        // was tun?
    }
}
mysql_free_result($rsLocations);