CVE-2015-10126 (PHP, published 2023-10-06T08:15Z)
Description: value: A vulnerability classified as critical was found in Easy2Map Photos Plugin 1.0.1 on WordPress. This vulnerability affects unknown code. The manipulation leads to sql injection. The attack can be initiated remotely. Upgrading to version 1.1.0 is able to address this issue. The patch is identified as 503d9ee2482d27c065f78d9546f076a406189908. It is recommended to upgrade the affected component. VDB-241318 is the identifier assigned to this vulnerability.
Severity: nan (CVSS v3 base score: 9.8)
Weakness: CWE-89 \u2014 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
Repository: https://github.com/wp-plugins/easy2map-photos
Files changed:
css/mapadmin.css
includes/CSSEditHTML.html
includes/Easy2MapImg.php
includes/Functions.php
includes/ImageFunctions.php
includes/MapAdmin.php
includes/MapPinImageUpload.php
includes/SettingsEdit.php
index.php
readme.txt
scripts/functions.imgmap.admin.js
scripts/functions.imgmappin.admin.js
Commit message: tested up to v 4.2.2 and SQL vulnerability plugged

git-svn-id: https://plugins.svn.wordpress.org/easy2map-photos/trunk@1193098 b8457f37-d9ea-0310-8a92-e5e31aec5664


