mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
feat(show post bbcode): Added 'only_for_first_post'
param (#1830)
* feat(show post bbcode): Added `'only_for_first_post'` param * Update config.php
This commit is contained in:
parent
3b8ee4c4d3
commit
4dcd1fb16e
5 changed files with 10 additions and 10 deletions
|
@ -15,7 +15,7 @@ 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'];
|
||||
$return_text = $bb_cfg['show_post_bbcode_button']['enabled'] && 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');
|
||||
|
|
|
@ -521,7 +521,10 @@ $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_post_bbcode_button'] = [ // Show "Code" button in topic to display BBCode of topic
|
||||
'enabled' => true,
|
||||
'only_for_first_post' => true,
|
||||
];
|
||||
$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
|
||||
|
|
|
@ -46,10 +46,6 @@ class Censor
|
|||
$censoredWords = $datastore->get('censor');
|
||||
}
|
||||
|
||||
if (isset($censoredWords['no_words'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($censoredWords as $word) {
|
||||
$this->words[] = '#(?<![\p{Nd}\p{L}_])(' . str_replace('\*', '[\p{Nd}\p{L}_]*?', preg_quote($word['word'], '#')) . ')(?![\p{Nd}\p{L}_])#iu';
|
||||
$this->replacements[] = $word['replacement'];
|
||||
|
|
|
@ -19,7 +19,7 @@ class BBCode
|
|||
public array $tpl = [];
|
||||
|
||||
/** @var array $smilies Replacements for smilies */
|
||||
public $smilies;
|
||||
public array $smilies;
|
||||
|
||||
/** @var array $tidy_cfg Tidy preprocessor configuration */
|
||||
public array $tidy_cfg = [
|
||||
|
@ -336,7 +336,8 @@ class BBCode
|
|||
{
|
||||
global $datastore;
|
||||
|
||||
if (null === $this->smilies) {
|
||||
if (!$this->smilies = $datastore->get('smile_replacements')) {
|
||||
$datastore->update('smile_replacements');
|
||||
$this->smilies = $datastore->get('smile_replacements');
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<!-- ENDIF -->
|
||||
<!-- ENDIF / LOGGED_IN -->
|
||||
|
||||
<!-- IF $bb_cfg['show_post_bbcode_button'] -->
|
||||
<!-- IF $bb_cfg['show_post_bbcode_button']['enabled'] -->
|
||||
<script type="text/javascript">
|
||||
let loadedText = [];
|
||||
|
||||
|
@ -430,7 +430,7 @@ function build_poll_add_form (src_el)
|
|||
<!-- IF postrow.QUOTE --><a class="txtb" href="<!-- IF $bb_cfg['use_ajax_posts'] -->" onclick="ajax.exec({ action: 'posts', post_id: {postrow.POST_ID}, type: 'reply'}); return false;<!-- ELSE -->{QUOTE_URL}{postrow.POST_ID}<!-- ENDIF -->">{QUOTE_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||
<!-- IF postrow.EDIT --><a class="txtb" href="<!-- IF $bb_cfg['use_ajax_posts'] -->" onclick="edit_post({postrow.POST_ID}, 'edit'); return false;<!-- ELSE -->{EDIT_POST_URL}{postrow.POST_ID}<!-- ENDIF -->">{EDIT_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||
<!-- IF postrow.DELETE --><a class="txtb" href="<!-- IF $bb_cfg['use_ajax_posts'] -->" onclick="ajax.exec({ action: 'posts', post_id: {postrow.POST_ID}, topic_id : {TOPIC_ID}, type: 'delete'}); return false;<!-- ELSE -->{DELETE_POST_URL}{postrow.POST_ID}<!-- ENDIF -->">{DELETE_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||
<!-- IF postrow.IS_FIRST_POST && $bb_cfg['show_post_bbcode_button'] --><a href="#" class="txtb" onclick="ajax.view_post('{postrow.POST_ID}'); return false;">{CODE_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||
<!-- IF $bb_cfg['show_post_bbcode_button']['enabled'] --><!-- IF postrow.IS_FIRST_POST || !$bb_cfg['show_post_bbcode_button']['only_for_first_post'] --><a href="#" class="txtb" onclick="ajax.view_post('{postrow.POST_ID}'); return false;">{CODE_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF --><!-- ENDIF -->
|
||||
<!-- IF postrow.IP --><a class="txtb" href="{IP_POST_URL}{postrow.POST_ID}&{#POST_TOPIC_URL#}={TOPIC_ID}">{IP_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||
<!-- IF AUTH_MOD -->
|
||||
<a class="menu-root menu-alt1 txtb" href="#mc_{postrow.POST_ID}">{MC_IMG}</a>{POST_BTN_SPACER}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue