/** * Format the nodeset output to an <ul> list * This is just for the scriptaculous autocompleter field * * @param Object $object - the data to format * @return string */ function format($object) { global $CFG; if (!$object instanceof NodeSet) { $doc = "<?xml version=\"1.0\"?>"; $doc .= "<error><message>" . $object->message . "</message><code>" . $object->code . "</code></error>"; return $doc; } $doc = "<?xml version=\"1.0\"?>"; $doc .= "<data>"; $nodes = $object->nodes; foreach ($nodes as $node) { // can only display if the node has at least a start date if (isset($node->startdatetime)) { $doc .= "<event start='" . date(r, $node->startdatetime) . "'"; if ($node->enddatetime) { $doc .= " end='" . date(r, $node->enddatetime) . "'"; // work out if it's a duration or not if ($node->startdatetime != $node->enddatetime) { $doc .= " isDuration='true'"; } } $doc .= " title='" . parseToXML($node->name) . "'"; //add url $doc .= " link='" . $CFG->homeAddress . "node.php?nodeid=" . $node->nodeid . "'"; $doc .= ">"; $doc .= parseToXML(strip_tags($node->description)); $doc .= "</event>"; } } $doc .= "</data>"; return $doc; }
function XML() { // Select all the rows in the markers table $query = "SELECT * FROM aiesec_trainees WHERE 1"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'id="' . parseToXML($row['id']) . '" '; echo 'name="' . parseToXML($row['name']) . '" '; echo 'address="' . parseToXML($row['address']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'type="' . $row['type'] . '" '; echo '/>'; } // End XML file echo '</markers>'; }
function generateMarkers($con, $marker_id, $showPathMarkers, $markerDelay) { // Select all the rows in the markers table $markerSql = ""; if ($marker_id != "") { $markerSql = "ge.gps_entry_id = " . phpGPS_DB::cleanInput($marker_id); } //build query, if marker is set, then show regardless of status $query = "SELECT \n" . " * \n" . "FROM \n" . " gps_entries ge \n" . " left join gps_type gt on ge.gps_type_id = gt.gps_type_id \n"; $query = $query . "WHERE \n"; if ($markerSql == "") { $query = $query . " ((ge.gps_status <> 'H' "; if (!$showPathMarkers) { $query = $query . "AND ge.gps_status <> 'P' "; } $query = $query . ") or ge.gps_status IS NULL) \n"; //H is Hidden, P is Path Only } else { $query = $query . " {$markerSql} \n"; } if ($markerDelay != null && $markerDelay > 0) { $query = $query . " AND ge.gps_entry_date < NOW() - INTERVAL {$markerDelay} DAY \n"; } $query = $query . "ORDER BY \n" . " ge.gps_date;"; $result = mysqli_query($con, $query); if (!$result) { die('Invalid query: ' . mysql_error()); } //Exit if no results if ($result->num_rows == 0) { return; } //Start Marker XML echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysqli_fetch_assoc($result)) { echo '<marker '; echo 'id="' . parseToXML($row['gps_entry_id']) . '" '; echo 'name="' . parseToXML($row['gps_name']) . '" '; echo 'comment="' . parseToXML($row['gps_comment']) . '" '; echo 'address="' . parseToXML($row['gps_address1']) . '" '; echo 'lat="' . $row['gps_latitude'] . '" '; echo 'lng="' . $row['gps_longitude'] . '" '; echo 'accuracy="' . $row['gps_accuracy'] . '" '; echo 'path_id="' . $row['gps_path_id'] . '" '; echo 'type_name="' . $row['gps_type_name'] . '" '; echo 'image="' . $row['gps_type_image'] . '" '; echo 'custom_icon_name="' . $row['gps_type_icon'] . '" '; echo '/>'; } // End XML file echo '</markers>'; }
/** * Format the nodeset output to an <ul> list * This is just for the scriptaculous autocompleter field * * @param Object $object - the data to format * @return string */ function format($object) { global $CFG; $doc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; $doc .= "<rss version=\"2.0\"\n xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\">"; $doc .= "<channel>"; $doc .= "<title>" . $CFG->SITE_TITLE . "</title>"; $doc .= "<link>" . $CFG->homeAddress . "</link>"; $doc .= "<description></description>"; $doc .= "<pubDate>" . date('r') . "</pubDate>"; $doc .= "<language>en</language>"; if ($object instanceof NodeSet) { $nodes = $object->nodes; foreach ($nodes as $node) { $role = $node->role; $url = $CFG->homeAddress . "explore.php?nodeid=" . $node->nodeid; $doc .= "<item>"; $doc .= "<title>" . parseToXML($node->name) . "</title>"; $doc .= "<link>" . $url . "</link>"; $doc .= "<pubDate>" . date('r', $node->creationdate) . "</pubDate>"; $user = $node->users[0]; $doc .= "<dc:creator>" . $user->name . "</dc:creator>"; $doc .= "<description><![CDATA[" . $node->description . "]]></description>"; $doc .= "<content:encoded><![CDATA[" . $node->description . "]]></content:encoded>"; $doc .= "<guid isPermaLink='true'>" . $url . "</guid>"; $doc .= "</item>"; } } else { if ($object instanceof ConnectionSet) { $conns = $object->connections; foreach ($conns as $conn) { $doc .= "<item>"; $doc .= "<title>" . parseToXML($conn->from->name) . " -> " . parseToXML($conn->to->name) . "</title>"; $doc .= "<link>" . $CFG->homeAddress . "node.php?nodeid=" . $conn->from->nodeid . "#conn-neighbour</link>"; $doc .= "<pubDate>" . date('r', $conn->creationdate) . "</pubDate>"; $user = $conn->from->users[0]; $doc .= "<dc:creator>" . $user->name . "</dc:creator>"; $fNode = $conn->from; $tNode = $conn->to; $desc = "<a href='" . $CFG->homeAddress . "node.php?nodeid=" . $conn->from->nodeid . "#conn-neighbour'>" . $fNode->name . "</a>"; $desc .= " -[" . $conn->linktype->label . "]-> "; $desc .= "<a href='" . $CFG->homeAddress . "node.php?nodeid=" . $conn->to->nodeid . "#conn-neighbour'>" . $tNode->name . "</a>"; $doc .= "<description><![CDATA[" . $desc . "]]></description>"; $doc .= "<content:encoded><![CDATA[" . $desc . "]]></content:encoded>"; $doc .= "<guid isPermaLink='true'>" . $CFG->homeAddress . "node.php?nodeid=" . $conn->from->nodeid . "#conn-neighbour</guid>"; $doc .= "</item>"; } } } $doc .= "</channel></rss>"; return $doc; }
// Create the database connection $mysqli = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE); if ($mysqli->connect_errno) { echo 'Connection error: (', $mysqli->connect_errno, ') ', $mysqli->connect_error; } $results = $mysqli->query("SELECT * FROM businesses"); function parseToXML($htmlStr) { $xmlStr = str_replace('<', '<', $htmlStr); $xmlStr = str_replace('>', '>', $xmlStr); $xmlStr = str_replace('"', '"', $xmlStr); $xmlStr = str_replace("'", ''', $xmlStr); $xmlStr = str_replace("&", '&', $xmlStr); return $xmlStr; } header("Content-type: text/xml"); echo '<markers>'; while ($row = $results->fetch_assoc()) { echo '<marker '; echo 'name="' . parseToXML($row['name']) . '" '; echo 'type="' . parseToXML($row['type']) . '" '; echo 'latitude="' . parseToXML($row['latitude']) . '" '; echo 'longitude="' . parseToXML($row['longitude']) . '" '; echo 'address="' . parseToXML($row['address']) . '" '; echo 'city="' . parseToXML($row['city']) . '" '; echo 'state="' . parseToXML($row['state']) . '" '; echo 'phone="' . parseToXML($row['phone']) . '" '; echo 'website="' . parseToXML($row['website']) . '" '; echo '/>'; } echo '</markers>';
echo "<select name='countryId1'>"; echo "<option value='0'>Select Visit</option>"; while ($row = $result->fetch_assoc()) { unset($id, $name); $id = $row['id']; $name = $row['organisation']; echo '<option value="' . $id . '">' . $name . '</option>'; } echo "</select>"; } else { header("Content-type: text/xml"); echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysqli_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'ID="' . $row['id'] . '" '; echo 'date2="' . $row['datee2'] . '" '; echo 'vanue="' . parseToXML($row['vanue']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'date1="' . parseToXML($row['datee1']) . '" '; echo 'organisation="' . parseToXML($row['organisation']) . '" '; echo 'delegation="' . parseToXML($row['delegation']) . '" '; echo 'purpose="' . parseToXML($row['purpose']) . '" '; echo 'outcomes="' . parseToXML($row['outcomes']) . '" '; echo '/>'; } // End XML file echo '</markers>'; }
} } } $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } setlocale(LC_MONETARY, 'en_US'); header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'SALEDT="' . parseToXML($row['SALEDT']) . '" '; echo 'PARCELLOCATION="' . parseToXML($row['PARCELLOCATION']) . '" '; echo 'PARID="' . parseToXML($row['PARID']) . '" '; echo 'PRICE="' . money_format('%(#10n', $row['PRICE']) . '" '; echo 'SALETYPE="' . translateSaleType($row['SALETYPE']) . '" '; echo 'SALEVALIDITY="' . translateSaleValidity($row['SALEVALIDITY']) . '" '; echo 'SALETYPEnum="' . parseToXML($row['SALETYPE']) . '" '; echo 'SALEVALIDITYnum="' . parseToXML($row['SALEVALIDITY']) . '" '; echo 'PRICEnum="' . parseToXML($row['PRICE']) . '" '; echo 'Latitude="' . $row['Latitude'] . '" '; echo 'Longitude="' . $row['Longitude'] . '" '; echo '/>'; } // End XML file echo '</markers>'; // http://www.tizag.com/ajaxTutorial/ajax-mysql-database.php
include 'includes/session.inc'; include 'includes/SQL_CommonFunctions.inc'; function parseToXML($htmlStr) { $xmlStr = str_replace('<', '<', $htmlStr); $xmlStr = str_replace('>', '>', $xmlStr); $xmlStr = str_replace('"', '"', $xmlStr); $xmlStr = str_replace("'", ''', $xmlStr); $xmlStr = str_replace("&", '&', $xmlStr); return $xmlStr; } $sql = "SELECT * FROM suppliers WHERE 1"; $ErrMsg = _('An error occurred in retrieving the information'); $result = DB_query($sql, $db, $ErrMsg); $myrow = DB_fetch_array($result); header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($myrow = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($myrow['suppname']) . '" '; echo 'address="' . parseToXML($myrow["address1"] . ", " . $myrow["address2"] . ", " . $myrow["address3"] . ", " . $myrow["address4"]) . '" '; echo 'lat="' . $myrow['lat'] . '" '; echo 'lng="' . $myrow['lng'] . '" '; echo 'type="' . $myrow['type'] . '" '; echo '/>'; } // End XML file echo '</markers>';
die('Nao eh possivel usar o DB: ' . mysql_error()); } //Seleciona todas as linhas na tabela de objetos $query = "SELECT * FROM objeto WHERE 1"; $result = mysql_query($query); if (!$result) { die('Query Invalida: ' . mysql_error()); } header("Content-type: text/xml"); //Comecando o arquivo XML echo '<markers>'; //Iteracoes entre as linhas adicionando nohs XML para cada uma delas while ($row = @mysql_fetch_assoc($result)) { //Adicionando a um noh de documento XML //$node = $doc->create_element("marker"); //$newnode = $parnode->append_child($node); //$newnode->set_attribute("id", $row['id']); //$newnode->set_attribute("tipo", $row['tipo']); //$newnode->set_attribute("latitude", $row['latitude']); //$newnode->set_attribute("longitude", $row['longitude']); echo '<marker '; echo 'id="' . parseToXML($row['id']) . '" '; echo 'tipo="' . parseToXML($row['tipo']) . '" '; echo 'latitude="' . $row['latitude'] . '" '; echo 'longitude="' . $row['longitude'] . '" '; echo '/>'; } //$xmlfile = $doc->dump_mem(); //echo $xmlfile; //Fim do arquivo XML echo '</markers>';
//----------------------------------------------------// include $DOC_ROOT . '/classes/userClass.php'; //-------------function to parse strings to xml-----------// function parseToXML($htmlStr) { $xmlStr = str_replace('<', '<', $htmlStr); $xmlStr = str_replace('>', '>', $xmlStr); $xmlStr = str_replace('"', '"', $xmlStr); $xmlStr = str_replace("'", ''', $xmlStr); $xmlStr = str_replace("&", '&', $xmlStr); return $xmlStr; } //Start XML file, echo parent node header("Content-type: text/xml"); echo "<?xml version='1.0' encoding='ISO-8859-1'?>"; echo "<markers>\n"; $sql = user::searchAll(); $resource1 = mysql_query($sql); while (@($row = mysql_fetch_assoc($resource1))) { //-------------------selects users friends address--------------// $address = $row['address1'] . " " . $row['address2'] . ", " . $row['city'] . ", " . $row['state']; echo '<marker '; echo 'address="' . parseToXML($address) . '" '; echo 'name="' . parseToXML($row['item_name']) . '" '; echo 'lat="' . parseToXML($row['latitude']) . '" '; echo 'lng="' . parseToXML($row['longitude']) . '"'; echo "/>"; } //--------------select user address ends---------------------// // End XML file*/ echo "</markers>\n";
// Select all the rows in the markers table $query = "SELECT * FROM landpks_input_data WHERE boolean_test_plot = 0"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } mysql_close($connection); header("Content-type: text/xml"); // Start XML file, echo parent node echo '<plots>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<plot '; echo 'name="' . parseToXML(parseName($row['name'])) . '" '; echo 'recorder_name="' . parseToXML($row['recorder_name']) . '" '; echo 'lat="' . $row['latitude'] . '" '; echo 'lng="' . $row['longitude'] . '" '; echo 'slope="' . $row['slope'] . '" '; echo 'slope_shape="' . $row['slope_shape'] . '" '; echo 'land_cover="' . $row['land_cover'] . '" '; if ($row['boolean_grazed'] == 1) { echo 'grazed= "Yes" '; } else { echo 'grazed= "No" '; } if ($row['boolean_flooding'] == 1) { echo 'flooding= "Yes" '; } else { echo 'flooding= "No" '; }
if (!$result) { die('Invalid query: ' . mysql_error()); } // Start XML file, echo parent node echo "<markers>\n"; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['sl_store']) . '" '; echo 'address="' . parseToXML($row['sl_address']) . ', '. parseToXML($row['sl_city']). ', ' .parseToXML($row['sl_state']).' ' .parseToXML($row['sl_zip']).'" '; echo 'lat="' . $row['sl_latitude'] . '" '; echo 'lng="' . $row['sl_longitude'] . '" '; echo 'distance="' . $row['sl_distance'] . '" '; echo 'description="' . parseToXML($row['sl_description']) . '" '; echo 'url="' . parseToXML($row['sl_url']) . '" '; echo 'hours="' . parseToXML($row['sl_hours']) . '" '; echo 'phone="' . parseToXML($row['sl_phone']) . '" '; echo 'image="' . parseToXML($row['sl_image']) . '" '; echo "/>\n"; } // End XML file echo "</markers>\n"; /*include("$sl_upload_path/cache/cacher-end.php"); */ ?>
$xmlStr = str_replace('"', '"', $xmlStr); $xmlStr = str_replace("'", ''', $xmlStr); $xmlStr = str_replace("&", '&', $xmlStr); return htmlspecialchars($xmlStr); } // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM markers WHERE 1"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['name']) . '" '; echo 'latlng="' . $row['latlng'] . '" '; echo 'country="' . $row['country'] . '" '; echo '/>'; } // End XML file echo '</markers>'; //
if ($region == 100) { $queryMap = "SELECT * FROM outgoingExchange WHERE '1'"; $resultMap = mysqli_query($irms, $queryMap); } else { $queryMap = "SELECT * FROM outgoingExchange WHERE regionid='{$region}'"; $resultMap = mysqli_query($irms, $queryMap); } if (!$resultMap) { die('Invalid query: ' . mysqli_error($irms)); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysqli_fetch_assoc($resultMap)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['hostInstitution']) . '" '; echo 'URLaddress="' . $row['uniURL'] . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'unilogo="' . parseToXML($row['unilogo']) . '" '; echo 'fldCountry="' . parseToXML($row['country']) . '" '; echo 'fldRegion="' . parseToXML($row['regionid']) . '" '; echo '/>'; } // End XML file echo '</markers>'; ?>
foreach ($hostArray as $host) { $icon = array(); //Check if google icon is used first //else a custom icon is used and we need to parse. if ($host->status == "up") { $icon = explode('.', $host->upimage); } elseif ($host->status == "down") { $icon = explode('.', $host->downimage); } elseif ($host->status == "recovering") { $icon = explode('.', $host->recoverimage); } else { $icon = explode('.', $host->upimage); } if (!strncmp("Google", $icon[0], 6)) { $icon[0] = strtolower(substr($icon[0], 6)); } $kmldoc .= "<Placemark>"; $kmldoc .= '<name>' . parseToXML($host->description) . '</name>'; $kmldoc .= "<styleUrl>" . parseToXml($icon[0]) . "</styleUrl> "; $kmldoc .= '<description>' . parseToXML($host->description) . "\n" . 'Availability: ' . $host->avail . "\n" . 'Address: ' . parseToXML($host->hostname) . '</description>'; $kmldoc .= '<Point>'; $kmldoc .= '<coordinates>' . parseToXML($host->long) . ',' . parseToXML($host->lat) . '</coordinates>'; $kmldoc .= '</Point>'; $kmldoc .= '</Placemark>'; $kmldoc .= "\n"; } } $kmldoc .= "</Document></kml>"; $f = fopen("./plugins/gpsmap/XML/" . $preemptive . ".kml", "w"); fwrite($f, $kmldoc); fclose($f);
//Get our locations from the database. $idkota = $_GET['idkota']; $query = "SELECT b.nama, a.gambar ,c.kategori,pos_lat, pos_long FROM " . $app[table][destinasi] . " as a LEFT JOIN " . $app[table][destinasi_bahasa] . " as b ON (a.id_reff = b.id_reff ) JOIN " . $app[table][destinasi_kategori] . " as c ON (a.id_kat=c.id) WHERE a.id_kota ='" . $idkota . "' AND a.status='aktif' "; $dbu->query($query, $rnear, $hit_near); $dnear = ""; if ($hit_near > 0) { // Header File XML header("Content-type: text/xml"); // Parent node XML echo '<markers>'; while ($row = $dbu->fetch($rnear)) { // Menambahkan ke node dokumen XML echo '<marker '; echo 'name="' . $row['nama'] . '" '; echo 'gambar="' . $app[data_www] . "/destinasi/gambar/" . $row['gambar'] . '" '; echo 'kategori="' . parseToXML($row['kategori']) . '" '; echo 'button="' . $app[http] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($row['nama']) . "/" . '" '; echo 'lat="' . $row['pos_lat'] . '" '; echo 'lng="' . $row['pos_long'] . '" '; echo '/>'; } echo '</markers>'; } function parseToXML($htmlStr) { $xmlStr = str_replace('<', '<', $htmlStr); $xmlStr = str_replace('>', '>', $xmlStr); $xmlStr = str_replace('"', '"', $xmlStr); $xmlStr = str_replace("'", "'", $xmlStr); $xmlStr = str_replace('&', '', $xmlStr); $xmlStr = str_replace(" ", "", $xmlStr);
function sl_dyn_js($post_content = "") { global $sl_dir, $sl_base, $sl_uploads_base, $sl_path, $sl_uploads_path, $wpdb, $sl_version, $pagename, $sl_map_language, $post, $sl_vars; print "<script type=\"text/javascript\">\n//<![CDATA[\n"; include SL_INCLUDES_PATH . "/mapdesigner-options.php"; $GLOBALS['output_zone_type'] = 'sl_dyn_js'; $output_arr = array_filter($sl_mdo, "filter_sl_mdo"); unset($GLOBALS['output_zone_type']); unset($sl_mdo); //var_dump($output_arr); die(); foreach ($output_arr as $value) { if (isset($value['output_zone'])) { if (!is_array($value['output_zone'])) { $the_field = $value['field_name']; ${$the_field} = trim($sl_vars[$the_field]) != "" ? $sl_vars[$the_field] : $value['default']; //print "//Field: ".$the_field; //print " | label?: ".preg_match("@\_label$@", $the_field); //print " | message?: ".preg_match("@\_message$@", $the_field)."\n"; if (preg_match("@\\_label\$@", $the_field)) { ${$the_field} = addslashes(${$the_field}); //originally parseToXML(); now stripslashes is applied in MD (since v3.56.2) } elseif (preg_match("@\\_message\$@", $the_field)) { ${$the_field} = addslashes(${$the_field}); } } else { $position_arr = array_keys($value['output_zone'], 'sl_dyn_js'); //array position of this sl_dyn_js output_zone, if an array foreach ($position_arr as $pos_value) { $the_field = $value['field_name'][$pos_value]; ${$the_field} = trim($sl_vars[$the_field]) != "" ? $sl_vars[$the_field] : $value['default'][$pos_value]; if (preg_match("@\\_label\$@", $the_field)) { ${$the_field} = addslashes(${$the_field}); } elseif (preg_match("@\\_message\$@", $the_field)) { ${$the_field} = addslashes(${$the_field}); } } } } } ### Defaults //$mt=(trim($sl_vars['map_type'])!="")? $sl_vars['map_type'] : "google.maps.MapTypeId.ROADMAP"; //$mt=(preg_match("@G\_@", $mt))? "'$mt'" : $mt; //$oc=(trim($sl_vars['map_overview_control'])!="")? $sl_vars['map_overview_control'] : 0; //$lld=(trim($sl_vars['load_locations_default'])!="")? $sl_vars['load_locations_default'] : 1 ; //$lrwld=(trim($sl_vars['load_results_with_locations_default'])!="")? $sl_vars['load_results_with_locations_default'] : 1 ; //$geo=(trim($sl_vars['geolocate'])!="")? $sl_vars['geolocate'] : 0 ; ### Labels //$website_label=(trim($sl_vars['website_label'])!="")? parseToXML($sl_vars['website_label']) : "Website"; //$directions_label=(trim($sl_vars['directions_label'])!="")? parseToXML($sl_vars['directions_label']) : "Directions"; //$hours_label=(trim($sl_vars['hours_label'])!="")? parseToXML($sl_vars['hours_label']) : "Hours"; //$phone_label=(trim($sl_vars['phone_label'])!="")? parseToXML($sl_vars['phone_label']) : "Phone"; //$fax_label=(trim($sl_vars['fax_label'])!="")? parseToXML($sl_vars['fax_label']) : "Fax"; //$email_label=(trim($sl_vars['email_label'])!="")? parseToXML($sl_vars['email_label']) : "Email"; //$no_results_found_message=(trim($sl_vars['no_results_found_message'])!="")? addslashes($sl_vars['no_results_found_message']) : "No Results Found"; //$location_not_found_message=(trim($sl_vars['location_not_found_message'])!="")? addslashes($sl_vars['location_not_found_message']) : ""; ### Dimensions //$zl=(trim($sl_vars['zoom_level'])!="")? $sl_vars['zoom_level'] : 4; //$du=(trim($sl_vars['distance_unit'])!="")? $sl_vars['distance_unit'] : "miles"; ### Design //$ic=(trim($sl_vars['icon'])!="")? $sl_vars['icon'] : SL_ICONS_BASE."/droplet_green.png"; //$ic2=(trim($sl_vars['icon2'])!="")? $sl_vars['icon2'] : SL_ICONS_BASE."/droplet_red.png"; ### Maps V2 -> V3 Transition //$map_type=(preg_match("@G\_@", $map_type))? "'$map_type'" : $map_type; //Had to remove in v3.56.2 for now -- was causing foreach error for $map_type in mapdesigner-options.php, line 93, which is an array - 4/29/15, 2:16p ## MapDesigner header row inputs $gmc = trim($sl_vars['google_map_country']) != "" ? parseToXML($sl_vars['google_map_country']) : "United States"; $gmd = trim($sl_vars['google_map_domain']) != "" ? $sl_vars['google_map_domain'] : "maps.google.com"; //WPML Display Integration if (function_exists('icl_t')) { include SL_INCLUDES_PATH . "/mapdesigner-options.php"; $GLOBALS['input_zone_type'] = 'labels'; $GLOBALS['output_zone_type'] = 'sl_dyn_js'; $labels_arr = array_filter($sl_mdo, "filter_sl_mdo"); unset($GLOBALS['input_zone_type']); unset($GLOBALS['output_zone_type']); unset($sl_mdo); //var_dump($labels_arr); die(); foreach ($labels_arr as $value) { $the_field = $value['field_name']; ${$the_field} = addslashes(icl_t(SL_DIR, $value['label'], ${$the_field})); } } //End WPML print "var sl_base='" . SL_BASE . "';\nvar sl_uploads_base='" . SL_UPLOADS_BASE . "';\nvar sl_addons_base=sl_uploads_base+'" . str_replace(SL_UPLOADS_BASE, '', SL_ADDONS_BASE) . "';\nvar sl_includes_base=sl_base+'" . str_replace(SL_BASE, '', SL_INCLUDES_BASE) . "';\nvar sl_google_map_country='" . $gmc . "'; \nvar sl_google_map_domain='" . $gmd . "';\n"; $icon_array = array('icon' => 'map_home_icon', 'icon2' => 'map_end_icon'); $without_quotes = array('map_type', 'zoom_level'); //Google map type, zoom level can't have quotes around theme foreach ($output_arr as $value) { if (isset($value['output_zone'])) { if (!is_array($value['output_zone'])) { $the_field = $value['field_name']; ${$the_field} = !in_array($the_field, $without_quotes) ? "'{${$the_field}}'" : ${$the_field}; if (in_array($the_field, array_keys($icon_array))) { //if-else needed due to inconsistency between 'icon'/'map_home_icon', etc labels $the_field_converted = $icon_array[$the_field]; print "var sl_{$the_field_converted}=" . ${$the_field} . ";\n"; } else { print "var sl_{$the_field}=" . ${$the_field} . ";\n"; } } else { $position_arr = array_keys($value['output_zone'], 'sl_dyn_js'); //array position of this sl_dyn_js output_zone, if an array foreach ($position_arr as $pos_value) { $the_field = $value['field_name'][$pos_value]; ${$the_field} = !in_array($the_field, $without_quotes) ? "'{${$the_field}}'" : ${$the_field}; if (in_array($the_field, array_keys($icon_array))) { $the_field_converted = $icon_array[$the_field]; print "var sl_{$the_field_converted}=" . ${$the_field} . ";\n"; } else { print "var sl_{$the_field}=" . ${$the_field} . ";\n"; } } } } } /*print "; var sl_map_home_icon='".$icon."'; var sl_map_end_icon='".$icon2."' var sl_zoom_level=$zl; var sl_map_type=$mt; var sl_website_label='$website_label'; var sl_directions_label='$directions_label'; var sl_hours_label='$hours_label'; var sl_phone_label='$phone_label'; var sl_fax_label='$fax_label'; var sl_email_label='$email_label'; var sl_load_locations_default='".$lld."'; var sl_load_results_with_locations_default='".$lrwld."'; var sl_geolocate='".$geo."'; var sl_distance_unit='$du'; var sl_map_overview_control='$oc'; var sl_no_results_found_message='$no_results_found_message'; var sl_location_not_found_message='$location_not_found_message';\n";*/ /*if (preg_match("@".SL_UPLOADS_BASE."@", $icon)){ $home_icon_path=str_replace(SL_UPLOADS_BASE, SL_UPLOADS_PATH, $icon); } else { $home_icon_path=str_replace(SL_BASE, SL_PATH, $icon); } $home_size=(function_exists("getimagesize") && file_exists($home_icon_path))? getimagesize($home_icon_path) : array(0 => 26, 1 => 35); print "var sl_map_home_icon_width=$home_size[0];\n"; print "var sl_map_home_icon_height=$home_size[1];\n"; if (preg_match("@".SL_UPLOADS_BASE."@", $icon2)){ $end_icon_path=str_replace(SL_UPLOADS_BASE, SL_UPLOADS_PATH, $icon2); } else { $end_icon_path=str_replace(SL_BASE, SL_PATH, $icon2); } $end_size=(function_exists("getimagesize") && file_exists($end_icon_path))? getimagesize($end_icon_path) : array(0 => 26, 1 => 35); print "var sl_map_end_icon_width=$end_size[0];\n"; print "var sl_map_end_icon_height=$end_size[1];\n";*/ print "//]]>\n</script>\n"; if (function_exists("do_sl_hook")) { do_sl_hook('sl_addon_head_scripts'); } if (function_exists("do_sl_hook")) { print "<script>\n//<![CDATA[\n"; sl_js_hooks(); print "\n//]]>\n</script>\n"; } }
$connection = mysql_connect($host, $username, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } // Set the active mySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM propiedades WHERE 1"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML('&', '&', $row['zona']) . '" '; echo 'address="' . parseToXML($row['direccion']) . '" '; echo 'lat="' . $row['latitud'] . '" '; echo 'lng="' . $row['longitud'] . '" '; echo 'type="propiedad" '; echo '/>'; } // End XML file echo '</markers>';
} setlocale(LC_MONETARY, 'en_US'); header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>' . PHP_EOL; //echo '<query="' . $query . '" />' . PHP_EOL ; //this breaks the js. it complains and says: "Uncaught TypeError: Cannot read property 'documentElement' of null" aagggh it was because I wasn't doing the parseToXML() bit echo '<item' . PHP_EOL . ' query="' . parseToXML($query) . '"' . PHP_EOL . ' />' . PHP_EOL; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker ' . PHP_EOL; echo 'SaleDate="' . parseToXML($row['SaleDate']) . '" ' . PHP_EOL; echo 'CaseNumber="' . parseToXML($row['CaseNumber']) . '" ' . PHP_EOL; echo 'Address="' . parseToXML($row['Address']) . '" ' . PHP_EOL; echo 'ZipCode="' . $row['ZipCode'] . '" ' . PHP_EOL; echo 'Plaintiff="' . parseToXML($row['Plaintiff']) . '" ' . PHP_EOL; echo 'Defendant="' . parseToXML($row['Defendant']) . '" ' . PHP_EOL; echo 'Attorney="' . parseToXML($row['Attorney']) . '" ' . PHP_EOL; echo 'SoldTo="' . parseToXML($row['SoldTo']) . '" ' . PHP_EOL; echo 'PID="' . parseToXML($row['PID']) . '" ' . PHP_EOL; echo 'Appraisal="' . money_format('%(#10n', $row['Appraisal']) . '" ' . PHP_EOL; echo 'MinBid="' . money_format('%(#10n', $row['MinBid']) . '" ' . PHP_EOL; echo 'SaleAmt="' . money_format('%(#10n', $row['SaleAmt']) . '" ' . PHP_EOL; echo 'SaleStatus="' . parseToXML($row['SaleStatus']) . '" ' . PHP_EOL; echo 'Latitude="' . $row['Latitude'] . '" ' . PHP_EOL; echo 'Longitude="' . $row['Longitude'] . '" ' . PHP_EOL; echo '/>' . PHP_EOL; } // End XML file echo '</markers>' . PHP_EOL; // http://www.tizag.com/ajaxTutorial/ajax-mysql-database.php
$resultMap = mysqli_query($irms, $queryMap); } else { $queryMap = "SELECT * FROM IRMS WHERE regionid='{$region}'"; $resultMap = mysqli_query($irms, $queryMap); } if (!$resultMap) { die('Invalid query: ' . mysqli_error($irms)); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysqli_fetch_assoc($resultMap)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['fldPartnerUniversity']) . '" '; echo 'URLaddress="' . $row['uniURL'] . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'MOU="' . parseToXML($row['AgreementInfoConcatenated']) . '" '; echo 'BriefingURL="' . parseToXML($row['RecentBriefingURL']) . '" '; echo 'unilogo="' . parseToXML($row['unilogo']) . '" '; echo 'countryid="' . parseToXML($row['countryid']) . '" '; echo 'fldCountry="' . parseToXML($row['fldCountry']) . '" '; echo '/>'; } // End XML file echo '</markers>'; ?>
header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysqli_fetch_assoc($resultMap)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['organisation']) . '" '; echo 'purpose="' . parseToXML($row['purpose']) . '" '; echo 'outcomes="' . parseToXML($row['outcomes']) . '" '; echo 'delegation="' . parseToXML($row['delegation']) . '" '; echo 'URLaddress="' . $row['uniURL'] . '" '; echo 'URLaddress1="' . $row['uniURL1'] . '" '; echo 'URLaddress2="' . $row['uniURL2'] . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'lat1="' . $row['lat1'] . '" '; echo 'lng1="' . $row['lng1'] . '" '; echo 'lat2="' . $row['lat2'] . '" '; echo 'lng2="' . $row['lng2'] . '" '; echo 'datee1="' . $row['datee'] . '" '; echo 'unilogo="' . parseToXML($row['unilogo']) . '" '; echo 'unilogo1="' . parseToXML($row['unilogo1']) . '" '; echo 'unilogo2="' . parseToXML($row['unilogo2']) . '" '; echo '/>'; } // End XML file echo '</markers>'; ?>
function createXMLNodes($hostArray) { //step through each node selected and get info and shove it to xml $doc = ""; $typeArray = createTypeArray(); foreach ($hostArray as $host) { if ($host->showMap == 1) { //Add a new node to XML $doc .= '<marker '; //gotta determine type based on host type, $type = $host->type; //insure nothing will be invalid. $doc .= 'id="' . parseToXML($host->id) . '" '; $doc .= 'name="' . parseToXML($host->description) . '" '; $doc .= 'address="' . parseToXML($host->hostname) . '" '; $doc .= 'lat="' . parseToXML($host->lat) . '" '; $doc .= 'lng="' . parseToXML($host->long) . '" '; if ($typeArray[$type]) { $doc .= 'type="' . parseToXML($typeArray[$type]) . '" '; } else { $doc .= 'type="' . parseToXML("Unknown") . '" '; } $doc .= 'templateId="' . parseToXML($type) . '" '; $doc .= 'availability="' . $host->avail . '" '; $doc .= 'radius="0" '; $doc .= 'status="' . parseToXML($host->status) . '" '; $doc .= 'latency="' . parseToXML($host->latency) . '" '; $doc .= 'group="' . parseToXML($host->group) . '" '; $doc .= '/>'; $doc .= "\n"; } } return $doc; }
echo '<marker '; echo 'name="' . parseToXML($row['name']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; if ($l1 == 'Agreements' and $l2 == 'Students' and $l3 == 'Exchange') { echo 'studentID="' . parseToXML($row['studentID']) . '" '; echo 'masterStudentID="' . parseToXML($row['masterStudentID']) . '" '; echo 'agreementsID="' . parseToXML($row['agreementsID']) . '" '; } elseif ($l1 == 'Agreements' and $l2 == 'Students') { echo 'masterStudentID="' . parseToXML($row['masterStudentID']) . '" '; echo 'agreementsID="' . parseToXML($row['agreementsID']) . '" '; } elseif ($l1 == 'Agreements' and $l3 == 'Exchange') { echo 'studentID="' . parseToXML($row['studentID']) . '" '; echo 'agreementsID="' . parseToXML($row['agreementsID']) . '" '; } elseif ($l2 == 'Students' and $l3 == 'Exchange') { echo 'masterStudentID="' . parseToXML($row['masterStudentID']) . '" '; echo 'studentID="' . parseToXML($row['studentID']) . '" '; } elseif ($l1 == 'Agreements') { echo 'agreementsID="' . parseToXML($row['agreementsID']) . '" '; } elseif ($l3 == 'Exchange') { echo 'studentID="' . parseToXML($row['studentID']) . '" '; } elseif ($l2 == 'Students') { echo 'masterStudentID="' . parseToXML($row['masterStudentID']) . '" '; } echo '/>'; } // End XML file echo '</markers>'; ?>
$xmlStr = str_replace('"', '"', $xmlStr); $xmlStr = str_replace("'", ''', $xmlStr); $xmlStr = str_replace("&", '&', $xmlStr); return $xmlStr; } $url_pref = "index.php?filter_loc=&filter_cat=&filter_stat=&filter_chn=&tktno="; $url_suff = "&parentviewtab=2&mod=4&submod=6&uction=view_submod"; // Select all the rows in the markers table //$query = "SELECT * FROM markers WHERE 1"; $query = "SELECT tktcategoryname,locationname,loctowns.lng, loctowns.lat,tktcategory.idtktcategory,tktcategory.gmap_bubble,tktin.timereported,tktin.refnumber,tktin.road_street,tktin.building_estate,tktin.unitno,tktstatusname FROM tktin\nINNER JOIN loctowns ON tktin.loctowns_idloctowns=loctowns.idloctowns\nINNER JOIN tktstatus ON tktin.tktstatus_idtktstatus=tktstatus.idtktstatus \t\nINNER JOIN tktcategory ON tktin.tktcategory_idtktcategory=tktcategory.idtktcategory WHERE tktin.usrteamzone_idusrteamzone=" . $_SESSION['MVGitHub_userteamzoneid'] . ""; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['refnumber'] . " - " . $row['tktcategoryname']) . '" '; echo 'address="' . parseToXML($row['locationname'] . " " . $row['road_street'] . " " . $row['building_estate']) . '" '; echo 'linkurl="' . parseToXML($url_pref . "" . $row['refnumber'] . "" . $url_suff) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'type="' . $row['gmap_bubble'] . '" '; echo '/>'; } // End XML file echo '</markers>';
// Set the active MySQL database $db_selected = mysql_select_db($db, $connection); if (!$db_selected) { die('No hay acceso a la base de datos: ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM optica WHERE 1"; $result = mysql_query($query); if (!$result) { die('Consulta invalida : ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['nombre']) . '" '; echo 'address="' . parseToXML($row['ubicacion']) . '" '; echo 'responsable="' . parseToXML($row['responsable']) . '" '; echo 'ext="' . parseToXML($row['ext']) . '" '; echo 'phone="' . parseToXML($row['telefono']) . '" '; echo 'email="' . parseToXML($row['email']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; // echo 'type="' . $row['type'] . '" '; echo '/>'; } // End XML file echo '</markers>';
} // Set the active MySQL database $db_selected = mysql_select_db($db, $connection); if (!$db_selected) { die('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM markers WHERE 1"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'id="' . $row['id'] . '" '; echo 'imovel="' . parseToXML($row['imovel']) . '" '; echo 'endereco="' . parseToXML($row['endereco']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'tipo="' . $row['tipo'] . '" '; echo '/>'; } // End XML file echo '</markers>'; ?>
$xmlStr = str_replace('>', '> ', $xmlStr); $xmlStr = str_replace(' " ', '" ', $xmlStr); $xmlStr = str_replace(" ' ", '' ', $xmlStr); $xmlStr = str_replace("&", '& ', $xmlStr); return $xmlStr; } $connection = mysql_connect(localhost, $username, $password); if (!$connection) { die("Not connected : " . mysql_error()); } // Pull data from table shops $query = sprintf("SELECT * FROM informatics"); $result = mysql_query($query); if (!$result) { die("Invalid query: " . mysql_error()); } // Start XML file, echo parent node echo "<markers>\n"; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // Add to XML Document Node echo '<marker '; echo 'name="' . parseToXML($row['name']) . '" '; echo 'address="' . parseToXML($row['address']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lngt'] . '" '; echo 'distance="' . $row['distance'] . '" '; echo "/>\n"; } // End XML file echo "</markers>\n";
$connection = mysql_connect($servername, $username, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } //Set the active MySQL database $dbname = "test3"; $db_selected = mysql_select_db($dbname, $connection); if (!$db_selected) { die('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = 'SELECT Station, Latitude, Longitude, princFact FROM `GPS_princFact`'; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['Station']) . '" '; echo 'lat="' . $row['Latitude'] . '" '; echo 'lng="' . $row['Longitude'] . '" '; echo 'type="' . $row['princFact'] . '" '; echo '/>'; } // End XML file echo '</markers>';
$xmlStr = str_replace("'", ''', $xmlStr); $xmlStr = str_replace("&", '&', $xmlStr); return $xmlStr; } try { $conn = new PDO("mysql:host=127.0.0.1;dbname=" . $database, $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // echo "Connected successfully"; } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); } // Select all the rows in the markers table $query = "SELECT * FROM markers"; $rs = $conn->query($query); header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each foreach ($rs as $value) { // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($value['name']) . '" '; echo 'address="' . parseToXML($value['address']) . '" '; echo 'lat="' . $value['lat'] . '" '; echo 'lng="' . $value['lng'] . '" '; echo 'type="' . $value['type'] . '" '; echo '/>'; } // End XML file echo '</markers>';
function g_map_options_callback() { function parseToXML($htmlStr) { $xmlStr = str_replace('<', '<', $htmlStr); $xmlStr = str_replace('>', '>', $xmlStr); $xmlStr = str_replace('"', '"', $xmlStr); $xmlStr = str_replace("'", ''', $xmlStr); $xmlStr = str_replace("&", '&', $xmlStr); return $xmlStr; } if (isset($_POST['task'])) { if ($_POST['task'] == 'post_shortcode_change_map') { global $wpdb; $sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%d", $_POST['id']); $getMap = $wpdb->get_row($sql); if ($getMap) { echo json_encode(array("success" => 1, "name" => $getMap->name, "type" => $getMap->type, "width" => $getMap->width, "height" => $getMap->height, "align" => $getMap->align, "border_radius" => $getMap->border_radius)); die; } } } if (isset($_POST['table'])) { global $wpdb; $table = $_POST['table']; if ($table == "g_markers" || $table == "g_polygones" || $table == "g_polylines" || $table == "g_circles") { $table_name = $wpdb->prefix . $table; $sql = $wpdb->prepare("DELETE FROM %s WHERE id=%d", $table_name, $_POST['id']); $sql = str_replace("'", "", $sql); if ($wpdb->query($sql)) { echo json_encode(array("success" => 1)); die; } else { echo json_encode(array("error" => $wpdb->last_error . " " . $sql)); die; } } else { echo json_encode(array("error" => "table name wrong")); die; } } if (isset($_POST['task'])) { if ($_POST['task'] == "styling_submit") { global $wpdb; $sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "g_maps SET styling_lightness=%d, styling_hue='%s', styling_gamma=%d, styling_saturation=%d WHERE id=%d", $_POST['g_map_styling_lightness'], $_POST['g_map_styling_hue'], $_POST['g_map_styling_gamma'], $_POST['g_map_styling_saturation'], $_POST['id']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['id'])); foreach ($map_params as $param) { echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer)); die; } } } } if (isset($_POST['task'])) { if ($_POST['task'] == "submit_circle_edit") { global $wpdb; $sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "g_circles SET hover_line_color=%s,hover_line_opacity=%s,hover_fill_color=%s,hover_fill_opacity=%s,name=%s,center_lat=%s, center_lng=%s,radius=%s,line_width=%s,line_color=%s,line_opacity=%s,fill_color=%s,fill_opacity=%s,show_marker=%s WHERE id=%d", $_POST['hover_circle_edit_line_color'], $_POST['hover_circle_edit_line_opacity'], $_POST['hover_circle_edit_fill_color'], $_POST['hover_circle_edit_fill_opacity'], $_POST['circle_edit_name'], $_POST['circle_edit_center_lat'], $_POST['circle_edit_center_lng'], $_POST['circle_edit_radius'], $_POST['circle_edit_line_width'], $_POST['circle_edit_line_color'], $_POST['circle_edit_line_opacity'], $_POST['circle_edit_fill_color'], $_POST['circle_edit_fill_opacity'], $_POST['circle_edit_marker_show'], $_POST['id']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['map_id'])); foreach ($map_params as $param) { echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer)); die; } } } } if (isset($_POST['task'])) { if ($_POST['task'] == "submit_circle") { global $wpdb; $sql = $wpdb->prepare("INSERT INTO " . $wpdb->prefix . "g_circles (map, name, center_lat, center_lng, radius ,hover_line_color ,hover_line_opacity ,hover_fill_color ,hover_fill_opacity , line_width, line_color, line_opacity, fill_color, fill_opacity, show_marker) VALUES(%d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%d)", $_POST['id'], $_POST['circle_name'], $_POST['circle_center_lat'], $_POST['circle_center_lng'], $_POST['circle_radius'], $_POST['hover_circle_line_color'], $_POST['hover_circle_line_opacity'], $_POST['hover_circle_fill_color'], $_POST['hover_circle_fill_opacity'], $_POST['circle_line_width'], $_POST['circle_line_color'], $_POST['circle_line_opacity'], $_POST['circle_fill_color'], $_POST['circle_fill_opacity'], $_POST['circle_marker_show']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['id'])); foreach ($map_params as $param) { $last = $wpdb->get_row("SHOW TABLE STATUS LIKE '" . $wpdb->prefix . "g_circles'"); $last_id = $last->Auto_increment - 1; echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer, "last_id" => $last_id)); die; } } } } if (isset($_POST['task'])) { if ($_POST['task'] == "polyline_edit_submit") { global $wpdb; $sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "g_polylines SET name=%s, data=%s ,hover_line_color=%s,hover_line_opacity=%s, line_opacity=%s, line_color=%s,line_width=%d WHERE id=%d", $_POST['polyline_edit_name'], $_POST['polyline_edit_coords'], $_POST['hover_polyline_edit_line_color'], $_POST['hover_polyline_edit_line_opacity'], $_POST['polyline_edit_line_opacity'], $_POST['polyline_edit_line_color'], $_POST['polyline_edit_line_width'], $_POST['id']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['map_id'])); foreach ($map_params as $param) { echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer)); die; } } } } if (isset($_POST['task'])) { if ($_POST['task'] == "submit_polyline") { global $wpdb; $sql = $wpdb->prepare("INSERT INTO " . $wpdb->prefix . "g_polylines (map,name,data,hover_line_color,hover_line_opacity,line_opacity,line_color ,line_width) VALUES (%d,%s,%s,%s,%s,%s,%s,%s)", $_POST['id'], $_POST['polyline_name'], $_POST['polyline_coords'], $_POST['hover_polyline_line_color'], $_POST['hover_polyline_line_opacity'], $_POST['polyline_line_opacity'], $_POST['polyline_line_color'], $_POST['polyline_line_width']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['id'])); foreach ($map_params as $param) { $last = $wpdb->get_row("SHOW TABLE STATUS LIKE '" . $wpdb->prefix . "g_polylines'"); $last_id = $last->Auto_increment - 1; echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer, "last_id" => $last_id)); die; } } } } if (isset($_POST['task'])) { if ($_POST['task'] == "submit_polygon_edit") { global $wpdb; $sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "g_polygones SET url=%s, hover_line_opacity=%s,hover_line_color=%s,hover_fill_opacity=%s,hover_fill_color=%s, name=%s, data=%s, line_opacity=%s, line_color=%s, line_width=%s, fill_opacity=%s, fill_color=%s WHERE id=%s", $_POST['polygone_edit_url'], $_POST['hover_polygone_edit_line_opacity'], $_POST['hover_polygone_edit_line_color'], $_POST['hover_polygone_edit_fill_opacity'], $_POST['hover_polygone_edit_fill_color'], $_POST['polygone_edit_name'], $_POST['polygone_edit_coords'], $_POST['polygone_edit_line_opacity'], $_POST['polygone_edit_line_color'], $_POST['polygone_edit_line_width'], $_POST['polygone_edit_fill_opacity'], $_POST['polygone_edit_fill_color'], $_POST['id']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['map_id'])); foreach ($map_params as $param) { echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer)); die; } } } } if (isset($_POST['task'])) { if ($_POST['task'] == "submit_polygon") { global $wpdb; $sql = $wpdb->prepare("INSERT INTO " . $wpdb->prefix . "g_polygones (map , name, url , data ,hover_line_opacity ,hover_line_color,hover_fill_opacity ,hover_fill_color , line_opacity , line_color , fill_opacity , fill_color, line_width) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", $_POST['id'], $_POST['polygone_name'], $_POST['polygone_url'], $_POST['polygone_coords'], $_POST['hover_polygone_line_opacity'], $_POST['hover_polygone_line_color'], $_POST['hover_polygone_fill_opacity'], $_POST['hover_polygone_fill_color'], $_POST['polygone_line_opacity'], $_POST['polygone_line_color'], $_POST['polygone_fill_opacity'], $_POST['polygone_fill_color'], $_POST['polygone_line_width']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['id'])); foreach ($map_params as $param) { $last = $wpdb->get_row("SHOW TABLE STATUS LIKE '" . $wpdb->prefix . "g_polygones'"); $last_id = $last->Auto_increment - 1; echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer, "last_id" => $last_id)); die; } } } } if (isset($_POST['task'])) { if ($_POST['task'] == "submit_marker_edit") { global $wpdb; $sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "g_markers SET title=%s,description=%s,size=%s, lat=%s, lng=%s, animation=%s, img=%s WHERE id=%s", $_POST['marker_edit_title'], $_POST['marker_edit_description'], $_POST['marker_edit_image_size'], $_POST['marker_edit_location_lat'], $_POST['marker_edit_location_lng'], $_POST['marker_edit_animation'], $_POST['marker_edit_image'], $_POST['id']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['map_id'])); foreach ($map_params as $param) { echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer)); die; } } } } if (isset($_POST['task'])) { if ($_POST['task'] == "submit_marker") { global $wpdb; $sql = $wpdb->prepare("INSERT INTO " . $wpdb->prefix . "g_markers (map,title, animation,lat, lng, description, img, size) VALUES (%s,%s,%s,%s,%s,%s,%s,%s)", $_POST['id'], $_POST['marker_title'], $_POST['marker_animation'], $_POST['marker_location_lat'], $_POST['marker_location_lng'], $_POST['marker_description'], $_POST['marker_image'], $_POST['marker_image_size']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['id'])); foreach ($map_params as $param) { $last = $wpdb->get_row("SHOW TABLE STATUS LIKE '" . $wpdb->prefix . "g_markers'"); $last_id = $last->Auto_increment - 1; echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer, "last_id" => $last_id)); die; } } } } if (isset($_POST['filename'])) { $filename = $_POST['filename']; $size = $_POST['size']; $url = $_POST['url']; $imagesize = $size . "," . $size; $image = wp_get_image_editor($url); $ext = pathinfo($url, PATHINFO_EXTENSION); $image->resize($size, $size, true); $filenameimage = $image->save('huge-it-google-map-custom-icons/' . $filename . "" . $size . "." . $ext); echo json_encode(array("success" => $filenameimage['path'])); die; } if (isset($_POST['task'])) { if ($_POST['task'] == "submit_general_options") { global $wpdb; $sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "g_maps SET name=%s,zoom=%s,border_radius=%s,center_lat=%s,center_lng=%s,pan_controller=%s,zoom_controller=%s,type_controller=%s,scale_controller=%s,street_view_controller=%s,overview_map_controller=%s,width=%s,height=%s,align=%s,min_zoom=%s,max_zoom=%s WHERE id=%s", $_POST['map_name'], $_POST['map_zoom'], $_POST['map_border_radius'], $_POST['map_center_lat'], $_POST['map_center_lng'], $_POST['map_controller_pan'], $_POST['map_controller_zoom'], $_POST['map_controller_type'], $_POST['map_controller_scale'], $_POST['map_controller_street_view'], $_POST['map_controller_overview'], $_POST['map_width'], $_POST['map_height'], $_POST['map_align'], $_POST['min_zoom'], $_POST['max_zoom'], $_POST['id']); if ($wpdb->query($sql)) { $map_params = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $_POST['id'])); foreach ($map_params as $param) { echo json_encode(array("success" => 1, "hue" => $param->styling_hue, "saturation" => $param->styling_saturation, "lightness" => $param->styling_lightness, "gamma" => $param->styling_gamma, "zoom" => $param->zoom, "type" => $param->type, "bike" => $param->bike_layer, "traffic" => $param->traffic_layer, "transit" => $param->transit_layer)); die; } } } } if (isset($_POST['task'])) { if ($_POST['task'] == "change_name") { global $wpdb; $name = $_POST['name']; $id = $_POST['id']; if ($wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "g_maps SET name='{$name}' WHERE id=%s", $id))) { echo json_encode(array("success" => 1)); die; } } } if (isset($_POST['task'])) { if ($_POST['task'] == "front_end_submit") { global $wpdb; $name = $_POST['name']; $type = $_POST['type']; $zoom = $_POST['zoom']; $width = $_POST['width']; $height = $_POST['height']; $id = $_POST['id']; $align = $_POST['align']; $sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "g_maps SET name=%s, type=%d, zoom = %d, width=%d, height=%d, align=%d WHERE id=%d", $name, $type, $zoom, $width, $height, $align, $id); $update = $wpdb->query($sql); if ($update) { echo json_encode(array("success" => 1)); die; } } } if (isset($_POST['task'])) { if ($_POST['task'] == "getxml") { $id = $_POST['map_id']; $response = "<?xml version='1.0' encoding='UTF-8'?>\r\n\t\t\t\t\t<maps>"; global $wpdb; $sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_maps WHERE id=%s", $id); $getMap = $wpdb->get_results($sql); if (isset($getMap)) { foreach ($getMap as $mapinfo) { $response = $response . "<map name='" . parseToXML($mapinfo->name) . "' info_type='" . $mapinfo->info_type . "' pan_controller='" . $mapinfo->pan_controller . "' zoom_controller='" . $mapinfo->zoom_controller . "' type_controller='" . $mapinfo->type_controller . "' scale_controller='" . $mapinfo->scale_controller . "' street_view_controller='" . $mapinfo->street_view_controller . "' overview_map_controller='" . $mapinfo->overview_map_controller . "' type='" . $mapinfo->type . "' zoom='" . $mapinfo->zoom . "' center_lat='" . $mapinfo->center_lat . "' center_lng='" . $mapinfo->center_lng . "' />"; } $sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_markers WHERE map=%d", $id); $getMarkers = $wpdb->get_results($sql); if (isset($getMarkers)) { foreach ($getMarkers as $marker) { $response = $response . "<marker id='" . $marker->id . "' size='" . $marker->size . "' name='" . parseToXML($marker->title) . "' animation='" . $marker->animation . "' lat='" . $marker->lat . "' lng='" . $marker->lng . "' description='" . parseToXML($marker->description) . "' img='" . parseToXML($marker->img) . "' />"; } } $sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_polygones WHERE map=%d", $id); $getPolygone = $wpdb->get_results($sql); if (isset($getPolygone)) { foreach ($getPolygone as $polygone) { $response = $response . "<polygone id='" . $polygone->id . "' name='" . parseToXML($polygone->name) . "' url='" . parseToXML($polygone->url) . "' line_width='" . $polygone->line_width . "' line_opacity='" . $polygone->line_opacity . "' line_color='" . $polygone->line_color . "' fill_opacity='" . $polygone->fill_opacity . "' fill_color='" . $polygone->fill_color . "' hover_line_color='" . $polygone->hover_line_color . "' hover_line_opacity='" . $polygone->hover_line_opacity . "' hover_fill_color='" . $polygone->hover_fill_color . "' hover_fill_opacity='" . $polygone->hover_fill_opacity . "' >"; preg_match_all('/\\(([^\\)]*)\\)/', $polygone->data, $matches); foreach ($matches[1] as $latlng) { preg_match_all("/[^,]+[\\d+][.?][\\d+]*/", $latlng, $results); foreach ($results as $latlng) { $response = $response . "<latlng lat='" . $latlng[0] . "' lng='" . $latlng[1] . "' />"; } } $response = $response . "</polygone>"; } } $sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_polylines WHERE map=%s", $id); $getPolyline = $wpdb->get_results($sql); if (isset($getPolyline)) { foreach ($getPolyline as $polyline) { $response = $response . "<polyline id='" . $polyline->id . "' name='" . parseToXML($polyline->name) . "' hover_line_color='" . $polyline->hover_line_color . "' hover_line_opacity='" . $polyline->hover_line_opacity . "' line_opacity='" . $polyline->line_opacity . "' line_color='" . $polyline->line_color . "' line_width='" . $polyline->line_width . "' >"; preg_match_all('/\\(([^\\)]*)\\)/', $polyline->data, $matches); foreach ($matches[1] as $latlng) { preg_match_all("/[^,]+[\\d+][.?][\\d+]*/", $latlng, $results); foreach ($results as $latlng) { $response = $response . "<latlng lat='" . $latlng[0] . "' lng='" . $latlng[1] . "' />"; } } $response = $response . "</polyline>"; } } $sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "g_circles WHERE map=%d", $id); $getCircle = $wpdb->get_results($sql); if ($getCircle) { foreach ($getCircle as $circle) { $response = $response . "<circle id='" . $circle->id . "' name='" . parseToXML($circle->name) . "' center_lat='" . $circle->center_lat . "' center_lng='" . $circle->center_lng . "' radius='" . $circle->radius . "' hover_fill_color='" . $circle->hover_fill_color . "' hover_fill_opacity='" . $circle->hover_fill_opacity . "' hover_line_color='" . $circle->hover_line_color . "' hover_line_opacity='" . $circle->hover_line_opacity . "' line_width='" . $circle->line_width . "' line_color='" . $circle->line_color . "' line_opacity='" . $circle->line_opacity . "' fill_color='" . $circle->fill_color . "' fill_opacity='" . $circle->fill_opacity . "' show_marker='" . $circle->show_marker . "' />"; } } $response = $response . "</maps>"; echo json_encode(array("success" => $response)); die; } } } }