[25617] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Admin Tools |
---|
| 4 | Version: auto |
---|
| 5 | Description: Do some admin task from the public pages |
---|
| 6 | Plugin URI: auto |
---|
| 7 | Author: Mistic |
---|
| 8 | Author URI: http://www.strangeplanet.fr |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
| 12 | |
---|
[25791] | 13 | |
---|
[25617] | 14 | // +-----------------------------------------------------------------------+ |
---|
| 15 | // | Plugin constants | |
---|
| 16 | // +-----------------------------------------------------------------------+ |
---|
[25915] | 17 | define('ADMINTOOLS_ID', basename(dirname(__FILE__))); |
---|
[25916] | 18 | define('ADMINTOOLS_PATH' , PHPWG_PLUGINS_PATH . ADMINTOOLS_ID . '/'); |
---|
[26061] | 19 | define('ADMINTOOLS_ADMIN', get_root_url() . 'admin.php?page=plugin-' . ADMINTOOLS_ID); |
---|
[25915] | 20 | define('ADMINTOOLS_VERSION', 'auto'); |
---|
[25617] | 21 | |
---|
| 22 | |
---|
| 23 | // +-----------------------------------------------------------------------+ |
---|
| 24 | // | Event handlers | |
---|
| 25 | // +-----------------------------------------------------------------------+ |
---|
| 26 | include_once(ADMINTOOLS_PATH . 'include/events.inc.php'); |
---|
| 27 | include_once(ADMINTOOLS_PATH . 'include/MultiView.class.php'); |
---|
| 28 | |
---|
| 29 | global $MultiView; |
---|
| 30 | $MultiView = new MultiView(); |
---|
| 31 | |
---|
[25655] | 32 | add_event_handler('init', 'admintools_init'); |
---|
[25617] | 33 | |
---|
| 34 | add_event_handler('user_init', array(&$MultiView, 'user_init')); |
---|
| 35 | add_event_handler('init', array(&$MultiView, 'init')); |
---|
| 36 | |
---|
[25817] | 37 | add_event_handler('ws_add_methods', array('MultiView', 'register_ws')); |
---|
[25818] | 38 | add_event_handler('delete_user', array('MultiView', 'invalidate_cache')); |
---|
| 39 | add_event_handler('register_user', array('MultiView', 'invalidate_cache')); |
---|
[25617] | 40 | |
---|
[25845] | 41 | if (!defined('IN_ADMIN')) |
---|
| 42 | { |
---|
| 43 | add_event_handler('loc_after_page_header', 'admintools_add_public_controller'); |
---|
| 44 | add_event_handler('loc_begin_picture', 'admintools_save_picture'); |
---|
| 45 | add_event_handler('loc_begin_index', 'admintools_save_category'); |
---|
| 46 | } |
---|
[26061] | 47 | else |
---|
| 48 | { |
---|
| 49 | add_event_handler('get_admin_plugin_menu_links', 'admintools_admin_link'); |
---|
| 50 | } |
---|
[25817] | 51 | |
---|
[25845] | 52 | |
---|
[25617] | 53 | // +-----------------------------------------------------------------------+ |
---|
| 54 | // | Plugin initialization | |
---|
| 55 | // +-----------------------------------------------------------------------+ |
---|
[25655] | 56 | function admintools_init() |
---|
| 57 | { |
---|
[26061] | 58 | global $conf; |
---|
[25845] | 59 | |
---|
[26061] | 60 | include_once(ADMINTOOLS_PATH . 'maintain.inc.php'); |
---|
| 61 | $maintain = new AdminTools_maintain(ADMINTOOLS_ID); |
---|
| 62 | $maintain->autoUpdate(ADMINTOOLS_VERSION, 'install'); |
---|
| 63 | |
---|
[25791] | 64 | load_language('plugin.lang', ADMINTOOLS_PATH); |
---|
| 65 | |
---|
[26061] | 66 | $conf['AdminTools'] = unserialize($conf['AdminTools']); |
---|
| 67 | } |
---|
[25617] | 68 | |
---|
[26061] | 69 | function admintools_admin_link($menu) |
---|
| 70 | { |
---|
| 71 | $menu[] = array( |
---|
| 72 | 'NAME' => 'Admin Tools', |
---|
| 73 | 'URL' => ADMINTOOLS_ADMIN, |
---|
| 74 | ); |
---|
[25845] | 75 | |
---|
[26061] | 76 | return $menu; |
---|
[25655] | 77 | } |
---|