1 | <?php |
---|
2 | /* |
---|
3 | Version: 1.2 |
---|
4 | Plugin Name: Psli-BingMaps |
---|
5 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=603 |
---|
6 | Author: psli |
---|
7 | Description: Extension to piwigo for use of bing maps to navigate in geolocalized album |
---|
8 | |
---|
9 | ----------------------------------------------------------------------------------------- |
---|
10 | 1.1 2012-05-08 Ajout de l'internationalisation et de l'anglais |
---|
11 | ----------------------------------------------------------------------------------------- |
---|
12 | 1.0 2012-05-07 Verison initiale |
---|
13 | ----------------------------------------------------------------------------------------- |
---|
14 | */ |
---|
15 | // Chech whether we are indeed included by Piwigo. |
---|
16 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
17 | |
---|
18 | // define Path for PHP and JS file |
---|
19 | define ('PSLI_BINGMAPS_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
20 | //define ('PSLI_BINGMAPS_JS', PSLI_BINGMAPS_PATH.'JS/Psli-BingMaps.js'); |
---|
21 | define ('PSLI_BINGMAPS_VERSION_INC_PHP', PSLI_BINGMAPS_PATH.'include/version.inc.php'); |
---|
22 | define ('PSLI_BINGMAPS_ADMIN_INC_PHP', PSLI_BINGMAPS_PATH.'include/admin.inc.php'); |
---|
23 | define ('PSLI_BINGMAPS_GUEST_INC_PHP', PSLI_BINGMAPS_PATH.'include/guest.inc.php'); |
---|
24 | define ('PSLI_BINGMAPS_ADMIN_PHP', PSLI_BINGMAPS_PATH.'include/admin.php'); |
---|
25 | |
---|
26 | // define Path for template file |
---|
27 | define('PSLI_BINGMAPS_TEMPLATE_PATH', dirname(__FILE__).'/'); |
---|
28 | define ('PSLI_BINGMAPS_ADMIN_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'template/admin.tpl'); |
---|
29 | |
---|
30 | // Include define data |
---|
31 | include_once(dirname(__FILE__).'/include/const.inc.php'); |
---|
32 | |
---|
33 | // Check plugin update |
---|
34 | include_once(PSLI_BINGMAPS_VERSION_INC_PHP); |
---|
35 | |
---|
36 | // Plugin for admin |
---|
37 | if (script_basename() == 'admin') |
---|
38 | { |
---|
39 | // Check if site root changed |
---|
40 | // define Path for JS file |
---|
41 | $query = ' |
---|
42 | SELECT value |
---|
43 | FROM '.CONFIG_TABLE.' |
---|
44 | WHERE param = "'.PSLI_CONF_PATH.'";'; |
---|
45 | $result = pwg_query($query); |
---|
46 | $row = pwg_db_fetch_assoc($result); |
---|
47 | $root = 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'],0, strrpos($_SERVER['REQUEST_URI'],"/")).'/'; |
---|
48 | if ($root != $row['value']) |
---|
49 | { |
---|
50 | $sql = 'UPDATE '.CONFIG_TABLE." SET value = '".$root."' WHERE param = '".PSLI_CONF_PATH."';"; |
---|
51 | pwg_query($sql); |
---|
52 | } |
---|
53 | else |
---|
54 | { |
---|
55 | $root = $row['value']; |
---|
56 | } |
---|
57 | define ('PSLI_BINGMAPS_JS', $root.'plugins/Psli-BingMaps/JS/Psli-BingMaps.js'); |
---|
58 | include_once(PSLI_BINGMAPS_ADMIN_INC_PHP); |
---|
59 | } |
---|
60 | else |
---|
61 | { |
---|
62 | // define Path for JS file |
---|
63 | $query = ' |
---|
64 | SELECT value |
---|
65 | FROM '.CONFIG_TABLE.' |
---|
66 | WHERE param = "'.PSLI_CONF_PATH.'";'; |
---|
67 | $result = pwg_query($query); |
---|
68 | $row = pwg_db_fetch_assoc($result); |
---|
69 | define ('PSLI_BINGMAPS_JS', $row['value'].'plugins/Psli-BingMaps/JS/Psli-BingMaps.js'); |
---|
70 | |
---|
71 | include_once(PSLI_BINGMAPS_GUEST_INC_PHP); |
---|
72 | } |
---|
73 | |
---|
74 | ?> |
---|