source: extensions/rv_akismet/admin.php @ 11466

Revision 11466, 2.1 KB checked in by rvelices, 8 years ago (diff)

removed call to is_adviser

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4load_language('plugin.lang', AKIS_PATH);
5
6function test_akismet()
7{
8  global $page, $conf;
9  include_once( dirname(__FILE__).'/akismet.class.php' );
10  $akismet = new Akismet(get_absolute_root_url(), $conf['akismet_api_key'], array('referrer'=>'') );
11  if( $akismet->errorsExist() )
12    $page['errors'] = array_merge($page['errors'], array_values($akismet->getErrors()) );
13  else
14    $page['infos'][] = 'Akismet is OK';
15}
16
17if ( isset($_POST['submit']) )
18{
19  $query = '
20UPDATE '.CONFIG_TABLE.'
21  SET value="'.$_POST['akismet_api_key'].'"
22  WHERE param="akismet_api_key"
23  LIMIT 1';
24  pwg_query($query);
25
26  $query = '
27UPDATE '.CONFIG_TABLE.'
28  SET value="'.$_POST['akismet_spam_action'].'"
29  WHERE param="akismet_spam_action"
30  LIMIT 1';
31  pwg_query($query);
32
33  list($conf['akismet_api_key']) = array_from_query('SELECT value FROM '.CONFIG_TABLE.' WHERE param="akismet_api_key"', 'value');
34  list($conf['akismet_spam_action']) = array_from_query('SELECT value FROM '.CONFIG_TABLE.' WHERE param="akismet_spam_action"', 'value');
35  test_akismet();
36}
37
38if ( isset($_GET['test']) )
39  test_akismet();
40if ( isset($_GET['reset-stats']) )
41{
42  $conf['akismet_counters']='0/0';
43  $query = 'UPDATE '.CONFIG_TABLE.' SET value="'.$conf['akismet_counters'].'" WHERE param="akismet_counters" LIMIT 1';
44  pwg_query($query);
45}
46
47$template->set_filename('plugin_admin_content', dirname(__FILE__).'/admin.tpl');
48
49$counters = explode('/', $conf['akismet_counters']);
50$template->assign(
51    array(
52      'AKISMET_API_KEY' => $conf['akismet_api_key'],
53      'AKISMET_BLOG_URL' => get_absolute_root_url(),
54      'AKISMET_TEST_URL' => add_url_params( get_admin_plugin_menu_link(dirname(__FILE__).'/admin.php'), array('test'=>1) ),
55      'AKISMET_RESET_STATS_URL' => add_url_params( get_admin_plugin_menu_link(dirname(__FILE__).'/admin.php'), array('reset-stats'=>1) ),
56      'AKISMET_SPAM_COMMENTS' => $counters[0],
57      'AKISMET_CHECKED_COMMENTS' => $counters[1],
58      'AKISMET_SPAM_ACTION' => $conf['akismet_spam_action'],
59    )
60  );
61
62
63$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
64
65?>
Note: See TracBrowser for help on using the repository browser.