Fix #1159 Add sort option to spamfilter word list

This commit is contained in:
Kijin Sung 2019-07-27 23:21:35 +09:00
parent 0a9d34c37f
commit 853d6753eb
3 changed files with 13 additions and 6 deletions

View file

@ -39,9 +39,16 @@ class spamfilterAdminView extends spamfilter
*/
function dispSpamfilterAdminDeniedWordList()
{
// Get sort index
$sort_index = Context::get('sort_index');
if (!in_array($sort_index, array('regdate', 'latest_hit', 'hit')))
{
$sort_index = 'hit';
}
// Get the list of denied IP addresses and words
$oSpamFilterModel = getModel('spamfilter');
$word_list = $oSpamFilterModel->getDeniedWordList();
$word_list = $oSpamFilterModel->getDeniedWordList($sort_index);
Context::set('word_list', $word_list);
$security = new Security();

View file

@ -62,10 +62,10 @@ class spamfilterModel extends spamfilter
/**
* @brief Return the list of registered Words which were banned
*/
function getDeniedWordList()
function getDeniedWordList($sort_index = 'hit')
{
$args = new stdClass();
$args->sort_index = "hit";
$args->sort_index = $sort_index;
$output = executeQueryArray('spamfilter.getDeniedWordList', $args);
return $output->data ?: array();
}

View file

@ -17,9 +17,9 @@
<thead>
<tr>
<th scope="col">{$lang->word}</th>
<th scope="col">{$lang->latest_hit}</th>
<th scope="col">{$lang->hit}</th>
<th scope="col">{$lang->regdate}</th>
<th scope="col"><a href="{getUrl('sort_index', 'latest_hit')}">{$lang->latest_hit} <!--@if($sort_index === 'latest_hit')--><!--@endif--></a></th>
<th scope="col"><a href="{getUrl('sort_index', 'hit')}">{$lang->hit} <!--@if($sort_index === 'hit' || !$sort_index)--><!--@endif--></a></th>
<th scope="col"><a href="{getUrl('sort_index', 'regdate')}">{$lang->regdate} <!--@if($sort_index === 'regdate')--><!--@endif--></a></th>
<th scope="col"><input type="checkbox" name="word" title="Check All" /></th>
</tr>
</thead>