1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Admin Tools |
---|
4 | Version: 2.7.1 |
---|
5 | Description: Do some admin task from the public pages |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=720 |
---|
7 | Author: Piwigo team |
---|
8 | Author URI: http://piwigo.org |
---|
9 | */ |
---|
10 | |
---|
11 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
12 | |
---|
13 | define('ADMINTOOLS_ID', basename(dirname(__FILE__))); |
---|
14 | define('ADMINTOOLS_PATH' , PHPWG_PLUGINS_PATH . ADMINTOOLS_ID . '/'); |
---|
15 | define('ADMINTOOLS_ADMIN', get_root_url() . 'admin.php?page=plugin-' . ADMINTOOLS_ID); |
---|
16 | |
---|
17 | include_once(ADMINTOOLS_PATH . 'include/events.inc.php'); |
---|
18 | include_once(ADMINTOOLS_PATH . 'include/MultiView.class.php'); |
---|
19 | |
---|
20 | |
---|
21 | global $MultiView; |
---|
22 | $MultiView = new MultiView(); |
---|
23 | |
---|
24 | add_event_handler('init', 'admintools_init'); |
---|
25 | |
---|
26 | add_event_handler('user_init', array(&$MultiView, 'user_init')); |
---|
27 | add_event_handler('init', array(&$MultiView, 'init')); |
---|
28 | |
---|
29 | add_event_handler('ws_add_methods', array('MultiView', 'register_ws')); |
---|
30 | add_event_handler('delete_user', array('MultiView', 'invalidate_cache')); |
---|
31 | add_event_handler('register_user', array('MultiView', 'invalidate_cache')); |
---|
32 | |
---|
33 | if (!defined('IN_ADMIN')) |
---|
34 | { |
---|
35 | add_event_handler('loc_after_page_header', 'admintools_add_public_controller'); |
---|
36 | add_event_handler('loc_begin_picture', 'admintools_save_picture'); |
---|
37 | add_event_handler('loc_begin_index', 'admintools_save_category'); |
---|
38 | } |
---|
39 | else |
---|
40 | { |
---|
41 | add_event_handler('loc_begin_page_header', 'admintools_add_admin_controller_setprefilter'); |
---|
42 | add_event_handler('loc_after_page_header', 'admintools_add_admin_controller'); |
---|
43 | add_event_handler('get_admin_plugin_menu_links', 'admintools_admin_link'); |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
47 | function admintools_init() |
---|
48 | { |
---|
49 | global $conf; |
---|
50 | $conf['AdminTools'] = safe_unserialize($conf['AdminTools']); |
---|
51 | |
---|
52 | load_language('plugin.lang', ADMINTOOLS_PATH); |
---|
53 | } |
---|
54 | |
---|
55 | function admintools_admin_link($menu) |
---|
56 | { |
---|
57 | $menu[] = array( |
---|
58 | 'NAME' => 'Admin Tools', |
---|
59 | 'URL' => ADMINTOOLS_ADMIN, |
---|
60 | ); |
---|
61 | |
---|
62 | return $menu; |
---|
63 | } |
---|