[25678] | 1 | <?php |
---|
[16591] | 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. |
---|
[23361] | 6 | Plugin URI: auto |
---|
[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 | |
---|
[25678] | 15 | define('USER_COLLEC_ID', basename(dirname(__FILE__))); |
---|
[23551] | 16 | define('USER_COLLEC_PATH', PHPWG_PLUGINS_PATH . USER_COLLEC_ID . '/'); |
---|
| 17 | define('COLLECTIONS_TABLE', $prefixeTable.'collections'); |
---|
| 18 | define('COLLECTION_IMAGES_TABLE', $prefixeTable.'collection_images'); |
---|
[24421] | 19 | define('COLLECTION_SHARES_TABLE', $prefixeTable.'collection_shares'); |
---|
[23551] | 20 | define('USER_COLLEC_ADMIN', get_root_url() . 'admin.php?page=plugin-' . USER_COLLEC_ID); |
---|
| 21 | define('USER_COLLEC_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'collections')) . '/'); |
---|
[19843] | 22 | define('USER_COLLEC_VERSION', 'auto'); |
---|
[16591] | 23 | |
---|
| 24 | add_event_handler('init', 'user_collections_init'); |
---|
| 25 | |
---|
| 26 | |
---|
[17657] | 27 | /** |
---|
| 28 | * update plugin & load language |
---|
| 29 | */ |
---|
| 30 | function user_collections_init() |
---|
| 31 | { |
---|
[25678] | 32 | include_once(USER_COLLEC_PATH . 'maintain.inc.php'); |
---|
| 33 | $maintain = new UserCollections_maintain(USER_COLLEC_ID); |
---|
| 34 | $maintain->autoUpdate(USER_COLLEC_VERSION, 'install'); |
---|
[26055] | 35 | |
---|
| 36 | if (mobile_theme()) |
---|
| 37 | { |
---|
| 38 | return; |
---|
| 39 | } |
---|
[25678] | 40 | |
---|
[17657] | 41 | load_language('plugin.lang', USER_COLLEC_PATH); |
---|
[25678] | 42 | |
---|
[26055] | 43 | global $conf; |
---|
[20090] | 44 | $conf['user_collections'] = unserialize($conf['user_collections']); |
---|
[26055] | 45 | |
---|
| 46 | require_once(USER_COLLEC_PATH . 'include/ws_functions.inc.php'); |
---|
| 47 | require_once(USER_COLLEC_PATH . 'include/functions.inc.php'); |
---|
| 48 | require_once(USER_COLLEC_PATH . 'include/UserCollection.class.php'); |
---|
| 49 | require_once(USER_COLLEC_PATH . 'include/events.inc.php'); |
---|
| 50 | |
---|
| 51 | add_event_handler('ws_add_methods', 'user_collections_ws_add_methods'); |
---|
| 52 | |
---|
| 53 | if (defined('IN_ADMIN')) |
---|
| 54 | { |
---|
| 55 | add_event_handler('get_admin_plugin_menu_links', 'user_collections_admin_menu'); |
---|
| 56 | } |
---|
| 57 | else |
---|
| 58 | { |
---|
| 59 | // collections page |
---|
| 60 | add_event_handler('loc_end_section_init', 'user_collections_section_init'); |
---|
| 61 | add_event_handler('loc_end_index', 'user_collections_page', EVENT_HANDLER_PRIORITY_NEUTRAL-10); |
---|
| 62 | |
---|
| 63 | // thumbnails actions |
---|
| 64 | add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_list', EVENT_HANDLER_PRIORITY_NEUTRAL-10, 2); |
---|
| 65 | |
---|
| 66 | // picture action |
---|
| 67 | add_event_handler('loc_end_picture', 'user_collections_picture_page'); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | // menu |
---|
| 71 | add_event_handler('blockmanager_register_blocks', 'user_collections_add_menublock'); |
---|
| 72 | add_event_handler('blockmanager_apply', 'user_collections_applymenu'); |
---|
[17657] | 73 | } |
---|
| 74 | |
---|
[20090] | 75 | /** |
---|
| 76 | * admin plugins menu |
---|
| 77 | */ |
---|
[25678] | 78 | function user_collections_admin_menu($menu) |
---|
[20090] | 79 | { |
---|
[25678] | 80 | $menu[] = array( |
---|
[20090] | 81 | 'NAME' => 'User Collections', |
---|
| 82 | 'URL' => USER_COLLEC_ADMIN, |
---|
[25678] | 83 | ); |
---|
| 84 | |
---|
[20090] | 85 | return $menu; |
---|
| 86 | } |
---|