Skip to content

Commit e0f8546

Browse files
committed
Change GPS file track storage
1 parent 7804564 commit e0f8546

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

admin/admin_config.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@
116116
{
117117
// Check the center GPS position is valid
118118
if ($_POST['osm_left_center'])
119-
//print explode(',', $_POST['osm_left_center'])[0];
120-
if (explode(',', $_POST['osm_left_center'])[0] <= -90 or explode(',', $_POST['osm_left_center'])[0] >= 90)
121-
array_push($page['warnings'], l10n('The specify center latitude (-90=S to 90=N) is not valid'));
122-
if (explode(',', $_POST['osm_left_center'])[1] <= -180 or explode(',', $_POST['osm_left_center'])[1] >= 180)
123-
array_push($page['warnings'], l10n('The specify center longitude (-180=W to 180=E) is not valid'));
119+
//print explode(',', $_POST['osm_left_center'])[0];
120+
$center_arr = explode(',', $_POST['osm_left_center']);
121+
if (isset($center_arr[0]) and ($center_arr[0] <= -90 or $center_arr[0] >= 90))
122+
array_push($page['warnings'], l10n('The specify center latitude (-90=S to 90=N) is not valid'));
123+
if (isset($center_arr[1]) and ($center_arr[1] <= -180 or $center_arr[1] >= 180))
124+
array_push($page['warnings'], l10n('The specify center longitude (-180=W to 180=E) is not valid'));
124125

125126
// On post admin form
126127
$conf['osm_conf'] = array(

admin/admin_gps.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@
5858
}
5959

6060
function gps_upload_file($uploaded_file) {
61-
$uploaded_galleries_dir = PHPWG_ROOT_PATH.'_data/i/galleries/gps/';
61+
62+
if (!is_dir(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'gps_track_files/') and !is_writable(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'gps_track_files/'))
63+
$uploaded_errors['upload_error'] = l10n('Unable to upload, No such writable directory: '. PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'gps_track_files/');
64+
// Create album for GPX entries
65+
mkdir (PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'gps_track_files/');
66+
$uploaded_galleries_dir = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'gps_track_files/';
6267
$uploaded_file_tmp = $uploaded_file['tmp_name'];
6368
$uploaded_file_name = preg_replace('/[^a-zA-Z0-9s.]/', '_', $uploaded_file['name']);
6469
$uploaded_file_destination = $uploaded_galleries_dir . $uploaded_file_name;

maintain.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function plugin_install()
110110
pwg_query( $q );
111111

112112
// Create album for GPX entries
113-
mkdir (PHPWG_ROOT_PATH.'_data/i/galleries/gps/' );
113+
mkdir (PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'gps_track_files/');
114114

115115
// Create world map link
116116
$dir_name = basename( dirname(__FILE__) );

0 commit comments

Comments
 (0)