-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmap.php
95 lines (81 loc) · 2.83 KB
/
map.php
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
<?php
if ( !defined('PHPWG_ROOT_PATH') )
define('PHPWG_ROOT_PATH','../../');
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
include_once( dirname(__FILE__) .'/include/functions.php');
include_once( dirname(__FILE__) .'/include/functions_map.php');
check_status(ACCESS_GUEST);
if (!isset($rvm_dir))
access_denied( 'Plugin not installed' );
rvm_load_language();
$section = '';
if ( $conf['question_mark_in_urls']==false and
isset($_SERVER["PATH_INFO"]) and !empty($_SERVER["PATH_INFO"]) )
{
$section = $_SERVER["PATH_INFO"];
$section = str_replace('//', '/', $section);
$path_count = count( explode('/', $section) );
$page['root_path'] = PHPWG_ROOT_PATH.str_repeat('../', $path_count-1);
if ( strncmp($page['root_path'], './', 2) == 0 )
{
$page['root_path'] = substr($page['root_path'], 2);
}
}
else
{
foreach ($_GET as $key=>$value)
{
if (!strlen($value)) $section=$key;
break;
}
}
// deleting first "/" if displayed
$tokens = explode(
'/',
preg_replace('#^/#', '', $section)
);
$next_token = 0;
$result = rvm_parse_map_data_url($tokens, $next_token);
$page = array_merge( $page, $result );
if (isset($page['category']))
check_restrictions($page['category']['id']);
if ( !isset($_GET['ll']) /*and ($page['section']!='categories' or isset($page['category']) )*/ )
{
$img_fields = 'MIN(i.latitude) s, MIN(i.longitude) w, MAX(i.latitude) n, MAX(i.longitude) e';
$page['flat']=true;
rvm_build_section_items($img_fields, null, RVM_BUILD_AGGREGATE);
//var_export( $page['items'] );
if ( isset($page['items'][0]['s']) )
$template->assign('initial_bounds', $page['items'][0] );
unset( $page['items'] );
}
$map_data_url = get_absolute_root_url().'plugins/'.$rvm_dir.'/map_data.php?';
$map_data_url .= $section;
$template->set_filename( 'map', dirname(__FILE__).'/template/map.tpl' );
$template->assign(
array(
'GMAPS_API_KEY' => !empty($conf['gmaps_api_key']) ? $conf['gmaps_api_key'] : '',
'CONTENT_ENCODING' => get_pwg_charset(),
'RVM_PLUGIN_VERSION' => RVM_PLUGIN_VERSION,
'PLUGIN_ROOT_URL' => get_absolute_root_url().'plugins/'.$rvm_dir,
'PLUGIN_LOCATION' => 'plugins/'.$rvm_dir,
'U_MAP_DATA' => $map_data_url,
'GALLERY_TITLE' => $conf['gallery_title'],
'U_HOME' => make_index_url(),
'U_HOME_MAP' => rvm_make_map_index_url(),
'MAP_TYPE' => rvm_get_config_var('map_type', 'ROADMAP'),
)
);
$marker_js_file = rvm_get_config_var('marker_icon', '');
if ( !empty($marker_js_file) )
$marker_js_file = dirname(__FILE__).'/template/markers/'.$marker_js_file.'.tpl';
if ( !empty($marker_js_file) and file_exists($marker_js_file) )
{
$template->set_filename( 'map_marker_icon', $marker_js_file );
$template->assign_var_from_handle('MAP_MARKER_ICON_JS', 'map_marker_icon');
}
else
$template->assign('MAP_MARKER_ICON_JS', 'new PwgSingleStyler()');
$template->pparse('map');
$template->p();
?>