<?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       = 16;
$modulename     = '鏈接模塊';
$version        = '2.0';
$modulepath     = 'm16_linkdirectory/linkdirectory.php';
$settingspath   = 'm16_linkdirectory/m16_settings.php';
$authorname     = 'weencompany';
$authorlink     = 1;
$modulesettings = '19';


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

if($installtype == 'install')
{
  $DB->query("CREATE TABLE " . TABLE_PREFIX . "m16_links (
  linkid       INT(10)      UNSIGNED NOT NULL              AUTO_INCREMENT,
  sectionid    INT(10)      UNSIGNED NOT NULL DEFAULT 0,
  activated    TINYINT(1)            NOT NULL DEFAULT 0,
  allowsmilies TINYINT(1)            NOT NULL DEFAULT 0,
  showauthor   TINYINT(1)            NOT NULL DEFAULT 0,
  author       VARCHAR(64)           NOT NULL DEFAULT '',
  title        VARCHAR(128)          NOT NULL DEFAULT '',
  url          TEXT                  NOT NULL,
  description  TEXT                  NOT NULL,
  KEY linkid (linkid)
  ) TYPE=MyISAM;" );


  $DB->query("CREATE TABLE " . TABLE_PREFIX . "m16_sections (
  sectionid   INT(10)      UNSIGNED NOT NULL              AUTO_INCREMENT,
  parentid    INT(10)      UNSIGNED NOT NULL DEFAULT 0,
  activated   TINYINT(1)            NOT NULL DEFAULT 0,
  name        VARCHAR(128)          NOT NULL DEFAULT '',
  description TEXT                  NOT NULL,
  sorting     VARCHAR(32)           NOT NULL DEFAULT '',
  KEY sectionid (sectionid)
  ) TYPE=MyISAM;" );

  // insert default section
  $DB->query("INSERT INTO " . TABLE_PREFIX . "m" . $uniqueid . "_sections VALUES ('0', 0, 1, '鏈接', '', '時間(降序)')");

  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置',              '每頁鏈接數',                       '每頁顯示的鏈接數量:', 'text', '20', 1) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置',              '每行鏈接數',              '每行顯示的鏈接數量:', 'text', '4', 2) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置',              '郵件通知',                    '會員提交鏈接後, 按此郵箱地址通知管理員:<br />\r\n多個信箱可用英文逗號隔開, 不希望收到通知, 請留空.', 'text', '', 3) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置',              '顯示導航欄',                         '是否顯示導航欄?', 'yesno', '1', 6) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置', 			  '自動發佈', 				  '是否允許會員提交鏈接後不經審核自動發佈?', 'yesno', '0', 7) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置', 			  '驗證碼', 				  '會員提交鏈接申請時, 是否需要填寫驗證碼?', 'yesno', '1', 8) ");
  
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'sections',                '分類:', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'submitting_link',         '申請鏈接', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'your_name',               '您的姓名:', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'website_name',            '網站名稱:', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'website_url',             '網站URL:', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'description',             '網站介紹:', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'submit_link',             '提交申請', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'submit_a_link',           '點擊這裏在此類中申請鏈接!', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'submitted_by',            '來自:', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'previous_links',          '&laquo; 上一頁', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'more_links',              '下一頁 &raquo;', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_name',              '請輸入您的姓名!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_site_name',         '請輸入網站名稱!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_site_url',          '請輸入網站URL!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'url_invalid',             '網站URL無效!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_description',       '請輸入網站介紹!', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'link_submitted',          '申請鏈接提交成功! 如未發佈, 請等待審核.', '', '', '', '', 1, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_from',        '友情鏈接模塊', '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_subject',         '有新申請鏈接提交到您的網站!','', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_message',         '有新申請鏈接提交到您的網站, 如友情鏈接模塊設置為審核發佈, 請儘快到網站後臺審核.',  '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_author',     '申請人', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_website',    '網站名稱', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_url',        '網站URL', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_description','網站介紹', '', '', '', '', 0, 0, 0)");

}


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

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


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

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

?>
