source: extensions/Comments_on_Albums/maintain.inc.php @ 15995

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

improve anti-spam system (Piwigo 2.5 feature)

File size: 1.3 KB
RevLine 
[9624]1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
[11267]4function plugin_install() 
5{
[10984]6  global $prefixeTable;
[9624]7
[11267]8  pwg_query("
9CREATE TABLE `" . $prefixeTable . "comments_categories` (
10  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
11  `category_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
12  `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
13  `author` varchar(255) DEFAULT NULL,
14  `author_id` smallint(5) DEFAULT NULL,
[15995]15  `anonymous_id` varchar(45) NOT NULL,
[11267]16  `content` longtext,
17  `validated` enum('true','false') NOT NULL DEFAULT 'false',
18  `validation_date` datetime DEFAULT NULL,
19  PRIMARY KEY (`id`)
20) DEFAULT CHARSET=utf8
21;");
[14528]22}
23
24function plugin_activate()
25{
[15995]26  global $conf, $prefixeTable;
[10984]27 
[14528]28  if (isset($conf['comments_on_albums']))
29  {
30    pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="comments_on_albums" LIMIT 1;');
31  }
[15995]32 
33  $query = 'SHOW COLUMNS FROM `' . $prefixeTable . 'comments_categories`;';
34  $columns = hash_from_query($query, 'Field');
35  if (!isset($columns['anonymous_id']))
36  {
37    pwg_query('ALTER TABLE `' . $prefixeTable . 'comments_categories` ADD `anonymous_id` VARCHAR( 45 ) DEFAULT NULL;');
38  }
[9624]39}
40
[11267]41function plugin_uninstall() 
42{
[10984]43  global $prefixeTable;
[9624]44
[10984]45  pwg_query("DROP TABLE `" . $prefixeTable . "comments_categories`;");
[9624]46}
47?>
Note: See TracBrowser for help on using the repository browser.