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

Last change on this file since 15181 was 14913, checked in by psli, 12 years ago

Version 1.3 :

  • correction de l'upgrade
  • correction des chemins d'accès
File size: 2.5 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-----------------------------------------------------------------------------------------
101.1             2012-05-08      Ajout de l'internationalisation et de l'anglais
11-----------------------------------------------------------------------------------------
121.0             2012-05-07      Verison initiale
13-----------------------------------------------------------------------------------------
14*/
15// Chech whether we are indeed included by Piwigo.
16if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
17
18// define Path for PHP and JS file
19define ('PSLI_BINGMAPS_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
20//define ('PSLI_BINGMAPS_JS', PSLI_BINGMAPS_PATH.'JS/Psli-BingMaps.js');
21define ('PSLI_BINGMAPS_VERSION_INC_PHP', PSLI_BINGMAPS_PATH.'include/version.inc.php');
22define ('PSLI_BINGMAPS_ADMIN_INC_PHP', PSLI_BINGMAPS_PATH.'include/admin.inc.php');
23define ('PSLI_BINGMAPS_GUEST_INC_PHP', PSLI_BINGMAPS_PATH.'include/guest.inc.php');
24define ('PSLI_BINGMAPS_ADMIN_PHP', PSLI_BINGMAPS_PATH.'include/admin.php');
25
26// define Path for template file
27define('PSLI_BINGMAPS_TEMPLATE_PATH', dirname(__FILE__).'/');
28define ('PSLI_BINGMAPS_ADMIN_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'template/admin.tpl');
29
30// Include define data
31include_once(dirname(__FILE__).'/include/const.inc.php');
32
33// Check plugin update
34include_once(PSLI_BINGMAPS_VERSION_INC_PHP);
35
36// Plugin for admin
37if (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}
60else
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?>
Note: See TracBrowser for help on using the repository browser.