use Utils\Database\XDb; $default_cachestatus_id = 1; $log_types = array(); $cache_types = array(); $wp_types = array(); $cache_status = array(); $cache_size = array(); // Sachesize-ID selected by default $default_logtype_id = 1; // new: get *_types from database if (!isset($cachetype)) { $cachetype = ''; } $log_types = get_log_types_from_database(); $cache_types = get_cache_types_from_database(); $wp_types = get_wp_types_from_database($cachetype); $cache_status = get_cache_status_from_database(); $cache_size = get_cache_size_from_database(); function get_log_types_from_database() { $log_types = array(); $resp = XDb::xSql("SELECT * FROM log_types ORDER BY id ASC"); while ($row = XDb::xFetchArray($resp)) { $log_types[] = $row; } return $log_types; } function get_cache_types_from_database() { $cache_types = array(); $resp = XDb::xSql("SELECT * FROM cache_type ORDER BY sort ASC");
$sel_type = isset($_POST['type']) ? $_POST['type'] : -1; if (checkField('waypoint_type', $lang)) { $lang_db = $lang; } else { $lang_db = "en"; } $types = ''; // if ($cache_record['type'] == '2' || $cache_record['type'] == '6' || $cache_record['type'] == '8' || $cache_record['type'] == '9') // check if final waypoint alreday exist for this cache $wp_check_final_exist = XDb::xMultiVariableQueryValue("SELECT COUNT(*) FROM `waypoints`\n WHERE `cache_id`= :1 AND type = 3", false, $cache_id); if ($wp_check_final_exist == 1) { $pomin = 1; } else { $pomin = 0; } foreach (get_wp_types_from_database($cache_record['type']) as $type) { if ($type['id'] == $sel_type) { if ($type['id'] == 3 && $pomin == 1) { } else { $types .= '<option value="' . $type['id'] . '" selected="selected">' . htmlspecialchars($type[$lang_db], ENT_COMPAT, 'UTF-8') . '</option>'; } } else { if ($type['id'] == 3 && $pomin == 1) { } else { $types .= '<option value="' . $type['id'] . '">' . htmlspecialchars($type[$lang_db], ENT_COMPAT, 'UTF-8') . '</option>'; } } } tpl_set_var('typeoptions', $types); //coords $lonEW = isset($_POST['lonEW']) ? $_POST['lonEW'] : $default_EW;