source: extensions/UserCollections/main.inc.php @ 19843

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

text collection name, absolute path for zClip inclusion

File size: 2.6 KB
Line 
1<?php 
2/*
3Plugin Name: User Collections
4Version: auto
5Description: Registered users can select pictures from the gallery and save them into collections, like advanced favorites.
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=615
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
12
13global $conf, $prefixeTable;
14
15define('USER_COLLEC_PATH',       PHPWG_PLUGINS_PATH . 'UserCollections/');
16define('COLLECTIONS_TABLE',      $prefixeTable.'collections');
17define('COLLECTION_IMAGES_TABLE',$prefixeTable.'collection_images');
18define('USER_COLLEC_ADMIN',      get_root_url() . 'admin.php?page=plugin-UserCollections');
19define('USER_COLLEC_PUBLIC',     get_absolute_root_url() . make_index_url(array('section' => 'collections')) . '/');
20define('USER_COLLEC_VERSION',    'auto');
21
22
23add_event_handler('init', 'user_collections_init');
24
25add_event_handler('loc_end_section_init', 'user_collections_section_init');
26add_event_handler('loc_end_index', 'user_collections_page', EVENT_HANDLER_PRIORITY_NEUTRAL-10);
27
28add_event_handler('loc_end_index', 'user_collections_index_actions');
29add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_list', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
30
31add_event_handler('loc_end_picture', 'user_collections_picture_page');
32
33add_event_handler('blockmanager_register_blocks', 'user_collections_add_menublock');
34add_event_handler('blockmanager_apply', 'user_collections_applymenu');
35
36require(USER_COLLEC_PATH . 'include/functions.inc.php');
37require(USER_COLLEC_PATH . 'include/UserCollection.class.php');
38require(USER_COLLEC_PATH . 'include/events.inc.php');
39
40
41/**
42 * update plugin & load language
43 */
44function user_collections_init()
45{
46  global $pwg_loaded_plugins;
47 
48  if (
49    USER_COLLEC_VERSION == 'auto' or
50    $pwg_loaded_plugins['UserCollections']['version'] == 'auto' or
51    version_compare($pwg_loaded_plugins['UserCollections']['version'], USER_COLLEC_VERSION, '<')
52  )
53  {
54    include_once(USER_COLLEC_PATH . 'include/install.inc.php');
55    user_collections_install();
56   
57    if ( $pwg_loaded_plugins['UserCollections']['version'] != 'auto' and USER_COLLEC_VERSION != 'auto' )
58    {
59      $query = '
60UPDATE '. PLUGINS_TABLE .'
61SET version = "'. USER_COLLEC_VERSION .'"
62WHERE id = "UserCollections"';
63      pwg_query($query);
64     
65      $pwg_loaded_plugins['UserCollections']['version'] = USER_COLLEC_VERSION;
66     
67      if (defined('IN_ADMIN'))
68      {
69        $_SESSION['page_infos'][] = 'UserCollections updated to version '. USER_COLLEC_VERSION;
70      }
71    }
72  }
73 
74  load_language('plugin.lang', USER_COLLEC_PATH);
75}
76
77?>
Note: See TracBrowser for help on using the repository browser.