1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Admin Messages |
---|
4 | Version: 1.0 |
---|
5 | Description: Allows administrators to leave messages on the main admin page. |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=505 |
---|
7 | Author: Mistic |
---|
8 | Author URI: http://www.strangeplanet.fr |
---|
9 | */ |
---|
10 | |
---|
11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
12 | |
---|
13 | global $prefixeTable; |
---|
14 | |
---|
15 | // +-----------------------------------------------------------------------+ |
---|
16 | // Variables globales AM |
---|
17 | // +-----------------------------------------------------------------------+ |
---|
18 | define('AM_DIR' , basename(dirname(__FILE__))); |
---|
19 | define('AM_PATH' , PHPWG_PLUGINS_PATH . AM_DIR .'/'); |
---|
20 | define('AM_TABLE', $prefixeTable .'admin_messages'); |
---|
21 | define('AM_NAME' , 'Admin Messages'); |
---|
22 | define('AM_VERSION', '1.0'); |
---|
23 | define('AM_ADMIN', PHPWG_ROOT_PATH .'admin.php?page=plugin&section='. AM_DIR .'/admin/admin.php'); |
---|
24 | |
---|
25 | |
---|
26 | // +-----------------------------------------------------------------------+ |
---|
27 | // Triggers |
---|
28 | // +-----------------------------------------------------------------------+ |
---|
29 | add_event_handler('get_admin_plugin_menu_links', 'AM_admin_menu'); // Lien d'administration |
---|
30 | add_event_handler('loc_begin_page_tail', 'AM_load_admin_messages'); // affichage sur admin |
---|
31 | |
---|
32 | |
---|
33 | // +-----------------------------------------------------------------------+ |
---|
34 | // Fonctions |
---|
35 | // +-----------------------------------------------------------------------+ |
---|
36 | // Lien d'administration |
---|
37 | function AM_admin_menu($menu) { |
---|
38 | array_push($menu, array( |
---|
39 | 'NAME' => AM_NAME, |
---|
40 | 'URL' => AM_ADMIN |
---|
41 | )); |
---|
42 | return $menu; |
---|
43 | } |
---|
44 | |
---|
45 | // affichage sur admin |
---|
46 | function AM_load_admin_messages() { |
---|
47 | global $template, $page, $conf, $user; |
---|
48 | |
---|
49 | if (script_basename() == 'admin' AND defined('IN_ADMIN') AND IN_ADMIN |
---|
50 | AND isset($page['body_id']) AND $page['body_id']=='theAdminPage' AND $page['page'] == 'intro') { |
---|
51 | include(AM_PATH . 'admin_messages.php'); |
---|
52 | } |
---|
53 | } |
---|
54 | ?> |
---|