Changeset 1259341
- Timestamp:
- 10/04/2015 03:30:02 PM (11 years ago)
- Location:
- easy2map/trunk
- Files:
-
- 10 edited
-
includes/Easy2Map.php (modified) (1 diff)
-
includes/MapImport.php (modified) (2 diffs)
-
includes/MapImportCSV.php (modified) (4 diffs)
-
includes/MapImportCSV2.php (modified) (2 diffs)
-
includes/MapPinImageSave.php (modified) (2 diffs)
-
includes/SettingsEdit.php (modified) (1 diff)
-
index.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
scripts/easy2map.js (modified) (4 diffs)
-
scripts/functions.map.admin.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
easy2map/trunk/includes/Easy2Map.php
r1242841 r1259341 7 7 const min_php_version = '5.0'; 8 8 const min_wp_version = '3.0'; 9 const e2m_version = '1. 2.9';9 const e2m_version = '1.3.0'; 10 10 11 11 // Used to uniquely identify this plugin's menu page in the WP manager -
easy2map/trunk/includes/MapImport.php
r898860 r1259341 21 21 $xmlObject = simplexml_load_string(file_get_contents($_FILES["xmlfile"]['tmp_name'])); 22 22 23 if ( isset($xmlObject->map)) {23 if ($xmlObject && isset($xmlObject->map)) { 24 24 25 25 //only import map settings if required … … 109 109 } 110 110 } 111 } else { 112 echo "Invalid XML uploaded"; 111 113 } 112 114 -
easy2map/trunk/includes/MapImportCSV.php
r1178300 r1259341 19 19 20 20 $file = $_FILES["csvfile"]['tmp_name']; 21 22 //only allow CSV files to be uploaded 23 $mimes = array('application/vnd.ms-excel','text/plain','text/csv','text/tsv'); 24 if(!in_array($_FILES["csvfile"]["type"],$mimes)){ 25 echo'<script> jQuery(function() { 26 alert("No records imported - incorrect file format. Only CSV files permitted.") 27 window.location = "?page=easy2map&action=edit&map_id=' . $mapID . '"; 28 }); 29 </script>'; 30 die(); 31 } 32 21 33 $handle = fopen($file, "r"); 22 34 $row = 0; … … 49 61 50 62 $SQL = $wpdb->prepare(" 51 INSERT INTO $markersTable (MapID, 52 CreatedByUserID, 53 LatLong, 54 Title, 55 PinImageURL, 56 DetailsHTML) 57 VALUES (%s, '%s', '%s', '%s', '%s', '%s');", $mapID, $current_user->ID, "(" . $lat . "," . $lng . ")", $title, $pinImage, $pinHTML); 63 INSERT INTO $markersTable (MapID, 64 CreatedByUserID, 65 LatLong, 66 Title, 67 PinImageURL, 68 DetailsHTML) 69 VALUES (%s, '%s', '%s', '%s', '%s', '%s');", 70 $mapID, $current_user->ID, "(" . $lat . "," . $lng . ")", 71 $title, $pinImage, $pinHTML); 58 72 59 73 $wpdb->query($SQL); … … 66 80 alert("' . $row . ' records successfully imported"); 67 81 window.location = "?page=easy2map&action=edit&map_id=' . $mapID . '";}); 68 </script>';69 }82 </script>'; 83 } 70 84 } 71 85 ?> … … 74 88 75 89 <form name="formImport3" enctype="multipart/form-data" id="formImport3" 76 action="?page=easy2map&action=mapimportcsv&map_id=<?php echo $mapID; ?>"77 method="post">90 action="?page=easy2map&action=mapimportcsv&map_id=<?php echo $mapID; ?>" 91 method="post"> 78 92 79 <table style="background-color:#EBEBEB;width:60%;margin-left:auto;margin-right:auto;margin-top:10px;" cellspacing="3" cellpadding="3" class="table table-bordered">80 <tr>81 <td class="instructions"><h5>Import Markers via .CSV (Using Latitude & Longitude)</h5>82 </td>83 </tr>93 <table style="background-color:#EBEBEB;width:60%;margin-left:auto;margin-right:auto;margin-top:10px;" cellspacing="3" cellpadding="3" class="table table-bordered"> 94 <tr> 95 <td class="instructions"><h5>Import Markers via .CSV (Using Latitude & Longitude)</h5> 96 </td> 97 </tr> 84 98 85 <tr><td align="center" style="text-align:center">99 <tr><td align="center" style="text-align:center"> 86 100 87 <h5><input type='file' name='csvfile'88 id='csvfile'89 size='30' style="width:300px;vertical-align:middle;"90 acceptedFileList='CSV'91 accept='csv/*'></h5>92 <h6><i>(Only Valid .CSV Files Accepted)</i></h6>93 <button style="margin-top:20px;margin-left:auto;" class="btn btn-primary" data-dismiss="modal"94 onclick="easy2map_map_functions.uploadImportCSV()" aria-hidden="true">Upload CSV File</button>95 <button onclick="window.history.back(-1);" type="button"96 style="margin-top:20px;width:120px;float:right" class="btn">Back</button>97 </td></tr>98 </table>101 <h5><input type='file' name='csvfile' 102 id='csvfile' 103 size='30' style="width:300px;vertical-align:middle;" 104 acceptedFileList='CSV' 105 accept='csv/*'></h5> 106 <h6><i>(Only Valid .CSV Files Accepted)</i></h6> 107 <button style="margin-top:20px;margin-left:auto;" class="btn btn-primary" data-dismiss="modal" 108 onclick="easy2map_map_functions.uploadImportCSV()" aria-hidden="true">Upload CSV File</button> 109 <button onclick="window.history.back(-1);" type="button" 110 style="margin-top:20px;width:120px;float:right" class="btn">Back</button> 111 </td></tr> 112 </table> 99 113 100 <table style="font-size:11px;background-color:#FFFFFF;width:60%;margin-left:auto;margin-right:auto;margin-top:30px;" cellspacing="3" cellpadding="3" class="table table-bordered">114 <table style="font-size:11px;background-color:#FFFFFF;width:60%;margin-left:auto;margin-right:auto;margin-top:30px;" cellspacing="3" cellpadding="3" class="table table-bordered"> 101 115 102 <tr>103 <th>Please upload .CSV files in the following format:</th>104 </tr>105 <tr><td>[marker 1 latitude],[marker 1 longitude],[marker 1 title],[marker 1 icon],[marker 1 description]<br>116 <tr> 117 <th>Please upload .CSV files in the following format:</th> 118 </tr> 119 <tr><td>[marker 1 latitude],[marker 1 longitude],[marker 1 title],[marker 1 icon],[marker 1 description]<br> 106 120 [marker 2 latitude],[marker 2 longitude],[marker 2 title],[marker 2 icon],[marker 2 description]</td></tr> 107 121 <tr><th>Example: 108 <p style="font-style:italic">51.508039, -0.128068999, Trafalgar Square, 222.png, At the heart of London<br>109 48.85837, 2.294481, Tour Eiffel, 222.png, At the heart of Paris110 </p></th></tr>111 <tr>122 <p style="font-style:italic">51.508039, -0.128068999, Trafalgar Square, 222.png, At the heart of London<br> 123 48.85837, 2.294481, Tour Eiffel, 222.png, At the heart of Paris 124 </p></th></tr> 125 <tr> 112 126 113 <td style="margin-top:20px;">127 <td style="margin-top:20px;"> 114 128 115 <h5>Important to note:</h5>116 <ul>117 <li> <b>Latitude and longitude:</b> must be numeric, for example <b><i>-26.022850990407825, 28.046894073486328</i></b></li>118 <li> <b>Marker icon:</b> this can be the file name of a marker icon that has been uploaded, for example <b>CoolPinIcon.png</b><br>(leave this field empty for default icon to appear)</li>119 <li> <b>Marker description:</b> can contain HTML</li>120 </ul>129 <h5>Important to note:</h5> 130 <ul> 131 <li> <b>Latitude and longitude:</b> must be numeric, for example <b><i>-26.022850990407825, 28.046894073486328</i></b></li> 132 <li> <b>Marker icon:</b> this can be the file name of a marker icon that has been uploaded, for example <b>CoolPinIcon.png</b><br>(leave this field empty for default icon to appear)</li> 133 <li> <b>Marker description:</b> can contain HTML</li> 134 </ul> 121 135 122 136 123 </td>137 </td> 124 138 125 </tr>126 </table>139 </tr> 140 </table> 127 141 128 142 129 </form>130 </div>143 </form> 144 </div> 131 145 -
easy2map/trunk/includes/MapImportCSV2.php
r1178308 r1259341 19 19 20 20 $file = $_FILES["csvfile"]['tmp_name']; 21 22 //only allow CSV files to be uploaded 23 $mimes = array('application/vnd.ms-excel','text/plain','text/csv','text/tsv'); 24 if(!in_array($_FILES["csvfile"]["type"],$mimes)){ 25 echo'<script> jQuery(function() { 26 alert("No records imported - incorrect file format. Only CSV files permitted.") 27 window.location = "?page=easy2map&action=edit&map_id=' . $mapID . '"; 28 }); 29 </script>'; 30 die(); 31 } 32 21 33 $handle = fopen($file, "r"); 22 34 $row = 0; … … 56 68 PinImageURL, 57 69 DetailsHTML) 58 VALUES (%s, '%s', '%s', '%s', '%s', '%s');", $mapID, $current_user->ID, "(" . $loc["lat"] . "," . $loc["lng"] . ")", $title, $pinImage, $pinHTML); 70 VALUES (%s, '%s', '%s', '%s', '%s', '%s');", 71 $mapID, $current_user->ID, "(" . 72 $loc["lat"] . "," . 73 $loc["lng"] . ")", 74 $title, $pinImage, $pinHTML); 59 75 60 76 $wpdb->query($SQL); -
easy2map/trunk/includes/MapPinImageSave.php
r1242823 r1259341 26 26 $resizeHeight = '100'; 27 27 28 if( isset($_POST['max_marker_width']) 28 //only resize if is valid image 29 if( isset($type) 30 && in_array($type, array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF)) 31 && isset($_POST['max_marker_width']) 29 32 && isset($_POST['max_marker_height']) 30 33 && is_numeric($_POST['max_marker_width']) … … 38 41 } 39 42 40 if ($_FILES["pinicon"]['size'] < 5000000) { 41 $arrSmallImage = resizeImage($imagesDirectory, $uploadedFile, $imageName, $width, $height, $type, $attr, $resizeWidth, $resizeHeight, "SMALL"); 42 $imagePlusLocation = WP_CONTENT_URL . "/uploads/easy2map/images/map_pins/uploaded/" . $_GET["map_id"] . "/" . $arrSmallImage[0]; 43 //sanitize data before uploading icon 44 if ($_FILES["pinicon"]['size'] < 5000000 45 && is_numeric($_GET["map_id"]) 46 && intval($_GET["map_id"]) > 0) { 47 48 $arrSmallImage = resizeImage($imagesDirectory, $uploadedFile, 49 $imageName, $width, $height, $type, $attr, 50 $resizeWidth, $resizeHeight, "SMALL"); 51 52 $imagePlusLocation = WP_CONTENT_URL . "/uploads/easy2map/images/map_pins/uploaded/" . intval($_GET["map_id"]) . "/" . $arrSmallImage[0]; 43 53 44 54 } -
easy2map/trunk/includes/SettingsEdit.php
r1195339 r1259341 58 58 echo ' disabled="disabled"'; 59 59 } 60 echo ' />  Allow map zooming <p style="font-size:0.9em;text-decoration:italic;">( only true, map zoom level is static and can\'t be changed).</p></h6>';60 echo ' />  Allow map zooming <p style="font-size:0.9em;text-decoration:italic;">(if false, map zoom level is static and can\'t be changed).</p></h6>'; 61 61 62 62 echo '<h5 style="margin-top:20px;border-top:1px solid #EBEBEB;padding-top:0.5em;">Marker Popup Settings</h5>' -
easy2map/trunk/index.php
r1242841 r1259341 6 6 Description: The easiest tool available for creating custom & great-looking Google Maps. Add multiple pins and customize maps with drag-and-drop simplicity. 7 7 Author: Steven Ellis 8 Version: 1. 2.98 Version: 1.3.0 9 9 Author URI: http://easy2map.com/ 10 10 */ -
easy2map/trunk/readme.txt
r1242841 r1259341 5 5 6 6 Requires at least: 3.0.1 7 Tested up to: 4.3 8 Stable tag: 1. 2.97 Tested up to: 4.3.1 8 Stable tag: 1.3.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 144 144 * Additional styling options added to map templates containing pin lists. 145 145 146 = 1.3.0 = 147 * Increased data sanitization logic, for improved plugin security. 148 * WordPress version 4.3.1 compatability. 149 146 150 == Upgrade Notice == 147 151 … … 202 206 * Two new map templates added. 203 207 * Additional styling options added to map templates containing pin lists. 208 209 = 1.3.0 = 210 * Improvements to data sanitization logic, for enhanced plugin security. 211 * WordPress version 4.3.1 compatability. -
easy2map/trunk/scripts/easy2map.js
r1195339 r1259341 82 82 83 83 }); 84 }84 } 85 85 //if pin 'load' settings set to '2', open popup on window load 86 86 if (loadBehaviour === 2) { … … 137 137 138 138 if (!!mapSettings 139 && !!mapSettings.setMaxWidthPopups140 && typeof mapSettings.setMaxWidthPopups !== "undefined"141 && !!mapSettings.maxWidthPopups142 && typeof mapSettings.maxWidthPopups !== "undefined"){143 144 if (parseInt(mapSettings.setMaxWidthPopups) === 1 && !isNaN(mapSettings.maxWidthPopups)){145 maxPopupWidth = mapSettings.maxWidthPopups;146 }147 148 }149 150 var data = {139 && !!mapSettings.setMaxWidthPopups 140 && typeof mapSettings.setMaxWidthPopups !== "undefined" 141 && !!mapSettings.maxWidthPopups 142 && typeof mapSettings.maxWidthPopups !== "undefined"){ 143 144 if (parseInt(mapSettings.setMaxWidthPopups) === 1 && !isNaN(mapSettings.maxWidthPopups)){ 145 maxPopupWidth = mapSettings.maxWidthPopups; 146 } 147 148 } 149 150 var data = { 151 151 action: 'retrieve_map_points', 152 152 MapID: mapID, … … 230 230 markersArray.push(insertNewMapPoint(arrMapPins[i], map, maxPopupWidth)); 231 231 } 232 }233 });232 } 233 }); 234 234 }; 235 235 … … 275 275 $allowMapZoom = true; 276 276 } 277 277 278 278 if ($mapType === "ROADMAP") 279 279 $mapType = google.maps.MapTypeId.ROADMAP; -
easy2map/trunk/scripts/functions.map.admin.js
r1242823 r1259341 1347 1347 1348 1348 if (csvContinue === true) { 1349 busy();1350 1349 document.formImport3.submit(); 1351 1350 }
Note: See TracChangeset
for help on using the changeset viewer.