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