-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathadmin_config.php
More file actions
259 lines (240 loc) · 9.4 KB
/
admin_config.php
File metadata and controls
259 lines (240 loc) · 9.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?php
/***********************************************
* File : admin_config.php
* Project : piwigo-openstreetmap
* Descr : Install / Uninstall method
*
* Created : 28.05.2013
*
* Copyright 2013-2016 <xbgmsharp@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
************************************************/
// Check whether we are indeed included by Piwigo.
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
// Check access and exit when user status is not ok
check_status(ACCESS_ADMINISTRATOR);
// Setup plugin Language
load_language('plugin.lang', OSM_PATH);
// Fetch the template.
global $template, $conf, $lang;
// Available baselayer
$available_baselayer = array(
'mapnik' => 'OpenStreetMap Mapnik',
'blackandwhite' => 'OpenStreetMap BlackAndWhite',
'mapnikfr' => 'OpenStreetMap FR',
'mapnikde' => 'OpenStreetMap DE',
'mapnikhot' => 'OpenStreetMap HOT',
'mapquest' => 'MapQuestOpen',
'mapquestaerial'=> 'MapQuestOpen Aerial',
'toner' => 'Stamen Toner',
'custom' => 'Own tile (custom style)',
'esri' => 'Esri.WorldImagery',
);
// Available zoom value
$available_zoom = array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10'=> '10',
'11'=> '11',
'12'=> '12',
'13'=> '13',
'14'=> '14',
'15'=> '15',
'16'=> '16',
'17'=> '17',
'18'=> '18',
);
// Available options
$available_add_before = array(
'Author' => l10n('Author'),
'datecreate'=> l10n('Created on'),
'datepost' => l10n('Posted on'),
'Dimensions'=> l10n('Dimensions'),
'File' => l10n('File'),
'Filesize' => l10n('Filesize'),
'Tags' => l10n('Tags'),
'Categories'=> l10n('Albums'),
'Visits' => l10n('Visits'),
'Average' => l10n('Rating score'),
'rating' => l10n('Rate this photo'),
'Privacy' => l10n('Who can see this photo?'),
);
// Available options
// 0 - PLUGIN_INDEX_CONTENT_BEGIN
// 1 - PLUGIN_INDEX_CONTENT_COMMENT
// 2 - PLUGIN_INDEX_CONTENT_END
$available_cat_index = array(
'0' => l10n('Thumbnail'),
'1' => l10n('Description'),
'2' => l10n('Last'),
);
// Available pin
$available_pin = array(
'0' => l10n('NOPIN'),
'1' => l10n('DEFAULTPIN'),
'2' => l10n('DEFAULTPINGREEN'),
'3' => l10n('DEFAULTPINRED'),
'4' => l10n('LEAFPINGREEN'),
'5' => l10n('LEAFPINORANGE'),
'6' => l10n('LEAFPINRED'),
'7' => l10n('MAPICONSBLEU'),
'8' => l10n('MAPICONSGREEN'),
'9' => l10n('OWNPIN'),
'10'=> l10n('IMAGE'),
);
// Available popup
$available_popup = array(
'0' => l10n('CLICK'),
// '1' => l10n('ALWAYS'),
'2' => l10n('NEVER'),
);
// TF, 20160102: give choice where to show clicked picture
// Available popup click targets
$available_popup_click_target = array(
'0' => l10n('BLANK'),
'1' => l10n('TOP'),
// '2' => l10n('SELF'),
// '3' => l10n('PARENT'),
);
// Available layout value
$available_layout = array(
'1' => 'osm-map.tpl',
'2' => 'osm-map2.tpl',
'3' => 'osm-map3.tpl',
// '4' => 'osm-map4.tpl',
);
$query = 'SELECT COUNT(*) FROM '.IMAGES_TABLE.' WHERE `latitude` IS NOT NULL and `longitude` IS NOT NULL ';
list($nb_geotagged) = pwg_db_fetch_array( pwg_query($query) );
// Update conf if submitted in admin site
if (isset($_POST['submit']) && !empty($_POST['osm_height']))
{
// Check the center GPS position is valid
$osm_left_center = (isset($_POST['osm_left_center']) and strlen($_POST['osm_left_center']) != 0) ? $_POST['osm_left_center'] : '0,0';
$center_arr = explode(',', $osm_left_center);
//print_r($center_arr);
$latitude = $center_arr[0];
$longitude = $center_arr[1];
if (isset($latitude) and isset($longitude))
if ( strlen($latitude)==0 and strlen($longitude)==0 )
array_push($page['warnings'], l10n('Both latitude/longitude must not empty'));
if (isset($latitude) and ($latitude <= -90 or $latitude >= 90))
array_push($page['warnings'], l10n('The specify center latitude (-90=S to 90=N) is not valid'));
if (isset($longitude) and ($longitude <= -180 or $longitude >= 180))
array_push($page['warnings'], l10n('The specify center longitude (-180=W to 180=E) is not valid'));
// On post admin form
$conf['osm_conf'] = array(
'right_panel' => array(
'enabled' => get_boolean($_POST['osm_right_panel']),
'add_before' => $_POST['osm_add_before'],
'height' => $_POST['osm_height'],
'zoom' => $_POST['osm_zoom'],
'link' => $_POST['osm_right_link'],
'linkcss' => $_POST['osm_right_linkcss'],
'showosm' => get_boolean($_POST['osm_showosm']),
),
'left_menu' => array(
'enabled' => get_boolean($_POST['osm_left_menu']),
'link' => $_POST['osm_left_link'],
'popup' => $_POST['osm_left_popup'],
'popupinfo_name' => isset($_POST['osm_left_popupinfo_name']),
'popupinfo_img' => isset($_POST['osm_left_popupinfo_img']),
'popupinfo_link' => isset($_POST['osm_left_popupinfo_link']),
'popupinfo_comment' => isset($_POST['osm_left_popupinfo_comment']),
'popupinfo_author' => isset($_POST['osm_left_popupinfo_author']),
'popup_click_target'=> $_POST['osm_left_popup_click_target'],
'zoom' => $_POST['osm_left_zoom'],
'center' => $osm_left_center,
'autocenter' => get_boolean($_POST['osm_left_autocenter']),
'layout' => $_POST['osm_left_layout'],
),
'category_description' => array(
'enabled' => get_boolean($_POST['osm_category_description']),
'height' => $_POST['osm_cat_height'],
'width' => $_POST['osm_cat_width'],
'index' => $_POST['osm_cat_index'],
// TF, 20160102: improve performance by hiding gpx tracks of sub-categories
'nogpxforsubcat' => get_boolean($_POST['osm_nogpxforsubcat']),
// TF, 20160102: improve performance by only showing firsat image of sub-categories
'firstimageforsubcat' => get_boolean($_POST['osm_firstimageforsubcat']),
),
'main_menu' => array(
'enabled' => get_boolean($_POST['osm_main_menu']),
'height' => $_POST['osm_menu_height'],
),
'gpx' => array(
'height' => $_POST['osm_gpx_height'],
'width' => $_POST['osm_gpx_width'],
),
'batch' => array(
'global_height' => $_POST['osm_batch_global_height'],
'unit_height' => $_POST['osm_batch_unit_height'],
),
'map' => array(
'baselayer' => $_POST['osm_baselayer'],
'custombaselayer' => $_POST['osm_custombaselayer'],
'custombaselayerurl' => $_POST['osm_custombaselayerurl'],
'noworldwarp' => get_boolean($_POST['osm_noworldwarp']),
'attrleaflet' => get_boolean($_POST['osm_attrleaflet']),
'attrimagery' => get_boolean($_POST['osm_attrimagery']),
'attrplugin' => get_boolean($_POST['osm_attrplugin']),
'mapquestapi' => $_POST['osm_mapquestapi'],
<<<<<<< HEAD
),
=======
),
>>>>>>> refs/remotes/Piwigo/master
'pin' => array(
'pin' => $_POST['osm_pin'],
'pinpath' => $_POST['osm_pinpath'],
'pinsize' => $_POST['osm_pinsize'],
'pinshadowpath' => $_POST['osm_pinshadowpath'],
'pinshadowsize' => $_POST['osm_pinshadowsize'],
'pinoffset' => $_POST['osm_pinoffset'],
'pinpopupoffset' => $_POST['osm_pinpopupoffset'],
),
);
// Update config to DB
conf_update_param('osm_conf', serialize($conf['osm_conf']));
// the prefilter changes, we must delete compiled templatess
$template->delete_compiled_templates();
array_push($page['infos'], l10n('Your configuration settings are saved'));
}
// send value to template
$template->assign($conf['osm_conf']);
$template->assign(
array(
'AVAILABLE_ADD_BEFORE' => $available_add_before,
'AVAILABLE_CAT_INDEX' => $available_cat_index,
'AVAILABLE_ZOOM' => $available_zoom,
'AVAILABLE_BASELAYER' => $available_baselayer,
'AVAILABLE_PIN' => $available_pin,
'AVAILABLE_POPUP' => $available_popup,
'AVAILABLE_POPUP_CLICK_TARGET' => $available_popup_click_target,
'AVAILABLE_LAYOUT' => $available_layout,
'NB_GEOTAGGED' => $nb_geotagged,
'OSM_PATH' => OSM_PATH,
'GLOBAL_MODE' => l10n('global mode'),
'SINGLE_MODE' => l10n('unit mode'),
)
);
?>