source: extensions/WiredForSound/maintain.inc.php @ 10344

Last change on this file since 10344 was 3609, checked in by patdenice, 15 years ago

Convert all php and tpl files in Unix format for my plugins.

File size: 1.3 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5function plugin_install()
6{
7  global $prefixeTable, $conf;
8
9  $query = 'SHOW TABLES LIKE "' . $prefixeTable . 'wfs_%"';
10  $result = pwg_query($query);
11  if (!mysql_fetch_row($result))
12  {
13    $q = 'CREATE TABLE ' . $prefixeTable . 'wfs_img_cat_sound(
14image_id MEDIUMINT( 8 ) UNSIGNED default NULL ,
15cat_id MEDIUMINT( 8 ) default NULL ,
16sound_id SMALLINT( 5 ) NOT NULL ,
17volume SMALLINT ( 3 ) UNSIGNED default NULL ,
18INDEX (image_id) ,
19INDEX (cat_id),
20INDEX (sound_id))
21DEFAULT CHARACTER SET utf8;';
22    pwg_query($q);
23
24    $q = 'CREATE TABLE ' . $prefixeTable . 'wfs_sounds (
25id SMALLINT( 5 ) NOT NULL ,
26file VARCHAR( 255 ) NOT NULL ,
27PRIMARY KEY (id))
28DEFAULT CHARACTER SET utf8;';
29    pwg_query($q);
30  }
31
32  if (!isset($conf['wired_for_sound']))
33  {
34    $q = '
35INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
36        VALUES
37        ("wired_for_sound" , "plugins/WiredForSound/mp3/,100,44,1,0" , "Parametres du plugin WiredForSound");';
38
39    pwg_query($q);
40  }
41}
42
43function plugin_uninstall()
44{
45  global $prefixeTable;
46
47        $q = 'DROP TABLE ' . $prefixeTable . 'wfs_img_cat_sound;';
48    pwg_query($q);
49
50        $q = 'DROP TABLE ' . $prefixeTable . 'wfs_sounds;';
51    pwg_query($q);
52
53        $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="wired_for_sound" LIMIT 1;';
54    pwg_query($q);
55}
56
57?>
Note: See TracBrowser for help on using the repository browser.