Added ability to view post_text of topic (#1401)

* Added ability to view `post_text` of topic

* Updated

* Update viewtopic.tpl

* Update view_post.php

* Update view_post.php

* Update view_post.php

* Update view_post.php

* Updated

* Update viewtopic.tpl

* Create _source.gif

* Create icon_code.gif

* Update tpl_config.php

* Updated

* Updated

* Updated

* Updated

* Update config.php

* Update icon_code.gif

* Updated

* Delete icon_code.gif

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-02-12 21:06:37 +07:00 committed by GitHub
commit c116fe970b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 42 additions and 3 deletions

View file

@ -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);
}