1 | <?php |
---|
2 | |
---|
3 | function cl_meta_get_cache_file_name() |
---|
4 | { |
---|
5 | global $conf; |
---|
6 | $dir = $conf['local_data_dir']; |
---|
7 | return $dir.'/tmp/_rvgm_cat_cache.dat'; |
---|
8 | } |
---|
9 | |
---|
10 | function cl_meta_invalidate_cache() |
---|
11 | { |
---|
12 | @unlink( cl_meta_get_cache_file_name() ); |
---|
13 | } |
---|
14 | |
---|
15 | function cl_meta_load_language() |
---|
16 | { |
---|
17 | global $lang,$lang_info,$conf; |
---|
18 | if ( isset($lang['Map']) or ($lang_info['code']=='en' and !$conf['debug_l10n']) ) |
---|
19 | return; |
---|
20 | load_language('lang', dirname(__FILE__).'/../'); |
---|
21 | } |
---|
22 | |
---|
23 | function cl_meta_items_have_latlon($items) |
---|
24 | { |
---|
25 | $query = ' |
---|
26 | SELECT id FROM '.IMAGES_TABLE.' |
---|
27 | WHERE lat IS NOT NULL |
---|
28 | AND id IN ('.implode(',', $items).') |
---|
29 | ORDER BY NULL |
---|
30 | LIMIT 0,1'; |
---|
31 | if ( mysql_num_rows(pwg_query($query))> 0) |
---|
32 | return true; |
---|
33 | return false; |
---|
34 | } |
---|
35 | |
---|
36 | function cl_meta_make_map_picture_url($params) |
---|
37 | { |
---|
38 | global $conf; |
---|
39 | if ( empty($conf['gmaps_api_key']) and $_SERVER['SERVER_ADDR']!='127.0.0.1' ) |
---|
40 | return ""; |
---|
41 | $map_url = make_picture_url($params); |
---|
42 | return add_url_params($map_url, array('map'=>null) ); |
---|
43 | } |
---|
44 | |
---|
45 | function cl_meta_duplicate_map_picture_url() |
---|
46 | { |
---|
47 | global $conf; |
---|
48 | if ( empty($conf['gmaps_api_key']) and $_SERVER['SERVER_ADDR']!='127.0.0.1' ) |
---|
49 | return ""; |
---|
50 | $map_url = duplicate_picture_url(); |
---|
51 | return add_url_params($map_url, array('map'=>null) ); |
---|
52 | } |
---|
53 | |
---|
54 | function cl_meta_make_map_index_url($params=array()) |
---|
55 | { |
---|
56 | global $conf, $cl_meta_dir; |
---|
57 | if ( empty($conf['gmaps_api_key']) and $_SERVER['SERVER_ADDR']!='127.0.0.1' ) |
---|
58 | return ""; |
---|
59 | $url = get_root_url().'map'; |
---|
60 | if ($conf['php_extension_in_urls']) |
---|
61 | $url .= '.php'; |
---|
62 | if ($conf['question_mark_in_urls']) |
---|
63 | $url .= '?'; |
---|
64 | $url .= make_section_in_url($params); |
---|
65 | $url = add_well_known_params_in_url($url, array_intersect_key($params, array('flat'=>1) ) ); |
---|
66 | return $url; |
---|
67 | } |
---|
68 | |
---|
69 | function cl_meta_duplicate_map_index_url($redefined=array(), $removed=array()) |
---|
70 | { |
---|
71 | return cl_meta_make_map_index_url( |
---|
72 | params_for_duplication($redefined, $removed) |
---|
73 | ); |
---|
74 | } |
---|
75 | |
---|
76 | function cl_meta_duplicate_kml_index_url($redefined=array(), $removed=array()) |
---|
77 | { |
---|
78 | return cl_meta_make_kml_index_url( |
---|
79 | params_for_duplication($redefined, $removed) |
---|
80 | ); |
---|
81 | } |
---|
82 | |
---|
83 | function cl_meta_make_kml_index_url($params) |
---|
84 | { |
---|
85 | global $conf, $cl_meta_dir; |
---|
86 | $url = get_root_url().'plugins/'.$cl_meta_dir.'/kml.php'; |
---|
87 | if ($conf['question_mark_in_urls']) |
---|
88 | $url .= '?'; |
---|
89 | |
---|
90 | $url .= make_section_in_url($params); |
---|
91 | unset( $params['start'] ); |
---|
92 | if ( 'categories'!=$params['section']) unset( $params['flat'] ); |
---|
93 | $url = add_well_known_params_in_url($url, $params); |
---|
94 | $get_params = array(); |
---|
95 | if ( isset($params['box']) and !empty($params['box']) ) |
---|
96 | { |
---|
97 | include_once( dirname(__FILE__).'/functions_map.php' ); |
---|
98 | if ( ! bounds_is_world($params['box']) ) |
---|
99 | $get_params['box'] = bounds_to_url($params['box']); |
---|
100 | } |
---|
101 | if ( isset($params['ll']) and !empty($params['ll']) ) |
---|
102 | $get_params['ll'] = $params['ll']['lat'].','.$params['ll']['lon']; |
---|
103 | $url = add_url_params($url, $get_params ); |
---|
104 | return $url; |
---|
105 | } |
---|
106 | ?> |
---|