Vulnerable code:
#easy2mapslidertext {display:none;text-align:center;color:#FFFFFF;font-family:Arial, Helvetica, sans-serif;font-size:0.9em;position:absolute;width:100%;top:15px;font-weight:bold;z-index:999;border-color:transparent;border-radius:0px;border-style:solid;border-width:1px;text-shadow:#171717 0.1em 0.1em 0.1em;background-color:transparent;white-space:nowrap;}

            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#272727\" background-color=\"#faf9f9\" />',
            
            
            
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#272727\" background-color=\"#faf9f9\" />',
            
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#272727\" background-color=\"#faf9f9\" />',
            
            '<settings width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#272727\" background-color=\"#faf9f9\" />',
            
             $SQLInsert15 = "UPDATE `$map_templates_table`
             
             $wpdb->query($SQLInsert15);
             
             $SQLInsert16 = "UPDATE `$map_templates_table`
             
             $wpdb->query($SQLInsert16);
            
            
            include('CopyMapSettings.php');    
        } else if (isset($_GET["action"]) && strcasecmp($_GET["action"], "activation") == 0) {
            include('Validation.php');
        
        if (strlen($code) == "") $code = get_option('phe_171323_transient_17666766');
        
        $wpdb->query(sprintf("UPDATE $mapsTable
            $wpdb->query(sprintf("
                    urldecode($_REQUEST['mapSettingsXML']), 
                    urldecode($_REQUEST["parentCSSXML"]),
                    urldecode($_REQUEST["photoCSSXML"]), 
                    urldecode($_REQUEST["mapCSSXML"]), 
                    urldecode($_REQUEST["mapHTML"]), $mapID));
            if (!$wpdb->query(sprintf("
                    urldecode($_REQUEST['mapSettingsXML']), 
                    urldecode($_REQUEST["parentCSSXML"]), 
                    urldecode($_REQUEST["photoCSSXML"]), 
                    urldecode($_REQUEST["mapCSSXML"]), 
                    urldecode($_REQUEST["mapHTML"])))) {
        $wpdb->query(sprintf("
        
                                                                                                        <button onclick="window.location='?page=easy2mapimg&action=viewMaps'" type="button" 
                                                                                                                style="margin-left:30px;width:100px;" 
                                                                                                                class="btn">Back</button> 
</form>                    
    
    $arrImage = array();
    if (extension_loaded('exif')) {
        $arrImage = exif_read_data($uploadedFile, 0, true);
    }
    
    if (isset($arrImage['GPS'])){
    
        $GPS = $arrImage['GPS'];
        
        if (isset($GPS['GPSLatitudeRef']) && isset($GPS['GPSLatitude'])){

            //LATITUDE
            $LatitudeRef = $GPS['GPSLatitudeRef'];
            $Latitude = $GPS['GPSLatitude'];
            
            $arrLatDegrees = explode("/", $Latitude[0]);
            $arrLatMinutes = explode("/", $Latitude[1]);
            $arrLatSeconds = explode("/", $Latitude[2]);
            
            $latDegrees = floatval($arrLatDegrees[0] / $arrLatDegrees[1]);
            $latMinutes = floatval($arrLatMinutes[0] / $arrLatMinutes[1]);
            $latSeconds = floatval($arrLatSeconds[0] / $arrLatSeconds[1]);
            
            echo $latDegrees . '|' . $latMinutes . '|' . $latSeconds . '|';

            //LONGITUDE
            $LongitudeRef = $GPS['GPSLongitudeRef'];
            $Longitude = $GPS['GPSLongitude'];
            
            $arrLngDegrees = explode("/", $Longitude[0]);
            $arrLngMinutes = explode("/", $Longitude[1]);
            $arrLngSeconds = explode("/", $Longitude[2]);
            
            $lngDegrees = floatval($arrLngDegrees[0] / $arrLngDegrees[1]);
            $lngMinutes = floatval($arrLngMinutes[0] / $arrLngMinutes[1]);
            $lngSeconds = floatval($arrLngSeconds[0] / $arrLngSeconds[1]);

            $lat = DMStoDEC($latDegrees,$latMinutes,$latSeconds);
            if (strcasecmp($LatitudeRef, "S") === 0) $lat = -1 * $lat;

            $lng = DMStoDEC($lngDegrees,$lngMinutes,$lngSeconds);
            if (strcasecmp($LongitudeRef, "W") === 0) $lng = -1 * $lng;
        }
function DMStoDEC($deg,$min,$sec)
{

// Converts DMS ( Degrees / minutes / seconds ) 
// to decimal format longitude / latitude
    return $deg+((($min*60)+($sec))/3600);
} 
  Version: 1.0.9 
Tested up to: 3.6.1
Stable tag: 1.0.9
* Various fixes and enhancements
        var templateID = parseInt(jQuery("#MapTemplateName").val());
        var proVersion = !!jQuery("#photoSize").attr("proVersion");
        for (var t = 0; t < $arrTemplates.length; t++) {
            var template = $arrTemplates[t];
            if (parseInt(template.ID) == templateID) {
                jQuery('#divPreview').html(replaceAll(template.TemplateHTML, '[siteurl]', $pluginsURL));
                if (proVersion === true)
                    jQuery('#easy2mapphotologo').remove();
                jQuery('[id ^= styleElement]').each(function() {
                    jQuery('#divMapParent').css(replaceAll(jQuery(this).attr('item'), "_", "-"), jQuery(this).attr('value'));
                });
                jQuery('[id ^= stylePhotoElement]').each(function() {
                    if (jQuery(this).attr('item') === "width") {
                        jQuery('#divMapParent').css("width", jQuery(this).attr('value'));
                        jQuery('#easy2mapmainimage').css("width", '');
                    } else {
                        jQuery('#easy2mapmainimage').css(replaceAll(jQuery(this).attr('item'), "_", "-"), jQuery(this).attr('value'));
                    }
                });
                jQuery('[id ^= styleMapElement]').each(function() {
                    jQuery('#divMap').css(replaceAll(jQuery(this).attr('item'), "_", "-"), jQuery(this).attr('value'));
                });
                jQuery("#easy2mapIimgShadow").width(jQuery("#divMapParent").width());
                jQuery("#easy2mapIimgShadow").width(jQuery("#divMapParent").width());
                jQuery("#easy2mapIimgShadow").css('marginLeft', jQuery("#divMapParent").css('marginLeft'));
                jQuery("#easy2mapIimgShadow").css('marginRight', jQuery("#divMapParent").css('marginRight'));
            }
        }
        //save the map to the database if required to do so
        if (!!saveMapToDatabase) {
            easy2map_imgmap_functions.saveMap(false, false);
        }
        easy2map_imgmap_functions.displayGoogleMap();
        google.maps.event.addDomListener(window, 'load', easy2map_imgmappin_functions.retrieveMapPoints());
    };

var easy2map_imgmappin_functions = (function(){
    
    clearPinArray = function(){
        
        if ($pinsArray) $pinsArray.length = 0;
        
    
    addPinToMap = function (objPointDetails){
            position	: new google.maps.LatLng(this.selectedMapPoint.lattitude, this.selectedMapPoint.longitude),
            draggable	: true,
            map		: $map,
            title           : this.selectedMapPoint.title.replace(/\\/gi, ''),
            ID              : this.selectedMapPoint.ID,
            icon            : this.selectedMapPoint.icon,
            settings        : this.selectedMapPoint.settings,
            small           : this.selectedMapPoint.small,
            medium          : this.selectedMapPoint.medium,
            large           : this.selectedMapPoint.large,
            pinHTML         : this.selectedMapPoint.pinhtml,
            pinText         : this.selectedMapPoint.pintext,
            visible         : false
        
        google.maps.event.addListener(marker, "dragend", function (mEvent) {
        
        google.maps.event.addListener(marker, "click", function (mEvent) {
            
            
            for(var i = 0; i < lines.length; i++){
                if (i > 0) pinContent += "<br>";
            
        //var infoWindow = new google.maps.InfoWindow();
        //infoWindow.setContent(pinContent);
        //infoWindow.open(marker.map, marker);
    
    clearTextOfAllFormatting = function(html){
        
        if (html.indexOf('<p') != -1){
        if (html.indexOf('[endif]') != -1){
        
    
    listedMapPin = function(objPinDetails){
    
    setPinImage = function (img){
        
                
                if (!!$selectedPin == false) continue;
                if (typeof $pinsArray[i].ID == "undefined" || typeof $selectedPin.ID == "undefined") continue;
                if ($pinsArray[i].ID == $selectedPin.ID) $pinsArray[i].setIcon(jQuery(img).attr('src'));
    
    showLatLong = function (){
    
    updateMapPinLocation = function(mapPinID){
               
            type : 'POST',
            url : ajaxurl,
            dataType : 'json',
                mapPointID : mapPinID,
                latLong : $latlng + '',
                action : "e2m_img_update_map_pin_location"
       
        
        addNewMapMarker : function(){
            
                        
        
        cancelSaveMapPin : function (){
            
            
            
            
            
            if (proVersion == false){
            
            
            
            if ($selectedPin) $selectedPin.setAnimation(null);
            
            
            
            
        
        changeMapPinTemplate : function(){
    
    
            for(var t = 0; t < $arrTemplates.length; t++){
        
                if (parseInt(template.ID) == templateID){
                }        
        
        deleteSelectedPoint : function (){
            if (!confirm('Are you sure you wish to delete this marker? This action is not reversible!')) return;
            
                type : 'POST',
                url : ajaxurl,
                dataType : 'json',
                    MapPointID : $mapPinID,
                success : function(returnData){
                    if (returnData.length > 0){
                    
                    if ($pinsArray) $pinsArray.length = 0;
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    if (errorThrown.length > 0) alert(errorThrown);
        
        editPinItem : function(index){
            
            for (i = 0; i < $pinsArray.length; i++){
            
            
            setTimeout(function(){
            $map.setCenter($latlng);            
            
            
            document.getElementById('MapTemplateName').style.visibility = 'hidden';  
            
            
            
            jQuery('#pinImagePreview').attr('src', pinDetails.large); 
            
            
            
                'background-image' : 'url(' + pinDetails.large + ')', 
                'background-repeat': 'no-repeat', 
                                    
            
            
        
        hidePreviewPage : function (){
        
        imageNotSuccessfullyUploaded : function (){
            
            if (document.getElementById('pinimage').value != ""){
                jQuery('#photoUploadError').modal();    
            
        
        imageSuccessfullyUploaded : function (smallImage, mediumImage, largeImage, lat, lng){
            
                'background-image' : 'url(' + largeImage + ')', 
                'background-repeat': 'no-repeat', 
                        
            for (i = 0; i < $pinsArray.length; i++){                
            
            
            if (lat === 0 && lng === 0){ 
                
                           
                easy2map_imgmappin_functions.SetPinPosition(lat, lng); 
            
            jQuery('#pinimage').val('');            
            
        
        openImagesDirectory : function (selectedImage){
            
                type            : 'POST',
                url             : ajaxurl,
                dataType        : 'json',
                    mapID : $mapID,
                    action : 'e2m_img_retrieve_pin_icons'
                success : function(returnData){
                    for (var i = 0; i < returnData.length; i++){
                        if (iCounter % 6 == 0){
                        var imageTd                 = document.createElement('td');
                        imageTd.align               = "center";
                        imageTd.style.padding       = "2px";
                        if (returnData[i] == selectedImage){
                            imageTd.style.borderRadius  = "3px"
                        
                    
                error : function(XMLHttpRequest, textStatus, errorThrown) {
        
        placePin : function (location, bounce) {
            
            for (i = 0; i < $pinsArray.length; i++){
            
                position    : location,
                ID          : 0,
                draggable   : true,
                bouncy      : true,
                title       : 'Click on icon to edit details',
                map         : $map,
                icon        : jQuery('#draggable').attr('src')
            
            
            if (!!bounce){
                setTimeout(function(){
            
            
            
                        
            
            google.maps.event.addListener(marker, "dragend", function (mEvent) {
            
            google.maps.event.addListener(marker, "click", function (mEvent) {
            
            
        
        retrieveMapPoints : function (){
            
            
                MapID : $mapID
            
        
                dataType : 'json',
                    
                    
                    
                    if (typeof returnData == "undefined" || typeof returnData == "null") noPinsFound = true;
                    if (!returnData) noPinsFound = true;
                    if (returnData.length == 0)  noPinsFound = true;
                    
                    if (noPinsFound){
                    
                    if ($markersArray) $markersArray.length = 0;
                                                           
                    for(var t = 0; t < returnData.length; t++){
                        
                            lattitude : arrLatLng[0],
                            longitude : arrLatLng[1],
                            ID : returnData[t].ID,
                            title : returnData[t].Title,
                            icon : returnData[t].ImageURL,
                            settings : returnData[t].Settings,
                            small : returnData[t].PinImageSmall,
                            medium : returnData[t].PinImageMedium,
                            large : returnData[t].PinImageLarge,
                            pinhtml : returnData[t].MapPinHTML,
                            pintext : returnData[t].MapPinText
                        
                    
                    for (var i = 0; i < $markersArray.length; i++){
                        
                        
                        if (document.getElementById('Easy2MapSliderParent')){
                            
                       
                       
                        
                        
                        
                       
                    
                    if (sliderImages.length > 0){
                        jQuery.preloadImages(sliderImages, function initSliderImages(){
                    
                    
                    jQuery("#Easy2MapSliderParent li:first").each(function(){
                    
                    
                error : function(XMLHttpRequest, textStatus, errorThrown) {
        
        saveMapPin : function (){
            
            
            if (pinText.length > 0) pinHTML += "<div style='text-align:left;margin:0px;padding:0px;'>" + pinText + "</div>";
            
            
            
                type 	: 'POST',
                url 	: ajaxurl,
                dataType : 'json',
                    mapPointID : $mapPinID,
                    action : "e2m_img_save_map_pin",
                    latLong : $latlng + '',
                    icon : jQuery('#draggable').attr('src'), 
                    pinTitle : '',
                    small : jQuery('#small').val(),
                    medium : jQuery('#medium').val(),
                    large : jQuery('#large').val(),
                    pinSettingsXML : '',
                    pinHTML : pinHTML,
                    pinText : pinText,
                    mapID : $mapID
                success : function(mapPinID){
                error : function(XMLHttpRequest, textStatus, errorThrown) {
            
        
        setCurrentPosition : function (lat,lng){
        
        setMapPinImage :  function (img){
        
                type : 'POST',
                url : ajaxurl,
                dataType : 'json',
                    MapID : $mapID,
                    PinImage : encodeURIComponent(jQuery(img).attr('src')),
                    action : "e2m_img_save_default_pin_image"
                success : function(returnImage){
                error : function(XMLHttpRequest, textStatus, errorThrown) {
        
        SetPinPosition : function (lat,lng){
            
                
                
                settings.zoom =  $map.getZoom();
                    formatOutput: true, 
                
                
            else $selectedPin.setPosition(location);
            
            setTimeout("jQuery('#address').val('')", 1500); 
        
        setIconDraggable : function(){
            
            jQuery("#draggable").draggable({                    
                    
                    var point = new google.maps.Point(e.pageX - position.left,e.pageY -position.top + 22);
                    if (latLngSouthW.lng() > 0 && (item.lng() > 0 && item.lng() < latLngSouthW.lng())) return;
                    if (latLngSouthW.lng() < 0 && (item.lng() < 0 && item.lng() < latLngSouthW.lng())) return;
                    
                    if (latLngNorthE.lng() > 0 && (item.lng() > 0 && item.lng() > latLngNorthE.lng())) return;
                    if (latLngNorthE.lng() < 0 && (item.lng() < 0 && item.lng() > latLngNorthE.lng())) return;
                    
                
            
        
        setIconNotDraggable : function(){

        uploadPinIcon : function (){
                
            if (validateFileType != ''){
        
        uploadPinPicture : function (){
            if (document.getElementById('pinimage').value === "") return;
                
            if (validateFileType != ''){
            
            if (bContinue == true){
    

Fixed code:
#easy2mapslidertext {display:none;text-align:center;position:absolute;width:100%;top:15px;z-index:999;border-color:transparent;border-radius:0px;border-style:solid;border-width:1px;text-shadow:#171717 0.1em 0.1em 0.1em;background-color:transparent;white-space:nowrap;}
<div id="div_edit_textalign" style="width:600px;" 
     class="modal hide fade" tabindex="-1" 
     role="dialog" aria-labelledby="winSettingsModalLabel" data-keyboard="true" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
        <h3>Alter Style Value</h3>
    </div>
    <div class="modal-body" style="max-height: 300px">
        <select class="Heading3" style="width:200px;height:28px" id="txtDefaultValue_textalign" name="txtDefaultValue_textalign">
            <option value="left">Left</option>
            <option value="center">Center</option> 
            <option value="right">Right</option>
        </select> 
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary" data-dismiss="modal" onclick="easy2map_imgmap_functions.saveItemValue();" aria-hidden="true">Save changes</button>
    </div>
</div>

<div id="div_edit_fontweight" style="width:600px;" 
     class="modal hide fade" tabindex="-1" 
     role="dialog" aria-labelledby="winSettingsModalLabel" data-keyboard="true" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
        <h3>Alter Style Value</h3>
    </div>
    <div class="modal-body" style="max-height: 300px;font-w">
        <select class="Heading3" style="width:200px;height:28px" id="txtDefaultValue_fontweight" name="txtDefaultValue_fontweight">
            <option value="normal">Normal</option>
            <option value="bold">Bold</option> 
            <option value="bolder">Bolder</option>
            <option value="lighter">Lighter</option>
        </select> 
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary" data-dismiss="modal" onclick="easy2map_imgmap_functions.saveItemValue();" aria-hidden="true">Save changes</button>
    </div>
</div>

<div id="div_edit_em" style="width:600px" 
     class="modal hide fade" tabindex="-1" 
     role="dialog" aria-labelledby="winSettingsModalLabel" data-keyboard="true" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
        <h3>Alter Style Value</h3>
    </div>
    <div class="modal-body" style="max-height: 300px">
        <select class="Heading3" style="width:200px;height:28px" id="txtDefaultValue_em" name="txtDefaultValue_em">
            <option value="0.1em">0.1em</option>
            <option value="0.15em">0.15em</option>
            <option value="0.2em">0.2em</option>
            <option value="0.25em">0.25em</option>
            <option value="0.3em">0.3em</option>
            <option value="0.35em">0.35em</option>
            <option value="0.4em">0.4em</option>
            <option value="0.45em">0.45em</option>
            <option value="0.5em">0.5em</option>
            <option value="0.55em">0.55em</option>
            <option value="0.6em">0.6em</option> 
            <option value="0.65em">0.65em</option>
            <option value="0.7em">0.7em</option>
            <option value="0.75em">0.75em</option>
            <option value="0.8em">0.8em</option>
            <option value="0.85em">0.85em</option>
            <option value="0.9em">0.9em</option>
            <option value="0.95em">0.95em</option>
            <option value="1.0em">1.0em</option>
            <option value="1.05em">1.05em</option>
            <option value="1.1em">1.1em</option>
            <option value="1.15em">1.15em</option>
            <option value="1.2em">1.2em</option>
            <option value="1.25em">1.25em</option>
            <option value="1.3em">1.3em</option>
            <option value="1.35em">1.35em</option>
            <option value="1.4em">1.4em</option>
            <option value="1.45em">1.45em</option>
            <option value="1.5em">1.5em</option>
            <option value="1.55em">1.55em</option>
            <option value="1.6em">1.6em</option> 
            <option value="1.65em">1.65em</option>
            <option value="1.7em">1.7em</option>
            <option value="1.75em">1.75em</option>
            <option value="1.8em">1.8em</option>
            <option value="1.85em">1.85em</option>
            <option value="1.9em">1.9em</option>
            <option value="1.95em">1.95em</option>
            <option value="2.0em">2.0em</option>
            <option value="2.1em">2.1em</option>
            <option value="2.2em">2.2em</option>
            <option value="2.3em">2.3em</option>
            <option value="2.4em">2.4em</option>
            <option value="2.5em">2.5em</option>
            <option value="2.6em">2.6em</option> 
            <option value="2.7em">2.7em</option>
            <option value="2.8em">2.8em</option>
            <option value="2.9em">2.9em</option>
            <option value="3.0em">3.0em</option>
        </select> 
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary" data-dismiss="modal" onclick="easy2map_imgmap_functions.saveItemValue();" aria-hidden="true">Save changes</button>
    </div>
</div>

<div id="div_edit_fontfamily" style="width:600px" 
     class="modal hide fade" tabindex="-1" 
     role="dialog" aria-labelledby="winSettingsModalLabel" data-keyboard="true" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
        <h3>Alter Style Value</h3>
    </div>
    <div class="modal-body" style="max-height: 300px">
        <select class="Heading3" style="width:300px;height:28px" id="txtDefaultValue_fontfamily" name="txtDefaultValue_fontfamily">
            <option value="Georgia, serif">Georgia, serif</option>
            <option value='Palatino, serif'>Palatino, serif</option> 
            <option value='Times, serif'>Times, serif</option>
            <option value='Arial, Helvetica, sans-serif'>Arial, Helvetica, sans-serif</option>
            <option value="Gadget, sans-serif">Gadget, sans-serif</option>
            <option value="cursive, sans-serif">cursive, sans-serif</option>
            <option value="Impact, Charcoal, sans-serif">Impact, Charcoal, sans-serif</option>
            <option value="Tahoma, Geneva, sans-serif">Tahoma, Geneva, sans-serif</option>
            <option value="Helvetica, sans-serif">Helvetica, sans-serif</option>
            <option value="Verdana, Geneva, sans-serif">Verdana, Geneva, sans-serif</option>
            <option value="Courier, monospace">Courier, monospace</option>
            <option value="Monaco, monospace">Monaco, monospace</option>
        </select> 
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary" data-dismiss="modal" onclick="easy2map_imgmap_functions.saveItemValue();" aria-hidden="true">Save changes</button>
    </div>
</div>

    //MERCURIAL COMMIT TEST 2
            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',
            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#faf9f9\" background-color=\"#faf9f9\" />',

            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#272727\" background-color=\"#faf9f9\" />',



            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#272727\" background-color=\"#faf9f9\" />',

            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#272727\" background-color=\"#faf9f9\" />',

            '<settings font-weight=\"bold\" color=\"#FFFFFF\" font-size=\"0.9em\" font-family=\"Arial, Helvetica, sans-serif\" width=\"520px\" height=\"390px\" border-style=\"solid\" border-radius=\"0px\" border-width=\"1px\" border-color=\"#272727\" background-color=\"#faf9f9\" />',

            $SQLInsert15 = "UPDATE `$map_templates_table`

            $wpdb->query($SQLInsert15);

            $SQLInsert16 = "UPDATE `$map_templates_table`
            $wpdb->query($SQLInsert16);
            include('CopyMapSettings.php');
        } else if (isset($_GET["action"]) && strcasecmp($_GET["action"], "copymapsettings") == 0 && isset($_GET["map_id"])) {
            include('CopyMapSettings.php');
        } else if (isset($_GET["action"]) && strcasecmp($_GET["action"], "photoimport") == 0 && isset($_GET["map_id"])) {
            include('ZipPhotoImport.php');

        if (strlen($code) == "")
            $code = get_option('phe_171323_transient_17666766');

        $wpdb->query($wpdb->prepare("UPDATE $mapsTable
            $wpdb->query($wpdb->prepare("
                    stripcslashes(urldecode($_REQUEST['mapSettingsXML'])), 
                    stripcslashes(urldecode($_REQUEST["parentCSSXML"])),
                    stripcslashes(urldecode($_REQUEST["photoCSSXML"])), 
                    stripcslashes(urldecode($_REQUEST["mapCSSXML"])), 
                    stripcslashes(urldecode($_REQUEST["mapHTML"])), $mapID));
            if (!$wpdb->query($wpdb->prepare("
                    stripcslashes(urldecode($_REQUEST['mapSettingsXML'])), 
                    stripcslashes(urldecode($_REQUEST["parentCSSXML"])), 
                    stripcslashes(urldecode($_REQUEST["photoCSSXML"])), 
                    stripcslashes(urldecode($_REQUEST["mapCSSXML"])), 
                    stripcslashes(urldecode($_REQUEST["mapHTML"]))))) {
        $wpdb->query($wpdb->prepare("
function extractLocationFromImageExif($uploadedFile) {

    $arrImage = array();
    $arrResult = array(0, 0);
    $lat = 0;
    $lng = 0;

    try {

        if (extension_loaded('exif')) {
            $arrImage = exif_read_data($uploadedFile, 0, true);
        }

        if (isset($arrImage['GPS'])) {

            $GPS = $arrImage['GPS'];

            if (isset($GPS['GPSLatitudeRef']) && isset($GPS['GPSLatitude'])) {

                //LATITUDE
                $LatitudeRef = $GPS['GPSLatitudeRef'];
                $Latitude = $GPS['GPSLatitude'];

                $arrLatDegrees = explode("/", $Latitude[0]);
                $arrLatMinutes = explode("/", $Latitude[1]);
                $arrLatSeconds = explode("/", $Latitude[2]);

                $latDegrees = floatval($arrLatDegrees[0] / $arrLatDegrees[1]);
                $latMinutes = floatval($arrLatMinutes[0] / $arrLatMinutes[1]);
                $latSeconds = floatval($arrLatSeconds[0] / $arrLatSeconds[1]);

                //LONGITUDE
                $LongitudeRef = $GPS['GPSLongitudeRef'];
                $Longitude = $GPS['GPSLongitude'];

                $arrLngDegrees = explode("/", $Longitude[0]);
                $arrLngMinutes = explode("/", $Longitude[1]);
                $arrLngSeconds = explode("/", $Longitude[2]);

                $lngDegrees = floatval($arrLngDegrees[0] / $arrLngDegrees[1]);
                $lngMinutes = floatval($arrLngMinutes[0] / $arrLngMinutes[1]);
                $lngSeconds = floatval($arrLngSeconds[0] / $arrLngSeconds[1]);

                $lat = DMStoDEC($latDegrees, $latMinutes, $latSeconds);
                if (strcasecmp($LatitudeRef, "S") === 0)
                    $lat = -1 * $lat;

                $lng = DMStoDEC($lngDegrees, $lngMinutes, $lngSeconds);
                if (strcasecmp($LongitudeRef, "W") === 0)
                    $lng = -1 * $lng;
            }
        }
    } catch (Exception $e) {
        
    }

    $arrResult = array($lat, $lng);
    return $arrResult;
}

function DMStoDEC($deg, $min, $sec) {

// Converts DMS ( Degrees / minutes / seconds ) 
// to decimal format longitude / latitude

    return $deg + ((($min * 60) + ($sec)) / 3600);
}


                                                                                                                <button onclick="window.location='?page=easy2mapimg&action=viewMaps'" type="button" 
                                                                                                                        style="margin-left:30px;width:100px;" 
                                                                                                                        class="btn">Back</button> 
                                    
                                    
                                    <tr id="zipUpload" style="display:none;"><td align="center" style="text-align:center" colspan="2">
                                        
                                        
                                        <h5><a href="#" onclick="document.formPhotoImport.photoSize.value=document.formAddPinImage.photoSize.value;jQuery('#mapZipImport').modal();">Upload  Zip File of Geotagged Images</a></h5>
                                        
                                        
                                    </tr>
</form>
<form name="formPhotoImport" 
      enctype="multipart/form-data"
      target="frameAddPinIcon" 
      id="formPhotoImport"
      onsubmit="return easy2map_imgmappin_functions.uploadZippedFile();"
      action="?page=easy2mapimg&action=photoimport&map_id=<?php echo $mapID; ?>"
      method="post">
    
    

    <div id="mapZipImport" style="width:600px" 
         class="modal hide fade" tabindex="-1" 
         role="dialog" aria-labelledby="winSettingsModalLabel" data-keyboard="true" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
            <h3>Upload Zip File of Geotagged Images</h3>
        </div>
        <div class="modal-body" style="max-height: 400px">

            <input type="hidden" name="photoSize" value="<?php echo $_REQUEST["photoSize"]; ?>" />

            <table style="background-color:#EBEBEB;width:60%;margin-left:auto;margin-right:auto;margin-top:10px;" cellspacing="3" cellpadding="3" class="table table-bordered">
                <tr>
                    <td class="instructions"><h5>Note: only geotagged images will be uploaded</h5>
                    </td>
                </tr>

                <tr><td align="center" style="text-align:center">

                        <h5><input type='file' name='zipfile' 
                                   id='zipfile' 
                                   size='30' style="width:300px;vertical-align:middle;"
                                   acceptedFileList='ZIP'
                                   accept='zip/*'></h5>
                        <h6><i>(Only Valid ZIP Files Accepted)</i></h6>
                    </td></tr>
            </table>

        </div>
        <div class="modal-footer">
            <button class="btn btn-primary" data-dismiss="modal" 
                    onclick="document.formPhotoImport.submit();"
                    aria-hidden="true">Upload Zip File</button>

        </div>
    </div>

</form>






<form name="formAddPinIcon" 
      target="frameAddPinIcon" 
      enctype="multipart/form-data" 
      id="formAddPinIcon"
      action="?page=easy2mapimg&action=mappiniconsave&map_id=<?php echo $mapID; ?>"
      method="post">

    <div id="mapPinIconList" style="width:600px" 
         class="modal hide fade" tabindex="-1" 
         role="dialog" aria-labelledby="winSettingsModalLabel" data-keyboard="true" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
            <h3>My map icons</h3>
        </div>
        <div class="modal-body" style="max-height: 400px">
            <h5>                
                <?php if (self::easy2MapPhotoCodeValidator('') === false) { ?>
                    <i>(Please upgrade to the Pro Version to upload your own custom icons)</i>
                    <br><br>
                <?php } else { ?>  
                    Upload own icon: 
                    <input type='file' name='pinicon' 
                           id='pinicon' 
                           size='30' style="width:300px;vertical-align:middle;"
                           acceptedFileList='JPG;JPEG;PJPEG;GIF;PNG;X-PNG'
                           accept='image/*'></h5>
                <h6><i>Valid image files accepted (.jpg, .png, .gif) with a maximum file size of 5MB.</i></h6>
            <?php } ?>
            <table style="width:96%" 
                   cellpadding="4" 
                   cellspacing="4" id="tblPinImages"></table>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
            <?php if (self::easy2MapPhotoCodeValidator('') === true) { ?><button class="btn btn-primary" data-dismiss="modal" onclick="easy2map_imgmappin_functions.uploadPinIcon()" aria-hidden="true">Upload Icon</button><?php } ?>
        </div>
    </div> 

</form>
                    
<form name="formRefresh" 
      id="formRefresh"
      action="?page=easy2mapimg&action=edit&map_id=<?php echo $mapID; ?>"
      method="post">                    
<div id="popupModalZipImport" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">Zip File Upload Result</h4>
                </div>
                <div class="modal-body">
                    <p style="font-size:1.5em;font-weight:bold;" id="resultMessage"></p>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="document.formRefresh.submit();" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</form>
var_dump($_REQUEST);

    $arrLatLng = extractLocationFromImageExif($uploadedFile);
    if (is_array($arrLatLng) && count($arrLatLng) == 2
            && is_numeric($arrLatLng[0])
            && is_numeric($arrLatLng[1]))
    {
        $lat = $arrLatLng[0];
        $lng = $arrLatLng[1];
   
  Version: 1.1.0 
Tested up to: 4.4.2
Stable tag: 1.1.0
= 1.1.0 = 
* Plugin made WP 4.2.2 compliant
* SQL injection vulnerabilities plugged

* Various fixes and enhancements

= 1.1.0 = 
* Plugin made WP 4.2.2 compliant
* SQL injection vulnerabilities plugged
                var templateID = parseInt(jQuery("#MapTemplateName").val());
                var proVersion = !!jQuery("#photoSize").attr("proVersion");
                for (var t = 0; t < $arrTemplates.length; t++) {
                    var template = $arrTemplates[t];
                    if (parseInt(template.ID) == templateID) {
                        jQuery('#divPreview').html(replaceAll(template.TemplateHTML, '[siteurl]', $pluginsURL));
                        if (proVersion === true)
                            jQuery('#easy2mapphotologo').remove();
                        jQuery('[id ^= styleElement]').each(function() {
                            jQuery('#divMapParent').css(replaceAll(jQuery(this).attr('item'), "_", "-"), jQuery(this).attr('value'));
                        });
                        jQuery('[id ^= stylePhotoElement]').each(function() {
                            if (jQuery(this).attr('item') === "width") {
                                jQuery('#divMapParent').css("width", jQuery(this).attr('value'));
                                jQuery('#easy2mapmainimage').css("width", '');
                            } else {
                                jQuery('#easy2mapmainimage').css(replaceAll(jQuery(this).attr('item'), "_", "-"), jQuery(this).attr('value'));
                            }
                        });
                        jQuery('[id ^= styleMapElement]').each(function() {
                            jQuery('#divMap').css(replaceAll(jQuery(this).attr('item'), "_", "-"), jQuery(this).attr('value'));
                        });
                        jQuery("#easy2mapIimgShadow").width(jQuery("#divMapParent").width());
                        jQuery("#easy2mapIimgShadow").width(jQuery("#divMapParent").width());
                        jQuery("#easy2mapIimgShadow").css('marginLeft', jQuery("#divMapParent").css('marginLeft'));
                        jQuery("#easy2mapIimgShadow").css('marginRight', jQuery("#divMapParent").css('marginRight'));
                    }
                }
                //save the map to the database if required to do so
                if (!!saveMapToDatabase) {
                    easy2map_imgmap_functions.saveMap(false, false);
                }
                easy2map_imgmap_functions.displayGoogleMap();
                google.maps.event.addDomListener(window, 'load', easy2map_imgmappin_functions.retrieveMapPoints());
            };
            
                case "font_family":
                    {
                        jQuery('#tdheading_fontfamily').html("Font Family");
                        jQuery('#div_edit_fontfamily').modal();
                        jQuery('#txtDefaultValue_fontfamily').val(value).focus();
                        break;
                    }

                case "text_align":
                    {
                        jQuery('#tdheading_textalign').html("Text Align");
                        jQuery('#div_edit_textalign').modal();
                        jQuery('#txtDefaultValue_textalign').val(value).focus();
                        break;
                    }

                case "font_weight":
                    {
                        jQuery('#tdheading_fontweight').html("Font Weight");
                        jQuery('#div_edit_fontweight').modal();
                        jQuery('#txtDefaultValue_fontweight').val(value).focus();
                        break;
                    }

                case "font_size":
                    {
                        jQuery('#tdheading_em').html("Font Size");
                        jQuery('#div_edit_em').modal();
                        jQuery('#txtDefaultValue_em').val(value).focus();
                        jQuery('#txtDefaultValue_em').val(type).prop('disabled', false);
                        break;
                    }

                case "color":
                    {
                        jQuery('#tdheading_color').html("Color");
                        jQuery('#div_edit_color').modal();
                        jQuery('#txtDefaultValue_color').val(value).focus();
                        jQuery('#txtDefaultValue_color').css('background-color', value);
                        jQuery('#colourpicker').attr('data-color', hexToRgb(value));
                        jQuery('#liDefaultValue_color').css('background-color', value);
                        break;
                    }

                case "font_family":
                    {
                        alteredValue = jQuery('#txtDefaultValue_fontfamily').val();
                        jQuery('#div_edit_fontfamily').hide();
                        break;
                    }

                case "text_align":
                    {
                        alteredValue = jQuery('#txtDefaultValue_textalign').val();
                        jQuery('#div_edit_textalign').hide();
                        break;
                    }
                case "font_weight":
                    {
                        alteredValue = jQuery('#txtDefaultValue_fontweight').val();
                        jQuery('#div_edit_fontweight').hide();
                        break;
                    }
                case "font_size":
                    {
                        alteredValue = jQuery('#txtDefaultValue_em').val();
                        jQuery('#div_edit_em').hide();
                        break;

                    }
                case "color":
                    {
                        alteredValue = jQuery('#txtDefaultValue_color').val();
                        jQuery('#tdItemElementValue').css('color', jQuery('#txtDefaultValue_color').val());
                        jQuery('#div_edit_color').hide();
                        break;
                    }
                    jQuery('#formPhotoImport').attr('action', '?page=easy2mapimg&action=photoimport&map_id=' + $mapID);
                    jQuery('#formRefresh').attr('action', '?page=easy2mapimg&action=edit&map_id=' + $mapID);
var easy2map_imgmappin_functions = (function() {

    clearPinArray = function() {

        if ($pinsArray)
            $pinsArray.length = 0;


    addPinToMap = function(objPointDetails) {
            position: new google.maps.LatLng(this.selectedMapPoint.lattitude, this.selectedMapPoint.longitude),
            draggable: true,
            map: $map,
            title: this.selectedMapPoint.title.replace(/\\/gi, ''),
            ID: this.selectedMapPoint.ID,
            icon: this.selectedMapPoint.icon,
            settings: this.selectedMapPoint.settings,
            small: this.selectedMapPoint.small,
            medium: this.selectedMapPoint.medium,
            large: this.selectedMapPoint.large,
            pinHTML: this.selectedMapPoint.pinhtml,
            pinText: this.selectedMapPoint.pintext,
            visible: false

        google.maps.event.addListener(marker, "dragend", function(mEvent) {

        google.maps.event.addListener(marker, "click", function(mEvent) {


            for (var i = 0; i < lines.length; i++) {
                if (i > 0)
                    pinContent += "<br>";

            //var infoWindow = new google.maps.InfoWindow();
            //infoWindow.setContent(pinContent);
            //infoWindow.open(marker.map, marker);

    clearTextOfAllFormatting = function(html) {

        if (html.indexOf('<p') != -1) {
        if (html.indexOf('[endif]') != -1) {


    listedMapPin = function(objPinDetails) {

    setPinImage = function(img) {


                if (!!$selectedPin == false)
                    continue;
                if (typeof $pinsArray[i].ID == "undefined" || typeof $selectedPin.ID == "undefined")
                    continue;
                if ($pinsArray[i].ID == $selectedPin.ID)
                    $pinsArray[i].setIcon(jQuery(img).attr('src'));

    showLatLong = function() {

    updateMapPinLocation = function(mapPinID) {

            type: 'POST',
            url: ajaxurl,
            dataType: 'json',
                mapPointID: mapPinID,
                latLong: $latlng + '',
                action: "e2m_img_update_map_pin_location"

        addNewMapMarker: function() {


        cancelSaveMapPin: function() {

            jQuery('#zipUpload').show();




            if (proVersion == false) {



            if ($selectedPin)
                $selectedPin.setAnimation(null);




        changeMapPinTemplate: function() {


            for (var t = 0; t < $arrTemplates.length; t++) {

                if (parseInt(template.ID) == templateID) {
                }
        deleteSelectedPoint: function() {

            if (!confirm('Are you sure you wish to delete this marker? This action is not reversible!'))
                return;
                type: 'POST',
                url: ajaxurl,
                dataType: 'json',
                    MapPointID: $mapPinID,
                success: function(returnData) {
                    if (returnData.length > 0) {

                    if ($pinsArray)
                        $pinsArray.length = 0;
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    if (errorThrown.length > 0)
                        alert(errorThrown);
        editPinItem: function(index) {

            for (i = 0; i < $pinsArray.length; i++) {


            setTimeout(function() {
            $map.setCenter($latlng);


            document.getElementById('MapTemplateName').style.visibility = 'hidden';



            jQuery('#pinImagePreview').attr('src', pinDetails.large);
            jQuery('#zipUpload').hide();



                'background-image': 'url(' + pinDetails.large + ')',
                'background-repeat': 'no-repeat',



        hidePreviewPage: function() {
        imageNotSuccessfullyUploaded: function() {

            if (document.getElementById('pinimage').value != "") {
                jQuery('#photoUploadError').modal();

        imageSuccessfullyUploaded: function(smallImage, mediumImage, largeImage, lat, lng) {

                'background-image': 'url(' + largeImage + ')',
                'background-repeat': 'no-repeat',

            for (i = 0; i < $pinsArray.length; i++) {

            jQuery('#zipUpload').show();
            jQuery('#zipUpload').hide();

            if (lat === 0 && lng === 0) {


                easy2map_imgmappin_functions.SetPinPosition(lat, lng);

            jQuery('#pinimage').val('');

        openImagesDirectory: function(selectedImage) {

                type: 'POST',
                url: ajaxurl,
                dataType: 'json',
                    mapID: $mapID,
                    action: 'e2m_img_retrieve_pin_icons'
                success: function(returnData) {
                    for (var i = 0; i < returnData.length; i++) {
                        if (iCounter % 6 == 0) {
                        var imageTd = document.createElement('td');
                        imageTd.align = "center";
                        imageTd.style.padding = "2px";
                        if (returnData[i] == selectedImage) {
                            imageTd.style.borderRadius = "3px"


                error: function(XMLHttpRequest, textStatus, errorThrown) {
        placePin: function(location, bounce) {

            for (i = 0; i < $pinsArray.length; i++) {

                position: location,
                ID: 0,
                draggable: true,
                bouncy: true,
                title: 'Click on icon to edit details',
                map: $map,
                icon: jQuery('#draggable').attr('src')


            if (!!bounce) {
                setTimeout(function() {





            google.maps.event.addListener(marker, "dragend", function(mEvent) {

            google.maps.event.addListener(marker, "click", function(mEvent) {


        retrieveMapPoints: function() {


                MapID: $mapID


                dataType: 'json',



                    if (typeof returnData == "undefined" || typeof returnData == "null")
                        noPinsFound = true;
                    if (!returnData)
                        noPinsFound = true;
                    if (returnData.length == 0)
                        noPinsFound = true;

                    if (noPinsFound) {

                    if ($markersArray)
                        $markersArray.length = 0;

                    for (var t = 0; t < returnData.length; t++) {

                            lattitude: arrLatLng[0],
                            longitude: arrLatLng[1],
                            ID: returnData[t].ID,
                            title: returnData[t].Title,
                            icon: returnData[t].ImageURL,
                            settings: returnData[t].Settings,
                            small: returnData[t].PinImageSmall,
                            medium: returnData[t].PinImageMedium,
                            large: returnData[t].PinImageLarge,
                            pinhtml: returnData[t].MapPinHTML,
                            pintext: returnData[t].MapPinText


                    for (var i = 0; i < $markersArray.length; i++) {


                        if (document.getElementById('Easy2MapSliderParent')) {








                    if (sliderImages.length > 0) {
                        jQuery.preloadImages(sliderImages, function initSliderImages() {


                    jQuery("#Easy2MapSliderParent li:first").each(function() {


                error: function(XMLHttpRequest, textStatus, errorThrown) {
        saveMapPin: function() {


            if (pinText.length > 0)
                pinHTML += "<div style='text-align:left;margin:0px;padding:0px;'>" + pinText + "</div>";



                type: 'POST',
                url: ajaxurl,
                dataType: 'json',
                    mapPointID: $mapPinID,
                    action: "e2m_img_save_map_pin",
                    latLong: $latlng + '',
                    icon: jQuery('#draggable').attr('src'),
                    pinTitle: '',
                    small: jQuery('#small').val(),
                    medium: jQuery('#medium').val(),
                    large: jQuery('#large').val(),
                    pinSettingsXML: '',
                    pinHTML: pinHTML,
                    pinText: pinText,
                    mapID: $mapID
                success: function(mapPinID) {
                error: function(XMLHttpRequest, textStatus, errorThrown) {

        setCurrentPosition: function(lat, lng) {
        setMapPinImage: function(img) {

                type: 'POST',
                url: ajaxurl,
                dataType: 'json',
                    MapID: $mapID,
                    PinImage: encodeURIComponent(jQuery(img).attr('src')),
                    action: "e2m_img_save_default_pin_image"
                success: function(returnImage) {
                error: function(XMLHttpRequest, textStatus, errorThrown) {
        SetPinPosition: function(lat, lng) {



                settings.zoom = $map.getZoom();
                    formatOutput: true,


            else
                $selectedPin.setPosition(location);

            setTimeout("jQuery('#address').val('')", 1500);
        setIconDraggable: function() {

            jQuery("#draggable").draggable({

                    var point = new google.maps.Point(e.pageX - position.left, e.pageY - position.top + 22);
                    if (latLngSouthW.lng() > 0 && (item.lng() > 0 && item.lng() < latLngSouthW.lng()))
                        return;
                    if (latLngSouthW.lng() < 0 && (item.lng() < 0 && item.lng() < latLngSouthW.lng()))
                        return;

                    if (latLngNorthE.lng() > 0 && (item.lng() > 0 && item.lng() > latLngNorthE.lng()))
                        return;
                    if (latLngNorthE.lng() < 0 && (item.lng() < 0 && item.lng() > latLngNorthE.lng()))
                        return;



        setIconNotDraggable: function() {
        uploadPinIcon: function() {

            if (validateFileType != '') {
        uploadZippedFile: function() {

            var validateFileType = checkFileExtensionSilent(document.getElementById('zipfile'));
            if (validateFileType !== '') {
                alert('Invalid file, only the following image types are allowed: ' + validateFileType + '. Please upload a different image.');
                return false;
            } else {
                return true;
            }
        },
        uploadZippedFileResult: function(successMessage){
            jQuery('#resultMessage').html(successMessage);
            jQuery('#popupModalZipImport').modal();
            
        },
        //verify that the pin icon is a valid image file
        uploadPinPicture: function() {

            if (document.getElementById('pinimage').value === "")
                return;

            if (validateFileType != '') {

            if (bContinue == true) {