Index: branches/5.3.x/units/private_messages/private_message_eh.php =================================================================== --- branches/5.3.x/units/private_messages/private_message_eh.php (revision 16104) +++ branches/5.3.x/units/private_messages/private_message_eh.php (revision 16105) @@ -1,300 +1,300 @@ 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->emailUser('PM.ADD', $object->GetDBField('ToId'), $object->getEmailParams()); 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); + $message_body->SetDBFieldsFromHash($object->GetFieldValues(), $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 */ $config = $this->Application->getUnitConfig($event->Prefix . '-body'); $sql = 'UPDATE ' . $config->getTableName() . ' SET ReferenceCount = ReferenceCount - 1 WHERE ' . $config->getIDField() . ' = ' . $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); $config = $event->getUnitConfig(); $virtual_fields = $config->getVirtualFields(); $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'); $config->setVirtualFields($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.3.x/units/helpers/post_helper.php =================================================================== --- branches/5.3.x/units/helpers/post_helper.php (revision 16104) +++ branches/5.3.x/units/helpers/post_helper.php (revision 16105) @@ -1,465 +1,466 @@ 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) { $categories_config = $this->Application->getUnitConfig('c'); $id_field = $categories_config->getIDField(); $table_name = $categories_config->getTableName(); $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 = date('Y-m-d'); if ( 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) { $topics_config = $this->Application->getUnitConfig('bb'); $id_field = $topics_config->getIDField(); $table_name = $topics_config->getTableName(); // 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>/Usi','$1',$text); $text = preg_replace('/(.*)<\/font>/Usi','$1',$text); // skip empty fonts $text = str_replace( Array('','[*]'), Array('','
  • '), $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.''; } return '<'.$BBCode.'>'.$TextInside.''; } 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('', true); $code = str_replace( Array('_no_match_string_', '_n_m_s_'), Array('\\', '/'), $code); $code = preg_replace('/<\?(.*)php(.*)\?>/Us', '\\2', $code); $code = preg_replace('/([\r\n]+)/si', '', $code); $code = preg_replace('/([\r\n]+)<\/font>([\r\n]+)<\/code>/si', '', $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 + * @see parsePostBody about why we unescape here. */ 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 = trim(str_replace('\"', '"', kUtil::unescape($input_string, kUtil::ESCAPE_HTML))); $input_string = $this->highlightCode($input_string); $input_string = preg_replace("/\r
    /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 ( 'EmailTemplateId' => $manager->getEmailTemplateId('TOPIC.ADD.SUB'), 'UserId' => $user_id, 'CategoryId' => $category_id, ); break; case 'TopicPosts': $fields_hash = Array ( '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.3.x/admin_templates/user_item_tab.tpl =================================================================== --- branches/5.3.x/admin_templates/user_item_tab.tpl (revision 16104) +++ branches/5.3.x/admin_templates/user_item_tab.tpl (revision 16105) @@ -1,34 +1,34 @@
    " view_template="in-bulletin/user_item_tab" edit_template="in-bulletin/topics/topics_edit" dep_buttons="new_topic" category_id="-1" class="catalog-tab">
    $Catalog.setItemCount('', ''); - $Catalog.setCurrentCategory('', ); + $Catalog.setCurrentCategory('', ); $Catalog.saveSearch('', '', ''); Grids[''].SetDependantToolbarButtons( new Array('edit','delete')); $Catalog.setViewMenu(''); #separator#
    - \ No newline at end of file + Index: branches/5.3.x/admin_templates/catalog_tab.tpl =================================================================== --- branches/5.3.x/admin_templates/catalog_tab.tpl (revision 16104) +++ branches/5.3.x/admin_templates/catalog_tab.tpl (revision 16105) @@ -1,56 +1,56 @@
    " view_template="in-bulletin/catalog_tab" edit_template="in-bulletin/topics/topics_edit" category_id="-1" dep_buttons="new_topic" class="catalog-tab">
    $Catalog.setItemCount('', ''); $Catalog.setItemCount('', ''); - $Catalog.setCurrentCategory('', ); + $Catalog.setCurrentCategory('', ); $Catalog.saveSearch('', '', ''); Grids[''].AddAlternativeGrid('', true); Grids[''].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6')); $Catalog.setViewMenu(''); Grids[''].DblClick = function() {return false}; #separator#
    - \ No newline at end of file + Index: branches/5.3.x/install/upgrades.php =================================================================== --- branches/5.3.x/install/upgrades.php (revision 16104) +++ branches/5.3.x/install/upgrades.php (revision 16105) @@ -1,102 +1,103 @@ dependencies = Array ( '4.3.9' => Array ('Core' => '4.3.9'), '5.0.0' => Array ('Core' => '5.0.0'), '5.0.1' => Array ('Core' => '5.0.1'), '5.0.2-B1' => Array ('Core' => '5.0.2-B1'), '5.0.2-B2' => Array ('Core' => '5.0.2-B2'), '5.0.2-RC1' => Array ('Core' => '5.0.2-RC1'), '5.0.2' => Array ('Core' => '5.0.2'), '5.0.3-B1' => Array ('Core' => '5.0.3-B1'), '5.0.3-B2' => Array ('Core' => '5.0.3-B2'), '5.0.3-RC1' => Array ('Core' => '5.0.3-RC1'), '5.0.3' => Array ('Core' => '5.0.3'), '5.0.4-B1' => Array ('Core' => '5.0.4-B1'), '5.0.4-B2' => Array ('Core' => '5.0.4-B2'), '5.0.4' => Array ('Core' => '5.0.4'), '5.1.0-B1' => Array ('Core' => '5.1.0-B1'), '5.1.0-B2' => Array ('Core' => '5.1.0-B2'), '5.1.0-RC1' => Array ('Core' => '5.1.0-RC1'), '5.1.0' => Array ('Core' => '5.1.0'), '5.1.1-B1' => Array ('Core' => '5.1.1-B1'), '5.1.1-B2' => Array ('Core' => '5.1.1-B2'), '5.1.1-RC1' => Array ('Core' => '5.1.1-RC1'), '5.1.1' => Array ('Core' => '5.1.1'), '5.1.2-B1' => Array ('Core' => '5.1.2-B1'), '5.1.2-RC1' => Array ('Core' => '5.1.2-RC1'), '5.1.2' => Array ('Core' => '5.1.2'), '5.1.3-B1' => Array ('Core' => '5.1.3-B1'), '5.1.3-B2' => Array ('Core' => '5.1.3-B2'), '5.1.3-RC1' => Array ('Core' => '5.1.3-RC1'), '5.1.3-RC2' => Array ('Core' => '5.1.3-RC2'), '5.1.3' => Array ('Core' => '5.1.3'), '5.2.0-B1' => Array ('Core' => '5.2.0-B1'), '5.2.0-B2' => Array ('Core' => '5.2.0-B2'), '5.2.0-B3' => Array ('Core' => '5.2.0-B3'), '5.2.0-RC1' => Array ('Core' => '5.2.0-RC1'), '5.2.0' => Array ('Core' => '5.2.0'), '5.2.1-B1' => Array ('Core' => '5.2.1-B1'), '5.2.1-B2' => Array ('Core' => '5.2.1-B2'), '5.2.1-RC1' => Array ('Core' => '5.2.1-RC1'), + '5.2.1' => Array ('Core' => '5.2.1'), '5.3.0-B1' => Array ('Core' => '5.3.0-B1'), ); } /** * Changes table structure, where multilingual fields of TEXT type are present * * @param string $mode when called mode {before, after) */ function Upgrade_5_0_0($mode) { if ($mode == 'after') { $categories_config = $this->Application->getUnitConfig('c'); $root_category = $this->Application->findModule('Name', 'In-Bulletin', 'RootCat'); $sql = 'UPDATE ' . $categories_config->getTableName() . ' SET UseMenuIconUrl = 1, MenuIconUrl = "in-bulletin/img/menu_topics.gif" WHERE ' . $categories_config->getIDField() . ' = ' . $root_category; $this->Conn->Query($sql); $this->_updateDetailTemplate('bb', 'inbulletin/post_list', 'in-bulletin/designs/detail'); } } /** * Update to 5.0.1, update details template * * @param string $mode when called mode {before, after) */ function Upgrade_5_0_1($mode) { if ($mode == 'after') { $this->_updateDetailTemplate('bb', 'in-bulletin/designs/detail', 'in-bulletin/topics/topic_detail'); } } } \ No newline at end of file Index: branches/5.3.x/install/upgrades.sql =================================================================== --- branches/5.3.x/install/upgrades.sql (revision 16104) +++ branches/5.3.x/install/upgrades.sql (revision 16105) @@ -1,277 +1,279 @@ # ===== v 4.3.9 ===== ALTER TABLE Emoticon ADD EmotionImage VARCHAR(255) NOT NULL, ADD INDEX (EmotionImage), DROP ImageId; UPDATE Emoticon SET EmotionImage = CONCAT('0_',EmoticonId,'.gif') WHERE EmoticonId < 21; # ===== v 5.0.0 ===== CREATE TABLE Polls ( PollId int(11) NOT NULL auto_increment, `Name` varchar(255) NOT NULL default '', l1_Question text, l2_Question text, l3_Question text, l4_Question text, l5_Question text, Image varchar(255) NOT NULL default '', CreatedOn int(11) unsigned NOT NULL, StartDate int(11) unsigned NOT NULL, EndDate int(11) unsigned default NULL, Priority tinyint(4) NOT NULL default '0', RequireLogin tinyint(4) NOT NULL default '0', AllowMultipleVotings tinyint(4) NOT NULL default '1', AllowComments tinyint(4) NOT NULL default '1', `Status` tinyint(4) NOT NULL default '1', CachedVotesQty int(11) NOT NULL, PRIMARY KEY (PollId), KEY `Status` (`Status`), KEY Priority (Priority), KEY StartDate (StartDate), KEY EndDate (EndDate) ); CREATE TABLE PollsAnswers ( AnswerId int(11) NOT NULL auto_increment, PollId int(11) NOT NULL, l1_Answer text, l2_Answer text, l3_Answer text, l4_Answer text, l5_Answer text, VotesQty int(11) NOT NULL, Priority int(11) NOT NULL default '0', Status tinyint(4) NOT NULL default '1', PRIMARY KEY (AnswerId), KEY Status (Status), KEY Priority (Priority), KEY VoteCount (VotesQty), KEY PollId (PollId) ); CREATE TABLE PollsComments ( CommentId int(11) NOT NULL auto_increment, PollId int(11) NOT NULL, AnswerId int(11) default NULL, CreatedById int(11) NOT NULL default '-2', GuestName varchar(255) NOT NULL, GuestEmail varchar(255) NOT NULL, CommentBody text, CreatedOn int(11) NOT NULL, UserIP varchar(255) NOT NULL, Priority int(11) NOT NULL, `Status` tinyint(4) NOT NULL default '1', PRIMARY KEY (CommentId), KEY `Status` (`Status`), KEY Priority (Priority), KEY CreatedOn (CreatedOn), KEY AnswerId (AnswerId), KEY PollId (PollId), KEY CreatedById (CreatedById) ); CREATE TABLE PollsStatistics ( StatisticsId int(11) NOT NULL auto_increment, PollId int(11) NOT NULL default '0', AnswerId int(11) NOT NULL default '0', CreatedById int(11) NOT NULL default '-2', UserIP varchar(255) NOT NULL, AnswerDate int(10) unsigned default NULL, PRIMARY KEY (StatisticsId), KEY AnswerId (AnswerId,PollId), KEY CreatedById (CreatedById), KEY UserIP (UserIP) ); INSERT INTO ConfigurationAdmin VALUES ('poll_CommentDelay_Value', 'la_Text_Polls', 'la_prompt_DupPollComments', 'text', '', '', 60.1, 1, 1); INSERT INTO ConfigurationAdmin VALUES ('poll_CommentDelay_Interval', 'la_Text_Polls', 'la_prompt_DupPollComments', 'select', '', '1=la_Text_Second,60=la_Text_Minute,3600=la_Text_Hour,86400=la_Text_Day,604800=la_Text_Week,2419200=la_Text_Month,29030400=la_text_Year', 60.2, 2, 1); 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,SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM CustomField WHERE (Type = 3) AND (IsSystem = 0)' 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'; INSERT INTO Events VALUES(DEFAULT, 'TOPIC.ADD', NULL, 1, 1, NULL, 'In-Bulletin', 'la_event_topic.add', 0); INSERT INTO Events VALUES(DEFAULT, 'TOPIC.ADD.PENDING', NULL, 1, 1, NULL, 'In-Bulletin', 'la_event_topic.add.pending', 1); INSERT INTO Events VALUES(DEFAULT, 'TOPIC.ADD.PENDING', NULL, 1, 1, NULL, 'In-Bulletin', 'la_event_topic.add.pending', 0); INSERT INTO Events VALUES(DEFAULT, 'TOPIC.MODIFY', NULL, 1, 1, NULL, 'In-Bulletin', 'la_event_topic.modify', 1); INSERT INTO Events VALUES(DEFAULT, 'TOPIC.MODIFY', NULL, 1, 1, NULL, 'In-Bulletin', 'la_event_topic.modify', 0); INSERT INTO Events VALUES(DEFAULT, 'TOPIC.MODIFY.PENDING', NULL, 1, 1, NULL, 'In-Bulletin', 'la_event_topic.modify.pending', 1); INSERT INTO Events VALUES(DEFAULT, 'TOPIC.MODIFY.PENDING', NULL, 1, 1, NULL, 'In-Bulletin', 'la_event_topic.modify.pending', 0); INSERT INTO Events VALUES(DEFAULT, 'TOPIC.APPROVE', NULL, 1, 0, NULL, 'In-Bulletin', 'la_event_topic.approve', 0); 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 ''; ALTER TABLE Polls CHANGE CreatedOn CreatedOn INT(11) UNSIGNED NULL DEFAULT NULL , CHANGE StartDate StartDate INT(11) UNSIGNED NULL DEFAULT NULL , CHANGE CachedVotesQty CachedVotesQty INT(11) NOT NULL DEFAULT '0'; ALTER TABLE PollsAnswers CHANGE PollId PollId INT(11) NOT NULL DEFAULT '0', CHANGE VotesQty VotesQty INT(11) NOT NULL DEFAULT '0'; ALTER TABLE PollsComments CHANGE PollId PollId INT(11) NOT NULL DEFAULT '0', CHANGE GuestName GuestName VARCHAR(255) NOT NULL DEFAULT '', CHANGE GuestEmail GuestEmail VARCHAR(255) NOT NULL DEFAULT '', CHANGE CreatedOn CreatedOn INT(11) NULL DEFAULT NULL , CHANGE UserIP UserIP VARCHAR(255) NOT NULL DEFAULT '', CHANGE Priority Priority INT(11) NOT NULL DEFAULT '0'; ALTER TABLE PollsStatistics CHANGE UserIP UserIP VARCHAR(255) NOT NULL DEFAULT ''; ALTER TABLE Posting CHANGE CreatedOn CreatedOn INT(11) NULL DEFAULT NULL, CHANGE Modified Modified INT(11) NULL DEFAULT NULL; ALTER TABLE PrivateMessages CHANGE CreatedOn CreatedOn INT(11) UNSIGNED NULL DEFAULT NULL; ALTER TABLE Topic CHANGE Modified Modified INT(11) NULL DEFAULT NULL, CHANGE CreatedOn CreatedOn INT(11) NULL DEFAULT NULL; # ===== v 5.0.2-B2 ===== # ===== v 5.0.2-RC1 ===== # ===== v 5.0.2 ===== # ===== v 5.0.3-B1 ===== # ===== v 5.0.3-B2 ===== # ===== v 5.0.3-RC1 ===== # ===== v 5.0.3 ===== # ===== v 5.0.4-B1 ===== # ===== v 5.0.4-B2 ===== # ===== v 5.0.4 ===== # ===== v 5.1.0-B1 ===== UPDATE Modules SET Path = 'modules/in-bulletin/' WHERE `Name` = 'In-Bulletin'; DELETE FROM ConfigurationValues WHERE VariableName IN ( 'Post_Sortfield', 'Post_SortOrder', 'Perpage_PrivateMessages', 'Topic_Root', 'Topic_Background1', 'Topic_Background2', 'Post_Background1', 'Post_Background2', 'Posting_SortOrder', 'Bulletin_TopCount', 'Bulletin_CatNewDays', 'Bulletin_Pick_First' ); UPDATE ConfigurationValues SET ModuleOwner = 'In-Bulletin' WHERE VariableName = 'BBTags'; UPDATE Phrase SET Module = 'Core' WHERE Phrase = 'la_fld_Replacement'; DELETE FROM Permissions WHERE Permission LIKE 'in-bulletin:configuration_email%'; # ===== v 5.1.0-B2 ===== # ===== v 5.1.0-RC1 ===== # ===== v 5.1.0 ===== # ===== v 5.1.1-B1 ===== ALTER TABLE PollsComments CHANGE CreatedById CreatedById INT(11) NULL DEFAULT NULL; ALTER TABLE Topic CHANGE OwnerId OwnerId INT( 11 ) NULL DEFAULT NULL , CHANGE ModifiedById ModifiedById INT( 11 ) NULL DEFAULT NULL; UPDATE Topic SET ModifiedById = NULL WHERE ModifiedById = 0; # ===== v 5.1.1-B2 ===== # ===== v 5.1.1-RC1 ===== # ===== v 5.1.1 ===== # ===== v 5.1.2-B1 ===== # ===== v 5.1.2-RC1 ===== # ===== v 5.1.2 ===== # ===== v 5.1.3-B1 ===== # ===== v 5.1.3-B2 ===== # ===== v 5.1.3-RC1 ===== UPDATE ConfigurationValues SET VariableValue = 'in-bulletin/topics/topic_detail' WHERE VariableName = 'bb_ItemTemplate' AND VariableValue = 'in-bulletin/designs/detail'; # ===== v 5.1.3-RC2 ===== # ===== v 5.1.3 ===== UPDATE Phrase SET `Module` = 'Core' WHERE PhraseKey = 'LA_FLD_REQUIRELOGIN'; # ===== v 5.2.0-B1 ===== UPDATE SearchConfig SET DisplayName = REPLACE(DisplayName, 'lu_', 'lc_') WHERE DisplayName IN ( 'lu_field_notifyowneronchanges', 'lu_field_topicid', 'lu_field_ownerid', 'lu_field_topictext', 'lu_field_postedby', 'lu_field_lastpostid' ); DELETE FROM LanguageLabels WHERE PhraseKey IN ('LA_POSTS_NEWDAYS_PROMPT'); DELETE FROM SystemSettings WHERE VariableName IN ('Topic_Highlight_OpenTag', 'Topic_Highlight_CloseTag', 'Posts_NewDays'); # ===== v 5.2.0-B2 ===== UPDATE Topic main_table SET main_table.CachedReviewsQty = (SELECT COUNT(*) FROM <%TABLE_PREFIX%>CatalogReviews review_table WHERE review_table.ItemId = main_table.ResourceId); # ===== v 5.2.0-B3 ===== 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'); # ===== v 5.2.0-RC1 ===== # ===== v 5.2.0 ===== INSERT INTO Permissions VALUES(DEFAULT, 'in-bulletin:configuration_output.add', 11, 1, 1, 0); # ===== v 5.2.1-B1 ===== # ===== v 5.2.1-B2 ===== UPDATE Modules SET ClassNamespace = 'Intechnic\\InPortal\\Modules\\InBulletin' WHERE `Name` = 'In-Bulletin'; # ===== v 5.2.1-RC1 ===== +# ===== v 5.2.1 ===== + # ===== v 5.3.0-B1 ===== Property changes on: branches/5.3.x ___________________________________________________________________ Modified: svn:mergeinfo Merged /modules/in-bulletin/releases/5.2.1:r16074 Merged /modules/in-bulletin/branches/5.2.x:r15898-16073