<?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) ");
  
  $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");
}

?>
