Ignore:
Timestamp:
Oct 14, 2013, 6:35:28 PM (11 years ago)
Author:
mistic100
Message:

use my plugin architecture, add options to hide the page for guests, fix admin links in mails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GuestBook/maintain.inc.php

    r15948 r24889  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 // Default config
    5 define('default_guestbook_config', serialize(array(
    6   'comments_validation' => false,
    7   'email_admin_on_comment' => false,
    8   'email_admin_on_comment_validation' => false,
    9   'nb_comment_page' => 15,
    10   'activate_rating' => true,
    11 )));
     4defined('GUESTBOOK_ID') or define('GUESTBOOK_ID', basename(dirname(__FILE__)));
     5include_once(PHPWG_PLUGINS_PATH . GUESTBOOK_ID . '/include/install.inc.php');
    126
    137// Installation
    148function plugin_install()
    159{
    16   global $prefixeTable;
    17 
    18   pwg_query("
    19 CREATE TABLE `" . $prefixeTable . "guestbook` (
    20   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    21   `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    22   `author` varchar(255) NOT NULL,
    23   `author_id` smallint(5) DEFAULT NULL,
    24   `anonymous_id` varchar(45) NOT NULL,
    25   `email` varchar(255) DEFAULT NULL,
    26   `website` varchar(255) DEFAULT NULL,
    27   `content` longtext NOT NULL,
    28   `rate` float(5,2) unsigned DEFAULT NULL,
    29   `validated` enum('true','false') NOT NULL DEFAULT 'false',
    30   `validation_date` datetime DEFAULT NULL,
    31   PRIMARY KEY (`id`)
    32 ) DEFAULT CHARSET=utf8
    33 ;");
    34  
    35   conf_update_param('guestbook', default_guestbook_config);
     10  guestbook_install();
     11  define('guestbook_installed', true
    3612}
    3713
     
    3915function plugin_activate()
    4016{
    41   global $conf;
    42  
    43   if (!isset($conf['guestbook']))
     17  if (!defined('guestbook_installed'))
    4418  {
    45     conf_update_param('guestbook', default_guestbook_config);
     19    guestbook_install();
    4620  }
    4721}
     
    5024function plugin_uninstall()
    5125{
    52   global $prefixeTable;
    53 
    54   pwg_query("DROP TABLE `" . $prefixeTable . "guestbook`;");
    55   pwg_query("DELETE FROM " . CONFIG_TABLE . " WHERE `param` = 'guestbook';");
     26  guestbook_uninstall();
    5627}
    57 ?>
Note: See TracChangeset for help on using the changeset viewer.