source: extensions/Psli_BingMaps/main.inc.php @ 32713

Last change on this file since 32713 was 15432, checked in by psli, 13 years ago

Pre-Version 2.0

File size: 5.0 KB
Line 
1<?php
2/*
3Version: 1.2
4Plugin Name: Psli-BingMaps
5Plugin URI: http://piwigo.org/ext/extension_view.php?eid=603
6Author: psli
7Description: Extension to piwigo for use of bing maps to navigate in geolocalized album
8*/
9// Chech whether we are indeed included by Piwigo.
10if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
11
12// define generic Path
13define ('PSLI_BINGMAPS_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
14define('PSLI_BINGMAPS_TEMPLATE_PATH', dirname(__FILE__).'/');
15define ('PSLI_BINGMAPS_VERSION_INC_PHP', PSLI_BINGMAPS_PATH.'include/version.inc.php');
16
17// Include define data and global function
18include_once(dirname(__FILE__).'/include/const.inc.php');
19include_once(dirname(__FILE__).'/include/function.inc.php');
20
21// Check plugin update
22include_once(PSLI_BINGMAPS_VERSION_INC_PHP);
23
24//******* Language data *******
25load_language('plugin.lang', PSLI_BINGMAPS_TEMPLATE_PATH);
26
27// Plugin for admin
28if (script_basename() == 'admin')   
29{
30        // Check if site root changed
31        // define Path for JS file
32        $query = '
33                SELECT value
34                        FROM '.CONFIG_TABLE.'
35                        WHERE param = "'.PSLI_CONF_PATH.'";';
36        $result = pwg_query($query);
37        $row = pwg_db_fetch_assoc($result);
38        $root = 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'],0, strrpos($_SERVER['REQUEST_URI'],"/")).'/';
39        if ($root != $row['value'])
40        {
41                $sql = 'UPDATE '.CONFIG_TABLE." SET value = '".$root."' WHERE param = '".PSLI_CONF_PATH."';";   
42                pwg_query($sql);
43        }
44        else   
45        {
46                $root = $row['value'];
47        }
48       
49        // define Path for admin file
50        define ('PSLI_BINGMAPS_ADMIN_PHP', PSLI_BINGMAPS_PATH.'admin/admin.php');
51        define ('PSLI_BINGMAPS_CLASS_ENTITY_PHP', PSLI_BINGMAPS_PATH.'admin/class/psli_entity.class.php');
52       
53        // Define path for configuration tab
54        define ('PSLI_BINGMAPS_ADMIN_CONF_PHP', PSLI_BINGMAPS_PATH.'admin/include/admin_conf.inc.php');
55        define ('PSLI_BINGMAPS_ADMIN_CONF_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'admin/template/admin_conf.tpl');
56       
57        // Define path for map tab
58        define ('PSLI_BINGMAPS_ADMIN_MAP_PHP', PSLI_BINGMAPS_PATH.'admin/include/admin_map.inc.php');
59        define ('PSLI_BINGMAPS_CLASS_MAP_PHP', PSLI_BINGMAPS_PATH.'admin/class/psli_map.class.php');
60        define ('PSLI_BINGMAPS_ADMIN_MAP_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'admin/template/admin_map.tpl');
61        define ('PSLI_BINGMAPS_JS_MAP', $root.'plugins/Psli-BingMaps/admin/JS/Psli-BingMaps-Map.js');
62       
63        // Define path for pin tab
64        define ('PSLI_BINGMAPS_ADMIN_PIN_PHP', PSLI_BINGMAPS_PATH.'admin/include/admin_pin.inc.php');
65        define ('PSLI_BINGMAPS_CLASS_PIN_PHP', PSLI_BINGMAPS_PATH.'admin/class/psli_pin.class.php');
66        define ('PSLI_BINGMAPS_ADMIN_PIN_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'admin/template/admin_pin.tpl');
67        define ('PSLI_BINGMAPS_JS_PIN', $root.'plugins/Psli-BingMaps/admin/JS/Psli-BingMaps-Pin.js');
68       
69        // Define path for zone tab
70        define ('PSLI_BINGMAPS_ADMIN_ZONE_PHP', PSLI_BINGMAPS_PATH.'admin/include/admin_zone.inc.php');
71        define ('PSLI_BINGMAPS_CLASS_ZONE_PHP', PSLI_BINGMAPS_PATH.'admin/class/psli_zone.class.php');
72        define ('PSLI_BINGMAPS_ADMIN_ZONE_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'admin/template/admin_zone.tpl');
73        define ('PSLI_BINGMAPS_JS_ZONE', $root.'plugins/Psli-BingMaps/admin/JS/Psli-BingMaps-Zone.js');
74       
75        // Define path for picture tab
76        define ('PSLI_BINGMAPS_ADMIN_PICTURE_PHP', PSLI_BINGMAPS_PATH.'admin/include/admin_picture.inc.php');
77        define ('PSLI_BINGMAPS_CLASS_PICTURE_PHP', PSLI_BINGMAPS_PATH.'admin/class/psli_picture.class.php');
78        define ('PSLI_BINGMAPS_ADMIN_PICTURE_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'admin/template/admin_picture.tpl');
79       
80        // Define path for exif tab
81        define ('PSLI_BINGMAPS_ADMIN_EXIF_PHP', PSLI_BINGMAPS_PATH.'admin/include/admin_exif.inc.php');
82        define ('PSLI_BINGMAPS_ADMIN_EXIF_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'admin/template/admin_exif.tpl');
83       
84        // Define path for batch tab
85        define ('PSLI_BINGMAPS_ADMIN_BATCH_PHP', PSLI_BINGMAPS_PATH.'admin/include/admin_batch.inc.php');
86        define ('PSLI_BINGMAPS_ADMIN_BATCH_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'admin/template/admin_batch.tpl');
87        define ('PSLI_BINGMAPS_ADMIN_BATCH_CSS', PSLI_BINGMAPS_PATH.'admin/css/admin_batch.css');
88       
89       
90        // Hook on to event on administration page.
91        add_event_handler('get_admin_plugin_menu_links', 'PSLIBINGMAPS_admin_menu');
92}
93else
94{
95        // define Path for JS file
96        $query = '
97                SELECT value
98                        FROM '.CONFIG_TABLE.'
99                        WHERE param = "'.PSLI_CONF_PATH.'";';
100        $result = pwg_query($query);
101        $row = pwg_db_fetch_assoc($result);
102       
103        define ('PSLI_BINGMAPS_GUEST_INC_PHP', PSLI_BINGMAPS_PATH.'include/guest.inc.php');
104        define ('PSLI_BINGMAPS_JS', $row['value'].'plugins/Psli-BingMaps/JS/Psli-BingMaps.js');
105       
106        include_once(PSLI_BINGMAPS_GUEST_INC_PHP);
107}
108
109/********************************************************************************************/
110// Add an entry to the 'Plugins' menu.
111/********************************************************************************************/
112function PSLIBINGMAPS_admin_menu($menu) {
113 array_push(
114   $menu,
115   array(
116     'NAME'  => 'PSLI-BingMaps',
117     'URL'   => get_admin_plugin_menu_link(PSLI_BINGMAPS_ADMIN_PHP)
118   )
119 );
120 return $menu;
121}
122
123?>
Note: See TracBrowser for help on using the repository browser.