smarty2-conpatibility
This commit is contained in:
parent
13c849cce9
commit
e647c1117a
2 changed files with 19 additions and 20 deletions
|
@ -16,7 +16,7 @@
|
|||
<input type="submit" class="serendipityPrettyButton input_button" value="{$CONST.PLUGIN_EVENT_SPAMBLOCK_BAYES_IMPORTDB}" name="submit"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="bayesDatabase">
|
||||
<table id="bayesDatabaseTable">
|
||||
<caption>{$CONST.PLUGIN_EVENT_SPAMBLOCK_BAYES_MENU_DATABASE}</caption>
|
||||
|
@ -48,16 +48,16 @@
|
|||
{elseif $curpage > 1}
|
||||
<a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=spamblock_bayes&serendipity[subpage]=2&serendipity[commentpage]=0" title="{$CONST.Page}">1</a>
|
||||
{/if}
|
||||
|
||||
{for $page=1 to $pages}
|
||||
{if $curpage == $page -1}
|
||||
<a class="curpage" href="?serendipity[adminModule]=event_display&serendipity[adminAction]=spamblock_bayes&serendipity[subpage]=2&serendipity[commentpage]={$page-1}" title="{$CONST.Page}">{$page}</a>
|
||||
|
||||
{section name=page start=1 loop=$pages+1}
|
||||
{if $curpage == $smarty.section.page.index -1}
|
||||
<a class="curpage" href="?serendipity[adminModule]=event_display&serendipity[adminAction]=spamblock_bayes&serendipity[subpage]=2&serendipity[commentpage]={$smarty.section.page.index-1}" title="{$CONST.Page}">{$smarty.section.page.index}</a>
|
||||
{/if}
|
||||
{if $curpage == $page -2 || $curpage == $page}
|
||||
<a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=spamblock_bayes&serendipity[subpage]=2&serendipity[commentpage]={$page-1}" title="{$CONST.Page}">{$page}</a>
|
||||
{if $curpage == $smarty.section.page.index -2 || $curpage == $smarty.section.page.index}
|
||||
<a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=spamblock_bayes&serendipity[subpage]=2&serendipity[commentpage]={$smarty.section.page.index-1}" title="{$CONST.Page}">{$smarty.section.page.index}</a>
|
||||
{/if}
|
||||
{/for}
|
||||
|
||||
{/section}
|
||||
|
||||
{if $curpage < $pages -3}
|
||||
...
|
||||
<a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=spamblock_bayes&serendipity[subpage]=2&serendipity[commentpage]={$pages-1}" title="{$CONST.Page}">{$pages}</a>
|
||||
|
@ -80,10 +80,10 @@
|
|||
<th colspan="2">{$CONST.COMMENT}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
{for $i=1 to 6}
|
||||
{section name=i loop=6 start=0}
|
||||
<th>{$CONST.PLUGIN_EVENT_SPAMBLOCK_BAYES_HAM}</th>
|
||||
<th>{$CONST.PLUGIN_EVENT_SPAMBLOCK_BAYES_SPAM}</th>
|
||||
{/for}
|
||||
{/section}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -109,4 +109,4 @@
|
|||
<script src="{$path}jquery.tablesorter.js" type="text/javascript"></script>
|
||||
<script>$("#bayesDatabaseTable").tablesorter();
|
||||
sortwithcolor(2);</script>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -36,7 +36,7 @@ class serendipity_event_spamblock_bayes extends serendipity_event {
|
|||
$this->title = PLUGIN_EVENT_SPAMBLOCK_BAYES_NAME;
|
||||
$propbag->add ( 'description', PLUGIN_EVENT_SPAMBLOCK_BAYES_DESC);
|
||||
$propbag->add ( 'name', $this->title);
|
||||
$propbag->add ( 'version', '0.4.6.1' );
|
||||
$propbag->add ( 'version', '0.4.6.2' );
|
||||
$propbag->add ( 'event_hooks', array ('frontend_saveComment' => true,
|
||||
'backend_spamblock_comments_shown' => true,
|
||||
'external_plugin' => true,
|
||||
|
@ -476,7 +476,6 @@ class serendipity_event_spamblock_bayes extends serendipity_event {
|
|||
type VARCHAR(20) DEFAULT '{$this->type['body']}'
|
||||
) {UTF_8};";
|
||||
serendipity_db_schema_import($sql);
|
||||
|
||||
#recycler-table
|
||||
if ($serendipity['dbType'] == 'mysql') {
|
||||
$sql = "CREATE TABLE
|
||||
|
@ -493,18 +492,15 @@ class serendipity_event_spamblock_bayes extends serendipity_event {
|
|||
{$serendipity['dbPrefix']}spamblock_bayes_recycler;";
|
||||
}
|
||||
serendipity_db_query($sql);
|
||||
|
||||
|
||||
$dbversion = $this->get_config('dbversion', 1);
|
||||
if ($dbversion == '1') {
|
||||
$this->updateDB1();
|
||||
}
|
||||
|
||||
$dbversion = $this->get_config('dbversion', 1);
|
||||
if ($dbversion == '2') {
|
||||
$this->updateDB2();
|
||||
}
|
||||
|
||||
}
|
||||
#when upgrading to 0.3, type has to get added
|
||||
function updateDB1() {
|
||||
|
@ -560,7 +556,7 @@ class serendipity_event_spamblock_bayes extends serendipity_event {
|
|||
FROM
|
||||
{$serendipity['dbPrefix']}spamblock_bayes;";
|
||||
$results = serendipity_db_query($sql);
|
||||
|
||||
|
||||
foreach ($results as $result) {
|
||||
$token = $result['token'];
|
||||
$ham = $result['ham'];
|
||||
|
@ -594,7 +590,6 @@ class serendipity_event_spamblock_bayes extends serendipity_event {
|
|||
|
||||
$sql3 = "DROP TABLE {$serendipity['dbPrefix']}spamblock_bayes;";
|
||||
serendipity_db_query($sql3);
|
||||
|
||||
|
||||
$sql4 = "CREATE TABLE {$serendipity['dbPrefix']}spamblock_bayes (
|
||||
token VARCHAR(100) NOT NULL,
|
||||
|
@ -605,7 +600,7 @@ class serendipity_event_spamblock_bayes extends serendipity_event {
|
|||
) {UTF_8};";
|
||||
|
||||
serendipity_db_schema_import($sql4);
|
||||
|
||||
|
||||
$sql5 = "INSERT INTO
|
||||
{$serendipity['dbPrefix']}spamblock_bayes
|
||||
(token, ham, spam, type)
|
||||
|
@ -616,6 +611,7 @@ class serendipity_event_spamblock_bayes extends serendipity_event {
|
|||
";
|
||||
|
||||
serendipity_db_schema_import($sql5);
|
||||
|
||||
serendipity_db_end_transaction(true);
|
||||
$this->set_config('dbversion', 3);
|
||||
}
|
||||
|
@ -1452,6 +1448,9 @@ class serendipity_event_spamblock_bayes extends serendipity_event {
|
|||
$this->showAnalysis($comment_ids);
|
||||
} else {
|
||||
$comments = $this->getAllComments($commentpage);
|
||||
if (!is_array($comments[0])) {
|
||||
$comments = array();
|
||||
}
|
||||
echo $this->smarty_show('admin/bayesAnalysismenu.tpl', array(
|
||||
'comments' => $comments,
|
||||
'commentpage' => $commentpage,
|
||||
|
|
Loading…
Reference in a new issue