unset($keys); unset($data); require_once('select.php'); die(); } } // Remove any old created files if there are any if (!delete_old_created_file($location_creation)) { die('Could not delete old files. Don\'t want to continue!'); } // AJAX Request handler if ($_GET['method'] === 'check_svg') { $path = (string)select_svg_file($_GET); if (!file_exists($path)) { die('Leider ist keine Basiskarte für diese Auswahl verfügbar.'); } die(); } else if ($_GET['method'] === 'get_data' && !empty($_GET['vis'])) { $keys = get_keys_by_vis($_GET); $error_msg_keys_missing = 'Die notwendigen Datensätze sind leider '. 'noch nicht verfügbar'; $error_msg_keys_missing_html = ' <p class="error">'."\n". ' '.$error_msg_keys_missing."\n".' </p>'."\n"; if ($_GET['interface'] == 'manual') { // 'No key values found' case if (empty($keys)) {
if (empty($_POST['fac'])) $fac = 1.0; else $fac = (float)$_POST['fac']; $error = _error_msg_for_data($data); if ($error === false) // no error $data = include_factor($data, $fac); else $error = array($error); } // Create files if (empty($error)) { $image = select_svg_file($_POST); // sanitize parameters $return = sanitize($_POST['title'], $_POST['subtitle'], $_POST['dec'], $_POST['colors'], $_POST['grad']); $file_title = $return[0][1]; $file_subtitle = $return[1][1]; $title = $return[0][0]; $subtitle = $return[1][0]; if ($file_title) $file_title = '-'.$file_title; if ($file_subtitle) $file_subtitle = '-'.$file_subtitle;
/* Example {"title":"test", "subtitle":"x", "vis":"bz", "bz_spec":"bl", "bz_bl": 2, "fac":2, "dec":1, "colors":10, "grad":2, "data" : { "Feldkirchen" : 1, "Hermagor" : 2, "Klagenfurt" : 3, "Klagenfurt-Land" : 4, "Spittal an der Drau" : 5, "St. Veit an der Glan" : 6, "Villach" : 7, "Villach-Stadt" : 8, "Völkermarkt" : 9,"Wolfsberg" : 10} } */ $param = ($_GET) ? $_GET : $_POST; if (empty($param['q'])) die(); $param['q'] = stripslashes($param['q']); $request = json_decode($param['q'], true); if (!$request) die(); $return = sanitize($request['title'], $request['subtitle'], $request['dec'], $request['colors'], $request['grad']); $s = select_svg_file($request); $data = json2data($request, $request['data']); if (!$data) die(); header('Content-type: image/svg+xml; charset=utf-8'); echo substitute($s, $return[0][0], $return[1][0], $return[2][0], $return[3][0], $return[4][0], $data); ?>