[10871] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
[11376] | 4 | function plugin_install() |
---|
| 5 | { |
---|
[10871] | 6 | global $prefixeTable; |
---|
| 7 | |
---|
| 8 | /* create table to store filters */ |
---|
[11333] | 9 | pwg_query( |
---|
| 10 | 'CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'category_filters` ( |
---|
| 11 | `category_id` smallint(5) unsigned NOT NULL, |
---|
| 12 | `type` varchar(16) NOT NULL, |
---|
| 13 | `cond` varchar(16) NULL, |
---|
| 14 | `value` text |
---|
| 15 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
---|
| 16 | ;'); |
---|
[10871] | 17 | |
---|
| 18 | /* add a collumn to image_category_table */ |
---|
[11376] | 19 | pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` ADD `smart` ENUM(\'true\', \'false\') NOT NULL DEFAULT \'false\';'); |
---|
[10871] | 20 | |
---|
| 21 | /* config parameter */ |
---|
[11376] | 22 | pwg_query(' |
---|
| 23 | INSERT INTO `' . CONFIG_TABLE . '` |
---|
| 24 | VALUES ( |
---|
| 25 | \'SmartAlbums\', |
---|
| 26 | \''.serialize(array( |
---|
[11451] | 27 | 'update_on_upload' => false, |
---|
[11392] | 28 | 'show_list_messages' => true, |
---|
[11376] | 29 | ) |
---|
| 30 | ).'\', |
---|
| 31 | \'Configuration for SmartAlbums plugin\' |
---|
| 32 | ) |
---|
| 33 | ;'); |
---|
| 34 | |
---|
[10871] | 35 | } |
---|
| 36 | |
---|
[11376] | 37 | function plugin_activate() |
---|
[11381] | 38 | { |
---|
[11438] | 39 | global $conf; |
---|
| 40 | |
---|
[11392] | 41 | if (!isset($conf['SmartAlbums'])) |
---|
[11376] | 42 | { |
---|
| 43 | pwg_query(' |
---|
| 44 | INSERT INTO `' . CONFIG_TABLE . '` |
---|
| 45 | VALUES ( |
---|
| 46 | \'SmartAlbums\', |
---|
| 47 | \''.serialize(array( |
---|
[11451] | 48 | 'update_on_upload' => false, |
---|
[11392] | 49 | 'show_list_messages' => true, |
---|
[11376] | 50 | ) |
---|
| 51 | ).'\', |
---|
| 52 | \'Configuration for SmartAlbums plugin\' |
---|
| 53 | ) |
---|
| 54 | ;'); |
---|
| 55 | } |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | function plugin_uninstall() |
---|
| 59 | { |
---|
[10871] | 60 | global $prefixeTable; |
---|
| 61 | |
---|
[11333] | 62 | pwg_query('DROP TABLE `' . $prefixeTable . 'category_filters`;'); |
---|
| 63 | pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` DROP `smart`;'); |
---|
[11376] | 64 | pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\';'); |
---|
[10871] | 65 | } |
---|
| 66 | ?> |
---|