diff options
author | mistic100 <mistic@piwigo.org> | 2014-06-13 19:53:56 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2014-06-13 19:53:56 +0000 |
commit | 0018bcd9f5ed3e86edfa83b389a8f2e42cf4101e (patch) | |
tree | fdf2b5d26b0db04856c4ed590f9954b2ddcd2b55 /plugins/AdminTools/main.inc.php | |
parent | 715f13b123c799eb5dae73147278a6e67fb1d8ea (diff) |
add AdminTools to trunk
git-svn-id: http://piwigo.org/svn/trunk@28694 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins/AdminTools/main.inc.php')
-rw-r--r-- | plugins/AdminTools/main.inc.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/plugins/AdminTools/main.inc.php b/plugins/AdminTools/main.inc.php new file mode 100644 index 000000000..ac12cd302 --- /dev/null +++ b/plugins/AdminTools/main.inc.php @@ -0,0 +1,61 @@ +<?php +/* +Plugin Name: Admin Tools +Version: auto +Description: Do some admin task from the public pages +Plugin URI: auto +Author: Mistic +Author URI: http://www.strangeplanet.fr +*/ + +defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); + +define('ADMINTOOLS_ID', basename(dirname(__FILE__))); +define('ADMINTOOLS_PATH' , PHPWG_PLUGINS_PATH . ADMINTOOLS_ID . '/'); +define('ADMINTOOLS_ADMIN', get_root_url() . 'admin.php?page=plugin-' . ADMINTOOLS_ID); + +include_once(ADMINTOOLS_PATH . 'include/events.inc.php'); +include_once(ADMINTOOLS_PATH . 'include/MultiView.class.php'); + + +global $MultiView; +$MultiView = new MultiView(); + +add_event_handler('init', 'admintools_init'); + +add_event_handler('user_init', array(&$MultiView, 'user_init')); +add_event_handler('init', array(&$MultiView, 'init')); + +add_event_handler('ws_add_methods', array('MultiView', 'register_ws')); +add_event_handler('delete_user', array('MultiView', 'invalidate_cache')); +add_event_handler('register_user', array('MultiView', 'invalidate_cache')); + +if (!defined('IN_ADMIN')) +{ + add_event_handler('loc_after_page_header', 'admintools_add_public_controller'); + add_event_handler('loc_begin_picture', 'admintools_save_picture'); + add_event_handler('loc_begin_index', 'admintools_save_category'); +} +else +{ + add_event_handler('get_admin_plugin_menu_links', 'admintools_admin_link'); +} + + +function admintools_init() +{ + global $conf; + $conf['AdminTools'] = safe_unserialize($conf['AdminTools']); + + load_language('plugin.lang', ADMINTOOLS_PATH); +} + +function admintools_admin_link($menu) +{ + $menu[] = array( + 'NAME' => 'Admin Tools', + 'URL' => ADMINTOOLS_ADMIN, + ); + + return $menu; +} |