<?php
// +---------------------------------------------+
// |     Copyright  2003-2006 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       = 2;
$modulename     = '文章模塊';
$version        = '2.0';
$modulepath     = 'm2_news/news.php';
$settingspath   = 'm2_news/m2_settings.php';
$authorname     = 'weencompany';
$authorlink     = 1;
$modulesettings = '27';


// ############################### INSTALL module ##############################

if($installtype == 'install')
{
  $DB->query("CREATE TABLE " . TABLE_PREFIX . "m2_news (
  articleid       INT(10)       UNSIGNED NOT NULL              AUTO_INCREMENT,
  categoryid      INT(10)       UNSIGNED NOT NULL DEFAULT 0,
  settings        INT(10)       UNSIGNED NOT NULL DEFAULT 0,
  views           INT(10)       UNSIGNED NOT NULL DEFAULT 0,
  displayorder    INT(10)       UNSIGNED NOT NULL DEFAULT 0,
  datecreated     INT(10)       UNSIGNED NOT NULL DEFAULT 0,
  dateupdated     INT(10)       UNSIGNED NOT NULL DEFAULT 0,
  datestart       INT(10)       UNSIGNED NOT NULL DEFAULT 0,
  dateend         INT(10)       UNSIGNED NOT NULL DEFAULT 0,
  author          VARCHAR(64)            NOT NULL DEFAULT '',
  title           VARCHAR(128)           NOT NULL DEFAULT '',
  metadescription TEXT                   NOT NULL,
  metakeywords    TEXT                   NOT NULL,
  description     TEXT                   NOT NULL,
  article         MEDIUMTEXT             NOT NULL,
  moduleid        INT(10)       UNSIGNED NOT NULL DEFAULT " . $uniqueid .",
  aorp            TINYINT(1)    NOT NULL DEFAULT 0,
  KEY articleid (articleid)
  ) TYPE=MyISAM;" );


  $DB->query("CREATE TABLE " . TABLE_PREFIX . "m2_settings (
  categoryid     INT(10)     UNSIGNED NOT NULL DEFAULT 0,
  maxarticles    INT(10)     UNSIGNED NOT NULL DEFAULT 10,
  sorting        VARCHAR(64)          NOT NULL DEFAULT 'Newest First',
  multiplepages  TINYINT(1)           NOT NULL DEFAULT 0,
  KEY categoryid (categoryid)
  ) TYPE=MyISAM;" );

  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置', '郵件通知', '會員提交文章條目後, 按此郵箱地址通知管理員:<br />不希望收到通知, 請留空.<br />多個信箱地址可用英文逗號隔開.', 'text', '', 1) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置', '自動發佈', '是否允許會員提交文章條目後不經審核自動發佈?', 'yesno', '0', 2) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置', '文章推廣', '是否允許用戶將文章內容Email給朋友?', 'yesno', '1', 3) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置', '郵件驗證碼', '用戶將文章內容Email給朋友時, 是否需要填寫驗證碼?', 'yesno', '1', 4) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置', '文章驗證碼', '會員發表文章時, 是否需要填寫驗證碼?', 'yesno', '1', 5) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '模塊設置', '列表顯示', '文章模塊是否以文章列表的方式顯示?', 'yesno', '0', 6) ");
  
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '顯示設置', '', '顯示標題',                      'yesno', '1', 1) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '顯示設置', '', '顯示作者',                     'yesno', '1', 2) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '顯示設置', '', '顯示發佈日期',              'yesno', '1', 3) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '顯示設置', '', '顯示更新日期',               'yesno', '1', 4) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "modulesettings VALUES (NULL, $uniqueid, '顯示設置', '', '顯示打印',         'yesno', '1', 5) ");
  $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 . "modulesettings VALUES (NULL, $uniqueid, '顯示設置', '', '顯示用戶評論',              'yesno', '1', 9) ");


  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'previous_page',            '&laquo; 上一頁', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'next_page',                '下一頁 &raquo;',     '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'page',                     '頁',                  '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'of',                       '/',                    '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'published',                '發佈: ', '', '', '', '', '0', '0', '0') ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'updated',                  '更新: ',                                          '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'discuss_article_in_forum', '在論壇中討論此文章!',                 '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'by',                       '作者:',                                                 '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'read_more',                '點擊查看...',                                       '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'previous',                 '&laquo; 上一頁',                                   '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'next',                     '下一頁 &raquo;',                                       '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'article_offline',          '此文章未發佈!',                 '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'author',                   '作者:',                                            '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'title',                    '標題:',                                             '', '', '', '', 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, 'article',                  '詳細內容:',                                           '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'submit_article',           '發表文章',                                     '', '', '', '', 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_title',              '請輸入文章標題!',                            '', '', '', '', 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, 'enter_article',            '請輸入詳細內容!',                           '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'article_submitted',        '謝謝! 您的文章已提交, 如未發表請等待審核.',           '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'print',                    '打印',                                              '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'email',                    '發送郵件',                                              '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_recipient_email',    '發送這篇文章到郵箱:',                              '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'separate_with_commas',     '多個郵箱請用英文逗號隔開.',           '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_your_email',         '您的Email地址:',                          '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_comment',            '您的對此文章的評論(可選):',                         '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'send_email',               '發送郵件',                                         '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'invalid_email',            '請輸入有效的Email地址!',                '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'email_sent',               '以下文章已發送成功:',               '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'go_back',                  '點擊返回到當前文章.',              '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'email_not_sent',           '系統錯誤! 郵件發送未完成.', '', '', '', '', 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',         '一個新文章已提交到您的網站, 如未發表請在後臺審核.', '', '', '', '', 0, 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_title',       '標題', '', '', '', '', 0, 0, 0)");

}


// ############################### UPGRADE module ##############################

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


// ############################## UNINSTALL module #############################

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

?>
