source: trunk/plugins/AdminTools/main.inc.php @ 29168

Last change on this file since 29168 was 29168, checked in by mistic100, 10 years ago

add MultiView controller on admin page (replaces the "switch theme" button)

File size: 1.7 KB
RevLine 
[25617]1<?php
2/*
3Plugin Name: Admin Tools
[28697]4Version: 2.6.2
[25617]5Description: Do some admin task from the public pages
[28697]6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=720
7Author: Piwigo team
8Author URI: http://piwigo.org
[25617]9*/
10
11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
12
[25915]13define('ADMINTOOLS_ID',       basename(dirname(__FILE__)));
[25916]14define('ADMINTOOLS_PATH' ,    PHPWG_PLUGINS_PATH . ADMINTOOLS_ID . '/');
[26061]15define('ADMINTOOLS_ADMIN',    get_root_url() . 'admin.php?page=plugin-' . ADMINTOOLS_ID);
[25617]16
17include_once(ADMINTOOLS_PATH . 'include/events.inc.php');
18include_once(ADMINTOOLS_PATH . 'include/MultiView.class.php');
19
[28692]20
[25617]21global $MultiView;
22$MultiView = new MultiView();
23
[25655]24add_event_handler('init', 'admintools_init');
[25617]25
26add_event_handler('user_init', array(&$MultiView, 'user_init'));
27add_event_handler('init', array(&$MultiView, 'init'));
28
[25817]29add_event_handler('ws_add_methods', array('MultiView', 'register_ws'));
[25818]30add_event_handler('delete_user', array('MultiView', 'invalidate_cache'));
31add_event_handler('register_user', array('MultiView', 'invalidate_cache'));
[25617]32
[25845]33if (!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}
[26061]39else
40{
[29168]41  add_event_handler('loc_begin_page_header', 'admintools_add_admin_controller');
[26061]42  add_event_handler('get_admin_plugin_menu_links', 'admintools_admin_link');
43}
[25817]44
[25845]45
[25655]46function admintools_init()
47{
[26061]48  global $conf;
[28692]49  $conf['AdminTools'] = safe_unserialize($conf['AdminTools']);
[25845]50
[25791]51  load_language('plugin.lang', ADMINTOOLS_PATH);
[26061]52}
[25617]53
[26061]54function admintools_admin_link($menu) 
55{
56  $menu[] = array(
57    'NAME' => 'Admin Tools',
58    'URL' => ADMINTOOLS_ADMIN,
59    );
[25845]60
[26061]61  return $menu;
[25655]62}
Note: See TracBrowser for help on using the repository browser.