--
-- Дамп данных таблицы `Module`
--

INSERT INTO `Module` (`Module_Name`, `Keyword`, `Description`, `Parameters`, `Example_URL`, `Help_URL`, `Installed`, `Number`, `Inside_Admin`, `Checked`) VALUES
('NETCAT_MODULE_COMMENTS', 'comments', 'NETCAT_MODULE_COMMENTS_DESCRIPTION', 'ADMIN_SETTINGS_LOCATION=module.comments.settings', '', '/settings/modules/comments/', 1, '', 0, 1);

-- --------------------------------------------------------

ALTER TABLE `Catalogue` ADD COLUMN `Comment_Rule_ID` int(11) NOT NULL default '0';
ALTER TABLE `Subdivision` ADD COLUMN `Comment_Rule_ID` int(11) NOT NULL default '0';
ALTER TABLE `Sub_Class` ADD COLUMN `Comment_Rule_ID` int(11) NOT NULL default '0';

--
-- Структура таблицы `Comments_Count`
--

CREATE TABLE IF NOT EXISTS `Comments_Count` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `Sub_Class_ID` int(11) NOT NULL DEFAULT '0',
  `Message_ID` int(11) NOT NULL DEFAULT '0',
  `CountComments` int(11) NOT NULL DEFAULT '0',
  `CountReplies` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Структура таблицы `Comments_LastVisit`
--

CREATE TABLE IF NOT EXISTS `Comments_LastVisit` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `User_ID` int(11) NOT NULL DEFAULT '0',
  `Class_ID` int(11) NOT NULL DEFAULT '0',
  `Message_ID` int(11) NOT NULL DEFAULT '0',
  `LastUpdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `CommentsLastVisit` (`User_ID`,`Class_ID`,`Message_ID`),
  KEY `User_ID` (`User_ID`),
  KEY `Class_ID` (`Class_ID`),
  KEY `Message_ID` (`Message_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Структура таблицы `Comments_Rules`
--

