#if value is 0 then set the price to 0 to. there would be is no sense to have a price set - maybe change this behavior if ($value == 0) { $admin->setWmsPrice(intval($value), intval($parts[1])); } #echo "log: $var = $value<br>"; } #check proxy fields if ($parts[0] == 'status' && $parts[2] == 'proxy') { #echo ("proxy settings identified: WMS_ID: ".intval($parts[1])." Value: ".$value."<br>"); #echo ("Is active?: "); #if ($admin->getWMSOWSstring(intval($parts[1]))=="") {echo " no";} else {echo " yes";} #echo ("<br>"); #check if proxy should be activated and is not set if ($value == 1 && $admin->getWMSOWSstring(intval($parts[1])) == "") { #activate it! $admin->setWMSOWSstring(intval($parts[1]), $value); #echo "Activate Proxy for ".intval($parts[1])."<br>"; } #check if active proxy should be deactivated if ($value == 0 && $admin->getWMSOWSstring(intval($parts[1])) !== "") { #deactivate it $admin->setWMSOWSstring(intval($parts[1]), $value); #echo "Deactivate Proxy for ".intval($parts[1])."<br>"; } } } } ?> <html> <head> <?php
/** * writeObjInDB * * this function exports the information from the xml to the mapbender database */ function writeObjInDB($gui_id) { global $con; if (func_num_args() == 2) { //new for HTTP Authentication $auth = func_get_arg(1); $username = $auth['username']; $password = $auth['password']; $authType = $auth['auth_type']; } else { $username = ''; $password = ''; $authType = ''; } $admin = new administration(); $uuid = new Uuid(); $this->checkObj(); db_begin(); # TABLE wms $sql = "INSERT INTO wms (wms_version, wms_title, wms_abstract, wms_getcapabilities, wms_getmap, "; $sql .= "wms_getfeatureinfo, wms_getlegendurl, wms_getcapabilities_doc, wms_upload_url, fees, "; $sql .= "accessconstraints, contactperson, contactposition, contactorganization, address, city, "; $sql .= "stateorprovince, postcode, country, contactvoicetelephone, contactfacsimiletelephone, contactelectronicmailaddress, "; $sql .= "wms_owner,wms_timestamp,wms_timestamp_create,wms_username,wms_password,wms_auth_type,"; $sql .= "wms_supportsld, wms_userlayer, wms_userstyle, wms_remotewfs, uuid) "; $sql .= "VALUES(\$1,\$2,\$3,\$4,\$5,\$6,\$7,\$8,\$9,\$10,\$11,\$12,\$13,\$14,\$15,\$16,\$17,\$18,\$19,\$20,\$21,\$22,\$23,\$24,\$25,\$26,\$27,\$28,\$29,\$30,\$31,\$32,\$33)"; $v = array($this->wms_version, $this->wms_title, $this->wms_abstract, $this->wms_getcapabilities, $this->wms_getmap, $this->wms_getfeatureinfo, $this->wms_getlegendurl, $admin->char_encode($this->wms_getcapabilities_doc), $this->wms_upload_url, $this->fees, $this->accessconstraints, $this->contactperson, $this->contactposition, $this->contactorganization, $this->address, $this->city, $this->stateorprovince, $this->postcode, $this->country, $this->contactvoicetelephone, $this->contactfacsimiletelephone, $this->contactelectronicmailaddress, Mapbender::session()->get('mb_user_id'), strtotime("now"), strtotime("now"), $username, $password, $authType, $this->wms_supportsld, $this->wms_userlayer, $this->wms_userstyle, $this->wms_remotewfs, $uuid); $t = array('s', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 'i', 'i', 'i', 's', 's', 's', 's', 's', 's', 's', 's'); $res = db_prep_query($sql, $v, $t); if (!$res) { db_rollback(); return null; } $myWMS = db_insert_id($con, 'wms', 'wms_id'); if ($authType != '') { //some authentication is needed! $admin = new administration(); echo "WMS ID: " . $myWMS; $admin->setWMSOWSstring($myWMS, 1); } # TABLE layer and gui_layer for ($i = 0; $i < count($this->objLayer); $i++) { $this->insertLayer($i, $myWMS, $gui_id); $this->insertGuiLayer($i, $myWMS, $gui_id); } #TABLE wms_srs $this->insertSRS($myWMS); # TABLE wms_format $this->insertFormat($myWMS); # TABLE gui_wms $sql = "SELECT MAX(gui_wms_position) AS pos FROM gui_wms WHERE fkey_gui_id = \$1"; $v = array($gui_id); $t = array('s'); $res = db_prep_query($sql, $v, $t); if (db_result($res, 0, "pos") > -1) { $position = db_result($res, 0, "pos") + 1; } else { $position = 0; } $sql = "INSERT INTO gui_wms (fkey_gui_id, fkey_wms_id, gui_wms_position, gui_wms_mapformat, "; $sql .= "gui_wms_featureinfoformat, gui_wms_exceptionformat, gui_wms_epsg)"; $sql .= "VALUES(\$1,\$2,\$3,\$4,\$5,\$6,\$7)"; $v = array($gui_id, $myWMS, $position, $this->gui_wms_mapformat, $this->gui_wms_featureinfoformat, $this->gui_wms_exceptionformat, $this->gui_wms_epsg); $t = array('s', 'i', 'i', 's', 's', 's', 's'); $res = db_prep_query($sql, $v, $t); if (!$res) { db_rollback(); return null; } db_commit(); // // update GeoRSS feed // $geoRssFactory = new GeoRssFactory(); $geoRss = $geoRssFactory->loadOrCreate(GEO_RSS_FILE); if (!is_null($geoRss)) { $geoRssItem = new GeoRssItem(); $geoRssItem->setTitle("NEW WMS: " . $this->wms_title . " (" . $myWMS . ")"); $geoRssItem->setDescription($this->wms_abstract); $geoRssItem->setUrl(self::getWmsMetadataUrl($myWMS)); $geoRssItem->setPubDate(self::rssDate()); for ($j = 0; $j < count($this->objLayer[0]->layer_epsg); $j++) { $currentEpsg = $this->objLayer[0]->layer_epsg[$j]; if ($currentEpsg["epsg"] === "EPSG:4326") { $currentBbox = new Mapbender_bbox($currentEpsg["minx"], $currentEpsg["miny"], $currentEpsg["maxx"], $currentEpsg["maxy"], $currentEpsg["epsg"]); $geoRssItem->setBbox($currentBbox); break; } } //for debugging: //print_r($geoRss); //die(); $geoRss->appendTop($geoRssItem); $geoRss->saveAsFile(); } //Changes JW $this->wms_id = $myWMS; }