Skip to content

Commit

Permalink
RSI v1.1.0 Fix
Browse files Browse the repository at this point in the history
Signed-off-by: Dark❶ <25451052+Dark1z@users.noreply.github.com>
  • Loading branch information
Dark1z committed Mar 29, 2022
1 parent 630f63f commit 81c5530
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions event/main_listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,12 @@ public function search_modify_submit_parameters()
*/
public function search_native_index_before($event)
{
$post_id = $event['post_id'];
$words = $event['words'];
$cur_words = $event['cur_words'];

if ($this->config['dark1_rsi_enable'])
{
$forum = $this->get_search_forum($post_id);

if ($forum['dark1_rsi_f_enable'] >= consts::F_ENABLE_TOPIC && $forum['topic_time'] <= $this->config['dark1_rsi_time'])
{
$words['add']['post'] = $words['add']['title'] = $words['del']['post'] = $words['del']['title'] = [];
}
else if ($forum['dark1_rsi_f_enable'] == consts::F_ENABLE_POST && $forum['post_time'] <= $this->config['dark1_rsi_time'])
if ($this->get_search_forum_enable((int) $event['post_id']))
{
$words['add']['post'] = $words['add']['title'] = $words['del']['post'] = $words['del']['title'] = [];
}
Expand Down Expand Up @@ -165,6 +158,24 @@ private function get_common_words_ary()



/**
* Get Search Forum Enable or Not
*
* @param int $post_id Post ID
* @return bool Enabled or Not
* @access private
*/
private function get_search_forum_enable($post_id)
{
$forum = $this->get_search_forum($post_id);
return (bool) (
($forum['dark1_rsi_f_enable'] >= consts::F_ENABLE_TOPIC && $forum['topic_time'] <= $this->config['dark1_rsi_time'])
|| ($forum['dark1_rsi_f_enable'] == consts::F_ENABLE_POST && $forum['post_time'] <= $this->config['dark1_rsi_time'])
);
}



/**
* Get Search Forum
*
Expand Down

0 comments on commit 81c5530

Please sign in to comment.