CREATE TABLE IF NOT EXISTS `Comments_Rules` (
  `ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `Catalogue_ID` int(11) unsigned NOT NULL DEFAULT '0',
  `Subdivision_ID` int(11) unsigned NOT NULL DEFAULT '0',
  `Sub_Class_ID` int(11) unsigned NOT NULL DEFAULT '0',
  `Access_ID` int(1) unsigned NOT NULL DEFAULT '0',
  `Edit_Rule` enum('disable','enable','unreplied') NOT NULL DEFAULT 'disable',
  `Delete_Rule` enum('disable','enable','unreplied') NOT NULL DEFAULT 'disable',
  `Message_ID` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Структура таблицы `Comments_Subscribe`
--

CREATE TABLE IF NOT EXISTS `Comments_Subscribe` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `User_ID` int(11) NOT NULL,
  `Sub_Class_ID` int(11) NOT NULL,
  `Message_ID` int(11) NOT NULL,
  `Comment_ID` int(11) NOT NULL,
  `Subdivision_ID` int(11) NOT NULL DEFAULT '0',
  `Catalogue_ID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  KEY `User_ID` (`User_ID`,`Sub_Class_ID`,`Message_ID`,`Comment_ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Структура таблицы `Comments_Template`
--

CREATE TABLE IF NOT EXISTS `Comments_Template` (
  `ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `Name` varchar(64) NOT NULL DEFAULT '',
  `Default` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `Prefix` varchar(255) NOT NULL DEFAULT '',
  `Comment_Block` text NOT NULL,
  `Reply_Block` text NOT NULL,
  `Comment_Link` varchar(255) NOT NULL DEFAULT '',
  `Reply_Link` varchar(255) NOT NULL DEFAULT '',
  `Edit_Link` varchar(255) NOT NULL DEFAULT '',
  `Delete_Link` varchar(255) NOT NULL DEFAULT '',
  `Add_Block` text NOT NULL,
  `Edit_Block` text NOT NULL,
  `Delete_Block` text NOT NULL,
  `Suffix` varchar(255) NOT NULL DEFAULT '',
  `User_Field` varchar(255) DEFAULT 'Login',
  `Value` text,
  `Premod_Text` text,
  `Warn_Text` text,
  `New_Comment_Button` text,
  `Pagination` text,
  `Show_All` text,
  `Rating_Block` text NOT NULL,
  `Moderator_Block` text NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

--
-- Дамп данных таблицы `Comments_Template`
--

INSERT INTO `Comments_Template` (`ID`, `Name`, `Default`, `Prefix`, `Comment_Block`, `Reply_Block`, `Comment_Link`, `Reply_Link`, `Edit_Link`, `Delete_Link`, `Add_Block`, `Edit_Block`, `Delete_Block`, `Suffix`, `User_Field`, `Value`, `Premod_Text`, `Warn_Text`, `New_Comment_Button`, `Pagination`, `Show_All`, `Rating_Block`, `Moderator_Block`) VALUES
(1, 'Основной шаблон', 1, '%SUBSCRIBE_BLOCK %MODERATOR_BLOCK\r\n<div id=\'%ID\' class=\'nc_comments\'>', '<div id=\'%ID\' style=\'margin:10px 0 0 0; padding: 5px; border: 1px dashed #cccccc; \'>\r\n<div style=\'line-height:25px;\".(\"%IS_NEW\" ? \"background-color: #ffbf7a;\" : \"\").\"\'>\r\n<span>\".(\"%USER_AVATAR\" ? \"<img src=\'%USER_AVATAR\' width=\'20\' height=\'20\' />\" : \"\").\"\r\n<b>\".(%USER_ID ? \"<a style=\'vertical-align: top;\' href=\'\".nc_auth_profile_url(%USER_ID).\"\'>%USER_NAME</a>\" : (\'%GUEST_NAME\' ? \'%GUEST_NAME\' : \'Гость\')).\" </b></span><span style=\'float: right;\'>\".date(\"d.m.Y H:i:s\", %DATE).\"</span></div>\r\n%RATING_BLOCK\r\n<div>%COMMENT</div>\r\n<div>%REPLY_LINK &nbsp; %EDIT_LINK &nbsp; %DELETE_LINK</div>\r\n%REPLY_BLOCK\r\n</div>\r\n', '<div id=\'%ID\' style=\'margin:5px 0px 5px 20px; \'>\r\n<div style=\'line-height:25px;\".(\"%IS_NEW\" ? \"background-color: #ffbf7a;\" : \"\").\"\'>\r\n<span>\".(\"%USER_AVATAR\" ? \"<img src=\'%USER_AVATAR\' width=\'20\' height=\'20\' />\" : \"\").\"\r\n<b>\".(%USER_ID ? \"<a href=\'\".nc_auth_profile_url(%USER_ID).\"\'>%USER_NAME</a>\" : (\'%GUEST_NAME\' ? \'%GUEST_NAME\' : \'Гость\')).\" </b></span><span style=\'float: right;\'>\".date(\"d.m.Y H:i:s\", %DATE).\"</span></div>\r\n<div>%COMMENT</div>\r\n<div>%REPLY_LINK &nbsp; %EDIT_LINK &nbsp; %DELETE_LINK</div>\r\n%REPLY_BLOCK\r\n</div>', '<a href=\'#\' id=\'%ID\' onclick=\'%ACTION\'>%TEXT</a>', '<a href=\'#\' id=\'%ID\' onclick=\'%ACTION\'>%TEXT</a>', '<a href=\'#\' id=\'%ID\' onclick=\'%ACTION\'>%TEXT</a>', '<a href=\'#\' id=\'%ID\' onclick=\'%ACTION\'>%TEXT</a>', '<div>\r\n<span id=\'%GUEST_NAME_ID\'>Ваше имя<input type=\'text\' name=\'%GUEST_NAME_ID\'></span> \r\n<span id=\'%GUEST_EMAIL_ID\'>Ваш email<input type=\'text\'  name=\'%GUEST_EMAIL_ID\'></span>\r\n\".(%ISBBCODES ? nc_bbcode_bar(\'this\', \'%FORM_ID\', \'%TEXTAREA_ID\', 1, array(\"SIZE\", \"COLOR\", \"SMILE\", \"B\", \"I\", \"U\", \"S\", \"LIST\", \"QUOTE\", \"CODE\", \"IMG\", \"URL\"), \"<div style=\'margin:5px 0\'>\", \"</div>\", true) : \"\").\"\r\n<textarea id=\'%TEXTAREA_ID\' name=\'%TEXTAREA_ID\' style=\'width:50%\'>%TEXTAREA_VALUE</textarea>\r\n<br/>\r\n \".( $AUTH_USER_ID ? \"\" : \"\".nc_captcha_formfield().\"\r\n <br/>\r\nВведите код на картинке: <input type=\'text\' name=\'nc_captcha_code\' value=\'\'>\r\n\" ).\"\r\n<br/> <button id=\'%SUBMIT_BUTTON_ID\' name=\'%SUBMIT_BUTTON_ID\'>\".NETCAT_MODULE_COMMENTS_ADD_FORM_APPEND_BUTTON.\"</button> <button onclick=\'%CANCEL_BUTTON_ACTION\' id=\'%CANCEL_BUTTON_ID\' name=\'%CANCEL_BUTTON_ID\'>\".NETCAT_MODULE_COMMENTS_ADD_FORM_CANCEL_BUTTON.\"</button>\r\n</div>', '<div>\r\n\".(%ISBBCODES ? nc_bbcode_bar(\'this\', \'%FORM_ID\', \'%TEXTAREA_ID\', 1, array(\"SIZE\", \"COLOR\", \"SMILE\", \"B\", \"I\", \"U\", \"S\", \"LIST\", \"QUOTE\", \"CODE\", \"IMG\", \"URL\"), \"<div style=\'margin:5px 0\'>\", \"</div>\", true) : \"\").\"\r\n<textarea id=\'%TEXTAREA_ID\' name=\'%TEXTAREA_ID\' style=\'width:50%\'>%TEXTAREA_VALUE</textarea>\r\n<br/>\r\n<button id=\'%SUBMIT_BUTTON_ID\' name=\'%SUBMIT_BUTTON_ID\'>\".NETCAT_MODULE_COMMENTS_ADD_FORM_UPDATE_BUTTON.\"</button> <button onclick=\'%CANCEL_BUTTON_ACTION\' id=\'%CANCEL_BUTTON_ID\' name=\'%CANCEL_BUTTON_ID\'>\".NETCAT_MODULE_COMMENTS_ADD_FORM_CANCEL_BUTTON.\"</button>\r\n</div>', '<div style=\'margin:5px 0;\'>\r\n<button id=\'%SUBMIT_BUTTON_ID\' name=\'%SUBMIT_BUTTON_ID\'>\".NETCAT_MODULE_COMMENTS_ADD_FORM_DELETE_BUTTON.\"</button> <button onclick=\'%CANCEL_BUTTON_ACTION\' id=\'%CANCEL_BUTTON_ID\' name=\'%CANCEL_BUTTON_ID\'>\".NETCAT_MODULE_COMMENTS_ADD_FORM_CANCEL_BUTTON.\"</button>\r\n</div>', '</div>', 'Login', NULL, '<div style=\'color:#455445\'>Ваш комментарий успешно добавлен и будет опубликован после просмотра модератором.</div>', '<b><div style=\'color:#455445\'>%WARNTEXT</div></b>', '<div id=\'nc_new_comment_button\' style=\'background: none repeat scroll 0 0 #999999; float: right; position: fixed; right: 0; top: 43%; width: 30px; height: 30px;\' onclick=\'%NEW_COMMENT_BUTTON_ACTION\'></div>', '\".($curPos ? \"<a href=\'#\' onclick=\'%FIRST_ONCLICK\'>&raquo;&raquo;</a>&nbsp;&nbsp;\" : \"\").\"\r\n\".browse_messages($env, 10, $browse_comments).\"\r\n\".($last_page ? \"&nbsp;&nbsp;<a href=\'#\' onclick=\'%LAST_ONCLICK\'>&raquo;&raquo;</a>\" : \"\").\"', '<a href=\'#\' onclick=\'%SHOW_ALL\'>Показать все</a>', '<div style=\'float:right\'>\n    <a href=\'#\' onclick=\'%DISLIKE_ACTION\'>[-]</a>\n    <span id=\'%RATING_ID\'>%RATING</span>\n    <a href=\'#\' onclick=\'%LIKE_ACTION\'>[+]</a>\n</div>', '<a href=\'%URL\' id=\'%ID\' class=\'%NAME\'>%TEXT</a><br/><br/>');

-- --------------------------------------------------------

--
-- Структура таблицы `Comments_Text`
--

CREATE TABLE IF NOT EXISTS `Comments_Text` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `Parent_Comment_ID` int(11) NOT NULL DEFAULT '0',
  `Sub_Class_ID` int(11) NOT NULL DEFAULT '0',
  `Message_ID` int(11) NOT NULL DEFAULT '0',
  `Date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `Updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `Comment` text NOT NULL,
  `User_ID` int(11) NOT NULL DEFAULT '0',
  `IP` varchar(15) DEFAULT '',
  `Checked` tinyint(1) NOT NULL DEFAULT '1',
  `Guest_Email` varchar(255) DEFAULT NULL,
  `Guest_Name` varchar(255) NOT NULL,
  `Value` text,
  `Like` int(11) NOT NULL,
  `Dislike` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `Sub_Class_ID` (`Sub_Class_ID`,`Message_ID`,`Checked`),
  KEY `User_ID` (`User_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

--
-- Дамп данных таблицы `Settings`
--

INSERT INTO `Settings` (`Key`, `Value`, `Module`, `Catalogue_ID`) VALUES
('GuestName', '1', 'comments', 0),
('GuestNameForced', '0', 'comments', 0),
('GuestEmail', '0', 'comments', 0),
('GuestEmailForced', '0', 'comments', 0),
('ShowAddBlock', '0', 'comments', 0),
('Highlight', '0', 'comments', 0),
('ShowButton', '0', 'comments', 0),
('Premoderation', '0', 'comments', 0),
('UserName', 'Login', 'comments', 0),
('UserAvatar', 'ForumAvatar', 'comments', 0),
('Qty', '5', 'comments', 0),
('Order', '0', 'comments', 0),
('BBcode', '1', 'comments', 0),
('Subscribe_Allow', '1', 'comments', 0),
('Subscribe_Block', '<a href=''#'' id=''%ID'' onclick=''%ACTION''>%TEXT</a><br/><br/>	', 'comments', 0),
('Mail_Subject', 'Новый комментарий', 'comments', 0),
('Mail_Template', 'Новый комментарий в разделе %SUBDIVISION_NAME. Ссылка - %FULL_LINK', 'comments', 0),
('ShowAll', '1', 'comments', 0),
('Rating', '1', 'comments', 0);

--
-- Дамп данных таблицы `Class`
--

INSERT INTO `Class` (`Class_ID`, `IsAuxiliary`, `Class_Name`, `Class_Group`, `DaysToHold`, `AllowTags`, `FormPrefix`, `FormSuffix`, `RecordTemplate`, `RecordsPerPage`, `SortBy`, `RecordTemplateFull`, `TitleTemplate`, `TitleList`, `UseAltTitle`, `AddTemplate`, `EditTemplate`, `AddActionTemplate`, `EditActionTemplate`, `SearchTemplate`, `FullSearchTemplate`, `SubscribeTemplate`, `System_Table_ID`, `Settings`, `AddCond`, `EditCond`, `SubscribeCond`, `DeleteCond`, `NL2BR`, `UseCaptcha`, `CheckActionTemplate`, `DeleteActionTemplate`, `CustomSettingsTemplate`, `ClassDescription`, `DeleteTemplate`, `ClassTemplate`, `Type`, `File_Mode`, `File_Path`, `File_Hash`) VALUES
(205, 1, 'Последние комментарии', 'Комментарии', 0, 0, '', '', '', 20, '', '', '', '', 0, '', '', '', '', '', '', '', 0, '', '', '', '', '', 1, 0, '', '', '$settings_array = array(\n	''TextLength'' => array(\n		''type'' => ''string'',\n		''subtype'' => '''',\n		''caption'' => ''Длина отображаемого текста комментария'',\n		''default_value'' => ''30'',\n		''validate_regexp'' => ''/^\\d+$/'',\n		''validate_error'' => ''Введите целое число'',\n		''size'' => ''4''));', '', '', 0, 'useful', 1, '/205/', ''),
(279, 1, 'Комментарии для личного кабинета', 'Шаблоны компонентов', 0, 0, '', '', '', 20, '', '', '', '', 0, '', '', '', '', '', '', '', 0, '', '', '', '', '', 1, 0, '', '', '$settings_array = array(\n	''TextLength'' => array(\n		''type'' => ''string'',\n		''subtype'' => '''',\n		''caption'' => ''Длина отображаемого текста комментария'',\n		''default_value'' => ''30'',\n		''validate_regexp'' => ''/^\\d+$/'',\n		''validate_error'' => ''Введите целое число'',\n		''size'' => ''4''));', '', '', 205, 'useful', 1, '/205/279/', ''),
(428, 1, 'Для корзины удаленных объектов', 'Шаблоны компонентов', 0, 0, '', '', '', 20, '', '', NULL, NULL, 0, '', '', '', '', '', '', '', 0, '', '', '', '', '', 1, 0, '', '', NULL, NULL, '', 205, 'trash', 1, '/205/428/', '0bbc28b44382782356f81036ae41aeaf');

--
-- Структура таблицы `Message205`
--

CREATE TABLE IF NOT EXISTS `Message205` (
  `Message_ID` int(11) NOT NULL AUTO_INCREMENT,
  `User_ID` int(11) NOT NULL,
  `Subdivision_ID` int(11) NOT NULL,
  `Sub_Class_ID` int(11) NOT NULL,
  `Priority` int(11) NOT NULL DEFAULT '0',
  `Keyword` char(255) NOT NULL,
  `ncTitle` varchar(255) DEFAULT NULL,
  `ncKeywords` varchar(255) DEFAULT NULL,
  `ncDescription` text,
  `Checked` tinyint(4) NOT NULL DEFAULT '1',
  `TimeToDelete` date DEFAULT NULL,
  `TimeToUncheck` date DEFAULT NULL,
  `IP` char(15) DEFAULT NULL,
  `UserAgent` char(255) DEFAULT NULL,
  `Parent_Message_ID` int(11) NOT NULL DEFAULT '0',
  `Created` datetime NOT NULL,
  `LastUpdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `LastUser_ID` int(11) NOT NULL,
  `LastIP` char(15) DEFAULT NULL,
  `LastUserAgent` char(255) DEFAULT NULL,
  PRIMARY KEY (`Message_ID`),
  UNIQUE KEY `Sub_Class_ID` (`Sub_Class_ID`,`Message_ID`,`Keyword`),
  KEY `User_ID` (`User_ID`),
  KEY `LastUser_ID` (`LastUser_ID`),
  KEY `Subdivision_ID` (`Subdivision_ID`),
  KEY `Parent_Message_ID` (`Parent_Message_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;