source: extensions/header_manager/maintain.inc.php @ 17034

Last change on this file since 17034 was 16937, checked in by mistic100, 12 years ago

ability to define a specific banner for an album + apply to sub-cats
(needs Piwigo 2.4.2 for tabs)

File size: 1.4 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4define('header_dir', PWG_LOCAL_DIR . 'banners/');
5
6define(
7  'header_manager_default_config', 
8  serialize(array(
9    'width' => 1000,
10    'height' => 150,
11    'image' => 'random',
12    'display' => 'image_only'
13    ))
14  );
15 
16
17function plugin_install() 
18{
19  global $prefixeTable;
20 
21        pwg_query(
22'CREATE TABLE IF NOT EXISTS `' .$prefixeTable . 'category_banner` (
23  `category_id` smallint(5) unsigned NOT NULL,
24  `image` varchar(255) NOT NULL,
25  `deep` tinyint(1) DEFAULT 1,
26  PRIMARY KEY (`category_id`)
27) ENGINE=MyISAM DEFAULT CHARSET=utf8
28;');
29
30  conf_update_param('header_manager', header_manager_default_config);
31  mkdir(header_dir, 0755);
32}
33
34function plugin_activate()
35{
36  global $conf, $prefixeTable;
37
38  if (empty($conf['header_manager']))
39  {
40    conf_update_param('header_manager', header_manager_default_config);
41  }
42  if (!file_exists(header_dir)) 
43  {
44    mkdir(header_dir, 0755);
45  }
46 
47  pwg_query(
48'CREATE TABLE IF NOT EXISTS `' .$prefixeTable . 'category_banner` (
49  `category_id` smallint(5) unsigned NOT NULL,
50  `image` varchar(255) NOT NULL,
51  `deep` tinyint(1) DEFAULT 1,
52  PRIMARY KEY (`category_id`)
53) ENGINE=MyISAM DEFAULT CHARSET=utf8
54;');
55}
56
57function plugin_uninstall() 
58{
59  global $prefixeTable;
60 
61  pwg_query('DROP TABLE `' .$prefixeTable . 'category_banner`;');
62  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "header_manager" LIMIT 1;');
63}
64
65?>
Note: See TracBrowser for help on using the repository browser.