Skip to content

Commit 81d347a

Browse files
committed
Improve GPS uploader
1 parent 9c99f97 commit 81d347a

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

admin/admin_gps.php

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
if (count($uploaded_errors) == 0) {
4949
$file_path = pwg_db_real_escape_string($upload_file['destination']);
5050
$category = pwg_db_real_escape_string($_POST['category']);
51-
$query="INSERT INTO ".$prefixeTable."gps ( `category_id`, `path` ) VALUES ('$category', '$file_path');";
51+
$query="INSERT INTO ".$prefixeTable."osm_gps ( `category_id`, `path` ) VALUES ('$category', '$file_path');";
5252
pwg_query($query);
5353
array_push($page['infos'], l10n('File uploaded and synchronized'));
5454
} else {
@@ -58,7 +58,7 @@
5858
}
5959

6060
function gps_upload_file($uploaded_file) {
61-
$uploaded_galleries_dir = PHPWG_ROOT_PATH.'galleries/gps/';
61+
$uploaded_galleries_dir = PHPWG_ROOT_PATH.'_data/i/galleries/gps/';
6262
$uploaded_file_tmp = $uploaded_file['tmp_name'];
6363
$uploaded_file_name = preg_replace('/[^a-zA-Z0-9s.]/', '_', $uploaded_file['name']);
6464
$uploaded_file_destination = $uploaded_galleries_dir . $uploaded_file_name;

include/functions_map.php

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ function osm_get_gps($page)
5656
global $prefixeTable;
5757
if (isset($page['category'])) {
5858
$category = $page['category']['id'];
59-
$query = "SELECT `path` FROM ".$prefixeTable."gps AS g INNER JOIN ".CATEGORIES_TABLE." AS c ON g.category_id = c.id WHERE FIND_IN_SET(".$category.", c.uppercats);";
59+
$query = "SELECT `path` FROM ".$prefixeTable."osm_gps AS g INNER JOIN ".CATEGORIES_TABLE." AS c ON g.category_id = c.id WHERE FIND_IN_SET(".$category.", c.uppercats);";
6060
} else {
61-
$query = "SELECT `path` FROM ".$prefixeTable."gps;";
61+
$query = "SELECT `path` FROM ".$prefixeTable."osm_gps;";
6262
}
6363
return array_from_query($query, 'path');
6464
}

maintain.inc.php

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,19 @@ function plugin_install()
9999

100100
$q = 'UPDATE '.CONFIG_TABLE.' SET `comment` = "Configuration settings for piwigo-openstreetmap plugin" WHERE `param` = "osm_conf";';
101101
pwg_query( $q );
102-
$q = "CREATE TABLE IF NOT EXISTS ".$prefixeTable."gps (
102+
103+
// Create DB for GPX entries
104+
$q = "CREATE TABLE IF NOT EXISTS ".$prefixeTable."osm_gps (
103105
`id` int(11) NOT NULL auto_increment,
104106
`category_id` smallint(5) unsigned NOT NULL,
105107
`path` varchar(255) NOT NULL,
106108
PRIMARY KEY (`id`)
107109
) DEFAULT CHARACTER SET ".DB_CHARSET." COLLATE utf8_general_ci;";
108110
pwg_query( $q );
109111

112+
// Create album for GPX entries
113+
mkdir (PHPWG_ROOT_PATH.'_data/i/galleries/gps/' );
114+
110115
// Create world map link
111116
$dir_name = basename( dirname(__FILE__) );
112117
$c = <<<EOF

0 commit comments

Comments
 (0)