source: extensions/header_manager/include/install.inc.php @ 19841

Last change on this file since 19841 was 19841, checked in by mistic100, 11 years ago

make sure banner folder is created on the right place

File size: 1.3 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3 
4function header_manager_install() 
5{
6  global $conf, $prefixeTable;
7
8  // configuration
9  if (empty($conf['header_manager']))
10  {
11    $header_manager_default_config = serialize(array(
12      'width' => 1000,
13      'height' => 150,
14      'image' => 'random',
15      'display' => 'image_only',
16      'banner_on_picture' => true,
17      ));
18   
19    conf_update_param('header_manager', $header_manager_default_config);
20    $conf['header_manager'] = $header_manager_default_config;
21  }
22  else
23  {
24    $new_conf = is_string($conf['header_manager']) ? unserialize($conf['header_manager']) : $conf['header_manager'];
25    if (!isset($new_conf['banner_on_picture']))
26    {
27      $new_conf['banner_on_picture'] = true;
28      $conf['header_manager'] = serialize($new_conf);
29      conf_update_param('header_manager', $conf['header_manager']);
30    }
31  }
32
33  // banners directory
34  if (!file_exists(PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'banners/')) 
35  {
36    mkdir(PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'banners/', 0755);
37  }
38
39  // banners table
40  $query = '
41CREATE TABLE IF NOT EXISTS `' .$prefixeTable . 'category_banner` (
42  `category_id` smallint(5) unsigned NOT NULL,
43  `image` varchar(255) NOT NULL,
44  `deep` tinyint(1) DEFAULT 1,
45  PRIMARY KEY (`category_id`)
46) ENGINE=MyISAM DEFAULT CHARSET=utf8
47;';
48  pwg_query($query);
49}
50
51?>
Note: See TracBrowser for help on using the repository browser.