source: extensions/header_manager/main.inc.php @ 30491

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

use new maintain class

File size: 2.0 KB
Line 
1<?php 
2/*
3Plugin Name: Header Manager
4Version: auto
5Description: Header Manager allows to simply manage gallery banners. You can upload a picture from your computer or use a picture already in the gallery.
6Plugin URI: auto
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
12
13global $prefixeTable, $conf;
14
15define('HEADER_MANAGER_PATH',    PHPWG_PLUGINS_PATH . 'header_manager/');
16define('HEADER_MANAGER_ADMIN',   get_root_url() . 'admin.php?page=plugin-header_manager');
17define('HEADER_MANAGER_DIR',     PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'banners/');
18define('HEADER_MANAGER_TABLE',   $prefixeTable . 'category_banner');
19
20include_once(HEADER_MANAGER_PATH . 'include/functions.inc.php');
21include_once(HEADER_MANAGER_PATH . 'include/header_manager.inc.php');
22
23
24$conf['header_manager'] = safe_unserialize($conf['header_manager']);
25
26 
27if (defined('IN_ADMIN'))
28{
29  add_event_handler('get_admin_plugin_menu_links', 'header_manager_admin_menu');
30  add_event_handler('tabsheet_before_select', 'header_manager_tab', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
31  add_event_handler('delete_categories', 'header_manager_delete_categories');
32}
33else if (!defined('PWG_HELP'))
34{
35  add_event_handler('render_page_banner', 'header_manager_render');
36}
37
38
39/**
40 * Header Manager admin link
41 */
42function header_manager_admin_menu($menu) 
43{
44  $menu[] = array(
45    'NAME' => 'Header Manager',
46    'URL' => HEADER_MANAGER_ADMIN,
47    );
48  return $menu;
49}
50
51/**
52 * tab on album edition page
53 */
54function header_manager_tab($sheets, $id)
55{
56  if ($id == 'album')
57  {
58    load_language('plugin.lang', HEADER_MANAGER_PATH);
59   
60    $sheets['headermanager'] = array(
61      'caption' => l10n('Banner'),
62      'url' => HEADER_MANAGER_ADMIN.'-album&amp;cat_id='.$_GET['cat_id'],
63      );
64  }
65 
66  return $sheets;
67}
68
69/**
70 * clean table when categories are deleted
71 */
72function header_manager_delete_categories($ids)
73{
74  $query = '
75DELETE FROM '.HEADER_MANAGER_TABLE.'
76  WHERE category_id IN('.implode(',', $ids).')
77;';
78  pwg_query($query);
79}
Note: See TracBrowser for help on using the repository browser.