* Improved security

* Included external javascript
* Multiple file upload
* Implemented sorting in file list
* Renamed internal function to improve wp compatibility
This commit is contained in:
bastianonm 2018-03-10 10:40:30 +00:00
parent a42f2091c6
commit 529ff95bbe
9 changed files with 232 additions and 169 deletions

10
js/Chart.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
Requires at least: 2.0.0
Tested up to: 4.9.4
Stable tag: 1.5.00
Stable tag: 1.5.01
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
@ -153,6 +153,12 @@ Yes!
1. Altitude & Speed & Hearth rate
== Changelog ==
= 1.5.01 =
* Improved security
* Included javascript
* Multiple file upload
* Implemented sorting in file list
* Renamed internal function to improve wp compatibility
= 1.5.00 =
* replaced highcharts with chartjs. This is a forced choice due highcharts license issue, view: https://devfarm.it/wordpress-plugin/wordpress-plugin-directory-notice-wp-gpx-maps-temporarily-disabled/
= 1.3.16 =

View File

@ -3,7 +3,7 @@
Plugin Name: WP-GPX-Maps
Plugin URI: http://www.devfarm.it/
Description: Draws a GPX track with altitude chart
Version: 1.5.00
Version: 1.5.01
Author: Bastianon Massimo
Author URI: http://www.devfarm.it/
*/
@ -46,22 +46,26 @@ function WP_GPX_Maps_action_links($links, $file) {
return $links;
}
function enqueue_WP_GPX_Maps_scripts()
{
function enqueue_WP_GPX_Maps_scripts() {
wp_register_script('chartjs', plugins_url( '/js/Chart.min.js', __FILE__ ), array(), "2.7.2" );
wp_register_script('WP-GPX-Maps', plugins_url( '/js/WP-GPX-Maps.js', __FILE__ ), array('jquery','googlemaps','chartjs'), "1.5.00" );
$wpgpxmaps_googlemapsv3_apikey = get_option('wpgpxmaps_googlemapsv3_apikey');
wp_enqueue_script( 'jquery' );
if ($wpgpxmaps_googlemapsv3_apikey) {
wp_enqueue_script('googlemaps', '//maps.googleapis.com/maps/api/js?key='.$wpgpxmaps_googlemapsv3_apikey, null, null);
}
else {
wp_enqueue_script('googlemaps', '//maps.googleapis.com/maps/api/js', null, null);
}
wp_enqueue_script( 'chartjs', '//cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js', array(), "2.7.2" );
wp_enqueue_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery','googlemaps','chartjs'), "1.5.00");
wp_enqueue_script('jquery');
wp_enqueue_script('chartjs');
wp_enqueue_script('WP-GPX-Maps');
}
function print_WP_GPX_Maps_styles()
{
function print_WP_GPX_Maps_styles() {
?>
<style type="text/css">
@ -100,8 +104,7 @@ function print_WP_GPX_Maps_styles()
<?php
}
function findValue($attr, $attributeName, $optionName, $defaultValue)
{
function wpgpxmaps_findValue($attr, $attributeName, $optionName, $defaultValue) {
$val = '';
if ( isset($attr[$attributeName]) ) {
$val = $attr[$attributeName];
@ -120,11 +123,11 @@ function findValue($attr, $attributeName, $optionName, $defaultValue)
function handle_WP_GPX_Maps_folder_Shortcodes($attr, $content='') {
$folder = findValue($attr, "folder", "", "");
$pointsoffset = findValue($attr, "pointsoffset", "wpgpxmaps_pointsoffset", 10);
$distanceType = findValue($attr, "distanceType", "wpgpxmaps_distance_type", 0);
$donotreducegpx = findValue($attr, "donotreducegpx", "wpgpxmaps_donotreducegpx", false);
$uom = findValue($attr, "uom", "wpgpxmaps_unit_of_measure", "0");
$folder = wpgpxmaps_findValue($attr, "folder", "", "");
$pointsoffset = wpgpxmaps_findValue($attr, "pointsoffset", "wpgpxmaps_pointsoffset", 10);
$distanceType = wpgpxmaps_findValue($attr, "distanceType", "wpgpxmaps_distance_type", 0);
$donotreducegpx = wpgpxmaps_findValue($attr, "donotreducegpx", "wpgpxmaps_donotreducegpx", false);
$uom = wpgpxmaps_findValue($attr, "uom", "wpgpxmaps_unit_of_measure", "0");
// fix folder path
$sitePath = sitePath();
@ -206,60 +209,60 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$error = '';
$gpx = findValue($attr, "gpx", "", "");
$w = findValue($attr, "width", "wpgpxmaps_width", "100%");
$mh = findValue($attr, "mheight", "wpgpxmaps_height", "450px");
$mt = findValue($attr, "mtype", "wpgpxmaps_map_type", "HYBRID");
$gh = findValue($attr, "gheight", "wpgpxmaps_graph_height", "200px");
$showCad = findValue($attr, "showcad", "wpgpxmaps_show_cadence", false);
$showHr = findValue($attr, "showhr", "wpgpxmaps_show_hr", false);
$showAtemp = findValue($attr, "showatemp", "wpgpxmaps_show_atemp", false);
$showW = findValue($attr, "waypoints", "wpgpxmaps_show_waypoint", false);
$showEle = findValue($attr, "showele", "wpgpxmaps_show_elevation", "true");
$showSpeed = findValue($attr, "showspeed", "wpgpxmaps_show_speed", false);
$showGrade = findValue($attr, "showgrade", "wpgpxmaps_show_grade", false);
$zoomOnScrollWheel = findValue($attr, "zoomonscrollwheel", "wpgpxmaps_zoomonscrollwheel", false);
$donotreducegpx = findValue($attr, "donotreducegpx", "wpgpxmaps_donotreducegpx", false);
$pointsoffset = findValue($attr, "pointsoffset", "wpgpxmaps_pointsoffset", 10);
$uom = findValue($attr, "uom", "wpgpxmaps_unit_of_measure", "0");
$uomspeed = findValue($attr, "uomspeed", "wpgpxmaps_unit_of_measure_speed", "0");
$color_map = findValue($attr, "mlinecolor", "wpgpxmaps_map_line_color", "#3366cc");
$color_graph = findValue($attr, "glinecolor", "wpgpxmaps_graph_line_color", "#3366cc");
$color_graph_speed = findValue($attr, "glinecolorspeed", "wpgpxmaps_graph_line_color_speed", "#ff0000");
$color_graph_hr = findValue($attr, "glinecolorhr", "wpgpxmaps_graph_line_color_hr", "#ff77bd");
$color_graph_atemp = findValue($attr, "glinecoloratemp", "wpgpxmaps_graph_line_color_atemp", "#ff77bd");
$color_graph_cad = findValue($attr, "glinecolorcad", "wpgpxmaps_graph_line_color_cad", "#beecff");
$color_graph_grade = findValue($attr, "glinecolorgrade", "wpgpxmaps_graph_line_color_grade", "#beecff");
$gpx = wpgpxmaps_findValue($attr, "gpx", "", "");
$w = wpgpxmaps_findValue($attr, "width", "wpgpxmaps_width", "100%");
$mh = wpgpxmaps_findValue($attr, "mheight", "wpgpxmaps_height", "450px");
$mt = wpgpxmaps_findValue($attr, "mtype", "wpgpxmaps_map_type", "HYBRID");
$gh = wpgpxmaps_findValue($attr, "gheight", "wpgpxmaps_graph_height", "200px");
$showCad = wpgpxmaps_findValue($attr, "showcad", "wpgpxmaps_show_cadence", false);
$showHr = wpgpxmaps_findValue($attr, "showhr", "wpgpxmaps_show_hr", false);
$showAtemp = wpgpxmaps_findValue($attr, "showatemp", "wpgpxmaps_show_atemp", false);
$showW = wpgpxmaps_findValue($attr, "waypoints", "wpgpxmaps_show_waypoint", false);
$showEle = wpgpxmaps_findValue($attr, "showele", "wpgpxmaps_show_elevation", "true");
$showSpeed = wpgpxmaps_findValue($attr, "showspeed", "wpgpxmaps_show_speed", false);
$showGrade = wpgpxmaps_findValue($attr, "showgrade", "wpgpxmaps_show_grade", false);
$zoomOnScrollWheel = wpgpxmaps_findValue($attr, "zoomonscrollwheel", "wpgpxmaps_zoomonscrollwheel", false);
$donotreducegpx = wpgpxmaps_findValue($attr, "donotreducegpx", "wpgpxmaps_donotreducegpx", false);
$pointsoffset = wpgpxmaps_findValue($attr, "pointsoffset", "wpgpxmaps_pointsoffset", 10);
$uom = wpgpxmaps_findValue($attr, "uom", "wpgpxmaps_unit_of_measure", "0");
$uomspeed = wpgpxmaps_findValue($attr, "uomspeed", "wpgpxmaps_unit_of_measure_speed", "0");
$color_map = wpgpxmaps_findValue($attr, "mlinecolor", "wpgpxmaps_map_line_color", "#3366cc");
$color_graph = wpgpxmaps_findValue($attr, "glinecolor", "wpgpxmaps_graph_line_color", "#3366cc");
$color_graph_speed = wpgpxmaps_findValue($attr, "glinecolorspeed", "wpgpxmaps_graph_line_color_speed", "#ff0000");
$color_graph_hr = wpgpxmaps_findValue($attr, "glinecolorhr", "wpgpxmaps_graph_line_color_hr", "#ff77bd");
$color_graph_atemp = wpgpxmaps_findValue($attr, "glinecoloratemp", "wpgpxmaps_graph_line_color_atemp", "#ff77bd");
$color_graph_cad = wpgpxmaps_findValue($attr, "glinecolorcad", "wpgpxmaps_graph_line_color_cad", "#beecff");
$color_graph_grade = wpgpxmaps_findValue($attr, "glinecolorgrade", "wpgpxmaps_graph_line_color_grade", "#beecff");
$chartFrom1 = findValue($attr, "chartfrom1", "wpgpxmaps_graph_offset_from1", "");
$chartTo1 = findValue($attr, "chartto1", "wpgpxmaps_graph_offset_to1", "");
$chartFrom2 = findValue($attr, "chartfrom2", "wpgpxmaps_graph_offset_from2", "");
$chartTo2 = findValue($attr, "chartto2", "wpgpxmaps_graph_offset_to2", "");
$startIcon = findValue($attr, "starticon", "wpgpxmaps_map_start_icon", "");
$endIcon = findValue($attr, "endicon", "wpgpxmaps_map_end_icon", "");
$currentIcon = findValue($attr, "currenticon", "wpgpxmaps_map_current_icon", "");
$waypointIcon = findValue($attr, "waypointicon", "wpgpxmaps_map_waypoint_icon", "");
$ngGalleries = findValue($attr, "nggalleries", "wpgpxmaps_map_ngGalleries", "");
$ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", "");
$chartFrom1 = wpgpxmaps_findValue($attr, "chartfrom1", "wpgpxmaps_graph_offset_from1", "");
$chartTo1 = wpgpxmaps_findValue($attr, "chartto1", "wpgpxmaps_graph_offset_to1", "");
$chartFrom2 = wpgpxmaps_findValue($attr, "chartfrom2", "wpgpxmaps_graph_offset_from2", "");
$chartTo2 = wpgpxmaps_findValue($attr, "chartto2", "wpgpxmaps_graph_offset_to2", "");
$startIcon = wpgpxmaps_findValue($attr, "starticon", "wpgpxmaps_map_start_icon", "");
$endIcon = wpgpxmaps_findValue($attr, "endicon", "wpgpxmaps_map_end_icon", "");
$currentIcon = wpgpxmaps_findValue($attr, "currenticon", "wpgpxmaps_map_current_icon", "");
$waypointIcon = wpgpxmaps_findValue($attr, "waypointicon", "wpgpxmaps_map_waypoint_icon", "");
$ngGalleries = wpgpxmaps_findValue($attr, "nggalleries", "wpgpxmaps_map_ngGalleries", "");
$ngImages = wpgpxmaps_findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", "");
// folgende Zeile hinzugefügt:
$attachments = findValue($attr, "attachments", "wpgpxmaps_map_attachments", false);
$download = findValue($attr, "download", "wpgpxmaps_download", "");
$dtoffset = findValue($attr, "dtoffset", "wpgpxmaps_dtoffset", 0);
$distanceType = findValue($attr, "distanceType", "wpgpxmaps_distance_type", 0);
$attachments = wpgpxmaps_findValue($attr, "attachments", "wpgpxmaps_map_attachments", false);
$download = wpgpxmaps_findValue($attr, "download", "wpgpxmaps_download", "");
$dtoffset = wpgpxmaps_findValue($attr, "dtoffset", "wpgpxmaps_dtoffset", 0);
$distanceType = wpgpxmaps_findValue($attr, "distanceType", "wpgpxmaps_distance_type", 0);
$skipcache = findValue($attr, "skipcache", "wpgpxmaps_skipcache", "");
$skipcache = wpgpxmaps_findValue($attr, "skipcache", "wpgpxmaps_skipcache", "");
$summary = findValue($attr, "summary", "wpgpxmaps_summary", "");
$p_tot_len = findValue($attr, "summarytotlen", "wpgpxmaps_summary_tot_len", false);
$p_max_ele = findValue($attr, "summarymaxele", "wpgpxmaps_summary_max_ele", false);
$p_min_ele = findValue($attr, "summaryminele", "wpgpxmaps_summary_min_ele", false);
$p_total_ele_up = findValue($attr, "summaryeleup", "wpgpxmaps_summary_total_ele_up", false);
$p_total_ele_down = findValue($attr, "summaryeledown", "wpgpxmaps_summary_total_ele_down", false);
$p_avg_speed = findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false);
$p_total_time = findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false);
$summary = wpgpxmaps_findValue($attr, "summary", "wpgpxmaps_summary", "");
$p_tot_len = wpgpxmaps_findValue($attr, "summarytotlen", "wpgpxmaps_summary_tot_len", false);
$p_max_ele = wpgpxmaps_findValue($attr, "summarymaxele", "wpgpxmaps_summary_max_ele", false);
$p_min_ele = wpgpxmaps_findValue($attr, "summaryminele", "wpgpxmaps_summary_min_ele", false);
$p_total_ele_up = wpgpxmaps_findValue($attr, "summaryeleup", "wpgpxmaps_summary_total_ele_up", false);
$p_total_ele_down = wpgpxmaps_findValue($attr, "summaryeledown", "wpgpxmaps_summary_total_ele_down", false);
$p_avg_speed = wpgpxmaps_findValue($attr, "summaryavgspeed", "wpgpxmaps_summary_avg_speed", false);
$p_total_time = wpgpxmaps_findValue($attr, "summarytotaltime", "wpgpxmaps_summary_total_time", false);
$usegpsposition = findValue($attr, "usegpsposition", "wpgpxmaps_usegpsposition", false);
$currentpositioncon = findValue($attr, "currentpositioncon", "wpgpxmaps_currentpositioncon", "");
$usegpsposition = wpgpxmaps_findValue($attr, "usegpsposition", "wpgpxmaps_usegpsposition", false);
$currentpositioncon = wpgpxmaps_findValue($attr, "currentpositioncon", "wpgpxmaps_currentpositioncon", "");
$colors_map = "\"".implode("\",\"",(explode(" ",$color_map)))."\"";
@ -586,7 +589,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
}
// Folgende Zeilen hinzugefügt
if ($attachments == true) {
$attimgs = getAttachedImages($points_x_time, $points_x_lat, $points_x_lon, $dtoffset, $error);
$attimgs = wpgpxmaps_getAttachedImages($points_x_time, $points_x_lat, $points_x_lon, $dtoffset, $error);
foreach ($attimgs as $img) {
$data = $img['data'];
$data = str_replace("\n","",$data);

View File

@ -13,7 +13,7 @@ function wpgpxmaps_admin_menu() {
}
}
function ilc_admin_tabs( $current ) {
function wpgpxmaps_ilc_admin_tabs( $current ) {
if (current_user_can('manage_options'))
{
@ -76,7 +76,7 @@ function WP_GPX_Maps_html_page() {
}
}
ilc_admin_tabs($tab);
wpgpxmaps_ilc_admin_tabs($tab);
if ($tab == "tracks")
{

View File

@ -5,7 +5,8 @@
?>
<script type="text/javascript" src="http://meta100.github.com/mColorPicker/javascripts/mColorPicker_min.js" charset="UTF-8"></script>
<script type="text/javascript" src="//meta100.github.com/mColorPicker/javascripts/mColorPicker_min.js" charset="UTF-8"></script>
<?php

View File

@ -5,15 +5,6 @@
$gpxRegEx = '/.gpx$/';
if ( isset($_POST['delete']) )
{
$del = $_POST['delete'];
if (preg_match($gpxRegEx, $del ) && file_exists($realGpxPath ."/". $del))
{
unlink($realGpxPath ."/". $del);
}
}
if ( isset($_POST['clearcache']) )
{
echo "Cache is now empty!";
@ -24,19 +15,28 @@
?>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.js"></script>
<div class="tablenav top">
<form enctype="multipart/form-data" method="POST" style="float:left; margin:5px 20px 0 0">
Choose a file to upload: <input name="uploadedfile" type="file" onchange="submitgpx(this);" />
<form enctype="multipart/form-data" method="POST" style="float:left; margin:5px 20px 0 0" action="/wp-admin/options-general.php?page=WP-GPX-Maps">
Choose a file to upload: <input name="uploadedfile[]" type="file" onchange="submitgpx(this);" multiple />
<?php
if ( isset($_FILES['uploadedfile']) )
{
$target_path = $realGpxPath ."/". basename( $_FILES['uploadedfile']['name']);
$total = count($_FILES['uploadedfile']['name']);
for($i=0; $i<$total; $i++) {
$uploadingFileName = basename( $_FILES['uploadedfile']['name'][$i]);
$target_path = $realGpxPath ."/". $uploadingFileName;
if (preg_match($gpxRegEx, $target_path))
{
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "File <b>". basename( $_FILES['uploadedfile']['name']). "</b> has been uploaded";
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$i], $target_path)) {
echo "<br />File <b>". $uploadingFileName . "</b> has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
echo "<br />There was an error uploading the file, please try again!";
}
}
else
@ -44,6 +44,7 @@
echo "file not supported!";
}
}
}
?>
</form>
@ -56,6 +57,55 @@
<?php
}
else
{
?>
<br />
<br />
<p style='font-size:2em;'>please make <b><?php echo $realGpxPath ?></b> folder writable. </p>
<br />
<br />
<?php
}
$myGpxFileNames = array();
if ( is_readable ( $realGpxPath ) && $handle = opendir($realGpxPath)) {
while (false !== ($entry = readdir($handle))) {
if (preg_match($gpxRegEx, $entry ))
{
if ( isset($_GET['wpgpxmaps_nonce'])
&&
wp_verify_nonce( $_GET['wpgpxmaps_nonce'], 'wpgpx_deletefile_nonce_' . $entry )
) {
if ( file_exists($realGpxPath ."/". $entry) )
{
unlink($realGpxPath ."/". $entry);
echo "<br/><b>$entry has been deleted.</b>";
}
else {
echo "<br/><b>Can't delete $entry.</b>";
}
}
else
{
$myFile = $realGpxPath . "/" . $entry;
$myGpxFileNames[] = array(
'name' => $entry,
'size' => filesize( $myFile ),
'lastedit' => filemtime( $myFile ),
'nonce' => wp_create_nonce( 'wpgpx_deletefile_nonce_' . $entry ),
);
}
}
}
closedir($handle);
}
if ( is_readable ( $realGpxPath ) && $handle = opendir($realGpxPath)) {
while (false !== ($entry = readdir($handle))) {
@ -64,69 +114,11 @@
$filenames[] = $realGpxPath . "/" . $entry;
}
}
closedir($handle);
}
?>
<table cellspacing="0" class="wp-list-table widefat plugins">
<thead>
<tr>
<th style="" class="manage-column" id="name" scope="col">File</th>
<th style="" class="manage-column" id="name" scope="col">Last modified</th>
<th style="" class="manage-column" id="name" scope="col">File size (Byte)</th>
</tr>
</thead>
<tfoot>
<tr>
<th style="" class="manage-column" id="name" scope="col">File</th>
<th style="" class="manage-column" id="name" scope="col">Last modified</th>
<th style="" class="manage-column" id="name" scope="col">File size (Byte)</th>
</tr>
</tfoot>
<tbody id="the-list">
<?php
if ($filenames)
{
$filenames = array_reverse($filenames);
foreach ($filenames as $file) {
$entry = basename($file);
?>
<tr>
<td style="border:none; padding-bottom:0;">
<strong><?php echo $entry; ?></strong>
</td>
<td style="border:none; padding-bottom:0;">
<?php echo date ("F d Y H:i:s.", filemtime( $file ) ) ?>
</td>
<td style="border:none; padding-bottom:0;">
<?php echo number_format ( filesize( $file ) , 0, '.', ',' ) ?>
</td>
</tr>
<tr>
<td colspan=3 style="padding: 0px 7px 7px 7px;">
<a href="#" onclick="delgpx('<?php echo $entry ?>'); return false;">Delete</a>
|
<a href="../wp-content/uploads/gpx/<?php echo $entry?>">Download</a>
|
Shortcode: [sgpx gpx="<?php echo $relativeGpxPath . $entry; ?>"]
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<table id="table" class="wp-list-table widefat plugins"></table>
<script type="text/javascript">
@ -138,16 +130,67 @@
el.parentNode.submit()
}
function delgpx(file)
{
if (confirm('Delete this file: ' + file + '?'))
{
document.formdelgpx.delete.value = file;
document.formdelgpx.submit();
jQuery('#table').bootstrapTable({
columns: [{
field: 'name',
title: 'File',
sortable: true,
formatter: function(value, row, index) {
return [
'<b>' + row.name + '</b><br />',
'<a class="delete_gpx_row" href="/wp-admin/options-general.php?page=WP-GPX-Maps&wpgpxmaps_nonce=' + row.nonce + '" >Delete</a>',
' | ',
'<a href="../wp-content/uploads/gpx/' + row.name + '">Download</a>',
' | ',
'Shortcode: [sgpx gpx="<?php echo $relativeGpxPath ?>' + row.name + '"]',
].join('')
}
}, {
field: 'lastedit',
title: 'Last modified',
sortable: true,
formatter: function(value, row, index) {
var d = new Date(value*1000);
return d.toLocaleDateString() + " " + d.toLocaleTimeString();
}
}, {
field: 'size',
title: 'File size',
sortable: true,
formatter: function(value, row, index) { return humanFileSize(value); }
}],
sortName : 'lastedit',
sortOrder : 'desc',
data: <?php echo json_encode( $myGpxFileNames ) ?>
});
jQuery('.delete_gpx_row').click(function(){
return confirm("Are you sure you want to delete?");
})
function humanFileSize(bytes, si) {
var thresh = si ? 1000 : 1024;
if(Math.abs(bytes) < thresh) {
return bytes + ' B';
}
var units = si
? ['kB','MB','GB','TB','PB','EB','ZB','YB']
: ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
var u = -1;
do {
bytes /= thresh;
++u;
} while(Math.abs(bytes) >= thresh && u < units.length - 1);
return bytes.toFixed(1)+' '+units[u];
}
</script>
<form method="post" name="formdelgpx" style="display:none;">
<input type="hidden" name="delete" />
</form>
<style>
#table tr:hover {
background:#eeeeee;
}
</style>

View File

@ -2,7 +2,7 @@
require_once("wp-gpx-maps_utils_nggallery.php");
function getAttachedImages($dt, $lat, $lon, $dtoffset, &$error)
function wpgpxmaps_getAttachedImages($dt, $lat, $lon, $dtoffset, &$error)
{
$result = array();

View File

@ -1,13 +1,13 @@
<?php
function isNGGalleryActive() {
function wpgpxmaps_isNGGalleryActive() {
if (!function_exists('is_plugin_active')) {
require_once(sitePath() . '/wp-admin/includes/plugin.php');
}
return is_plugin_active("nextgen-gallery/nggallery.php");
}
function isNGGalleryProActive() {
function wpgpxmaps_isNGGalleryProActive() {
if (!function_exists('is_plugin_active')) {
require_once(sitePath() . '/wp-admin/includes/plugin.php');
}
@ -22,7 +22,7 @@
$galids = explode(',', $ngGalleries);
$imgids = explode(',', $ngImages);
if (!isNGGalleryActive())
if (!wpgpxmaps_isNGGalleryActive())
return '';
try {