function auth_user($name, $pw) { $setEncPw = false; $sql = "SELECT * FROM mb_user WHERE mb_user_name = \$1 AND mb_user_password = \$2"; $v = array($name, md5($pw)); $t = array('s', 's'); $res = db_prep_query($sql, $v, $t); if ($row = db_fetch_array($res)) { return $row; } else { if (SYS_DBTYPE == 'pgsql' && $setEncPw == true) { // unencrypted pw in postgres without md5-support? $sql = "SELECT * FROM mb_user WHERE mb_user_name = \$1 AND mb_user_password = \$2"; $v = array($name, $pw); $t = array('s', 's'); $resn = db_prep_query($sql, $v, $t); if ($rown = db_fetch_array($resn)) { $sqlu = "UPDATE mb_user SET mb_user_password = \$1 WHERE mb_user_id = \$2"; $vu = array(md5($pw), $rown["mb_user_id"]); $tu = array('s', 'i'); $rowu = db_prep_query($sqlu, $vu, $tu); return $rown; } } } }
/** * If access to the WFS conf is restricted, modify the filter. * TODO: this function is also in mod_wfs_result!! Maybe merge someday. */ function checkAccessConstraint($filter, $wfs_conf_id) { /* wfs_conf_element */ $sql = "SELECT * FROM wfs_conf_element "; $sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id "; $sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = \$1 "; $sql .= "ORDER BY wfs_conf_element.f_respos"; $v = array($wfs_conf_id); $t = array('i'); $res = db_prep_query($sql, $v, $t); while ($row = db_fetch_array($res)) { if (!empty($row["f_auth_varname"])) { $auth_varname = $row["f_auth_varname"]; $element_name = $row["element_name"]; } } if (!empty($auth_varname)) { if (isValidVarName($auth_varname)) { $user = eval("return " . $auth_varname . ";"); if ($user) { $pattern = "(<ogc:Filter[^>]*>)(.*)(</ogc:Filter>)"; $replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . "</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3"; $filter = mb_eregi_replace($pattern, $replacement, $filter); } else { $e = new mb_exception("mod_wfsGazetteerEditor_server: checkAccessConstraint: invalid value of variable containing user information!"); } } else { $e = new mb_exception("mod_wfsGazetteerEditor_server: checkAccessConstraint: var name is not valid! (" . $auth_varname . ")"); } } return $filter; }
function forgotten_password() { if (!isset($_REQUEST["Benutzername"]) || !isset($_REQUEST["EMail"]) || $_REQUEST["Benutzername"] == 'guest' || empty($_REQUEST["Benutzername"]) || empty($_REQUEST["EMail"]) || !(bool) trim($_REQUEST["Benutzername"]) || !(bool) trim($_REQUEST["EMail"])) { return -1; } if (!USE_PHP_MAILING) { return -4; } $administration = new administration(); define("USER_NAME", trim($_REQUEST["Benutzername"])); define("USER_EMAIL", trim($_REQUEST["EMail"])); if (!$administration->getUserIdByUserName(USER_NAME) || USER_EMAIL != $administration->getEmailByUserId($administration->getUserIdByUserName(USER_NAME))) { return -2; } $new_password = $administration->getRandomPassword(); $sql_update = "UPDATE mb_user SET mb_user_password = \$1, mb_user_digest = \$3 WHERE mb_user_id = \$2"; $v = array(md5($new_password), $administration->getUserIdByUserName(USER_NAME), md5(USER_NAME . ";" . USER_EMAIL . ":" . REALM . ":" . $new_password)); $t = array("s", "i"); if (!db_prep_query($sql_update, $v, $t)) { return -3; } $email_subject = "New GeoPortal.rlp Password"; $email_body = sprintf("Your new GeoPortal.rlp password is: %s", $new_password); if (!$administration->sendEmail(NULL, NULL, USER_EMAIL, USER_NAME, $email_subject, $email_body, $error_msg)) { return -4; } return 1; }
/** * increments the load count in table "layer_load_count" for * each layer in the WMC document by one. */ function increment($layer_id) { if (!is_numeric($layer_id)) { return false; } //check if an entry exists for the current layer id $sql = "SELECT COUNT(layer_id) AS i FROM layer WHERE layer_id = \$1"; $v = array($layer_id); $t = array('i'); $res = db_prep_query($sql, $v, $t); $row = db_fetch_array($res); if (intval($row["i"]) === 0) { return false; } //check if an entry exists for the current layer id $sql = "SELECT load_count FROM layer_load_count WHERE fkey_layer_id = \$1"; $v = array($layer_id); $t = array('i'); $res = db_prep_query($sql, $v, $t); $row = db_fetch_array($res); //if yes, increment the load counter if ($row) { $currentCount = $row["load_count"]; $sql = "UPDATE layer_load_count SET load_count = \$1 WHERE fkey_layer_id = \$2"; $v = array(intval($currentCount + 1), $layer_id); $t = array('i', 'i'); $res = db_prep_query($sql, $v, $t); } else { $sql = "INSERT INTO layer_load_count (fkey_layer_id, load_count) VALUES (\$1, 1)"; $v = array($layer_id); $t = array('i'); $res = db_prep_query($sql, $v, $t); } }
/** * This function saves the data into the database * @param string $data the content of the sld-document to be stored inside the database */ function saveSld($data) { $con = db_connect($DBSERVER, $OWNER, $PW); db_select_db($DB, $con); $sql = "UPDATE sld_user_layer SET sld_xml=\$1 WHERE fkey_gui_id=\$2 AND fkey_layer_id=\$3 AND fkey_mb_user_id=\$4"; $v = array($data, $_SESSION["sld_gui_id"], $_SESSION["sld_layer_id"], $_SESSION["mb_user_id"]); $t = array('s', 's', 'i', 'i'); $res = db_prep_query($sql, $v, $t); }
public static function getWfsIdByFeaturetypeId($id) { $sql = "SELECT DISTINCT fkey_wfs_id FROM wfs_featuretype WHERE featuretype_id = \$1"; $res = db_prep_query($sql, array($id), array("i")); $row = db_fetch_assoc($res); if ($row) { return $row["fkey_wfs_id"]; } return null; }
private function getVersionByWmsId($id) { $sql = "SELECT wms_version FROM wms WHERE wms_id = \$1"; $v = array($id); $t = array("i"); $res = db_prep_query($sql, $v, $t); $row = db_fetch_array($res); if ($row) { return $row["wms_version"]; } return null; }
function getEpsgByLayerId($layer_id) { // from merge_layer.php $epsg_list = ""; $sql = "SELECT DISTINCT epsg FROM layer_epsg WHERE fkey_layer_id = \$1"; $v = array($layer_id); $t = array('i'); $res = db_prep_query($sql, $v, $t); while ($row = db_fetch_array($res)) { $epsg_list .= $row['epsg'] . " "; } return trim($epsg_list); }
function saveLayerWfsConnection($myWfsConf, $myGui, $myLayer) { $sql = "UPDATE gui_layer SET gui_layer_wfs_featuretype = \$1 "; $sql .= "WHERE fkey_gui_id = \$2 AND fkey_layer_id = \$3"; $v = array($myWfsConf, $myGui, $myLayer); $t = array('s', 's', 'i'); $res = db_prep_query($sql, $v, $t); if ($res) { return true; } else { return false; } }
function mb_getGUIs($mb_user_id) { $arrayGuis = array(); if (isset($mb_user_id)) { $sql_groups = "SELECT fkey_mb_group_id FROM mb_user_mb_group WHERE fkey_mb_user_id = \$1 "; $v = array($mb_user_id); $t = array('i'); $res_groups = db_prep_query($sql_groups, $v, $t); $cnt_groups = 0; while (db_fetch_row($res_groups)) { $mb_user_groups[$cnt_groups] = db_result($res_groups, $cnt_groups, "fkey_mb_group_id"); $cnt_groups++; } $count_g = 0; if ($cnt_groups > 0) { $v = array(); $t = array(); $sql_g = "SELECT DISTINCT gui.gui_id FROM gui JOIN gui_mb_group "; $sql_g .= " ON gui.gui_id = gui_mb_group.fkey_gui_id WHERE( gui_mb_group.fkey_mb_group_id IN ("; for ($i = 0; $i < count($mb_user_groups); $i++) { if ($i > 0) { $sql_g .= ","; } $sql_g .= "\$" . ($i + 1); array_push($v, $mb_user_groups[$i]); array_push($t, 'i'); } $sql_g .= "))"; $res_g = db_prep_query($sql_g, $v, $t); while (db_fetch_row($res_g)) { $arrayGuis[$count_g] = db_result($res_g, $count_g, "gui_id"); $count_g++; } } $sql_guis = "SELECT DISTINCT gui.gui_id FROM gui JOIN gui_mb_user "; $sql_guis .= "ON gui.gui_id = gui_mb_user.fkey_gui_id WHERE (gui_mb_user.fkey_mb_user_id = \$1) "; $sql_guis .= " AND gui.gui_public = 1"; $v = array($mb_user_id); $t = array('i'); $res_guis = db_prep_query($sql_guis, $v, $t); $count_guis = 0; while (db_fetch_row($res_guis)) { if (!in_array(db_result($res_guis, $count_guis, "gui_id"), $arrayGuis)) { $arrayGuis[$count_g] = db_result($res_guis, $count_guis, "gui_id"); $count_g++; } $count_guis++; } } return $arrayGuis; }
function log($module, $req, $time_client, $type = "") { $this->url = $req; if ($type == "") { $type = $this->logtype; } if ($type == "file") { if (is_dir($this->dir)) { $logfile = $this->dir . "mb_access_" . date("Y_m_d") . ".log"; if (!($h = @fopen($logfile, "a"))) { #exit; } else { for ($i = 0; $i < count($this->url); $i++) { $content = strtotime("now") . " "; $content .= "[" . date("d/M/Y:H:i:s O") . "]"; $content .= " " . Mapbender::session()->get("mb_user_ip"); $content .= ' "'; if ($this->log_username == true) { $content .= Mapbender::session()->get("mb_user_name"); } $content .= '"'; $content .= " " . Mapbender::session()->get("mb_user_id"); $content .= " " . $module; $content .= ' "' . $this->url[$i] . '"'; $content .= chr(13) . chr(10); if (!fwrite($h, $content)) { #exit; } } fclose($h); } } } else { if ($type == 'db') { for ($i = 0; $i < count($this->url); $i++) { $sql = "INSERT INTO mb_log ("; $sql .= "time_client, time_server, time_readable, mb_session, "; $sql .= "gui, module, ip, username, userid, request"; $sql .= ") VALUES (\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9, \$10)"; $v = array($time_client, strtotime("now"), "[" . date("d/M/Y:H:i:s O") . "]", SID, Mapbender::session()->get("mb_user_gui"), $module, Mapbender::session()->get("mb_user_ip"), Mapbender::session()->get("mb_user_name"), Mapbender::session()->get("mb_user_id"), $this->url[$i]); $t = array("s", "s", "s", "s", "s", "s", "s", "s", "s", "s"); $res = db_prep_query($sql, $v, $t) or die(db_error()); if (!$res) { include_once dirname(__FILE__) . "/class_mb_exception.php"; $e = new mb_exception("class_log: Writing table mb_log failed."); } } } } }
function authenticate($name, $pw) { $con = db_connect(DBSERVER, OWNER, PW); db_select_db(DB, $con); $sql = "SELECT * FROM mb_user WHERE mb_user_name = \$1 AND mb_user_password = \$2"; $v = array($name, md5($pw)); // is md5 used really? $t = array('s', 's'); $res = db_prep_query($sql, $v, $t); if ($row = db_fetch_array($res)) { $e = new mb_exception('row mb_user_name: ' . $row['mb_user_name']); return $row; } else { return false; } }
function createIsoTopicCategoryString($prefix, $languageCode) { $str = ""; $htmlrows = ""; $sql = "SELECT md_topic_category_id, md_topic_category_code_" . $languageCode . " FROM md_topic_category"; $v = array(); $t = array(); $res = db_prep_query($sql, $v, $t); if (db_error()) { return "Could not get Categories from db"; } $i = 0; while ($row = db_fetch_array($res)) { $i++; $str .= "<label for=\"{$prefix}_wmcIsoTopicCategory_{$row[0]}\">" . "<input class=\"wmcIsoTopicCategory\" id=\"{$prefix}_wmcIsoTopicCategory_{$row[0]}\" " . "type=\"checkbox\" />{$row[1]}</label>"; } return $str; }
public function select($id, $applicationId) { $sql = "SELECT fkey_gui_id, e_id, e_pos, e_public, e_comment, e_public, " . "gettext(\$1, e_title) as e_title, e_element, e_src, e_attributes, " . "e_left, e_top, e_width, e_height, e_z_index, e_more_styles, " . "e_content, e_closetag, e_js_file, e_mb_mod, e_target, " . "e_requires, e_url FROM gui_element WHERE e_id = \$2 AND " . "fkey_gui_id = \$3 LIMIT 1"; $v = array(Mapbender::session()->get("mb_lang"), $id, $applicationId); $t = array("s", "s", "s"); $res = db_prep_query($sql, $v, $t); $row = db_fetch_array($res); if ($row) { $this->guiId = $applicationId; $this->id = $row["e_id"]; $this->pos = $row["e_pos"]; $this->isPublic = $row["e_public"]; $this->comment = $row["e_comment"]; $this->title = $row["e_title"]; $this->element = $row["e_element"]; $this->src = $row["e_src"]; $this->attributes = $row["e_attributes"]; $this->left = $row["e_left"]; $this->top = $row["e_top"]; $this->width = $row["e_width"]; $this->height = $row["e_height"]; $this->zIndex = $row["e_z_index"]; $this->moreStyles = $row["e_more_styles"]; $this->content = $row["e_content"]; $this->closeTag = $row["e_closetag"]; $this->jsFile = $row["e_js_file"]; $this->mbMod = $row["e_mb_mod"]; $this->target = $row["e_target"]; $this->requires = $row["e_requires"]; $this->helpUrl = $row["e_url"]; $sql = "SELECT var_name FROM gui_element_vars WHERE fkey_gui_id = \$1 AND fkey_e_id = \$2;"; $v = array($applicationId, $id); $t = array("s", "s"); $res = db_prep_query($sql, $v, $t); while ($row = db_fetch_assoc($res)) { $name = $row["var_name"]; $this->elementVars[] = new ElementVar($applicationId, $id, $name); } return true; } return false; }
/** * If access to the WFS conf is restricted, modify the filter. * TODO: this function is also in mod_wfs_result!! Maybe merge someday. */ function checkAccessConstraint($filter, $wfs_conf_id) { /* wfs_conf_element */ $sql = "SELECT f.featuretype_name AS name FROM " . "wfs_featuretype AS f, wfs_conf AS c " . "WHERE c.wfs_conf_id = \$1 AND " . "c.fkey_featuretype_id = f.featuretype_id"; $v = array($wfs_conf_id); $t = array('i'); $res = db_prep_query($sql, $v, $t); $row = db_fetch_array($res); if ($row) { $ns = substr($row["name"], 0, strpos($row["name"], ":")) . ":"; } else { $ns = ""; } unset($sql); unset($v); unset($t); unset($res); $sql = "SELECT * FROM wfs_conf_element "; $sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id "; $sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = \$1 "; $sql .= "ORDER BY wfs_conf_element.f_respos"; $v = array($wfs_conf_id); $t = array('i'); $res = db_prep_query($sql, $v, $t); while ($row = db_fetch_array($res)) { if (!empty($row["f_auth_varname"])) { $auth_varname = $row["f_auth_varname"]; $element_name = $row["element_name"]; } } $e = new mb_exception($auth_varname . " " . $element_name); if (!empty($auth_varname)) { if (isValidVarName($auth_varname)) { $user = eval("return " . $auth_varname . ";"); $pattern = "(<ogc:Filter[^>]*>)(.*)(</ogc:Filter>)"; $replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . $ns . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . "</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3"; $filter = eregi_replace($pattern, $replacement, $filter); } } return $filter; }
function deleteWfsConf($obj) { global $con; $wfsConf['id'] = array(); $wfsConf['id'] = $obj->confs; foreach ($wfsConf['id'] as $wfsConfId) { $sql = "DELETE FROM gui_wfs_conf WHERE fkey_wfs_conf_id =\$1"; $v = array($wfsConfId); $t = array('i'); $res = db_prep_query($sql, $v, $t); $sql1 = "DELETE FROM wfs_conf WHERE wfs_conf_id = \$1"; $v1 = array($wfsConfId); $t1 = array('i'); $res1 = db_prep_query($sql1, $v1, $t1); } $obj->success = true; return true; }
array_push($v, $selected_user); } array_push($t, 'i'); $sql_user_mb_gui .= " AND gui.gui_id IN("; $c = 2; for ($i = 0; $i < count($arrayGuis); $i++) { if ($i > 0) { $sql_user_mb_gui .= ","; } $sql_user_mb_gui .= "\$" . $c; array_push($v, $arrayGuis[$i]); array_push($t, 's'); $c++; } $sql_user_mb_gui .= ") ORDER BY gui.gui_name"; $res_user_mb_gui = db_prep_query($sql_user_mb_gui, $v, $t); while ($row = db_fetch_array($res_user_mb_gui)) { $gui_id_user[$cnt_gui_user] = $row["gui_id"]; $gui_name_user[$cnt_gui_user] = $row["gui_name"]; $cnt_gui_user++; } /*INSERT HTML*/ echo "<form name='form1' action='" . $self . "' method='post'>"; /*filterbox****************************************************************************************/ echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>"; /*insert all user in selectbox*************************************************************************************/ echo "<div class='text1'>USER: </div>"; echo "<select style='background:#ffffff' onchange='updateMail(this, user);submit();' class='select1' id='selecteduser' name='selected_user' size='10'>"; for ($i = 0; $i < $cnt_user; $i++) { echo "<option value='" . $user_id[$i] . "' title='" . $user_email[$i] . "' "; if ($selected_user && $selected_user == $user_id[$i]) {
function getUpdateUrl($obj) { global $con; $sql = "SELECT * FROM wfs WHERE wfs_id = \$1;"; $v = array($obj->wfs); $t = array('i'); $res = db_prep_query($sql, $v, $t); while ($row = db_fetch_array($res)) { $ContentOfColumn = $row[$obj->column]; if ($obj->column == 'wfs_getcapabilities') { $n = new administration(); $updateUrl = $n->checkURL($ContentOfColumn) . "VERSION=" . $row['wfs_version'] . "&REQUEST=GetCapabilities&SERVICE=WFS"; } else { $updateUrl = $ContentOfColumn; } return $updateUrl; } return ""; }
/*get owner groups from selected gui***************************************************************/ $sql_gui_group = "SELECT mb_group.mb_group_id, mb_group.mb_group_name, gui_mb_group.fkey_gui_id FROM gui_mb_group "; $sql_gui_group .= "INNER JOIN mb_group ON gui_mb_group.fkey_mb_group_id = mb_group.mb_group_id "; $sql_gui_group .= "WHERE gui_mb_group.fkey_gui_id = \$1 "; if (!$selected_gui) { $v = array($gui_id_array[0]); } if ($selected_gui) { $v = array($selected_gui); } $t = array('s'); $sql_gui_group .= " AND mb_group.mb_group_owner = \$2 "; array_push($v, $logged_user_id); array_push($t, 'i'); $sql_gui_group .= " ORDER BY mb_group.mb_group_name"; $res_gui_group = db_prep_query($sql_gui_group, $v, $t); while ($row = db_fetch_array($res_gui_group)) { $group_id_gui[$cnt_gui_group] = $row["mb_group_id"]; $group_name_gui[$cnt_gui_group] = $row["mb_group_name"]; $cnt_gui_group++; } /*INSERT HTML*/ echo "<form name='form1' action='" . $self . "' method='post'>"; /*insert guis in selectbox*************************************************************************/ echo "<div class='text1'>GUI: </div>"; echo "<select style='background:#ffffff' class='select1' name='selected_gui' onChange='submit()' size='10'>"; for ($i = 0; $i < $cnt_gui; $i++) { echo "<option value='" . $gui_id_array[$i] . "' "; if ($selected_gui && $selected_gui == $gui_id_array[$i]) { echo "selected"; }
$countWfsWithoutUuid = 0; while ($row = db_fetch_array($res)) { $wfsId = $row['wfs_id']; $uuid = new Uuid(); $vUpdate = array($uuid, $wfsId); $tUpdate = array('s'); $sqlUpdate = "UPDATE wfs set uuid = \$1 WHERE wfs_id = \$2;"; $resUpdate = db_prep_query($sqlUpdate, $vUpdate, $tUpdate); $countWfsWithoutUuid++; } echo $countWfsWithoutUuid . " Wfs updated!"; echo "<br>"; //end -- update wfs table //update featuretype table $v = array(); $t = array(); $sql = "SELECT featuretype_id FROM wfs_featuretype WHERE uuid IS NULL;"; $res = db_prep_query($sql, $v, $t); $countFeaturetypeWithoutUuid = 0; while ($row = db_fetch_array($res)) { $featuretypeId = $row['featuretype_id']; $uuid = new Uuid(); $vUpdate = array($uuid, $featuretypeId); $tUpdate = array('s'); $sqlUpdate = "UPDATE wfs_featuretype set uuid = \$1 WHERE featuretype_id = \$2;"; $resUpdate = db_prep_query($sqlUpdate, $vUpdate, $tUpdate); $countFeaturetypeWithoutUuid++; } echo $countFeaturetypeWithoutUuid . " Featuretype updated!"; echo "<br>"; //end -- update featuretype table
/** * create a getmap request for the map images * * @param <string> gui_id * @param <int> layer_id * @param <int> wms_id * * @return <string> getmap URL */ function getPreviewMapUrl($gui_id, $layer_id, $wms_id) { $previewMapSrs = ""; $sql = "select w.gui_wms_epsg as srs, e.minx, e.miny, e.maxx, e.maxy "; $sql .= "from gui_wms w, layer l, layer_epsg e "; $sql .= "where l.fkey_wms_id=w.fkey_wms_id and e.fkey_layer_id=l.layer_id and e.epsg=w.gui_wms_epsg and "; $sql .= "l.layer_parent = '' and w.fkey_gui_id = \$1 and w.gui_wms_position=0"; $v = array($gui_id); $t = array('s'); $res = db_prep_query($sql, $v, $t); if ($res) { $row = db_fetch_array($res, 0); $previewMapSrs .= "&SRS=" . $row["srs"] . "&BBOX=" . $row["minx"] . "," . $row["miny"] . "," . $row["maxx"] . "," . $row["maxy"]; } else { return false; } $sql = "select wms.wms_getmap as mapurl, layer.layer_name, wms.wms_version as version, w.gui_wms_mapformat as format "; $sql .= "from gui_wms w, gui_layer l, wms, layer "; $sql .= "where w.fkey_gui_id=l.fkey_gui_id and wms.wms_id = w.fkey_wms_id and l.fkey_layer_id = layer.layer_id and "; $sql .= "w.fkey_gui_id=\$1 and l.fkey_layer_id=\$2 and wms.wms_id = \$3"; $v = array($gui_id, $layer_id, $wms_id); $t = array('s', 'i', 'i'); $res = db_prep_query($sql, $v, $t); $previewMapUrl = ""; if ($res) { $row = db_fetch_array($res, 0); $previewMapUrl .= $row["mapurl"] . "SERVICE=WMS&REQUEST=GetMap&VERSION=" . $row["version"]; $previewMapUrl .= "&LAYERS=" . $row["layer_name"] . "&STYLES="; $previewMapUrl .= $previewMapSrs; $previewMapUrl .= "&FORMAT=" . $row["format"]; return $previewMapUrl; } else { return false; } }
public function load() { $sql = "SELECT * from gui_element_vars WHERE fkey_gui_id = \$1 AND fkey_e_id = \$2 AND var_name = \$3; "; $v = array($this->applicationId, $this->elementId, $this->name); $t = array("s", "s", "s"); $res = db_prep_query($sql, $v, $t); if ($row = db_fetch_array($res)) { $this->value = $row["var_value"]; $this->context = $row["context"]; $this->type = $row["var_type"]; } else { throw new Exception("no such element var"); } }
/** end createObjfromDB **/ public function getallwfs($userid) { $this->wfs_id = array(); $this->wfs_name = array(); $this->wfs_title = array(); $this->wfs_abstract = array(); global $DBSERVER, $DB, $OWNER, $PW; $con = db_connect($DBSERVER, $OWNER, $PW); db_select_db($DB, $con); if ($userid) { $sql = "SELECT * FROM wfs WHERE wfs_owner = \$1"; $v = array($userid); $t = array('i'); $res = db_prep_query($sql, $v, $t); } else { $sql = "SELECT * FROM wfs"; $res = db_query($sql); } $cnt = 0; while ($row = db_fetch_array($res)) { $this->wfs_version[$cnt] = $row["wfs_version"]; $this->wfs_id[$cnt] = $row["wfs_id"]; $this->wfs_name[$cnt] = $row["wfs_name"]; $this->wfs_title[$cnt] = $row["wfs_title"]; $this->wfs_abstract[$cnt] = $row["wfs_abstract"]; $this->wfs_getcapabilities[$cnt] = $row["wfs_getcapabilities"]; $this->wfs_describefeaturetype[$cnt] = $row["wfs_describefeaturetype"]; $this->wfs_getfeature[$cnt] = $row["wfs_getfeature"]; $cnt++; } }
#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $ # Copyright (C) 2002 CCGIS # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. require_once dirname(__FILE__) . "/../php/mb_validateSession.php"; require_once dirname(__FILE__) . "/../classes/class_json.php"; require_once dirname(__FILE__) . "/../classes/class_mb_exception.php"; $buttonObj = array(); $sql = "SELECT e_id, gettext(\$1, e_title) AS e_title FROM gui_element, " . "(SELECT v.var_value AS current_e_id FROM gui_element AS e, " . "gui_element_vars AS v WHERE e.e_id = v.fkey_e_id AND " . "e.fkey_gui_id = v.fkey_gui_id AND e.e_id = 'tabs' AND " . "v.var_name LIKE 'tab_ids%' AND e.fkey_gui_id = \$2) " . "AS gui_element_temp WHERE gui_element_temp.current_e_id = e_id " . "AND fkey_gui_id = \$3"; $v = array(Mapbender::session()->get("mb_lang"), Mapbender::session()->get("mb_user_gui"), Mapbender::session()->get("mb_user_gui")); $t = array("s", "s", "s"); $res = db_prep_query($sql, $v, $t); while ($row = db_fetch_array($res)) { array_push($buttonObj, array("id" => $row["e_id"], "title" => $row["e_title"])); } $json = new Mapbender_JSON(); $output = $json->encode($buttonObj); header("Content-type:text/plain; charset=utf-8"); echo $output;
/** * Selects all WMS of the current user from the database. * Then it creates the corresponding WMS object and returns * these objects as an array. * * @return wms[] * @param $appId String */ public static function selectMyWmsByApplication($appId) { // check if user is permitted to access the application $currentUser = new User(Mapbender::session()->get("mb_user_id")); $appArray = $currentUser->getApplicationsByPermission(false); if (!in_array($appId, $appArray)) { $e = new mb_warning("class_wms.php: selectMyWmsByApplication(): User '" . $currentUser . "' is not allowed to acces application '" . $appId . "'."); return array(); } // get WMS of this application $sql = "SELECT fkey_wms_id FROM gui_wms WHERE " . "fkey_gui_id = \$1 ORDER BY gui_wms_position"; $v = array($appId); $t = array('s'); $res = db_prep_query($sql, $v, $t); // instantiate PHP objects and store in array $wmsArray = array(); while ($row = db_fetch_array($res)) { $currentWms = new wms(); $currentWms->createObjFromDB($appId, $row["fkey_wms_id"]); array_push($wmsArray, $currentWms); } return $wmsArray; }
/*get only owner user from selected gui************************************************************/ $sql_gui_mb_user = "******"; $sql_gui_mb_user .= "INNER JOIN mb_user ON gui_mb_user.fkey_mb_user_id = mb_user.mb_user_id "; $sql_gui_mb_user .= "WHERE gui_mb_user.fkey_gui_id = \$1 "; if (!$selected_gui) { $v = array($gui_id_array[0]); } if ($selected_gui) { $v = array($selected_gui); } $t = array('s'); $sql_gui_mb_user .= " AND mb_user.mb_user_owner = \$2 "; array_push($v, $logged_user_id); array_push($t, 'i'); $sql_gui_mb_user .= " ORDER BY mb_user.mb_user_name"; $res_gui_mb_user = db_prep_query($sql_gui_mb_user, $v, $t); while ($row = db_fetch_array($res_gui_mb_user)) { $user_id_gui[$cnt_gui_user] = $row["mb_user_id"]; $user_name_gui[$cnt_gui_user] = $row["mb_user_name"]; $user_email_gui[$cnt_gui_user] = $row["mb_user_email"]; $cnt_gui_user++; } /*INSERT HTML*/ echo "<form name='form1' action='" . $self . "' method='post'>"; /*insert guis in selectbox*************************************************************************/ echo "<div class='text1'>GUI: </div>"; echo "<select style='background:#ffffff' class='select1' name='selected_gui' onChange='submit()' size='10'>"; for ($i = 0; $i < $cnt_gui; $i++) { echo "<option value='" . $gui_id_array[$i] . "' "; if ($selected_gui && $selected_gui == $gui_id_array[$i]) { echo "selected";
if (!$selected_group) { if ($group_id[0] > 0) { $v = array($group_id[0]); } else { $v = array("NULL"); } } if ($selected_group) { if ($selected_group >= 0) { $v = array($selected_group); } else { $v = array("NULL"); } } $t = array('i'); $res_group_mb_gui = db_prep_query($sql_group_mb_gui, $v, $t); while ($row = db_fetch_array($res_group_mb_gui)) { $gui_id_group[$cnt_gui_group] = $row["gui_id"]; $gui_name_group[$cnt_gui_group] = $row["gui_name"]; $cnt_gui_group++; } /*INSERT HTML*/ echo "<form name='form1' action='" . $self . "' method='post'>"; /*insert all group in selectbox********************************************************************/ echo "<div class='text1'>GROUP: </div>"; echo "<select style='background:#ffffff' class='select1' name='selected_group' onChange='submit()' size='10'>"; for ($i = 0; $i < $cnt_group; $i++) { echo "<option value='" . $group_id[$i] . "' "; if ($selected_group && $selected_group == $group_id[$i]) { echo "selected"; }
$validatorInterfaceObject->load($validatorUrl); header("Content-type: text/html; charset=UTF-8"); echo $validatorInterfaceObject->file; //delete file in tmp //TODO - this normally done by a cronjob die; } //INSPIRE Mapping $md_ident = array(array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:fileIdentifier/gco:CharacterString", iso19139explode => "false", inspire => "unique resource identifier", inspiremandatory => "false", iso_name => "fileIdentifier", html => _mb("Metadata identifier"), value => "", category => "identification", description => _mb("A value uniquely identifying the resource. The value domain of this metadata element is a mandatory character string code, generally assigned by the data owner, and a character string namespace uniquely identifying the context of the identifier code (for example, the data owner).")), array(ibus => "rtitle", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString", iso19139explode => "false", inspire => "resource title", inspiremandatory => "true", iso_name => "type", html => _mb("Resource title"), value => "", category => "identification", description => _mb("This a characteristic, and often unique, name by which the resource is known. The value domain of this metadata element is free text.")), array(ibus => "abstract", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:abstract/gco:CharacterString", iso19139explode => "false", inspire => "resource abstract", inspiremandatory => "true", iso_name => "description", html => _mb("Resource abstract"), value => "", category => "identification", description => _mb("This is a brief narrative summary of the content of the resource.")), array(ibus => "rtype", iso19139 => "/gmd:MD_Metadata/gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue", iso19139explode => "false", inspire => "resource type", inspiremandatory => "true", iso_name => "type", html => _mb("Resource type"), value => "", category => "identification", description => _mb("This is the type of resource being described by the metadata.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:linkage/gmd:URL", iso19139explode => "false", inspire => "unique resource locator", inspiremandatory => "true", iso_name => "resourceLocator", html => _mb("Resource locator"), value => "", category => "identification", description => _mb("The resource locator defines the link(s) to the resource and/or the link to additional information about the resource. The value domain of this metadata element is a character string, commonly expressed as uniform resource locator (URL).")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:code/gco:CharacterString", iso19139explode => "false", inspire => "unique resource identifier namespace", inspiremandatory => "true", iso_name => "dataset id", html => _mb("Unique resource identifier id"), value => "", category => "identification", description => _mb("A value uniquely identifying the resource. The value domain of this metadata element is a mandatory character string code, generally assigned by the data owner.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:codeSpace/gco:CharacterString", iso19139explode => "false", inspire => "unique resource identifier namespace", inspiremandatory => "true", iso_name => "dataset namespace", html => _mb("Unique resource identifier namespace"), value => "", category => "identification", description => _mb("A character string namespace uniquely identifying the context of the identifier code (for example, the data owner)")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/srv:operatesOn/@xlinkhref", iso19139explode => "false", inspire => "coupled resource", inspiremandatory => "true", iso_name => "coupled resource", html => _mb("Coupled resource"), value => "", category => "identification", description => _mb("If the resource is a spatial data service, this metadata element identifies, where relevant, the target spatial data set(s) of the service through their unique resource identifiers (URI). The value domain of this metadata element is a mandatory character string code, generally assigned by the data owner, and a character string namespace uniquely identifying the context of the identifier code (for example, the data owner).")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:language/gmd:LanguageCode/@codeListValue", iso19139explode => "false", inspire => "Language", inspiremandatory => "true", iso_name => "language", html => _mb("Language"), value => "", category => "identification", description => _mb("The language(s) used within the resource. The value domain of this metadata element is limited to the languages defined in ISO 639-2.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:topicCategory/gmd:MD_TopicCategoryCode", iso19139explode => "true", inspire => "topic category", inspiremandatory => "true", iso_name => "topic category", html => _mb("Topic category"), value => "", category => "classification", description => _mb("The topic category is a high-level classification scheme to assist in the grouping and topic-based search of available spatial data resources. The value domain of this metadata element is defined in Part D.2.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/srv:SV_ServiceIdentification/srv:serviceType/gco:LocalName", iso19139explode => "false", inspire => "spatial data service type", inspiremandatory => "true", iso_name => "topic category", html => _mb("Spatial data service type"), value => "", category => "classification", description => _mb("This is a classification to assist in the search of available spatial data services. A specific service shall be categorised in only one category. The value domain of this metadata element is defined in Part D.3.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword/gco:CharacterString", iso19139explode => "true", inspire => "keyword value", inspiremandatory => "true", iso_name => "keywordValue", html => _mb("Keyword value"), value => "", category => "keyword", description => _mb("If the resource is a spatial data service, at least one keyword from Part D.4 shall be provided. If a resource is a spatial data set or spatial data set series, at least one keyword shall be provided from the general environmental multilingual thesaurus (GEMET) describing the relevant spatial data theme as defined in Annex I, II or III to Directive 2007/2/EC.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/*/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/*/gco:Decimal", iso19139explode => "true", inspire => "geographic bounding box", inspiremandatory => "true", iso_name => "geographic bounding box", html => _mb("Geographic bounding box"), value => "", category => "location", description => _mb("This is the extent of the resource in the geographic space, given as a bounding box. The bounding box shall be expressed with westbound and eastbound longitudes, and southbound and northbound latitudes in decimal degrees, with a precision of at least two decimals.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_EX_TemporalExtent/gmd:extent/gml:TimePeriod/*", iso19139explode => "false", inspire => "temporal extent", inspiremandatory => "false", iso_name => "Temporal extent", html => _mb("Temporal extent"), value => "", category => "actuality", description => _mb("The temporal extent defines the time period covered by the content of the resource. This time period may be expressed as any of the following: - an individual date, - an interval of dates expressed through the starting date and end date of the interval, - a mix of individual dates and intervals of dates.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue='publication']/gmd:date/*", iso19139explode => "false", inspire => "date of publication", inspiremandatory => "true", iso_name => "date of publication", html => _mb("Date of publication"), value => "", category => "actuality", description => _mb("This is the date of publication of the resource when available, or the date of entry into force. There may be more than one date of publication.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue='revision']/gmd:date/*", iso19139explode => "false", inspire => "date of last revision", inspiremandatory => "true", iso_name => "date of last revision", html => _mb("Date of last revision"), value => "", category => "actuality", description => _mb("This is the date of last revision of the resource, if the resource has been revised. There shall not be more than one date of last revision.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue='creation']/gmd:date/*", iso19139explode => "false", inspire => "date of creation", inspiremandatory => "true", iso_name => "date of creation", html => _mb("Date of creation"), value => "", category => "actuality", description => _mb("This is the date of creation of the resource. There shall not be more than one date of creation.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:lineage/gmd:LI_Lineage/gmd:statement/gco:CharacterString", iso19139explode => "false", inspire => "lineage", inspiremandatory => "true", iso_name => "lineage", html => _mb("Lineage"), value => "", category => "quality", description => _mb("This is a statement on process history and/or overall quality of the spatial data set. Where appropriate it may include a statement whether the data set has been validated or quality assured, whether it is the official version (if multiple versions exist), and whether it has legal validity.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:spatialResolution/gmd:MD_Resolution/gmd:equivalentScale/gmd:MD_RepresentativeFraction/gmd:denominator/gco:Integer", iso19139explode => "false", inspire => "equivalent scale", inspiremandatory => "true", iso_name => "equivalent scale", html => _mb("Equivalent scale"), value => "", category => "resolution", description => _mb("An equivalent scale is generally expressed as an integer value expressing the scale denominator.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:spatialResolution/gmd:MD_Resolution/gmd:distancegco:Distance", iso19139explode => "false", inspire => "ground distance value", inspiremandatory => "true", iso_name => "groundDistanceValue", html => _mb("Ground Distance Value"), value => "", category => "resolution", description => _mb("A resolution distance shall be expressed as a numerical value associated with a unit of length.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:title/gco:CharacterString", iso19139explode => "false", inspire => "Specification title", inspiremandatory => "true", iso_name => "Specification title", html => _mb("Specification title"), value => "", category => "quality", description => _mb("This is a citation of the implementing rules adopted under Article 7(1) of Directive 2007/2/EC or other specification to which a particular resource conforms. A resource may conform to more than one implementing rules adopted under Article 7(1) of Directive 2007/2/EC or other specification. This citation shall include at least the title and a reference date (date of publication, date of last revision or of creation) of the implementing rules adopted under Article 7(1) of Directive 2007/2/EC or of the specification.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/*", iso19139explode => "false", inspire => "specification reference date", inspiremandatory => "true", iso_name => "Specification reference date", html => _mb("Specification reference date"), value => "", category => "quality", description => _mb("This is a citation of the implementing rules adopted under Article 7(1) of Directive 2007/2/EC or other specification to which a particular resource conforms. A resource may conform to more than one implementing rules adopted under Article 7(1) of Directive 2007/2/EC or other specification. This citation shall include at least the title and a reference date (date of publication, date of last revision or of creation) of the implementing rules adopted under Article 7(1) of Directive 2007/2/EC or of the specification.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:pass/gco:Boolean", iso19139explode => "false", inspire => "deegree of conformance", inspiremandatory => "true", iso_name => "Degree of conformance", html => _mb("Degree of conformance"), value => "", category => "quality", description => _mb("This is the degree of conformity of the resource to the implementing rules adopted under Article 7(1) of Directive 2007/2/EC or other specification. The value domain of this metadata element is defined in Part D.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:resourceConstraints/gmd:MD_Constraints/gmd:useLimitation/gco:CharacterString", iso19139explode => "false", inspire => "conditions applying to access and use", inspiremandatory => "true", iso_name => "conditions applying to access and use", html => _mb("Conditions applying to access and use"), value => "", category => "useconstraints", description => _mb("A set of conditions applying to access and use.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode/@codeListValue", iso19139explode => "false", inspire => "access constraints code", inspiremandatory => "true", iso_name => "access constraints code", html => _mb("Access constraints code"), value => "", category => "useconstraints", description => _mb("Code for access constraints")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gco:CharacterString", iso19139explode => "false", inspire => "other constraints", inspiremandatory => "true", iso_name => "other constraints", html => _mb("Other constraints"), value => "", category => "useconstraints", description => _mb("Other constraints")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString", iso19139explode => "false", inspire => "responsible party name", inspiremandatory => "true", iso_name => "responsible party name", html => _mb("Responsible party name"), value => "", category => "contact", description => _mb("The name of the organisation as free text.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString", iso19139explode => "false", inspire => "responsible party email", inspiremandatory => "true", iso_name => "responsible party email", html => _mb("Responsible party email"), value => "", category => "contact", description => _mb("A contact e-mail address as a character string.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode/@codeListValue", iso19139explode => "false", inspire => "responsible party role", inspiremandatory => "true", iso_name => "responsible party role", html => _mb("Responsible party role"), value => "", category => "contact", description => _mb("This is the role of the responsible organisation. The value domain of this metadata element is defined in Part D.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:contact/gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString", iso19139explode => "false", inspire => "metadata point of contact name", inspiremandatory => "true", iso_name => "Metadata point of contact name", html => _mb("Metadata point of contact name"), value => "", category => "contact", description => _mb("The name of the organisation as free text.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:contact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString", iso19139explode => "false", inspire => "metadata point of contact email", inspiremandatory => "true", iso_name => "Metadata point of contact email", html => _mb("Metadata point of contact email"), value => "", category => "contact", description => _mb("A contact e-mail address as a character string.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:dateStamp/*", iso19139explode => "false", inspire => "metadata date", inspiremandatory => "true", iso_name => "Metadata date", html => _mb("Metadata date"), value => "", category => "metadata", description => _mb("The date which specifies when the metadata record was created or updated. This date shall be expressed in conformity with ISO 8601.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:language/gmd:LanguageCode/@codeListValue", iso19139explode => "false", inspire => "metadata language", inspiremandatory => "true", iso_name => "Metadata language", html => _mb("Metadata language"), value => "", category => "metadata", description => _mb("This is the language in which the metadata elements are expressed. The value domain of this metadata element is limited to the official languages of the Community expressed in conformity with ISO 639-2.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:RS_Identifier/gmd:code/gco:CharacterString", iso19139explode => "false", inspire => "coordinate reference system", inspiremandatory => "true", iso_name => "coordinate reference system", html => _mb("Coordinate reference system"), value => "", category => "dataspec", description => _mb("Description of the coordinate reference system(s) used in the data set.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:MD_DataIdentification/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name/gco:CharacterString", iso19139explode => "false", inspire => "encoding", inspiremandatory => "true", iso_name => "encoding", html => _mb("Encoding"), value => "", category => "dataspec", description => _mb("Description of the computer language construct(s) specifying the representation of data objects in a record, file, message, storage device or transmission channel.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:characterSet/gmd:MD_CharacterSetCode/@codeListValue", iso19139explode => "false", inspire => "character Encoding", inspiremandatory => "true", iso_name => "character Encoding", html => _mb("Character encoding"), value => "", category => "dataspec", description => _mb("The character encoding used in the data set. This element is mandatory only if an encoding is used that is not based on UTF-8.")), array(ibus => "t01_object.obj_id", iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:graphicOverview/gmd:MD_BrowseGraphic/gmd:fileName/gco:CharacterString", iso19139explode => "false", inspire => "preview", inspiremandatory => "false", iso_name => "graphicOverview", html => _mb("Preview"), value => "", category => "metadata", description => _mb("Graphical overview of the resource."))); #***get the information out of the mapbender-db #get url to search interface (opensearch): $sql_os = "SELECT * from gp_opensearch where os_id = \$1"; #do db select $v_os = array($_REQUEST["osid"]); $t_os = array('i'); $res_os = db_prep_query($sql_os, $v_os, $t_os); #initialize count of search interfaces $cnt_os = 0; #initialize result array $os_list = array(array()); #fill result array while ($row_os = db_fetch_array($res_os)) { $os_list[$cnt_os]['id'] = $row_os["os_id"]; $os_list[$cnt_os]['name'] = $row_os["os_name"]; $os_list[$cnt_os]['url'] = $row_os["os_url"]; $os_list[$cnt_os]['h'] = $row_os["os_h"]; $os_list[$cnt_os]['standardfilter'] = $row_os["os_standard_filter"]; $os_list[$cnt_os]['version'] = $row_os["os_version"]; $cnt_os++; } #give out count of interfaces to use
$sql = "SELECT DISTINCT e_target, e_width, e_height FROM gui_element WHERE e_id = \$1 AND fkey_gui_id = \$2"; $v = array($e_id, $gui_id); $t = array('s', 's'); $res = db_prep_query($sql, $v, $t); $cnt = 0; while ($row = db_fetch_array($res)) { $e_target = $row["e_target"]; $cnt++; } if ($cnt > 1) { echo "alert('legend: ID not unique!');"; } $sql2 = "SELECT e_left,e_top,e_width,e_height FROM gui_element WHERE e_id = \$1 AND fkey_gui_id = \$2"; $v = array($e_target, $gui_id); $t = array('s', 's'); $res2 = db_prep_query($sql2, $v, $t); echo "<script type='text/javascript'>\n"; echo "var mod_legend_target = '" . $e_target . "';\n"; echo "var mod_legend_target_left = " . intval(db_result($res2, 0, "e_left")) . ";\n"; echo "var mod_legend_target_top = " . intval(db_result($res2, 0, "e_top")) . ";\n"; //echo "var mod_legend_target_width = ".db_result($res2,0,"e_width").";\n"; //echo "var mod_legend_target_height = ".db_result($res2,0,"e_height").";\n"; echo "</script>\n"; ?> <script type="text/javascript"> <!-- mod_legend_offsetLeft = 25; mod_legend_offsetTop = -10;
if (isset($_REQUEST["id"]) & $_REQUEST["id"] != "") { //validate to csv integer list $testMatch = $_REQUEST["id"]; $pattern = '/^[\\d,]*$/'; if (!preg_match($pattern, $testMatch)) { echo 'id: <b>' . $testMatch . '</b> is not valid.<br/>'; die; } $layerId = $testMatch; $testMatch = NULL; } //dbselect for generate KML $sqlKML = "select wms.wms_getmap, wms.wms_version, layer.layer_name,layer.layer_title, layer_epsg.minx,layer_epsg.miny,layer_epsg.maxx,layer_epsg.maxy from wms, layer, layer_epsg, wms_format where layer.layer_id=\$1 and layer.fkey_wms_id=wms.wms_id and layer.layer_id=layer_epsg.fkey_layer_id and layer_epsg.epsg='EPSG:4326' and wms.wms_id=wms_format.fkey_wms_id and wms_format.data_format like '%image/png%' LIMIT 1"; $vKML = array($layerId); $tKML = array('i'); $resKML = db_prep_query($sqlKML, $vKML, $tKML); $rowKML = db_fetch_array($resKML); if (!isset($rowKML['layer_name'])) { echo "Layer with requested id doesn't exists in registry or layer has no name, so it can't be invoked by Google Earth!"; die; } $getmapurl = eregi_replace("&", "&", $rowKML['wms_getmap']); $kml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . chr(13) . chr(10); $kml .= "<kml xmlns=\"http://earth.google.com/kml/2.2\">" . chr(13) . chr(10); $kml .= "<GroundOverlay>" . chr(13) . chr(10); $kml .= "<name>" . $rowKML['layer_title'] . "</name>" . chr(13) . chr(10); $kml .= "<Icon>" . chr(13) . chr(10); $kml .= "<href>" . $getmapurl . "VERSION=" . $rowKML['wms_version'] . "&REQUEST=GetMap&SRS=EPSG:4326&WIDTH=512&HEIGHT=512&LAYERS=" . $rowKML['layer_name'] . "&STYLES=&TRANSPARENT=TRUE&BGCOLOR=0xffffff&FORMAT=image/png&</href>" . chr(13) . chr(10); $kml .= "<RefreshMode>onExpire</RefreshMode>" . chr(13) . chr(10); $kml .= "<viewRefreshMode>onStop</viewRefreshMode>" . chr(13) . chr(10); $kml .= "<viewRefreshTime>1</viewRefreshTime>" . chr(13) . chr(10);