source: extensions/linked_pages/main.inc.php @ 25059

Last change on this file since 25059 was 23218, checked in by mistic100, 11 years ago

prevent bad display when page name contains double quotes

File size: 2.2 KB
RevLine 
[17882]1<?php 
2/*
3Plugin Name: Linked Pages
4Version: auto
5Description: Link Additional Pages to albums.
[23218]6Plugin URI: auto
[17882]7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
[22866]13if (mobile_theme())
14{
15  return;
16}
17
[17882]18global $prefixeTable;
19
20// +-----------------------------------------------------------------------+
21// | Define plugin constants                                               |
22// +-----------------------------------------------------------------------+
[17925]23defined('LINKEDPAGES_ID') or define('LINKEDPAGES_ID', basename(dirname(__FILE__)));
24define('LINKEDPAGES_PATH' ,   PHPWG_PLUGINS_PATH . LINKEDPAGES_ID . '/');
[17882]25define('LINKEDPAGES_TABLE',   $prefixeTable . 'linked_pages');
[17925]26define('LINKEDPAGES_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . LINKEDPAGES_ID);
[21326]27define('LINKEDPAGES_VERSION', 'auto');
[17882]28
29
30// init the plugin
31add_event_handler('init', 'linked_pages_init');
32
33
34/**
35 * plugin initialization
36 */
37function linked_pages_init()
38{
39  global $conf, $pwg_loaded_plugins;
40 
41  if (!isset($pwg_loaded_plugins['AdditionalPages']))
42  {
43    return;
44  }
45 
[17888]46  // add event handlers
47  if (defined('IN_ADMIN'))
48  {
49    add_event_handler('tabsheet_before_select', 'linked_pages_tabsheet_before_select', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
50  }
51  else
52  {
53    add_event_handler('loc_end_index', 'linked_pages_loc_end_index', EVENT_HANDLER_PRIORITY_NEUTRAL+20);
54  }
55
56  include_once(LINKEDPAGES_PATH . 'include/functions.inc.php');
57 
[17882]58  if (
[21326]59    LINKEDPAGES_VERSION == 'auto' or
[17925]60    $pwg_loaded_plugins[LINKEDPAGES_ID]['version'] == 'auto' or
61    version_compare($pwg_loaded_plugins[LINKEDPAGES_ID]['version'], LINKEDPAGES_VERSION, '<')
[17882]62  )
63  {
64    include_once(LINKEDPAGES_PATH . 'include/install.inc.php');
65    linked_pages_install();
66   
[21326]67    if ( $pwg_loaded_plugins[LINKEDPAGES_ID]['version'] != 'auto' and LINKEDPAGES_VERSION != 'auto')
[17882]68    {
69      $query = '
70UPDATE '. PLUGINS_TABLE .'
71SET version = "'. LINKEDPAGES_VERSION .'"
[17925]72WHERE id = "'. LINKEDPAGES_ID .'"';
[17882]73      pwg_query($query);
74     
[17925]75      $pwg_loaded_plugins[LINKEDPAGES_ID]['version'] = LINKEDPAGES_VERSION;
[17882]76     
77      if (defined('IN_ADMIN'))
78      {
[17925]79        $_SESSION['page_infos'][] = 'Linked Pages updated to version '. LINKEDPAGES_VERSION;
[17882]80      }
81    }
82  }
83}
84
85?>
Note: See TracBrowser for help on using the repository browser.