OSDN Git Service

Ticket処理を追加
[nucleus-jp/nucleus-plugins.git] / trunk / NP_Blacklist / blacklist / index.php
1 <?php
2     require_once("blacklist_lib.php");
3
4     //
5     // Nucleus Admin section;
6     // Created by Xiffy
7     //
8         $strRel = '../../../';
9         include($strRel . 'config.php');
10
11         include($DIR_LIBS . 'PLUGINADMIN.php');
12
13         if ($blogid) {$isblogadmin = $member->isBlogAdmin($blogid);}
14         else $isblogadmin = 0;
15
16         if (!($member->isAdmin() || $isblogadmin)) {
17                 $oPluginAdmin = new PluginAdmin('Blacklist');
18                 $pbl_config = array();
19                 $oPluginAdmin->start();
20                 echo "<p>"._ERROR_DISALLOWED."</p>";
21                 $oPluginAdmin->end();
22                 exit;
23         }
24         
25         $action = requestVar('action');
26         $aActionsNotToCheck = array(
27                 '',
28         );
29         if (!in_array($action, $aActionsNotToCheck)) {
30                 if (!$manager->checkTicket()) doError(_ERROR_BADTICKET);
31         }
32
33         // Okay; we are allowed. let's go
34         // create the admin area page
35         $oPluginAdmin = new PluginAdmin('Blacklist');
36         $oPluginAdmin->start();
37         // get the plugin options; stored in the DB
38     $pbl_config['enabled']       = $oPluginAdmin->plugin->getOption('enabled');
39     $pbl_config['redirect']      = $oPluginAdmin->plugin->getOption('redirect');
40     //$pbl_config['update']        = $oPluginAdmin->plugin->getOption('update');
41     $pbl_config['referrerblock'] = $oPluginAdmin->plugin->getOption('referrerblock');
42     $pbl_config['ipblock']       = $oPluginAdmin->plugin->getOption('ipblock');
43     $pbl_config['ipthreshold']   = $oPluginAdmin->plugin->getOption('ipthreshold');
44     $pbl_config['BulkfeedsKey']   = $oPluginAdmin->plugin->getOption('BulkfeedsKey');
45     $pbl_config['SkipNameResolve']   = $oPluginAdmin->plugin->getOption('SkipNameResolve');
46
47         function getPluginOption($name) {
48             global $pbl_config;
49             return $pbl_config[$name];
50         }
51         function getPlugid() {
52             global $oPluginAdmin;
53             return $oPluginAdmin->plugin->plugid;
54         }
55
56         pbl_nucmenu();
57         if ($action == 'blacklist') {
58             pbl_blacklisteditor();
59         echo "</div>";
60 //      } elseif ($action == 'getblacklist') {
61 //       if (pbl_updateblacklist($pbl_config['update'],true))  {
62 //              $pblmessage = "Blacklist succesfully updated!";
63 //          pbl_blacklisteditor();
64 //              echo "</div>";
65 //      }
66         } elseif ($action == 'addpersonal') {
67         pbl_addpersonal();
68         pbl_blacklisteditor();
69         echo "</div>";
70         } elseif ($action == 'deleteexpression') {
71         pbl_deleteexpression();
72             echo "<div class=\"pblmessage\">Expression deleted from personal blacklist.</div>\n";
73         pbl_blacklisteditor();
74     } elseif ($action == 'log') {
75         echo "<h2 style=\"text-align:left\"><span style=\"margin-left:10px;\">Blacklist: Blacklist Log</span></h2>";
76             echo "<div class=\"pbldescription\">This is your Blacklist logviewer. Each blocked spam attempt will end up in this overview.If you wish you can reset the log below.</div>\n";
77         pbl_logtable();
78     } elseif ($action == 'resetlog') {
79         pbl_resetfile('log');
80         echo "<h2> logfile has been reset</h2>";
81         echo "<h2 style=\"text-align:left\"><span style=\"margin-left:10px;\">Blacklist: Blacklist Log</span></h2>";
82             echo "<div class=\"pbldescription\">This is your Blacklist logviewer. Each blocked spam attempt will end up in this overview.If you wish you can reset the log below.</div>\n";
83         pbl_logtable();
84     } elseif ($action == 'testpage') {
85         echo "<h2>Test if an expression is considered spam</h2>";
86         pbl_testpage();
87     } elseif ($action == 'test') {
88         echo "<h2>Test if an expression is considered spam</h2>";
89         pbl_test();
90         pbl_testpage();
91     } elseif ($action == 'showipblock') {
92         echo "<h2>These ip-addresses are blocked</h2>";
93         pbl_showipblock();
94     } elseif ($action == 'addip') {
95         pbl_addipblock();
96         echo "<h2>These ip-addresses are blocked</h2>";
97         pbl_showipblock();
98     } elseif  ($action == 'deleteipblock') {
99         pbl_deleteipblock();
100             echo "<div class=\"pblmessage\">Block deleted</div>\n";
101         echo "<h2>These ip-addresses are blocked</h2>";
102         pbl_showipblock();
103     } elseif ($action == 'htaccess') {
104         echo "<h2>Here you can generate .htaccess snippets</h2>";
105         pbl_htaccesspage();
106     } elseif ($action == 'spamsubmission') {
107                 $url = requestVar('url');
108                 if( requestVar('type') == 'send' && ! empty($url) ){
109                         $result = $oPluginAdmin->plugin->submitSpamToBulkfeeds( $url );
110
111                         echo "<h2>Spam submission</h2>";
112                         echo "<h3>result</h3>";
113                         echo "<pre>" . htmlspecialchars($result, ENT_QUOTES) . "</pre>";
114                 } else {
115                         echo "<h2>Spam submission</h2>";
116                         pbl_spamsubmission_form();
117                 }
118     }
119     echo "<br />";
120         echo "Based on pivot blacklist: <a style=\"border:0px; padding:0px; margin:10px;\" href=\"http://www.i-marco.nl/pivot-blacklist/\"><img style=\"border:0px\" src=\"".dirname($_SERVER['PHP_SELF'])."/pblbutton.png\" alt=\"Pivot Blacklist\"/></a><br/>";
121
122         $oPluginAdmin->end();
123
124 ?>