}
function loadFile($filename)
{
    $handle = fopen($filename, "r");
    $cnt = 0;
    while (!feof($handle)) {
        $buffer .= fgets($handle, 4096);
    }
    fclose($handle);
    return $buffer;
}
$admin = new administration();
//$kmlIdArray = $admin->getKmlByOwner($user_id);
// kml is being deleted
if (!empty($delKmlId)) {
    $result = $admin->deleteKml($delKmlId, $user_id);
    if (!$result) {
        echo "<script language='javascript'>";
        echo "alert('KML could not be deleted!');";
        echo "</script>";
    }
} elseif ($clientFilename) {
    $serverFilename = "../tmp/kml" . time() . ".xml";
    copy($clientFilename, $serverFilename);
    $kmlDoc = loadFile($serverFilename);
    $kmlObj = new KML();
    if ($kmlObj->parseKml($kmlDoc)) {
        $geoJSON = $kmlObj->toGeoJSON();
        setGeoJson($geoJSON);
    } else {
        echo "<script language='javascript'>";