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