diff --git a/CHANGELOG.md b/CHANGELOG.md index 995490288..12678a086 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ **Merged pull requests:** - Release 2.4.2 🐯 ([belomaxorka](https://github.com/belomaxorka)) +- Added ability to view post_text of topic [\#1401](https://github.com/torrentpier/torrentpier/pull/1401) ([belomaxorka](https://github.com/belomaxorka)) - Added support for rutracker font BBCode tag [\#1397](https://github.com/torrentpier/torrentpier/pull/1397) ([belomaxorka](https://github.com/belomaxorka)) - Added mod "Reason to move topic" [\#1388](https://github.com/torrentpier/torrentpier/pull/1388) ([belomaxorka](https://github.com/belomaxorka)) - Created template file for AJAX quick actions [\#1381](https://github.com/torrentpier/torrentpier/pull/1381) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/library/ajax/view_post.php b/library/ajax/view_post.php index 06d0bcf12..62aa54e32 100644 --- a/library/ajax/view_post.php +++ b/library/ajax/view_post.php @@ -11,19 +11,22 @@ if (!defined('IN_AJAX')) { die(basename(__FILE__)); } -global $user, $lang; +global $user, $lang, $bb_cfg; $post_id = isset($this->request['post_id']) ? (int)$this->request['post_id'] : null; $topic_id = isset($this->request['topic_id']) ? (int)$this->request['topic_id'] : null; +$return_text = $bb_cfg['show_post_bbcode_button'] && isset($this->request['return_text']) && (bool)$this->request['return_text']; if (is_null($post_id)) { $post_id = DB()->fetch_row("SELECT topic_first_post_id FROM " . BB_TOPICS . " WHERE topic_id = $topic_id", 'topic_first_post_id'); } +$post_text_sql = $return_text ? "pt.post_text," : "IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,"; + $sql = " SELECT p.*, - h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text, + h.post_html, $post_text_sql f.auth_read FROM " . BB_POSTS . " p INNER JOIN " . BB_POSTS_TEXT . " pt ON(pt.post_id = p.post_id) @@ -52,4 +55,8 @@ if ($post_data['auth_read'] == AUTH_REG) { $this->response['post_id'] = $post_id; $this->response['topic_id'] = $topic_id; -$this->response['post_html'] = get_parsed_post($post_data); +if ($return_text) { + $this->response['post_text'] = $post_data['post_text']; +} else { + $this->response['post_html'] = get_parsed_post($post_data); +} diff --git a/library/config.php b/library/config.php index 722b4b022..96ea1deaf 100644 --- a/library/config.php +++ b/library/config.php @@ -474,6 +474,7 @@ $bb_cfg['sf_on_first_page_only'] = true; // Show subforums only on the first pag $bb_cfg['allowed_topics_per_page'] = [50, 100, 150, 200, 250, 300]; // Allowed number of topics per page // Topics +$bb_cfg['show_post_bbcode_button'] = true; // Show "Code" button in topic to display BBCode of topic $bb_cfg['show_quick_reply'] = true; // Show quick reply forim $bb_cfg['show_rank_text'] = false; // Show user rank name in topics $bb_cfg['show_rank_image'] = true; // Show user rank image in topics diff --git a/library/language/source/main.php b/library/language/source/main.php index 0ca5f8167..fbad3926d 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -1363,6 +1363,7 @@ $lang['READ_PROFILE_TXTB'] = '[Profile]'; $lang['SEND_EMAIL_TXTB'] = '[E-mail]'; $lang['VISIT_WEBSITE_TXTB'] = '[www]'; $lang['EDIT_DELETE_POST_TXTB'] = '[Edit]'; +$lang['CODE_TOPIC_TXTB'] = '[Code]'; $lang['SEARCH_USER_POSTS_TXTB'] = '[Search]'; $lang['VIEW_IP_TXTB'] = '[ip]'; $lang['DELETE_POST_TXTB'] = '[x]'; diff --git a/styles/templates/default/images/lang/source/icon_code.gif b/styles/templates/default/images/lang/source/icon_code.gif new file mode 100644 index 000000000..5afd6e2c7 Binary files /dev/null and b/styles/templates/default/images/lang/source/icon_code.gif differ diff --git a/styles/templates/default/images/lang/source/icons_sources/icon_large.gif b/styles/templates/default/images/lang/source/icons_sources/icon_large.gif new file mode 100644 index 000000000..e3d072db6 Binary files /dev/null and b/styles/templates/default/images/lang/source/icons_sources/icon_large.gif differ diff --git a/styles/templates/default/images/lang/source/icons_sources/icon_medium.gif b/styles/templates/default/images/lang/source/icons_sources/icon_medium.gif new file mode 100644 index 000000000..fed70f75e Binary files /dev/null and b/styles/templates/default/images/lang/source/icons_sources/icon_medium.gif differ diff --git a/styles/templates/default/images/lang/source/icons_sources/icon_small.gif b/styles/templates/default/images/lang/source/icons_sources/icon_small.gif new file mode 100644 index 000000000..85b723015 Binary files /dev/null and b/styles/templates/default/images/lang/source/icons_sources/icon_small.gif differ diff --git a/styles/templates/default/tpl_config.php b/styles/templates/default/tpl_config.php index 2ed84aaa7..372ef8816 100644 --- a/styles/templates/default/tpl_config.php +++ b/styles/templates/default/tpl_config.php @@ -17,6 +17,7 @@ $_main = BB_ROOT . 'styles/' . basename(TEMPLATES_DIR) . '/' . $template_name . $_lang = $_main . 'lang/' . basename($bb_cfg['default_lang']) . '/'; // post_buttons +$images['icon_code'] = $_lang . 'icon_code.gif'; $images['icon_quote'] = $_lang . 'icon_quote.gif'; $images['icon_edit'] = $_lang . 'icon_edit.gif'; $images['icon_search'] = $_lang . 'icon_search.gif'; @@ -129,6 +130,7 @@ $template->assign_vars([ if (!empty($page_cfg['load_tpl_vars']) and $vars = array_flip($page_cfg['load_tpl_vars'])) { if (isset($vars['post_buttons'])) { $template->assign_vars([ + 'CODE_IMG' => $bb_cfg['text_buttons'] ? $lang['CODE_TOPIC_TXTB'] : '' . $lang['CODE_TOPIC_TXTB'] . '', 'QUOTE_IMG' => $bb_cfg['text_buttons'] ? $lang['REPLY_WITH_QUOTE_TXTB'] : '' . $lang['REPLY_WITH_QUOTE_TXTB'] . '', 'EDIT_POST_IMG' => $bb_cfg['text_buttons'] ? $lang['EDIT_DELETE_POST_TXTB'] : '' . $lang['EDIT_DELETE_POST_TXTB'] . '', 'DELETE_POST_IMG' => $bb_cfg['text_buttons'] ? $lang['DELETE_POST_TXTB'] : '' . $lang['DELETE_POST_TXTB'] . '', diff --git a/styles/templates/default/viewtopic.tpl b/styles/templates/default/viewtopic.tpl index 2b7fccc2c..c9ac0dfac 100644 --- a/styles/templates/default/viewtopic.tpl +++ b/styles/templates/default/viewtopic.tpl @@ -11,6 +11,32 @@ $(document).ready(function(){ $('div.sp-head').click(); }); + + + + @@ -398,6 +424,7 @@ function build_poll_add_form (src_el) {QUOTE_IMG}{POST_BTN_SPACER} {EDIT_POST_IMG}{POST_BTN_SPACER} {DELETE_POST_IMG}{POST_BTN_SPACER} + {CODE_IMG} {IP_POST_IMG}{POST_BTN_SPACER} {MC_IMG}{POST_BTN_SPACER}