INSERT INTO ConfigurationValues VALUES (DEFAULT, 'poll_CommentDelay_Interval', '60', 'In-Bulletin', 'in-bulletin:configuration_output');
INSERT INTO ConfigurationValues VALUES (DEFAULT, 'poll_CommentDelay_Value', '10', 'In-Bulletin', 'in-bulletin:configuration_output');
UPDATE Category SET Template = '/in-bulletin/designs/section' WHERE Template = 'inbulletin/index';
UPDATE Category SET CachedTemplate = '/in-bulletin/designs/section' WHERE CachedTemplate = 'inbulletin/index';
UPDATE ConfigurationValues SET VariableValue = '/in-bulletin/designs/section' WHERE VariableName = 'bb_CategoryTemplate';
UPDATE ConfigurationValues SET VariableValue = 'in-bulletin/designs/detail' WHERE VariableName = 'bb_ItemTemplate';
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:topics.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:setting_folder.view', 11, 1, 1, 0);
DELETE FROM Permissions WHERE Permission LIKE 'in-bulletin:inbulletin_general.%';
UPDATE Phrase SET Module = 'In-Bulletin' WHERE ((Phrase LIKE '%Topic%' OR Phrase LIKE '%Post%' OR Phrase LIKE '%Forum%' OR Phrase LIKE '%Censor%' OR Phrase LIKE '%Smiley%' OR Phrase = 'la_title_In-Bulletin') AND (Module = 'Core'));
# ===== v 5.0.1 =====
UPDATE ConfigurationValues SET VariableValue = 'in-bulletin/topics/topic_detail' WHERE VariableName = 'bb_ItemTemplate';
UPDATE ConfigurationAdmin
SET ValueList = 'TopicText=la_opt_TopicText,Posts=la_opt_NumberOfPosts,CreatedOn=la_opt_CreatedOn,LastPostDate=la_opt_LastUpdated,Views=la_opt_TopicViews,CachedRating=la_opt_Rating,LastPoser=la_opt_LastPoster,<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomField WHERE (Type = 3) AND (IsSystem = 0)</SQL>'
WHERE VariableName IN ('Topic_SortField', 'Topic_SortField2');
UPDATE ConfigurationAdmin
SET ValueList = 'ASC=la_common_Ascending,DESC=la_common_Descending'
WHERE VariableName IN ('Topic_SortOrder', 'Topic_SortOrder2');
UPDATE ConfigurationAdmin SET ValueList = '1=la_opt_Sec,60=la_opt_Min,3600=la_opt_Hour,86400=la_opt_Day,604800=la_opt_Week,2419200=la_opt_Month,29030400=la_opt_Year' WHERE VariableName = 'topic_ReviewDelay_Interval';
UPDATE ConfigurationAdmin SET ValueList = '1=la_opt_Sec,60=la_opt_Min,3600=la_opt_Hour,86400=la_opt_Day,604800=la_opt_Week,2419200=la_opt_Month,29030400=la_opt_Year' WHERE VariableName = 'topic_RatingDelay_Interval';
UPDATE ConfigurationAdmin SET ValueList = '1=la_opt_Sec,60=la_opt_Min,3600=la_opt_Hour,86400=la_opt_Day,604800=la_opt_Week,2419200=la_opt_Month,29030400=la_opt_Year' WHERE VariableName = 'poll_CommentDelay_Interval';
UPDATE CustomField SET FieldLabel = 'la_fld_cust_bb_ItemTemplate', Prompt = 'la_fld_cust_bb_ItemTemplate' WHERE FieldName = 'bb_ItemTemplate';
UPDATE ConfigurationAdmin SET ValueList = 'style="width: 50px;"' WHERE VariableName IN ('topic_ReviewDelay_Value', 'topic_RatingDelay_Value', 'poll_CommentDelay_Value');
# ===== v 5.0.2-B1 =====
ALTER TABLE PrivateMessageBody CHANGE Body Body text NULL;
ALTER TABLE Emoticon CHANGE EmotionImage EmotionImage VARCHAR(255) NOT NULL DEFAULT '';
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.VIEW', 'la_PermName_Topic.View_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.ADD', 'la_PermName_Topic.Add_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.ADD.PENDING', 'la_PermName_Topic.Add.Pending_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.DELETE', 'la_PermName_Topic.Delete_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.MODIFY', 'la_PermName_Topic.Modify_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.REPLY.DELETE', 'la_PermName_Topic.Reply.Delete_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.REPLY.VIEW', 'la_PermName_Topic.Reply.View_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.REPLY.ADD', 'la_PermName_Topic.Reply.Add_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.REPLY.MODIFY', 'la_PermName_Topic.Reply.Modify_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.RATE', 'la_PermName_Topic.Rate_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.REVIEW', 'la_PermName_Topic.Review_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.MODIFY', 'la_PermName_Topic.Reply.Owner.Modify_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.DELETE', 'la_PermName_Topic.Reply.Owner.Delete_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.OWNER.DELETE', 'la_PermName_Topic.Owner.Delete_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.MODIFY.PENDING', 'la_PermName_Topic.Modify.Pending_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.OWNER.MODIFY.PENDING', 'la_PermName_Topic.Owner.Modify.Pending_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.OWNER.MODIFY', 'la_PermName_Topic.Owner.Modify_desc', 'In-Bulletin', 1);
INSERT INTO PermissionConfig VALUES (DEFAULT, 'TOPIC.LOCK', 'la_PermName_Topic.Lock_desc', 'In-Bulletin', 1);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT count(*) FROM <%prefix%>Topic WHERE Status=1', NULL, 'la_prompt_ActiveTopics', 0, 1);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) AS TotalTopics FROM <%prefix%>Topic', NULL, 'la_prompt_TopicsTotal', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) AS ActiveTopics FROM <%prefix%>Topic WHERE Status = 1', NULL, 'la_prompt_TopicsActive', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) AS PendingTopics FROM <%prefix%>Topic WHERE Status = 2', NULL, 'la_prompt_TopicsPending', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) AS DisabledTopics FROM <%prefix%>Topic WHERE Status = 0', NULL, 'la_prompt_TopicsDisabled', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) AS NewTopics FROM <%prefix%>Topic WHERE (NewItem = 1) OR ( (UNIX_TIMESTAMP() - CreatedOn) <= <%m:config name="Topic_NewDays"%>*86400 AND (NewItem = 2) )', NULL, 'la_prompt_NewTopics', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) FROM <%prefix%>Topic WHERE EditorsPick = 1', NULL, 'la_prompt_EditorsPickTopics', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) AS HotTopics FROM <%prefix%>Topic WHERE (HotItem = 1) OR (Posts >= <%m:config name="Topic_MaxHotNumber"%> AND (HotItem = 2) )', NULL, 'la_prompt_HotTopics', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) AS PopularTopics FROM <%prefix%>Topic WHERE (PopItem = 1) OR ( (CachedRating >= <%topic:hit_count type="top"%>) AND <%topic:hit_count type="top"%> AND (PopItem = 2) )', NULL, 'la_prompt_PopularTopics', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT <%m:post_format field="AVG(CachedRating)" type="currency" precision="2"%> FROM <%prefix%>Topic WHERE CachedRating > 0', NULL, 'la_prompt_TopicAverageRating', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT MAX(Views) AS MaxTopicHits FROM <%prefix%>Topic', NULL, 'la_prompt_MaxTopicHits', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT MAX(CachedVotesQty) AS MaxTopicVotes FROM <%prefix%>Topic', NULL, 'la_prompt_MaxTopicVotes', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT <%m:post_format field="MAX(CreatedOn)" type="date"%> FROM <%prefix%>Topic', NULL, 'la_prompt_NewestTopicDate', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT <%m:post_format field="MAX(CreatedOn)" type="time"%> FROM <%prefix%>Topic', NULL, 'la_prompt_NewestTopicTime', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT <%m:post_format field="MAX(Modified)" type="date"%> FROM <%prefix%>Topic', NULL, 'la_prompt_LastUpdatedTopicDate', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT <%m:post_format field="MAX(Modified)" type="time"%> FROM <%prefix%>Topic', NULL, 'la_prompt_LastUpdatedTopicTime', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) FROM <%prefix%>ItemReview WHERE Module = \'<%modules:get_current%>\'', NULL, 'la_prompt_TopicReviews', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT COUNT(*) AS TotalPosts FROM <%prefix%>Posting', NULL, 'la_prompt_PostsTotal', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT <%m:post_format field="MAX(CreatedOn)" type="date"%> FROM <%prefix%>Posting', NULL, 'la_prompt_NewestPostDate', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT <%m:post_format field="MAX(CreatedOn)" type="time"%> FROM <%prefix%>Posting', NULL, 'la_prompt_NewestPostTime', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT <%m:post_format field="MAX(Modified)" type="date"%> FROM <%prefix%>Posting', NULL, 'la_prompt_LastUpdatedPostDate', 0, 2);
INSERT INTO StatItem VALUES (DEFAULT, 'In-Bulletin', 'SELECT <%m:post_format field="MAX(Modified)" type="time"%> FROM <%prefix%>Posting', NULL, 'la_prompt_LastUpdatedPostTime', 0, 2);