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

if($sitedefaultlang == 'en') //Insert Chinese phrase.
{
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'previous_page',            '&laquo; Previous Page', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'next_page',                'Next Page &raquo;',     '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'page',                     'Page',                  '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'of',                       'of',                    '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'published',                'Published: ', '', '', '', '', '0', '0', '0') ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'updated',                  'Updated: ',                                          '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'discuss_article_in_forum', 'Discuss this article in the Forum!',                 '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'by',                       'By',                                                 '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'read_more',                'Read More...',                                       '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'previous',                 '&laquo; Previous',                                   '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'next',                     'Next &raquo;',                                       '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'article_offline',          'This article is currently offline!',                 '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'author',                   'Author:',                                            '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'title',                    'Title:',                                             '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'description',              'Description:',                                       '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'article',                  'Article:',                                           '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'submit_article',           'Submit Article',                                     '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_name',               'Please enter your name!',                            '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_title',              'Please enter the title!',                            '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_description',        'Please enter the description!',                      '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_article',            'Please enter an article!',                           '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'article_submitted',        'Thanks! Your article has been submitted.',           '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'print',                    'Print',                                              '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'email',                    'Email',                                              '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_recipient_email',    'Send this article to:',                              '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'separate_with_commas',     'Separate multiple addresses with commas.',           '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_your_email',         'Enter your email address:',                          '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'enter_comment',            'Enter an optional comment:',                         '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'send_email',               'Send Email',                                         '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'invalid_email',            'Please enter a valid email address!',                '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'email_sent',               'The following article has been sent:',               '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'go_back',                  'Click here to go back to the article.',              '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'email_not_sent',           'A system error occured. Your message was not sent!', '', '', '', '', 1, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_from',                 'Article Module', '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_subject',         'New article submitted to your website!', '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_message',         'A new article has been submitted to your website.', '', '', '', '', 0, 0, 0) ");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_author',      'Author', '', '', '', '', 0, 0, 0)");
  $DB->query("INSERT INTO " . TABLE_PREFIX . "phrases VALUES (NULL, $uniqueid, 'notify_email_title',       'Title', '', '', '', '', 0, 0, 0)");

}
else  //Insert English phrase.
{
  $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");
}

?>