Changeset 20090 for extensions/UserCollections/main.inc.php
- Timestamp:
- Jan 12, 2013, 3:13:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserCollections/main.inc.php
r19843 r20090 13 13 global $conf, $prefixeTable; 14 14 15 define('USER_COLLEC_PATH', PHPWG_PLUGINS_PATH . 'UserCollections/'); 15 defined('USER_COLLEC_ID') or define('USER_COLLEC_ID', basename(dirname(__FILE__))); 16 define('USER_COLLEC_PATH', PHPWG_PLUGINS_PATH . USER_COLLEC_ID . '/'); 16 17 define('COLLECTIONS_TABLE', $prefixeTable.'collections'); 17 18 define('COLLECTION_IMAGES_TABLE',$prefixeTable.'collection_images'); 18 define('USER_COLLEC_ADMIN', get_root_url() . 'admin.php?page=plugin- UserCollections');19 define('USER_COLLEC_ADMIN', get_root_url() . 'admin.php?page=plugin-' . USER_COLLEC_ID); 19 20 define('USER_COLLEC_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'collections')) . '/'); 20 21 define('USER_COLLEC_VERSION', 'auto'); 21 22 22 23 23 add_event_handler('init', 'user_collections_init'); 24 24 25 add_event_handler('loc_end_section_init', 'user_collections_section_init'); 26 add_event_handler('loc_end_index', 'user_collections_page', EVENT_HANDLER_PRIORITY_NEUTRAL-10); 25 add_event_handler('ws_add_methods', 'user_collections_ws_add_methods'); 27 26 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); 27 if (defined('IN_ADMIN')) 28 { 29 add_event_handler('get_admin_plugin_menu_links', 'user_collections_admin_menu'); 30 } 31 else 32 { 33 // collections page 34 add_event_handler('loc_begin_index', 'user_collections_save_pagination', EVENT_HANDLER_PRIORITY_NEUTRAL-10); 35 add_event_handler('loc_end_section_init', 'user_collections_section_init'); 36 add_event_handler('loc_end_index', 'user_collections_page', EVENT_HANDLER_PRIORITY_NEUTRAL-10); 30 37 31 add_event_handler('loc_end_picture', 'user_collections_picture_page'); 38 // thumbnails actions 39 add_event_handler('loc_end_index', 'user_collections_index_actions'); 40 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_list', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 32 41 33 add_event_handler('blockmanager_register_blocks', 'user_collections_add_menublock'); 34 add_event_handler('blockmanager_apply', 'user_collections_applymenu');42 // picture action 43 add_event_handler('loc_end_picture', 'user_collections_picture_page'); 35 44 45 // menu 46 add_event_handler('blockmanager_register_blocks', 'user_collections_add_menublock'); 47 add_event_handler('blockmanager_apply', 'user_collections_applymenu'); 48 } 49 50 require(USER_COLLEC_PATH . 'include/ws_functions.inc.php'); 36 51 require(USER_COLLEC_PATH . 'include/functions.inc.php'); 37 52 require(USER_COLLEC_PATH . 'include/UserCollection.class.php'); … … 44 59 function user_collections_init() 45 60 { 46 global $pwg_loaded_plugins ;61 global $pwg_loaded_plugins, $conf; 47 62 48 63 if ( 49 64 USER_COLLEC_VERSION == 'auto' or 50 $pwg_loaded_plugins[ 'UserCollections']['version'] == 'auto' or51 version_compare($pwg_loaded_plugins[ 'UserCollections']['version'], USER_COLLEC_VERSION, '<')65 $pwg_loaded_plugins[USER_COLLEC_ID]['version'] == 'auto' or 66 version_compare($pwg_loaded_plugins[USER_COLLEC_ID]['version'], USER_COLLEC_VERSION, '<') 52 67 ) 53 68 { … … 55 70 user_collections_install(); 56 71 57 if ( $pwg_loaded_plugins[ 'UserCollections']['version'] != 'auto' and USER_COLLEC_VERSION != 'auto' )72 if ( $pwg_loaded_plugins[USER_COLLEC_ID]['version'] != 'auto' and USER_COLLEC_VERSION != 'auto' ) 58 73 { 59 74 $query = ' 60 75 UPDATE '. PLUGINS_TABLE .' 61 76 SET version = "'. USER_COLLEC_VERSION .'" 62 WHERE id = " UserCollections"';77 WHERE id = "'. USER_COLLEC_ID .'"'; 63 78 pwg_query($query); 64 79 65 $pwg_loaded_plugins[ 'UserCollections']['version'] = USER_COLLEC_VERSION;80 $pwg_loaded_plugins[USER_COLLEC_ID]['version'] = USER_COLLEC_VERSION; 66 81 67 82 if (defined('IN_ADMIN')) … … 73 88 74 89 load_language('plugin.lang', USER_COLLEC_PATH); 90 91 $conf['user_collections'] = unserialize($conf['user_collections']); 92 } 93 94 /** 95 * admin plugins menu 96 */ 97 function user_collections_admin_menu($menu) 98 { 99 array_push($menu, array( 100 'NAME' => 'User Collections', 101 'URL' => USER_COLLEC_ADMIN, 102 )); 103 return $menu; 75 104 } 76 105
Note: See TracChangeset
for help on using the changeset viewer.