[22201] | 1 | <?php |
---|
| 2 | function plugin_install($id, $version, &$errors) |
---|
| 3 | { |
---|
| 4 | if (version_compare(PHP_VERSION, '5.3') < 0) |
---|
| 5 | { |
---|
| 6 | $errors[] = "PHP 5.3 required"; |
---|
| 7 | return; |
---|
| 8 | } |
---|
| 9 | global $prefixeTable; |
---|
| 10 | |
---|
| 11 | $q = ' |
---|
| 12 | CREATE TABLE `'.$prefixeTable.'suggestions` ( |
---|
| 13 | `id` INT NOT NULL AUTO_INCREMENT, |
---|
| 14 | `name` VARCHAR(255) NOT NULL, |
---|
| 15 | `counter` INT NOT NULL DEFAULT 0, |
---|
| 16 | `url` VARCHAR(255) DEFAULT NULL, |
---|
| 17 | `level` tinyint unsigned NOT NULL default 0, |
---|
| 18 | PRIMARY KEY (`id`) , |
---|
| 19 | UNIQUE INDEX `i_name` (`name` ASC) )'; |
---|
| 20 | |
---|
| 21 | pwg_query( create_table_add_character_set($q) ); |
---|
| 22 | |
---|
| 23 | $opts = array( 'excluded_tags'=>array(), 'excluded_albums'=>array() ); |
---|
| 24 | conf_update_param('rvac_opts', addslashes(serialize($opts)) ); |
---|
[29602] | 25 | |
---|
| 26 | $insert = array( |
---|
| 27 | 'name' => addslashes(l10n('Help')), |
---|
| 28 | 'url' => '$r/popuphelp.php?page=quick_search', |
---|
| 29 | ); |
---|
| 30 | single_insert($prefixeTable.'suggestions', $insert); |
---|
[22201] | 31 | } |
---|
| 32 | |
---|
| 33 | function plugin_activate($id, $version, &$errors) |
---|
| 34 | { |
---|
| 35 | global $conf; |
---|
| 36 | conf_update_param('rvac_version', @++$conf['rvac_version'] ); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | function plugin_uninstall() |
---|
| 40 | { |
---|
| 41 | global $prefixeTable; |
---|
| 42 | $q = 'DROP TABLE IF EXISTS '.$prefixeTable.'suggestions'; |
---|
| 43 | pwg_query($q); |
---|
| 44 | |
---|
| 45 | $q = 'DELETE FROM '.CONFIG_TABLE.' |
---|
| 46 | WHERE param IN(\'rvac_opts\',\'rvac_version\')'; |
---|
| 47 | pwg_query($q); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | ?> |
---|