4 * File: EditIPofURL.Admin.class.php
5 * This is the Edit IPofURL Module for the Geeklog Spam-X plugin
7 * Copyright (C) 2004-2009 by the following authors:
8 * Author Tom Willett tomw AT pigstye DOT net
9 * Dirk Haun dirk AT haun-online DOT de
11 * Licensed under GNU General Public License
17 if (strpos(strtolower($_SERVER['PHP_SELF']), 'editipofurl.admin.class.php') !== false) {
18 die('This file can not be used on its own!');
22 * Include Abstract Base Class
24 require_once $_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php';
27 * IP of URL Black List Editor
32 class EditIPofUrl extends BaseAdmin {
38 global $_CONF, $_TABLES, $LANG_SX00;
41 if (isset($_GET['action'])) {
42 $action = $_GET['action'];
43 } elseif (isset($_POST['paction'])) {
44 $action = $_POST['paction'];
48 if (isset($_GET['entry'])) {
49 $entry = COM_stripslashes($_GET['entry']);
50 } elseif (isset($_POST['pentry'])) {
51 $entry = COM_stripslashes($_POST['pentry']);
54 if (($action == 'delete') && SEC_checkToken()) {
55 $entry = addslashes($entry);
56 DB_delete($_TABLES['spamx'], array('name', 'value'),
57 array('IPofUrl', $entry));
58 } elseif (($action == $LANG_SX00['addentry']) && SEC_checkToken()) {
60 $entry = addslashes($entry);
61 $result = DB_query("INSERT INTO {$_TABLES['spamx']} VALUES ('IPofUrl', '$entry')");
65 $token = SEC_createToken();
66 $display = '<hr' . XHTML . '>' . LB . '<p><b>';
67 $display .= $LANG_SX00['ipofurlblack'];
68 $display .= '</b></p>' . LB . '<ul>' . LB;
69 $result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name = 'IPofUrl'");
70 $nrows = DB_numRows($result);
71 for ($i = 0; $i < $nrows; $i++) {
72 list($e) = DB_fetchArray($result);
73 $display .= '<li>'. COM_createLink(htmlspecialchars($e),
74 $_CONF['site_admin_url']
75 . '/plugins/spamx/index.php?command=EditIPofUrl&action=delete&entry=' . urlencode($e) . '&' . CSRF_TOKEN . '=' . $token) . '</li>' . LB;
77 $display .= '</ul>' . LB . '<p>' . $LANG_SX00['e1'] . '</p>' . LB;
78 $display .= '<p>' . $LANG_SX00['e2'] . '</p>' . LB;
79 $display .= '<form method="post" action="' . $_CONF['site_admin_url']
80 . '/plugins/spamx/index.php?command=EditIPofUrl">';
81 $display .= '<div><input type="text" size="30" name="pentry"' . XHTML
82 . '> ';
83 $display .= '<input type="submit" name="paction" value="'
84 . $LANG_SX00['addentry'] . '"' . XHTML . '>' . LB;
85 $display .= '<input type="hidden" name="' . CSRF_TOKEN
86 . "\" value=\"{$token}\"" . XHTML . '>' . LB;
87 $display .= '</div></form>' . LB;
94 return 'Edit IP of URL Blacklist';