<?php
// +---------------------------------------------+
// |     Copyright 2003-2005 weenCompany |
// |     http://www.weentech.com               |
// |     This file may not be redistributed.     |
// +---------------------------------------------+

if(!defined('TABLE_PREFIX'))
  define('TABLE_PREFIX', "");

if(!defined('IN_WEENCOMPANY'))
  die("File not found!");


// ############################### MODULE DETAILS ##############################

$uniqueid       = 7;
$modulename     = '留言板';
$version        = '2.0';
$modulepath     = 'm7_chatterbox/chatterbox.php';
$settingspath   = 'm7_chatterbox/m7_settings.php';
$authorname     = 'weencompany';
$authorlink     = 1;
$modulesettings = '19';


// ############################### INSTALL MODULE ##############################

if($installtype == 'install')
{
  $DB->query("CREATE TABLE " . TABLE_PREFIX . "m7_chatterbox (
  commentid   INT(10)     UNSIGNED NOT NULL AUTO_INCREMENT,
  categoryid  INT(10)     UNSIGNED NOT NULL DEFAULT 0,
  username    VARCHAR(64)          NOT NULL DEFAULT '',
  comment     TEXT                 NOT NULL,
  datecreated INT(10)     UNSIGNED NOT NULL DEFAULT 0,
  KEY commentid (commentid)
  ) TYPE=MyISAM;" );

  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid,  '模块设置',              '允许表情符号',                       '允许表情符号可以使输入的表情代码字符组合转换成表情符号.', 'yesno', '1', 2) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid,  '模块设置',              '显示条目数',        '模块内显示的内容条目数量:', 'text', '5', 3) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid,  '模块设置',              '换行字符数',                            '插入换行符的字符数量(\"0\"表示不插入换行):', 'text', '0', 4) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid,  '模块设置',              '用户名长度',              '非注册用户可输入姓名的最多字符数:', 'text', '12', 5) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid,  '模块设置',              '内容字符长度',               '内容中可输入的最大字符数量:', 'text', '80', 6) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid,  '模块设置',              '目标菜单',                   '当不同的网站菜单中包含此模块时, 仅显示打开该菜单时提交的内容.', 'yesno', '1', 7) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid,  '模块设置',              '显示全部内容',                   '显示一个链接, 在新窗口中打开全部模块内容.', 'yesno', '1', 8) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid,  '模块设置',                  '显示发表时间',                         '是否显示留言发表的日期和时间?', 'yesno', '0', 10) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid,  '模块设置',                  '日期时间格式',                          '格式化日期时间显示:<br /><br />参考: <a href=\'http://us2.php.net/manual/en/function.date.php\' target=\'_blank\'>http://us2.php.net/manual/en/function.date.php</a>', 'text', 'Y.m.d-H:i:s', 11) ");
  
if($sitedefaultlang == 'en') //Insert English phrase.
{
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'name',                     'Name:', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'comment',                  'Comment:', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'say',                      'Say', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'no_username',              'No username supplied!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'no_comment',               'No comment supplied!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'repeat_comment',           'Repeat comment not posted!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'view_history',             'View Message History', '', '', '', '', 0, 0, 0)");

}
else  //Insert Chinese phrase.
{
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'name',                     '姓名:', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'comment',                  '内容:', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'say',                      '提交', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'no_username',              '请输入您的姓名!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'no_comment',               '请输入留言内容!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'repeat_comment',           '请勿重复提交内容相同的留言!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'view_history',             '查看全部留言', '', '', '', '', 0, 0, 0)");

}

}


// ############################### UPGRADE MODULE ##############################

if($installtype == 'upgrade')
{
  if($currentversion == '2.0')
  {
    // example:
    // UpdateModuleVersion(7, 2.1);
    // $currentversion = 2.1;
  }
}


// ############################## UNINSTALL MODULE #############################

if($installtype == 'uninstall')
{
  $DB->query("DROP TABLE IF EXISTS " . TABLE_PREFIX . "m7_chatterbox");
}

?>