Page MenuHomeIn-Portal Phabricator

in-bulletin
No OneTemporary

File Metadata

Created
Mon, Feb 24, 2:05 PM

in-bulletin

Index: branches/5.2.x/units/private_messages/private_message_eh.php
===================================================================
--- branches/5.2.x/units/private_messages/private_message_eh.php (revision 15603)
+++ branches/5.2.x/units/private_messages/private_message_eh.php (revision 15604)
@@ -1,299 +1,299 @@
<?php
/**
* @version $Id$
* @package In-Bulletin
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class PrivateMessageEventHandler extends kDBEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
'OnItemBuild' => Array ('self' => true),
'OnCreate' => Array ('self' => true),
'OnDelete' => Array ('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Applies folder & message owner filter to message list
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$folder_id = $this->Application->GetVar('folder_id');
if ( $folder_id === false ) {
$folder_id = PM_FOLDER_INBOX;
$this->Application->SetVar('folder_id', $folder_id);
}
$object = $event->getObject();
/* @var $object kDBList */
$user_id = $this->Application->RecallVar('user_id');
if ( $folder_id == PM_FOLDER_INBOX ) {
$object->addFilter('owner_filter', '%1$s.ToId = ' . $user_id);
}
else {
$object->addFilter('owner_filter', '%1$s.FromId = ' . $user_id);
}
$object->addFilter('folder_filter', '%1$s.FolderId = ' . $folder_id);
}
/**
* Puts message to Sent folder
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
$object = $event->getObject();
/* @var $object kDBItem */
if ( $object->GetDBField('FolderId') != PM_FOLDER_SENT ) {
// when creating "Inbox" message (from "Sent" message) don't reset folder & status
return ;
}
$user_id = $this->Application->RecallVar('user_id');
$object->SetDBField('FromId', $user_id);
$object->SetDBField('FolderId', PM_FOLDER_SENT);
$object->SetDBField('Status', PM_STATUS_READ);
}
/**
* Creates 1st post when topic is created
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
$object = $event->getObject();
/* @var $object kDBItem */
- $this->Application->EmailEventUser('PM.ADD', $object->GetDBField('ToId'));
+ $this->Application->emailUser('PM.ADD', $object->GetDBField('ToId'));
if ( $object->GetDBField('FolderId') != PM_FOLDER_SENT ) {
// 1. create message in sender's "Sent" folder (this method only for this step)
// 2. create message body (shared)
// 3. create message copy in recipient's "Inbox" folder
return ;
}
$message_body = $this->Application->recallObject($event->Prefix . '-body', null, Array ('skip_autoload' => true));
/* @var $message_body kDBItem */
// 1. create message body (for sender & recipient)
$copy_fields = Array ('Subject', 'Body', 'ShowSignatures', 'DisableSmileys', 'DisableBBCodes');
$message_body->SetDBFieldsFromHash($object->GetFieldValues(), null, $copy_fields);
$body_created = $message_body->Create();
if ( $body_created ) {
// 2. link body with message
$object->SetDBField('PMBodyId', $message_body->GetID());
$object->Update();
// 3. create message in recipient's Inbox folder
$object->SetDBField('FolderId', PM_FOLDER_INBOX);
$object->SetDBField('Status', PM_STATUS_UNREAD);
$object->Create();
}
}
/**
* Sets post options to virtual fields
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
$object = $event->getObject();
/* @var $object kDBItem */
$post_helper = $this->Application->recallObject('PostHelper');
/* @var $post_helper PostHelper */
$options_map = $post_helper->getOptionsMap();
$post_options = $object->GetDBField('Options');
foreach ($options_map as $option_name => $field_name) {
$option_value = $post_helper->GetPostOption($option_name, $post_options);
$object->SetDBField($field_name, (int)$option_value);
}
}
/**
* Goes to next_template after post creation
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCreate(kEvent $event)
{
parent::OnCreate($event);
if ( $event->status == kEvent::erSUCCESS && !$this->Application->isAdmin ) {
$event->SetRedirectParam('opener', 's');
$event->redirect = $this->Application->GetVar('next_template');
}
}
/**
* Prevents user from deleting other user private messages
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemDelete(kEvent $event)
{
parent::OnBeforeItemDelete($event);
$object = $event->getObject();
/* @var $object kDBItem */
$user_id = $this->Application->RecallVar('user_id');
$owner_field = ($object->GetDBField('FolderId') == PM_FOLDER_INBOX) ? 'ToId' : 'FromId';
if ( $object->GetDBField($owner_field) != $user_id ) {
$event->status = kEvent::erFAIL;
}
}
/**
* Updates reference counter in message body record
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemDelete(kEvent $event)
{
parent::OnAfterItemDelete($event);
$object = $event->getObject();
/* @var $object kDBItem */
$body_idfield = $this->Application->getUnitOption($event->Prefix . '-body', 'IDField');
$body_table = $this->Application->getUnitOption($event->Prefix . '-body', 'TableName');
$sql = 'UPDATE ' . $body_table . '
SET ReferenceCount = ReferenceCount - 1
WHERE ' . $body_idfield . ' = ' . $object->GetDBField('PMBodyId');
$this->Conn->Query($sql);
}
/**
* Sets default values to posting options based on persistent session
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields');
$virtual_fields['DisableBBCodes']['default'] = (int)!$this->Application->RecallPersistentVar('bbcode');
$virtual_fields['DisableSmileys']['default'] = (int)!$this->Application->RecallPersistentVar('smileys');
$virtual_fields['ShowSignatures']['default'] = (int)$this->Application->RecallPersistentVar('show_sig');
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields);
}
/**
* Checks, that current user is recipient or sender of viewed message
*
* @param kEvent $event
* @return bool
* @access protected
*/
protected function checkItemStatus(kEvent $event)
{
$object = $event->getObject();
/* @var $object kDBItem */
if ( !$object->isLoaded() ) {
return true;
}
$user_id = $this->Application->RecallVar('user_id');
return ($object->GetDBField('FromId') == $user_id) || ($object->GetDBField('ToId') == $user_id);
}
/**
* Prepares new reply & new message form
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnNew(kEvent $event)
{
parent::OnNew($event);
$reply_to = $this->Application->GetVar('reply_to');
$user_id = $this->Application->GetVar('user_id');
$object = $event->getObject();
/* @var $object kDBItem */
if ( $reply_to > 0 ) {
// reply to message
$source_msg = $this->Application->recallObject($event->Prefix . '.-item', null, Array ('skip_autoload' => true));
/* @var $source_msg kDBItem */
$source_msg->Load($reply_to);
$object->SetDBField('ToId', $source_msg->GetDBField('FromId'));
$object->SetDBField('Subject', 'Re: ' . $source_msg->GetDBField('Subject'));
}
elseif ( $user_id > 0 ) {
// send message to any user by id
$object->SetDBField('ToId', $user_id);
}
}
}
\ No newline at end of file
Index: branches/5.2.x/units/helpers/post_helper.php
===================================================================
--- branches/5.2.x/units/helpers/post_helper.php (revision 15603)
+++ branches/5.2.x/units/helpers/post_helper.php (revision 15604)
@@ -1,463 +1,463 @@
<?php
/**
* @version $Id$
* @package In-Bulletin
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class PostHelper extends kHelper {
var $postOptionBits = Array (
'show_sig' => 128,
'disable_bbcode' => 64,
'disable_smileys' => 32,
);
/**
* Checks if specific option is set for post
*
* @param string $option_name
* @param Array $options
* @return bool
*/
function GetPostOption($option_name, $options)
{
if (!isset($this->postOptionBits[$option_name])) {
return false;
}
$option_bit = $this->postOptionBits[$option_name];
return ($options & $option_bit) == $option_bit;
}
/**
* Sets given option bit (by name) to post options
*
* @param string $option_name
* @param int $option_value
* @param Array $options
* @return bool
*/
function SetPostOption($option_name, $option_value, &$options)
{
if (!isset($this->postOptionBits[$option_name])) {
return false;
}
$option_bit = $this->postOptionBits[$option_name];
if ($option_value) {
$options |= $option_bit;
}
else {
$options = $options &~ $option_bit;
}
return true;
}
/**
* Returns post options map to virtual field names
*
* @return Array
*/
function getOptionsMap()
{
$options_map = Array (
'show_sig' => 'ShowSignatures',
'disable_smileys' => 'DisableSmileys',
'disable_bbcode' => 'DisableBBCodes',
);
return $options_map;
}
/**
* @return void
* @param int $date
* @desc Set any field to category & all it's parent categories
*/
function PropagateCategoryField($category_id, $field_name, $field_value)
{
$id_field = $this->Application->getUnitOption('c', 'IDField');
$table_name = $this->Application->getUnitOption('c', 'TableName');
$sql = 'SELECT ParentPath
FROM ' . $table_name . '
WHERE ' . $id_field . ' = ' . $category_id;
$parent_path = $this->Conn->GetOne($sql);
$parent_categories = explode('|', substr($parent_path, 1, -1));
if ( !$parent_categories ) {
return;
}
$fields_hash = Array ($field_name => $field_value);
$this->Conn->doUpdate($fields_hash, $table_name, $id_field . ' IN (' . implode(',', $parent_categories) . ')');
}
/**
* Sets today posts count & today date for topic
*
* @param kCatDBItem $object
* @param int $post_date
* @param int $increment_by
* @return bool
*/
function updateTodayPostsCount(&$object, $post_date, $increment_by = 1)
{
$date_now = adodb_date('Y-m-d');
if (adodb_date('Y-m-d', $post_date) != $date_now) {
return true;
}
// last post update date was today or not
$today_posts = ($date_now == $object->GetDBField('TodayDate')) ? $object->GetDBField('TodayPosts') : 0;
$object->SetDBField('TodayDate', $date_now);
$object->SetDBField('TodayPosts', $today_posts + $increment_by);
return $object->Update();
}
function updatePostCount($topic_id, $increment = 1)
{
$id_field = $this->Application->getUnitOption('bb', 'IDField');
$table_name = $this->Application->getUnitOption('bb', 'TableName');
// helps in case, when 2 (or more) users tries to post in same topic at same time
$sql = 'UPDATE '.$table_name.'
SET Posts = Posts '.($increment > 0 ? '+' : '-').' '.abs($increment).'
WHERE '.$id_field.' = '.$topic_id;
$this->Conn->Query($sql);
// returns new value
$sql = 'SELECT Posts
FROM '.$table_name.'
WHERE '.$id_field.' = '.$topic_id;
return $this->Conn->GetOne($sql);
}
/**
* Replaces all special formatting in post before displaing it to user
*
* @param string $post_body
* @param int $post_options bit array of post options
* @param Array $sub_blocks block names for rendering smileys & bbcodes
* @return string
*/
function parsePostBody($post_body, $post_options, $sub_blocks)
{
// 1. escape all html sequences
$post_body = htmlspecialchars($post_body, ENT_NOQUOTES, CHARSET); // don't touch quotes in bbcode attribute values
// 2. replace censored words
$post_body = $this->CensorText($post_body);
// 3. replace bb codes
if (!$this->GetPostOption('disable_bbcode', $post_options)) {
$post_body = $this->replaceBBCodes($post_body, $sub_blocks['bbcode']);
}
// 4. replace smileys
if (!$this->GetPostOption('disable_smileys', $post_options)) {
$post_body = $this->replaceSmileys($post_body, $sub_blocks['smileys']);
}
// 5. add enters (because we don't use HTML in post body)
$post_body = nl2br($post_body);
// 6. replace quoted text
return $this->replacePostQuote($post_body, $sub_blocks['quote']);
}
function replacePostQuote($text, $render_as)
{
if (preg_match('/\[quote id=([\d]+)\](.*)\[\/quote\]/s', $text, $regs)) {
$post = $this->Application->recallObject('bb-post.-item', null, Array ('skip_autoload' => true));
/* @var $post kDBItem */
$post->Load($regs[1]);
$block_params = Array ('name' => $render_as, 'PrefixSpecial' => 'bb-post.-item', 'Prefix' => 'bb-post', 'Special' => '-item', 'strip_nl' => 2);
$parsed_quote = $this->Application->ParseBlock($block_params);
return str_replace($regs[0], $parsed_quote, $text);
}
return $text;
}
/**
* Replaces bad words with good words (censorship process)
*
* @param string $text
* @return string
*/
function CensorText($text)
{
static $censor_words = null;
if (!isset($censor_words)) {
$sql = 'SELECT Replacement, BadWord
FROM '.TABLE_PREFIX.'Censorship';
$censor_words = $this->Conn->GetCol($sql, 'BadWord');
}
foreach ($censor_words as $replace_from => $replace_to) {
$text = str_replace($replace_from, $replace_to, $text);
}
return $text;
}
function replaceSmileys($text, $smiley_element)
{
static $smileys = null;
if (!isset($smileys)) {
$sql = 'SELECT em.EmotionImage, em.KeyStroke
FROM '.TABLE_PREFIX.'Emoticon em
WHERE em.Enabled = 1
ORDER BY CHAR_LENGTH(em.KeyStroke) DESC';
$smileys = $this->Conn->GetCol($sql, 'KeyStroke');
}
$block_params = Array ('name' => $smiley_element, 'smiley_url' => '#SMILEY_URL#');
$smiley_mask = trim($this->Application->ParseBlock($block_params));
$base_url = rtrim($this->Application->BaseURL(),'/');
foreach ($smileys as $key_stoke => $image_url) {
if (strpos($text, $key_stoke) === false) {
continue;
}
$smiley_html = str_replace('#SMILEY_URL#', $base_url.SMILEYS_PATH.$image_url, $smiley_mask);
$text = str_replace($key_stoke, $smiley_html, $text);
}
return $text;
}
/**
* Sort params by name and then by length
*
* @param string $a
* @param string $b
* @return int
* @access private
*/
function CmpParams($a, $b)
{
list ($a, ) = explode(':', $a);
list ($b, ) = explode(':', $b);
$a_len = strlen($a);
$b_len = strlen($b);
if ($a_len == $b_len) return 0;
return $a_len > $b_len ? -1 : 1;
}
function replaceBBCodes($text, $bbcode_element)
{
// convert phpbb bbcodes to in-bulletin bbcodes
$text = $this->preformatBBCodes($text);
$tags_defs = explode(';', $this->Application->ConfigValue('BBTags')); // 'b:;i:;u:;ul:type|align;font:color|face|size;url:href;img:src|border';
usort($tags_defs, Array (&$this, 'CmpParams'));
foreach($tags_defs as $tag) {
list ($tag_name, $tag_params) = explode(':', $tag);
$tag_params = $tag_params ? array_flip(explode('|', $tag_params)) : 0;
$text = preg_replace('/\['.$tag_name.'(.*)\](.*)\[\/'.$tag_name.' *\]/Uise','$this->checkBBCodeAttribs("'.$tag_name.'",\'$1\',\'$2\',$tag_params);', $text);
}
// additional processing for [url], [*], [img] bbcode
$text = preg_replace('/<url>(.*)<\/url>/Usi','<url href="$1">$1</url>',$text);
$text = preg_replace('/<font>(.*)<\/font>/Usi','$1',$text); // skip empty fonts
$text = str_replace( Array('<url','</url>','[*]'),
Array('<a target="_blank"','</a>','<li>'),
$text);
// bbcode [code]xxx[/code] processing
$text = preg_replace('/\[code\](.*)\[\/code\]/Uise', "\$this->replaceCodeBBCode('$1', '".$bbcode_element."')", $text);
return $text;
}
/**
* Convert phpbb url bbcode to valid in-bulletin's format
*
* @param string $text
* @return string
*/
function preformatBBCodes($text)
{
// 1. urls
$text = preg_replace('/\[url=(.*)\](.*)\[\/url\]/Ui','[url href="$1"]$2[/url]',$text);
$text = preg_replace('/\[url\](.*)\[\/url\]/Ui','[url href="$1"]$1[/url]',$text);
// 2. images
$text = preg_replace('/\[img\](.*)\[\/img\]/Ui','[img src="$1" border="0"][/img]',$text);
// 3. color
$text = preg_replace('/\[color=(.*)\](.*)\[\/color\]/Ui','[font color="$1"]$2[/font]',$text);
// 4. size
$text = preg_replace('/\[size=(.*)\](.*)\[\/size\]/Ui','[font size="$1"]$2[/font]',$text);
// 5. lists
$text = preg_replace('/\[list(.*)\](.*)\[\/list\]/Uis','[ul]$2[/ul]',$text);
// 6. email to link
$text = preg_replace('/\[email\](.*)\[\/email\]/Ui','[url href="mailto:$1"]$1[/url]',$text);
//7. b tag
$text = preg_replace('/\[(b|i|u):(.*)\](.*)\[\/(b|i|u):(.*)\]/Ui','[$1]$3[/$4]',$text);
//8. code tag
$text = preg_replace('/\[code:(.*)\](.*)\[\/code:(.*)\]/Uis','[code]$2[/code]',$text);
return $text;
}
/**
* Removes not allowed params from tag and returns result
*
* @param string $BBCode bbcode to check
* @param string $TagParams params string entered by user
* @param string $TextInside text between opening and closing bbcode tag
* @param string $ParamsAllowed list of allowed parameter names ("|" separated)
* @return string
*/
function checkBBCodeAttribs($BBCode, $TagParams, $TextInside, $ParamsAllowed)
{
// unescape escaped quotes in tag
$TagParams = str_replace('\"', '"', $TagParams);
$TextInside = str_replace('\"', '"', $TextInside);
$params_extracted = preg_match_all('/ +([^=]*)=["\']?([^ "\']*)["\']?/is', $TagParams, $extracted_params, PREG_SET_ORDER);
if ($ParamsAllowed && $params_extracted) {
$ret = Array();
foreach ($extracted_params as $param) {
$param_name = strtolower(trim( $param[1] ));
$param_value = trim($param[2]);
// 1. prevent hacking
if ($BBCode == 'url' && $param_name == 'href') {
if (strpos(strtolower($param_value), 'script:') !== false) {
// script tag found in "href" parameter of "url" bbcode (equals to hacking) -> remove bbcode
return $TextInside;
}
}
// 2. leave only allowed params & remove all not allowed
if (isset($ParamsAllowed[$param_name])) {
$ret[] = $param_name.'="'.$param_value.'"';
}
}
$ret = count($ret) ? ' '.implode(' ', $ret) : '';
return '<'.$BBCode.$ret.'>'.$TextInside.'</'.$BBCode.'>';
}
return '<'.$BBCode.'>'.$TextInside.'</'.$BBCode.'>';
}
function highlightCode($code, $strip_tabs = 0)
{
if ($strip_tabs) {
$code = preg_replace('/(\t){'.$strip_tabs.'}(.*)/', '\\2', $code);
}
$code = str_replace( Array('\\', '/') , Array('_no_match_string_', '_n_m_s_'), $code);
$code = highlight_string('<?php'.$code.'?>', true);
$code = str_replace( Array('_no_match_string_', '_n_m_s_'), Array('\\', '/'), $code);
$code = preg_replace('/&lt;\?(.*)php(.*)\?&gt;/Us', '\\2', $code);
$code = preg_replace('/<code><font color="(.*)">([\r\n]+)/si', '<code><font color="\\1">', $code);
$code = preg_replace('/([\r\n]+)<\/font>([\r\n]+)<\/code>/si', '</font></code>', $code);
return $code;
}
/**
* Replaces [code]php code[/code] bbcode in post
*
* @param string $input_string code line to highlight
* @param string $bbcode_element block name used for bbcode descoration
* @return string
*/
function replaceCodeBBCode($input_string, $bbcode_element)
{
static $bbcode_mask = null;
if (!isset($bbcode_mask)) {
$block_params = Array ('name' => $bbcode_element, 'bb_code' => '#BB_CODE#');
$bbcode_mask = trim($this->Application->ParseBlock($block_params));
}
$input_string = trim( str_replace('\"','"', htmlspecialchars_decode($input_string)) );
$input_string = $this->highlightCode($input_string);
$input_string = preg_replace("/\r<br \/>/s", "\r", $input_string); // undo nl2br added in highlighting
$input_string = str_replace('#BB_CODE#', $input_string, $bbcode_mask);
return $input_string;
}
/**
* Returns subscription manager by name
*
* @param string $name
* @param array $arguments
* @return kSubscriptionManager
* @throws InvalidArgumentException
*/
public function getSubscriptionManager($name, $arguments = Array ())
{
if ( $name != 'CategoryTopics' && $name != 'TopicPosts' ) {
throw new InvalidArgumentException('Unknown subscription manager "' . $name . '"');
}
$manager = $this->Application->makeClass('kSubscriptionManager');
/* @var $manager kSubscriptionManager */
$fields_hash = Array ();
$user_id = isset($arguments[1]) ? $arguments[1] : $this->Application->RecallVar('user_id');
switch ( $name ) {
case 'CategoryTopics':
$category_id = isset($arguments[0]) ? $arguments[0] : $this->Application->GetVar('m_cat_id');
$fields_hash = Array (
- 'EmailEventId' => $manager->getEmailEventId('TOPIC.ADD.SUB'),
+ 'EmailTemplateId' => $manager->getEmailTemplateId('TOPIC.ADD.SUB'),
'UserId' => $user_id,
'CategoryId' => $category_id,
);
break;
case 'TopicPosts':
$fields_hash = Array (
- 'EmailEventId' => $manager->getEmailEventId('POST.ADD.SUB'),
+ 'EmailTemplateId' => $manager->getEmailTemplateId('POST.ADD.SUB'),
'UserId' => $user_id,
'ParentItemId' => $arguments[0],
);
break;
}
$manager->add($fields_hash);
return $manager;
}
}
\ No newline at end of file
Index: branches/5.2.x/units/posts/post_eh.php
===================================================================
--- branches/5.2.x/units/posts/post_eh.php (revision 15603)
+++ branches/5.2.x/units/posts/post_eh.php (revision 15604)
@@ -1,447 +1,447 @@
<?php
/**
* @version $Id$
* @package In-Bulletin
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class PostEventHandler extends kDBEventHandler {
/**
* Checks topic-post modify and delete permissions
*
* @param kEvent $event
* @return bool
* @access public
*/
public function CheckPermission(kEvent $event)
{
$events = Array ('OnUpdate', 'OnDelete');
if ( in_array($event->Name, $events) ) {
return true;
}
return parent::CheckPermission($event);
}
/**
* Sets default values
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
$object = $event->getObject();
/* @var $object kDBItem */
$user_id = $this->Application->RecallVar('user_id');
$now = adodb_mktime();
$object->SetDBField('CreatedById', $user_id);
$object->SetDBField('CreatedOn_date', $now);
$object->SetDBField('CreatedOn_time', $now);
$object->SetDBField('ModifiedById', $user_id);
$object->SetDBField('Modified_date', $now);
$object->SetDBField('Modified_time', $now);
$object->SetDBField('IPAddress', $this->Application->getClientIp());
$sql = 'SELECT Username
FROM ' . TABLE_PREFIX . 'Users
WHERE PortalUserId = ' . $user_id;
$object->SetDBField('PosterAlias', $this->Conn->GetOne($sql));
// set post options
$post_helper = $this->Application->recallObject('PostHelper');
/* @var $post_helper PostHelper */
$options_map = $post_helper->getOptionsMap();
$post_options = $object->GetDBField('Options');
foreach ($options_map as $option_name => $field_name) {
$option_value = $object->GetDBField($field_name);
$post_helper->SetPostOption($option_name, $option_value, $post_options);
}
$object->SetDBField('Options', $post_options);
$table_info = $object->getLinkedInfo($event->Special, true);
$object->SetDBField($table_info['ForeignKey'], $table_info['ParentId']);
}
/**
* Checks if user has permission on post
*
* @param kEvent $event
* @param string $permissions
*/
function checkPostPermission($event, $permissions)
{
$object = $event->getObject();
/* @var $object kDBItem */
$sql = 'SELECT ci.CategoryId, p.CreatedById
FROM '.$object->TableName.' p
LEFT JOIN '.TABLE_PREFIX.'Topic t ON t.TopicId = p.TopicId
LEFT JOIN '.TABLE_PREFIX.'CategoryItems ci ON ci.ItemResourceId = t.ResourceId AND ci.PrimaryCat = 1
WHERE p.'.$object->IDField.' = '.$object->GetID();
$post_info = $this->Conn->GetRow($sql);
$perm_helper = $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$is_owner = $post_info['CreatedById'] == $this->Application->RecallVar('user_id');
$params['permissions'] = 'TOPIC.REPLY.MODIFY|TOPIC.REPLY.OWNER.MODIFY';
$params['cat_id'] = $post_info['CategoryId'];
return $perm_helper->TagPermissionCheck($params, $is_owner);
}
/**
* Sets post options before post update
* Ensures, that only user with permission will update topic
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
$object = $event->getObject();
/* @var $object kDBItem */
$perm_status = $this->checkPostPermission($event, 'TOPIC.REPLY.MODIFY|TOPIC.REPLY.OWNER.MODIFY');
if ( !$perm_status ) {
$event->status = kEvent::erFAIL;
return;
}
$post_helper = $this->Application->recallObject('PostHelper');
/* @var $post_helper PostHelper */
$options_map = $post_helper->getOptionsMap();
$post_options = $object->GetDBField('Options');
foreach ($options_map as $option_name => $field_name) {
$option_value = $object->GetDBField($field_name);
$post_helper->SetPostOption($option_name, $option_value, $post_options);
}
$object->SetDBField('Options', $post_options);
}
/**
* Notifies admin about post change
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
- $this->Application->EmailEventAdmin('POST.MODIFY');
+ $this->Application->emailAdmin('POST.MODIFY');
}
/**
* Checks, that user can delete post
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemDelete(kEvent $event)
{
parent::OnBeforeItemDelete($event);
$object = $event->getObject();
/* @var $object kDBItem */
if ( !$this->checkPostPermission($event, 'TOPIC.REPLY.OWNER.DELETE|TOPIC.REPLY.DELETE') ) {
$event->status = kEvent::erFAIL;
}
}
/**
* Sets post options to virtual fields
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
$object = $event->getObject();
/* @var $object kDBItem */
$post_helper = $this->Application->recallObject('PostHelper');
/* @var $post_helper PostHelper */
$options_map = $post_helper->getOptionsMap();
$post_options = $object->GetDBField('Options');
foreach ($options_map as $option_name => $field_name) {
$option_value = $post_helper->GetPostOption($option_name, $post_options);
$object->SetDBField($field_name, (int)$option_value);
}
}
/**
* Updates cached post counter in topic
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemCreate(kEvent $event)
{
parent::OnAfterItemCreate($event);
$object = $event->getObject();
/* @var $object kDBItem */
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$main_object = $this->Application->recallObject($parent_prefix);
/* @var $main_object kCatDBItem */
// update user posts counter
$user_posts = $this->Application->RecallPersistentVar('bb_posts');
$this->Application->StorePersistentVar('bb_posts', $user_posts + 1);
$post_helper = $this->Application->recallObject('PostHelper');
/* @var $post_helper PostHelper */
$category_id = $this->Application->GetVar('m_cat_id');
$post_helper->PropagateCategoryField($category_id, 'Modified', $object->GetDBField('CreatedOn'));
if ( !$this->Application->isAdmin && $main_object->GetDBField('Posts') ) {
// don't send any email events when in admin OR new topic just added (0 posts)
$user_notified = false; // don't send POST.ADD event twice to same user (in case if owner adds new post)
if ( $main_object->GetDBField('NotifyOwnerOnChanges') ) {
$user_notified = $main_object->GetDBField('OwnerId');
- $this->Application->EmailEventUser('POST.ADD', $user_notified);
+ $this->Application->emailUser('POST.ADD', $user_notified);
}
$post_owner_id = $object->GetDBField('CreatedById');
if ( ($post_owner_id > 0) && ($user_notified != $post_owner_id) ) {
- $this->Application->EmailEventUser('POST.ADD', $post_owner_id);
+ $this->Application->emailUser('POST.ADD', $post_owner_id);
}
- $this->Application->EmailEventAdmin('POST.ADD');
+ $this->Application->emailAdmin('POST.ADD');
}
$post_helper->updateTodayPostsCount($main_object, $object->GetDBField('CreatedOn'), +1);
$this->updateTopicInfo($event, $main_object);
$topic_id = $object->GetDBField('TopicId');
$posts_count = $post_helper->updatePostCount($topic_id, +1);
$main_object->SetDBField('Posts', $posts_count);
// auto-lock topic after N number of posts (if option enabled)
$auto_lock = $this->Application->ConfigValue('AutoTopicLockPosts');
if ( (int)$auto_lock > 0 ) {
if ( $posts_count >= $auto_lock ) {
// user has unlocked topic after $auto_lock and posts again -> ensure that topic will be locked again
$this->Application->HandleEvent(new kEvent($parent_prefix . ':OnTopicLockToggle'));
}
}
}
/**
* Update last post info in topic
*
* @param kEvent $event
* @param kCatDBItem $main_object
*/
function updateTopicInfo($event, &$main_object)
{
$object = $event->getObject();
/* @var $object kDBItem */
$main_object->SetDBField('Modified_date', $object->GetDBField('Modified'));
$main_object->SetDBField('Modified_time', $object->GetDBField('Modified'));
$main_object->SetDBField('LastPostId', $object->GetID());
$main_object->SetDBField('LastPostDate_date', $object->GetDBField('CreatedOn'));
$main_object->SetDBField('LastPostDate_time', $object->GetDBField('CreatedOn'));
$main_object->Update();
}
/**
* Goes to next_template after post creation
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCreate(kEvent $event)
{
parent::OnCreate($event);
if ( $event->status == kEvent::erSUCCESS && !$this->Application->isAdmin ) {
$event->SetRedirectParam('opener', 's');
$event->redirect = $this->Application->GetVar('next_template');
}
}
/**
* Goes to next_template after post editing
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnUpdate(kEvent $event)
{
parent::OnUpdate($event);
if ($event->status == kEvent::erSUCCESS && !$this->Application->isAdmin) {
$event->SetRedirectParam('opener', 's');
$event->redirect = $this->Application->GetVar('next_template');
$event->SetRedirectParam('pass', 'm,bb');
}
}
/**
* Moves reference to last post in topic, when it is deleted
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemDelete(kEvent $event)
{
parent::OnAfterItemDelete($event);
$object = $event->getObject();
/* @var $object kDBItem */
$topic_id = $object->GetDBField('TopicId');
if ( !$topic_id ) {
// deleting post from non-existing topic
return;
}
$post_helper = $this->Application->recallObject('PostHelper');
/* @var $post_helper PostHelper */
// update posts count in topic
$post_helper->updatePostCount($topic_id, -1);
// update post owner posts counter
$sql = 'UPDATE ' . TABLE_PREFIX . 'UserPersistentSessionData
SET VariableValue = IF (VariableValue > 0, VariableValue - 1, 0)
WHERE (PortalUserId = ' . $object->GetDBField('CreatedById') . ') AND (VariableName = "bb_posts")';
$this->Conn->Query($sql);
$main_object = $this->Application->recallObject('bb.-item', null, Array ('skip_autoload' => true));
/* @var $main_object kCatDBItem */
$main_object->Load($topic_id);
if ( !$main_object->isLoaded() ) {
// this is topic deletion proccess, when all it's posts are deleted too
return;
}
$post_helper->updateTodayPostsCount($main_object, $object->GetDBField('CreatedOn'), -1);
if ( $main_object->GetDBField('LastPostId') == $object->GetID() ) {
$sql = 'SELECT PostingId, CreatedOn
FROM ' . $object->TableName . '
WHERE TopicId = ' . $topic_id . '
ORDER BY PostingId DESC';
$last_post = $this->Conn->GetRow($sql);
$fields_hash = Array (
'LastPostId' => $last_post['PostingId'],
'LastPostDate' => $last_post['CreatedOn'],
);
$this->Conn->doUpdate($fields_hash, $main_object->TableName, $main_object->IDField . ' = ' . $topic_id);
}
}
/**
* Sets default values to posting options based on persistent session
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields');
$virtual_fields['DisableBBCodes']['default'] = (int)!$this->Application->RecallPersistentVar('bbcode');
$virtual_fields['DisableSmileys']['default'] = (int)!$this->Application->RecallPersistentVar('smileys');
$virtual_fields['ShowSignatures']['default'] = (int)$this->Application->RecallPersistentVar('show_sig');
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields);
}
/**
* Deletes items & preserves clean env
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnDelete(kEvent $event)
{
parent::OnDelete($event);
if ( $event->status == kEvent::erSUCCESS && !$this->Application->isAdmin ) {
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$event->SetRedirectParam('pass', 'm,' . $parent_prefix);
}
}
/**
* Prepares new reply form
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnNew(kEvent $event)
{
parent::OnNew($event);
$reply_to = $this->Application->GetVar('reply_to');
if ( $reply_to > 0 ) {
$object = $event->getObject();
/* @var $object kDBItem */
$source_post = $this->Application->recallObject($event->Prefix . '.-item', null, Array ('skip_autoload' => true));
/* @var $source_post kDBItem */
$source_post->Load($reply_to);
$object->SetDBField('Subject', 'Re: ' . $source_post->GetDBField('Subject'));
$object->SetDBField('PostingText', '[quote id=' . $reply_to . ']' . $source_post->GetDBField('PostingText') . '[/quote]');
}
}
}
\ No newline at end of file
Index: branches/5.2.x/install/install_data.sql
===================================================================
--- branches/5.2.x/install/install_data.sql (revision 15603)
+++ branches/5.2.x/install/install_data.sql (revision 15604)
@@ -1,229 +1,229 @@
# Section "in-bulletin:configuration_output":
INSERT INTO SystemSettings VALUES(DEFAULT, 'Topic_SortOrder', 'desc', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_topic_sortfield_prompt', 'select', '', 'asc=la_common_Ascending||desc=la_common_Descending', 10.01, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Topic_SortField', 'LastPostDate', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_topic_sortfield_prompt', 'select', '', '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>CustomFields WHERE (Type = 3) AND (IsSystem = 0)</SQL>', 10.01, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Topic_SortOrder2', 'desc', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_topic_sortfield2_prompt', 'select', '', 'asc=la_common_Ascending||desc=la_common_Descending', 10.02, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Topic_SortField2', 'Posts', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_topic_sortfield2_prompt', 'select', '', '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>CustomFields WHERE (Type = 3) AND (IsSystem = 0)</SQL>', 10.02, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Perpage_Topics', '5', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_topic_perpage_prompt', 'text', '', '', 10.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Perpage_Topics_Short', '3', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_topic_perpage_short_prompt', 'text', '', '', 10.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Topic_NewDays', '6', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_topic_newdays_prompt', 'text', '', '', 10.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Topic_MinPopRating', '3', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_fld_Topic_MinPopRating', 'text', '', '', 10.06, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Topic_MinPopVotes', '8', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_fld_Topic_MinPopVotes', 'text', '', '', 10.07, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Topic_MaxHotNumber', '3', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_fld_Topic_MaxHotNumber', 'text', '', '', 10.08, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Topic_EditorPicksAbove', '1', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_topic_editorpicksabove_prompt', 'checkbox', '', '', 10.09, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'topic_ReviewDelay_Interval', '60', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_prompt_DupReviews', 'select', '', '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', 10.1, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'topic_ReviewDelay_Value', '10', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_prompt_DupReviews', 'text', '', 'style="width: 50px;"', 10.1, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'topic_RatingDelay_Interval', '3600', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_prompt_DupRating', 'select', '', '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', 10.11, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'topic_RatingDelay_Value', '1', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_prompt_DupRating', 'text', '', 'style="width: 50px;"', 10.11, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'AutoTopicLockPosts', '0', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Topics', 'la_prompt_PostsToLock', 'text', NULL, NULL, 10.12, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Perpage_Postings', '25', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_posts_subheading', 'la_posts_perpage_prompt', 'text', '', '', 20.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Perpage_TopicReviews', '10', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Reviews', 'la_review_perpage_prompt', 'text', NULL, NULL, 30.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'bb_CategoryTemplate', '/in-bulletin/designs/section', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_section_Templates', 'la_fld_CategoryTemplate', 'text', '', '', 40.01, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'bb_ItemTemplate', 'in-bulletin/topics/topic_detail', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_section_Templates', 'la_fld_ItemTemplate', 'text', '', '', 40.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'bb_MaxImageCount', '5', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_section_ImageSettings', 'la_config_MaxImageCount', 'text', '', '', 50.01, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'bb_ThumbnailImageWidth', '120', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_section_ImageSettings', 'la_config_ThumbnailImageWidth', 'text', '', '', 50.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'bb_ThumbnailImageHeight', '120', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_section_ImageSettings', 'la_config_ThumbnailImageHeight', 'text', '', '', 50.03, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'bb_FullImageWidth', '450', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_section_ImageSettings', 'la_config_FullImageWidth', 'text', '', '', 50.04, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'bb_FullImageHeight', '450', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_section_ImageSettings', 'la_config_FullImageHeight', 'text', '', '', 50.05, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'poll_CommentDelay_Value', '10', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Polls', 'la_prompt_DupPollComments', 'text', '', 'style="width: 50px;"', 60.1, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'poll_CommentDelay_Interval', '60', 'In-Bulletin', 'in-bulletin:configuration_output', 'la_Text_Polls', 'la_prompt_DupPollComments', 'select', '', '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', 60.2, 2, 1, NULL);
# Section "in-bulletin:configuration_search":
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Increase_topics', '30', 'In-Bulletin', 'in-bulletin:configuration_search', 'la_config_DefaultIncreaseImportance', 'la_text_increase_importance', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Keyword_topics', '90', 'In-Bulletin', 'in-bulletin:configuration_search', 'la_config_SearchRel_DefaultKeyword', 'la_text_keyword', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Pop_topics', '5', 'In-Bulletin', 'in-bulletin:configuration_search', 'la_config_DefaultPop', 'la_text_popularity', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Rating_topics', '5', 'In-Bulletin', 'in-bulletin:configuration_search', 'la_config_DefaultRating', 'la_prompt_Rating', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Increase_posts', '30', 'In-Bulletin', 'in-bulletin:configuration_search', '', '', '', NULL, NULL, 0, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Keyword_posts', '90', 'In-Bulletin', 'in-bulletin:configuration_search', '', '', '', NULL, NULL, 0, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Pop_posts', '5', 'In-Bulletin', 'in-bulletin:configuration_search', '', '', '', NULL, NULL, 0, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Rating_posts', '5', 'In-Bulletin', 'in-bulletin:configuration_search', '', '', '', NULL, NULL, 0, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Search_ShowMultiple_topics', '0', 'In-Bulletin', 'in-bulletin:configuration_search', 'la_config_ShowMultiple', 'la_Text_MultipleShow', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'BBTags', 'b:;i:;u:;ul:type|align;font:color|face|size;url:href;img:src|border', 'In-Bulletin', '', '', '', '', NULL, NULL, 0, 0, 0, NULL);
INSERT INTO Emoticon VALUES (1, 'Happy Smile', ':)', 1, '');
INSERT INTO Emoticon VALUES (2, 'Big Grin', ':grin:', 1, '');
INSERT INTO Emoticon VALUES (3, 'Wink', ';)', 1, '');
INSERT INTO Emoticon VALUES (4, 'Scared', ':scared:', 1, '');
INSERT INTO Emoticon VALUES (5, 'Teasing', ':eek:', 1, '');
INSERT INTO Emoticon VALUES (6, 'Cool', ':cool:', 1, '');
INSERT INTO Emoticon VALUES (7, 'Angry', ':@', 1, '');
INSERT INTO Emoticon VALUES (8, 'Squint', ':squint:', 1, '');
INSERT INTO Emoticon VALUES (9, 'Oops', ':o', 1, '');
INSERT INTO Emoticon VALUES (10, 'Sad', ':(', 1, '');
INSERT INTO Emoticon VALUES (11, 'Cry', ':cry:', 1, '');
INSERT INTO Emoticon VALUES (12, 'Smirk', ';]', 1, '');
INSERT INTO Emoticon VALUES (13, 'Happy sleep', ':sleep:', 1, '');
INSERT INTO Emoticon VALUES (14, 'Very angry', ':x', 1, '');
INSERT INTO Emoticon VALUES (15, 'Geek', ':geek:', 1, '');
INSERT INTO Emoticon VALUES (16, 'Upset', ';(', 1, '');
INSERT INTO Emoticon VALUES (17, 'LOL', ':lol:', 1, '');
INSERT INTO Emoticon VALUES (18, 'Yawn', ':O', 1, '');
INSERT INTO Emoticon VALUES (19, 'Thinking', ':hm:', 1, '');
INSERT INTO Emoticon VALUES (20, 'Secret', ':|', 1, '');
UPDATE Emoticon SET EmotionImage = CONCAT('0_',EmoticonId,'.gif');
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.ADD', NULL, 1, 1, 'In-Bulletin', 'Topic Added', 1, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.ADD', NULL, 1, 1, 'In-Bulletin', 'Topic Added', 0, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.ADD.PENDING', NULL, 1, 1, 'In-Bulletin', 'Add Pending Topic', 1, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.ADD.PENDING', NULL, 1, 1, 'In-Bulletin', 'Add Pending Topic', 0, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.MODIFY', NULL, 1, 1, 'In-Bulletin', 'Modify Topic', 1, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.MODIFY', NULL, 1, 1, 'In-Bulletin', 'Modify Topic', 0, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.MODIFY.PENDING', NULL, 1, 1, 'In-Bulletin', 'Topic Modifications Pending', 1, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.MODIFY.PENDING', NULL, 1, 1, 'In-Bulletin', 'Topic Modifications Pending', 0, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.APPROVE', NULL, 1, 0, 'In-Bulletin', 'Approve Topic', 0, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'POST.ADD', NULL, 1, 1, 'In-Bulletin', 'Post Added', 1, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'POST.MODIFY', NULL, 1, 1, 'In-Bulletin', 'Post Modified', 1, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'POST.ADD', NULL, 1, 0, 'In-Bulletin', 'Post Added', 0, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'PM.ADD', NULL, 1, 0, 'In-Bulletin', 'New Private Message', 0, 1, 1);
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient, BindToSystemEvent) VALUES(DEFAULT, 'POST.ADD.SUB', NULL, 1, 0, 'In-Bulletin', 'Post Added (for subscribers)', 0, 1, 0, 'bb-post:OnCreate');
-INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient, BindToSystemEvent) VALUES(DEFAULT, 'TOPIC.ADD.SUB', NULL, 1, 0, 'In-Bulletin', 'Topic Added (for subscribers)', 0, 1, 0, 'bb:OnCreate');
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.ADD', NULL, 1, 1, 'In-Bulletin', 'Topic Added', 1, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.ADD', NULL, 1, 1, 'In-Bulletin', 'Topic Added', 0, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.ADD.PENDING', NULL, 1, 1, 'In-Bulletin', 'Add Pending Topic', 1, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.ADD.PENDING', NULL, 1, 1, 'In-Bulletin', 'Add Pending Topic', 0, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.MODIFY', NULL, 1, 1, 'In-Bulletin', 'Modify Topic', 1, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.MODIFY', NULL, 1, 1, 'In-Bulletin', 'Modify Topic', 0, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.MODIFY.PENDING', NULL, 1, 1, 'In-Bulletin', 'Topic Modifications Pending', 1, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.MODIFY.PENDING', NULL, 1, 1, 'In-Bulletin', 'Topic Modifications Pending', 0, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'TOPIC.APPROVE', NULL, 1, 0, 'In-Bulletin', 'Approve Topic', 0, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'POST.ADD', NULL, 1, 1, 'In-Bulletin', 'Post Added', 1, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'POST.MODIFY', NULL, 1, 1, 'In-Bulletin', 'Post Modified', 1, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'POST.ADD', NULL, 1, 0, 'In-Bulletin', 'Post Added', 0, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'PM.ADD', NULL, 1, 0, 'In-Bulletin', 'New Private Message', 0, 1, 1);
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient, BindToSystemEvent) VALUES(DEFAULT, 'POST.ADD.SUB', NULL, 1, 0, 'In-Bulletin', 'Post Added (for subscribers)', 0, 1, 0, 'bb-post:OnCreate');
+INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient, BindToSystemEvent) VALUES(DEFAULT, 'TOPIC.ADD.SUB', NULL, 1, 0, 'In-Bulletin', 'Topic Added (for subscribers)', 0, 1, 0, 'bb:OnCreate');
INSERT INTO ItemTypes VALUES (3, 'In-Bulletin', 'bb', 'Topic', 'TopicText', 'OwnerId', 'Views', 'CachedRating', 'la_ItemTab_Topics', 1, '', 'clsTopic', 'Topic');
INSERT INTO ItemTypes VALUES (30, 'In-Bulletin', 'posting', 'Posting', 'Subject', 'CreatedById', NULL, NULL, 'la_ItemTab_Posts', 0, '', '', 'Post');
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.VIEW', 'la_PermName_Topic.View_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.ADD', 'la_PermName_Topic.Add_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.ADD.PENDING', 'la_PermName_Topic.Add.Pending_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.DELETE', 'la_PermName_Topic.Delete_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.MODIFY', 'la_PermName_Topic.Modify_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.REPLY.DELETE', 'la_PermName_Topic.Reply.Delete_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.REPLY.VIEW', 'la_PermName_Topic.Reply.View_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.REPLY.ADD', 'la_PermName_Topic.Reply.Add_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.REPLY.MODIFY', 'la_PermName_Topic.Reply.Modify_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.RATE', 'la_PermName_Topic.Rate_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.REVIEW', 'la_PermName_Topic.Review_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.MODIFY', 'la_PermName_Topic.Reply.Owner.Modify_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.DELETE', 'la_PermName_Topic.Reply.Owner.Delete_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.OWNER.DELETE', 'la_PermName_Topic.Owner.Delete_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.MODIFY.PENDING', 'la_PermName_Topic.Modify.Pending_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.OWNER.MODIFY.PENDING', 'la_PermName_Topic.Owner.Modify.Pending_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'TOPIC.OWNER.MODIFY', 'la_PermName_Topic.Owner.Modify_desc', 'In-Bulletin', 1);
INSERT INTO CategoryPermissionsConfig 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%>CatalogReviews 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);
INSERT INTO SearchConfig VALUES ('Topic', 'NotifyOwnerOnChanges', 0, 1, 'lu_fielddesc_topic_notifyowneronchanges', 'lc_field_notifyowneronchanges', 'In-Bulletin', 'la_text_topic', 1, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'TopicId', 0, 1, 'lu_fielddesc_topic_topicid', 'lc_field_topicid', 'In-Bulletin', 'la_text_topic', 0, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'Priority', 0, 1, 'lu_fielddesc_topic_priority', 'lc_field_priority', 'In-Bulletin', 'la_text_topic', 8, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'OwnerId', 0, 1, 'lu_fielddesc_topic_ownerid', 'lc_field_ownerid', 'In-Bulletin', 'la_text_topic', 9, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'Modified', 0, 1, 'lu_fielddesc_topic_modified', 'lc_field_modified', 'In-Bulletin', 'la_text_topic', 2, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'TopicText', 1, 1, 'lu_fielddesc_topic_topictext', 'lc_field_topictext', 'In-Bulletin', 'la_text_topic', 3, DEFAULT, 1, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'Posts', 0, 1, 'lu_fielddesc_topic_posts', 'lu_field_posts', 'In-Bulletin', 'la_text_topic', 4, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'Views', 0, 1, 'lu_fielddesc_topic_views', 'lu_field_views', 'In-Bulletin', 'la_text_topic', 5, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'EditorsPick', 0, 1, 'lu_fielddesc_topic_editorspick', 'lc_field_EditorsPick', 'In-Bulletin', 'la_text_topic', 6, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'Status', 0, 1, 'lu_fielddesc_topic_status', 'lc_field_status', 'In-Bulletin', 'la_text_topic', 7, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'ModifiedById', 0, 1, 'lu_fielddesc_topic_modifiedbyid', 'lc_field_modifiedbyid', 'In-Bulletin', 'la_text_topic', 10, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'ResourceId', 0, 1, 'lu_fielddesc_topic_resourceid', 'lc_field_resourceid', 'In-Bulletin', 'la_text_topic', 11, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'TopicType', 0, 1, 'lu_fielddesc_topic_topictype', 'lu_field_topictype', 'In-Bulletin', 'la_text_topic', 12, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'CreatedOn', 0, 1, 'lu_fielddesc_topic_createdon', 'lc_field_createdon', 'In-Bulletin', 'la_text_topic', 13, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'CachedReviewsQty', 0, 1, 'lu_fielddesc_topic_cachedreviewsqty', 'lc_field_cachedreviewsqty', 'In-Bulletin', 'la_text_topic', 14, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'CachedRating', 0, 1, 'lu_fielddesc_topic_cachedrating', 'lc_field_cachedrating', 'In-Bulletin', 'la_text_topic', 15, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'CachedVotesQty', 0, 1, 'lu_fielddesc_topic_cachedvotesqty', 'lc_field_cachedvotesqty', 'In-Bulletin', 'la_text_topic', 16, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'NewItem', 0, 1, 'lu_fielddesc_topic_newitem', 'lc_field_newitem', 'In-Bulletin', 'la_text_topic', 17, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'PopItem', 0, 1, 'lu_fielddesc_topic_popitem', 'lc_field_popitem', 'In-Bulletin', 'la_text_topic', 18, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'HotItem', 0, 1, 'lu_fielddesc_topic_hotitem', 'lc_field_hotitem', 'In-Bulletin', 'la_text_topic', 19, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'PostedBy', 0, 1, 'lu_fielddesc_topic_postedby', 'lc_field_postedby', 'In-Bulletin', 'la_text_topic', 20, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'OrgId', 0, 1, 'lu_fielddesc_topic_orgid', 'lc_field_orgid', 'In-Bulletin', 'la_text_topic', 21, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Topic', 'LastPostId', 0, 1, 'lu_fielddesc_topic_lastpostid', 'lc_field_lastpostid', 'In-Bulletin', 'la_text_topic', 22, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.VIEW', 14, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.VIEW', 14, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'FAVORITES', 12, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.VIEW', 12, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.VIEW', 12, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.ADD', 12, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.MODIFY', 12, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.DELETE', 12, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.OWNER.DELETE', 12, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.OWNER.MODIFY.PENDING', 12, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.OWNER.MODIFY', 12, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'FAVORITES', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.VIEW', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.ADD', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.VIEW', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.ADD', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.RATE', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REVIEW', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.MODIFY', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.DELETE', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.OWNER.MODIFY', 13, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'FAVORITES', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.VIEW', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.ADD', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.DELETE', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.MODIFY', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.DELETE', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.VIEW', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.ADD', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.MODIFY', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.RATE', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REVIEW', 11, 1, 0, {TopicCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.VIEW', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.ADD', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.ADD.PENDING', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.DELETE', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.MODIFY', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.DELETE', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.VIEW', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.ADD', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.MODIFY', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.RATE', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REVIEW', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.MODIFY', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.REPLY.OWNER.DELETE', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.OWNER.DELETE', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.MODIFY.PENDING', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.OWNER.MODIFY.PENDING', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.OWNER.MODIFY', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'TOPIC.LOCK', 15, 0, 0, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin.view', 11, 1, 1, 0);
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);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_output.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_output.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_output.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_search.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_search.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_censorship.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_censorship.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_censorship.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_censorship.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_emoticon.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_emoticon.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_emoticon.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_custom.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_custom.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_custom.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:configuration_custom.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:polls.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:polls.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:polls.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-bulletin:polls.delete', 11, 1, 1, 0);
#INSERT INTO ImportScripts VALUES (DEFAULT, 'In-Bulletin', 'phpbb', 'phpbb_import', 'phpBB 2.x', 'phpBB', 'user_regular,init_cat', 1, 'db');
INSERT INTO CustomFields VALUES (DEFAULT, 1, 'bb_ItemTemplate', 'la_fld_cust_bb_ItemTemplate', 0, 'la_title_SystemCF', 'la_fld_cust_bb_ItemTemplate', 'text', NULL, '', 0, 0, 1, 0);
INSERT INTO Modules VALUES ('In-Bulletin', 'modules/in-bulletin/', 'bb', DEFAULT, 1, 3, 'in-bulletin/', {TopicCatId}, NULL, NULL);

Event Timeline