• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの


Commit MetaInfo

Revision4b9800b35c33fae6aa561909e87cc7d027cea372 (tree)
Time2006-10-18 00:37:58
Authorhsur <hsur@1ca2...>
Commiterhsur

Log Message

Ticket処理を追加

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@457 1ca29b6e-896d-4ea0-84a5-967f57386b96

Change Summary

Incremental Difference

--- a/trunk/NP_Blacklist/NP_Blacklist.php
+++ b/trunk/NP_Blacklist/NP_Blacklist.php
@@ -110,10 +110,7 @@ class NP_Blacklist extends NucleusPlugin {
110110
111111 function getEventList() {
112112 $this->_initSettings();
113-// cles::blog
114- //return array('QuickMenu','PreAddComment','PreSkinParse','ValidateForm', 'SpamCheck');
115- return array('QuickMenu', 'SpamCheck', 'PreSkinParse');
116-// cles::blog
113+ return array('QuickMenu','PreAddComment','PreSkinParse','ValidateForm', 'SpamCheck');
117114 }
118115
119116 function hasAdminArea() {
--- a/trunk/NP_Blacklist/blacklist/blacklist_lib.php
+++ b/trunk/NP_Blacklist/blacklist/blacklist_lib.php
@@ -199,21 +199,22 @@ function is_domain($stheDomain) {
199199
200200
201201 function pbl_nucmenu() {
202+ global $manager;
202203 echo "<h2>Blacklist menu</h2>\n";
203204 echo "<ul>\n";
204- echo "<li><a href=\"".serverVar('PHP_SELF')."?page=blacklist\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_edit.gif\" /> Blacklist Editor</a></li>\n";
205- echo "<li><a href=\"".serverVar('PHP_SELF')."?page=log\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_log.gif\" /> Blacklist Log</a></li>\n";
206- echo "<li><a href=\"".dirname(serverVar('PHP_SELF'))."/../../index.php?action=pluginoptions&amp;plugid=".getPlugid()."\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_prefs.gif\" /> Blacklist options</a></li>\n";
207- echo "<li><a href=\"".serverVar('PHP_SELF')."?page=testpage\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_edit.gif\" /> Test Blacklist</a></li>\n";
208- echo "<li><a href=\"".serverVar('PHP_SELF')."?page=showipblock\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_log.gif\" /> Show blocked ip addresses</a></li>\n";
209- echo "<li><a href=\"".serverVar('PHP_SELF')."?page=htaccess\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_edit.gif\" /> Generate .htaccess snippets</a></li>\n";
210- echo "<li><a href=\"".serverVar('PHP_SELF')."?page=spamsubmission\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_edit.gif\" /> Spam submission (Bulkfeeds)</a></li>\n";
205+ echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=blacklist"),ENT_QUOTES)."\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_edit.gif\" /> Blacklist Editor</a></li>\n";
206+ echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=log"),ENT_QUOTES)."\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_log.gif\" /> Blacklist Log</a></li>\n";
207+ echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(dirname(serverVar('PHP_SELF'))."/../../index.php?action=pluginoptions&plugid=".getPlugid()),ENT_QUOTES)."\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_prefs.gif\" /> Blacklist options</a></li>\n";
208+ echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=testpage"),ENT_QUOTES)."\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_edit.gif\" /> Test Blacklist</a></li>\n";
209+ echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=showipblock"),ENT_QUOTES)."\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_log.gif\" /> Show blocked ip addresses</a></li>\n";
210+ echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=htaccess"),ENT_QUOTES)."\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_edit.gif\" /> Generate .htaccess snippets</a></li>\n";
211+ echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=spamsubmission"),ENT_QUOTES)."\"><img src=\"".dirname(serverVar('PHP_SELF'))."/icons/i_edit.gif\" /> Spam submission (Bulkfeeds)</a></li>\n";
211212 echo "</ul>\n";
212213 }
213214
214215 function pbl_blacklisteditor() {
215216
216- global $pblmessage;
217+ global $pblmessage, $manager;
217218
218219 if(strlen($pblmessage) > 0) {
219220 echo "<div class=\"pblmessage\">$pblmessage</div>\n";
@@ -255,7 +256,9 @@ function pbl_blacklisteditor() {
255256 echo "</div>\n";
256257 echo "<div class=\"pbform\">\n";
257258 echo "<form action=\"".serverVar('PHP_SELF')."\" method=\"get\">\n";
258- echo "<input type=\"hidden\" name=\"page\" value=\"addpersonal\" />\n";
259+ $manager->addTicketHidden();
260+
261+ echo "<input type=\"hidden\" name=\"action\" value=\"addpersonal\" />\n";
259262 echo "<table class=\"pblform\">\n";
260263 echo "<tr>\n";
261264 echo "<td>expression</td>\n";
@@ -295,7 +298,7 @@ function pbl_blacklisteditor() {
295298 echo "<td>".htmlspecialchars($key,ENT_QUOTES)."</td>\n";
296299 echo "<td>".htmlspecialchars($value,ENT_QUOTES)."</td>\n";
297300 echo "<td>";
298- echo "<a href=\"".serverVar('PHP_SELF')."?page=deleteexpression&amp;line=".$line."\">delete</a>";
301+ echo "<a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=deleteexpression&line=".$line),ENT_QUOTES)."\">delete</a>";
299302 echo "</td>";
300303 echo "</tr>\n";
301304 }
@@ -335,6 +338,7 @@ function pbl_addexpression($expression, $comment) {
335338 }
336339 fwrite($handle, $expression."\n");
337340 fclose($handle);
341+
338342 }
339343 }
340344
@@ -419,6 +423,7 @@ function pbl_log($text) {
419423
420424
421425 function pbl_logtable() {
426+ global $manager;
422427 if (file_exists(__WEBLOG_ROOT.__EXT."/settings/blacklist.log")) {
423428 $handle = fopen(__WEBLOG_ROOT.__EXT."/settings/blacklist.log", "r");
424429 $logrows = "";
@@ -452,8 +457,10 @@ function pbl_logtable() {
452457 }
453458 echo "<div class=\"pbform\" style=\"margin-left:10px;\">\n";
454459 echo "<form action=\"".serverVar('PHP_SELF')."\" method=\"get\">\n";
455- echo "<input type=\"hidden\" name=\"page\" value=\"resetlog\" />\n";
460+ echo "<input type=\"hidden\" name=\"action\" value=\"resetlog\" />\n";
456461 echo "<input type=\"submit\" value=\"Reset log\" />\n";
462+ $manager->addTicketHidden();
463+
457464 echo "</form>\n";
458465 echo "</div>\n";
459466 }
@@ -628,13 +635,15 @@ function pbl_suspectIP($threshold, $remote_ip = '') {
628635 }
629636
630637 function pbl_showipblock() {
631- global $pblmessage;
638+ global $pblmessage, $manager;
632639 $filename = __WEBLOG_ROOT.__EXT."/settings/blockip.pbl";
633640 $line = 0;
634641 $fp = fopen($filename,'r');
635642 echo "<div class=\"pbform\">\n";
636643 echo "<form action=\"".serverVar('PHP_SELF')."\" method=\"get\">\n";
637- echo "<input type=\"hidden\" name=\"page\" value=\"addip\" />\n";
644+ echo "<input type=\"hidden\" name=\"action\" value=\"addip\" />\n";
645+ $manager->addTicketHidden();
646+
638647 echo "Add IP to block: ";
639648 echo "<input class=\"pbltextinput\" type=\"text\" name=\"ipaddress\" />\n";
640649 echo "<input type=\"submit\" value=\"Add\" />\n";
@@ -652,7 +661,8 @@ function pbl_showipblock() {
652661 echo "<tr><td>".$ip."</td><td>[".gethostbyaddr(rtrim($ip))."]</td><td>";
653662 else
654663 echo "<tr><td>".$ip."</td><td>[<em>skipped</em>]</td><td>";
655- echo "<a href=\"".serverVar('PHP_SELF')."?page=deleteipblock&amp;line=".$line."\">delete</a>";
664+ // TODO: aaa
665+ echo "<a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=deleteipblock&line=".$line),ENT_QUOTES)."\">delete</a>";
656666 echo "</td></tr>";
657667 }
658668 echo "</table>";
@@ -725,7 +735,7 @@ function pbl_htaccess($type) {
725735 }
726736
727737 function pbl_htaccesspage() {
728- global $pblmessage;
738+ global $pblmessage, $manager;
729739 if(strlen($pblmessage) > 0) {
730740 echo "<div class=\"pblmessage\">$pblmessage</div>\n";
731741 }
@@ -739,11 +749,13 @@ function pbl_htaccesspage() {
739749 }
740750 echo "<div class=\"pbform\" style=\"margin-left:10px;\">\n";
741751 echo "<form action=\"".serverVar('PHP_SELF')."\" method=\"post\">\n";
752+ $manager->addTicketHidden();
753+
742754 echo "<input type=\"submit\" label=\"ip\" value=\"Generate blocked IP's\" name=\"type\" />\n";
743755 echo "<input type=\"submit\" label=\"ip\" value=\"Generate rewrite rules\" name=\"type\" />\n";
744756 echo "<br />";
745757 echo "<br />";
746- echo "<input type=\"hidden\" name=\"page\" value=\"htaccess\" />\n";
758+ echo "<input type=\"hidden\" name=\"action\" value=\"htaccess\" />\n";
747759 echo "<textarea class=\"pbltextinput\" cols=\"60\" rows=\"15\" name=\"snippet\" >". pbl_htaccess($type)."</textarea><br />";
748760 echo "<br />";
749761 echo "<input title=\"this will clean your block IP addresses file\" type=\"submit\" label=\"ip\" value=\"Reset blocked IP's\" name=\"type\" />\n";
@@ -795,6 +807,8 @@ function pbl_test () {
795807 }
796808
797809 function pbl_testpage () {
810+ global $manager;
811+
798812 // shows user testpage ...
799813 global $pblmessage;
800814 if(strlen($pblmessage) > 0) {
@@ -802,7 +816,9 @@ function pbl_testpage () {
802816 }
803817 echo "<div class=\"pbform\" style=\"margin-left:10px;\">\n";
804818 echo "<form action=\"".serverVar('PHP_SELF')."\" method=\"get\">\n";
805- echo "<input type=\"hidden\" name=\"page\" value=\"test\" />\n";
819+ echo "<input type=\"hidden\" name=\"action\" value=\"test\" />\n";
820+ $manager->addTicketHidden();
821+
806822 echo "<textarea class=\"pbltextinput\" cols=\"60\" rows=\"6\" name=\"expression\" ></textarea><br />";
807823 echo "<input type=\"submit\" value=\"Test this\" />\n";
808824 echo "</form>\n";
@@ -810,8 +826,13 @@ function pbl_testpage () {
810826 }
811827
812828 function pbl_spamsubmission_form() {
829+ global $manager;
830+
813831 // form
814- echo "<form action=\"".serverVar('PHP_SELF')."?page=spamsubmission&action=send\" method=\"post\">\n";
832+ echo "<form action=\"".serverVar('PHP_SELF')."\" method=\"post\">\n";
833+ echo "<input type=\"hidden\" name=\"action\" value=\"spamsubmission\" />\n";
834+ echo "<input type=\"hidden\" name=\"type\" value=\"send\" />\n";
835+ $manager->addTicketHidden();
815836
816837 // table
817838 echo "<table>\n";
--- a/trunk/NP_Blacklist/blacklist/cache_eaccelerator.php
+++ b/trunk/NP_Blacklist/blacklist/cache_eaccelerator.php
@@ -1,10 +1,10 @@
11 <?php
22
33 /**
4-* cache_eaccelerator.php ($Revision: 1.2 $)
4+* cache_eaccelerator.php ($Revision: 1.3 $)
55 *
66 * by hsur ( http://blog.cles.jp/np_cles )
7-* $Id: cache_eaccelerator.php,v 1.2 2006-09-30 11:46:18 hsur Exp $
7+* $Id: cache_eaccelerator.php,v 1.3 2006-10-17 15:37:58 hsur Exp $
88 */
99
1010 function pbl_ipcache_write(){
@@ -43,4 +43,4 @@ function pbl_ipcache_gc(){
4343
4444 return $lastGc;
4545 }
46-?>
\ No newline at end of file
46+?>
--- a/trunk/NP_Blacklist/blacklist/help.html
+++ b/trunk/NP_Blacklist/blacklist/help.html
@@ -3,6 +3,7 @@
33 <ul>
44 <li>Version 0.98 jp9: (2006/*/*)</li>
55 <li> [Changed] 正規表現に/m修飾子を追加</li>
6+ <li> [Added] Ticket処理を追加(CSRF対策)</li>
67 </ul>
78
89 <ul>
--- a/trunk/NP_Blacklist/blacklist/index.php
+++ b/trunk/NP_Blacklist/blacklist/index.php
@@ -21,10 +21,14 @@
2121 $oPluginAdmin->end();
2222 exit;
2323 }
24-
25-
26- if (isset($_GET['page'])) {$action = $_GET['page'];}
27- if (isset($_POST['page'])) {$action = $_POST['page'];}
24+
25+ $action = requestVar('action');
26+ $aActionsNotToCheck = array(
27+ '',
28+ );
29+ if (!in_array($action, $aActionsNotToCheck)) {
30+ if (!$manager->checkTicket()) doError(_ERROR_BADTICKET);
31+ }
2832
2933 // Okay; we are allowed. let's go
3034 // create the admin area page
@@ -100,13 +104,13 @@
100104 echo "<h2>Here you can generate .htaccess snippets</h2>";
101105 pbl_htaccesspage();
102106 } elseif ($action == 'spamsubmission') {
103- if( $_REQUEST['action'] == 'send' && !empty($_REQUEST['url']) ){
104- $result = $oPluginAdmin->plugin->submitSpamToBulkfeeds($_REQUEST['url']);
107+ $url = requestVar('url');
108+ if( requestVar('type') == 'send' && ! empty($url) ){
109+ $result = $oPluginAdmin->plugin->submitSpamToBulkfeeds( $url );
105110
106111 echo "<h2>Spam submission</h2>";
107112 echo "<h3>result</h3>";
108- echo "<pre>" . htmlspecialchars($result) . "</pre>";
109-
113+ echo "<pre>" . htmlspecialchars($result, ENT_QUOTES) . "</pre>";
110114 } else {
111115 echo "<h2>Spam submission</h2>";
112116 pbl_spamsubmission_form();
Show on old repository browser