<?php
/**
- * NP_Blacklist(JP) ($Revision: 1.12 $)
+ * NP_Blacklist(JP) ($Revision: 1.13 $)
* by hsur ( http://blog.cles.jp/np_cles )
- * $Id: NP_Blacklist.php,v 1.12 2007-05-04 15:11:12 hsur Exp $
+ * $Id: NP_Blacklist.php,v 1.13 2008-05-04 00:41:54 hsur Exp $
*
* Based on NP_Blacklist 0.98
* by xiffy
*/
/*
- * Copyright (C) 2005-2007 cles All rights reserved.
+ * Copyright (C) 2005-2008 cles All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
return 'http://blog.cles.jp/np_cles/category/31/subcatid/11';
}
function getVersion() {
- return '1.2';
+ return '1.3';
}
function getDescription() {
- return '[$Revision: 1.12 $]<br />'.NP_BLACKLIST_description;
+ return '[$Revision: 1.13 $]<br />'.NP_BLACKLIST_description;
}
function supportsFeature($what) {
switch ($what) {
$this->createOption('redirect', NP_BLACKLIST_redirect, 'text', '');
$this->createOption('ipblock', NP_BLACKLIST_ipblock, 'yesno', 'yes');
$this->createOption('ipthreshold', NP_BLACKLIST_ipthreshold, 'text', '10');
- $this->createOption('BulkfeedsKey', NP_BLACKLIST_BulkfeedsKey, 'text', '');
$this->createOption('SkipNameResolve', NP_BLACKLIST_SkipNameResolve, 'yesno', 'yes');
$this->_initSettings();
}
}
- function submitSpamToBulkfeeds($url) {
- if (is_array($url))
- $url = implode("\n", $url);
-
- $postData['apikey'] = $this->getOption('BulkfeedsKey');
- if (!$postData['apikey'])
- return "BulkfeedsKey not found. see http://bulkfeeds.net/app/register_api.html";
- $postData['url'] = $url;
-
- $data = $this->_http('http://bulkfeeds.net:80/app/submit_spam.xml', 'POST', '', $postData);
- return $data;
- }
-
- function _http($url, $method = "GET", $headers = "", $post = array ("")) {
- $URL = parse_url($url);
-
- if (isset ($URL['query'])) {
- $URL['query'] = "?".$URL['query'];
- } else {
- $URL['query'] = "";
- }
-
- if (!isset ($URL['port']))
- $URL['port'] = 80;
-
- $request = $method." ".$URL['path'].$URL['query']." HTTP/1.0\r\n";
-
- $request .= "Host: ".$URL['host']."\r\n";
- $request .= "User-Agent: NP_Blacklist/".phpversion()."\r\n";
-
- if (isset ($URL['user']) && isset ($URL['pass'])) {
- $request .= "Authorization: Basic ".base64_encode($URL['user'].":".$URL['pass'])."\r\n";
- }
-
- $request .= $headers;
-
- if (strtoupper($method) == "POST") {
- while (list ($name, $value) = each($post)) {
- $POST[] = $name."=".urlencode($value);
- }
- $postdata = implode("&", $POST);
- $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
- $request .= "Content-Length: ".strlen($postdata)."\r\n";
- $request .= "\r\n";
- $request .= $postdata;
- } else {
- $request .= "\r\n";
- }
-
- $fp = fsockopen($URL['host'], $URL['port'], $errno, $errstr, 20);
-
- if ($fp) {
- socket_set_timeout($fp, 20);
- fputs($fp, $request);
- $response = "";
- while (!feof($fp)) {
- $response .= fgets($fp, 4096);
- }
- fclose($fp);
- $DATA = split("\r\n\r\n", $response, 2);
- return $DATA[1];
- } else {
- $host = $URL['host'];
- $port = $URL['port'];
- ACTIONLOG :: add(WARNING, $this->getName().':'."[$errno]($host:$port) $errstr");
- return "";
- }
- }
-
function _redirect($url) {
if (!$url) {
header("HTTP/1.0 403 Forbidden");
//
// Modified by hsur
// http://blog.cles.jp
-// $Id: blacklist_lib.php,v 1.11 2007-05-04 15:11:07 hsur Exp $
+// $Id: blacklist_lib.php,v 1.12 2008-05-04 00:41:54 hsur Exp $
define('__WEBLOG_ROOT', dirname(dirname(realpath(__FILE__))));
define('__EXT', '/blacklist');
}
fwrite($handle, $expression."\n");
fclose($handle);
+
}
}
}
function check_for_domainrbl($comment_text) {
- $domainrbl = array ('rbl.bulkfeeds.jp', 'url.rbl.jp', 'bsb.spamlookup.net');
+ $domainrbl = array ('url.rbl.jp', 'bsb.spamlookup.net');
$regex_url = "{https?://(?:www\.)?([a-z0-9._-]{2,})(?::[0-9]+)?((?:/[_.!~*a-z0-9;@&=+$,%-]+){0,2})}i";
$mk_regex_array = array ();
<h3>バージョン履歴</h3>
<ul>
+ <li>Version 1.3: (2008/05/04)</li>
+ <li> [Added] ログ消去時などに確認ダイアログが出るようにした。</li>
+ <li> [Added] 動作確認フォームを追加。</li>
+ <li> [Fixed] bulkfeedsが消滅したので関連機能を全て削除した。</li>
+</ul>
+
+<ul>
<li>Version 1.2: (2007/05/04)</li>
<li> [Added] コメント時のemailフィールドもチェック対象にした</li>
</ul>
include($DIR_LIBS . 'PLUGINADMIN.php');
require_once($DIR_PLUGINS . 'sharedlibs/sharedlibs.php');
require_once('cles/Template.php');
+ require_once('cles/Feedback.php');
if ($blogid) {$isblogadmin = $member->isBlogAdmin($blogid);}
else $isblogadmin = 0;
// create the admin area page
$oPluginAdmin = new PluginAdmin('Blacklist');
$oPluginAdmin->start();
+ $fb =& new cles_Feedback($oPluginAdmin);
+
// get the plugin options; stored in the DB
$pbl_config['enabled'] = $oPluginAdmin->plugin->getOption('enabled');
$pbl_config['redirect'] = $oPluginAdmin->plugin->getOption('redirect');
}
$tplVars['snippet'] = pbl_htaccess($type);
break;
-
- case 'spamsubmission':
- $url = requestVar('url');
- if( requestVar('type') == 'send' && ! empty($url) ){
- $tplVars['message'] = $oPluginAdmin->plugin->submitSpamToBulkfeeds( $url );
- $action = 'spamsubmission_result';
- }
- break;
-
+
default:
break;
}
case 'htaccess':
$content = $templateEngine->fetch('htaccess', NP_BLACKLIST_TEMPLATEDIR_INDEX);
break;
-
- case 'spamsubmission':
- $content = $templateEngine->fetch('spamsubmission_form', NP_BLACKLIST_TEMPLATEDIR_INDEX);
- break;
-
- case 'spamsubmission_result':
- $content = $templateEngine->fetch('spamsubmission_result', NP_BLACKLIST_TEMPLATEDIR_INDEX);
+
+ case 'report':
+ $content = '';
+ $fb->printForm();
break;
default:
$footer = $templateEngine->fetch('footer', NP_BLACKLIST_TEMPLATEDIR_INDEX);
echo $templateEngine->fill($footer, $tplVars, false);
- $oPluginAdmin->end();
\ No newline at end of file
+ $oPluginAdmin->end();
<input type="hidden" name="ticket" value="{{ticket|}}" />
<input type="hidden" name="action" value="htaccess" />
<input type="hidden" name="type" value="reset_ip" />
- <input type="submit" name="submit" value="IP¥Ö¥é¥Ã¥¯¥ê¥¹¥È¤Î¥ê¥»¥Ã¥È" />
+ <input type="submit" name="submit" value="IP¥Ö¥é¥Ã¥¯¥ê¥¹¥È¤Î¥ê¥»¥Ã¥È" onClick="return confirm('IP¥Ö¥é¥Ã¥¯¥ê¥¹¥È¤ò¥ê¥»¥Ã¥È¤·¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©');"/>
</form>
<form action="{{indexurl}}" method="post" style="display:inline">
<input type="hidden" name="ticket" value="{{ticket|}}" />
<input type="hidden" name="action" value="htaccess" />
<input type="hidden" name="type" value="reset_rule" />
- <input type="submit" name="submit" value="Rewrite¥ë¡¼¥ë¤Î¥ê¥»¥Ã¥È" />
+ <input type="submit" name="submit" value="Rewrite¥ë¡¼¥ë¤Î¥ê¥»¥Ã¥È" onClick="return confirm('Rewrite¥ë¡¼¥ë¤ò¥ê¥»¥Ã¥È¤·¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©');"/>
</form><br />
<span style="color: red;">
¥ë¡¼¥ë¤Î¥ê¥»¥Ã¥È¤ò¹Ô¤¦¤È¡¢¤³¤ì¤Þ¤Ç¤ËÃßÀѤµ¤ì¤¿³Æ¥Ç¡¼¥¿¤¬Á´¤Æ¾Ãµî¤µ¤ì¤Þ¤¹¡£<br />
<input type="hidden" name="ticket" value="{{ticket|}}" />
<input type="hidden" name="action" value="htaccess" />
<input type="hidden" name="type" value="reset_ip" />
- <input type="submit" name="submit" value="IPブラックリストのリセット" />
+ <input type="submit" name="submit" value="IPブラックリストのリセット" onClick="return confirm('IPブラックリストをリセットしてもよろしいですか?');"/>
</form>
<form action="{{indexurl}}" method="post" style="display:inline">
<input type="hidden" name="ticket" value="{{ticket|}}" />
<input type="hidden" name="action" value="htaccess" />
<input type="hidden" name="type" value="reset_rule" />
- <input type="submit" name="submit" value="Rewriteルールのリセット" />
+ <input type="submit" name="submit" value="Rewriteルールのリセット" onClick="return confirm('Rewriteルールをリセットしてもよろしいですか?');"/>
</form><br />
<span style="color: red;">
ルールのリセットを行うと、これまでに蓄積された各データが全て消去されます。<br />
<form action="{{indexurl}}" method="post">
<input type="hidden" name="action" value="resetlog" />
<input type="hidden" name="ticket" value="{{ticket|}}" />
- <input type="submit" value="¥í¥°¾Ãµî" />
+ <input type="submit" value="¥í¥°¾Ãµî" onClick="return confirm('¥í¥°¾Ãµî¤·¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©');"/>
</form>
</div>
<form action="{{indexurl}}" method="post">
<input type="hidden" name="action" value="resetlog" />
<input type="hidden" name="ticket" value="{{ticket|}}" />
- <input type="submit" value="ログ消去" />
+ <input type="submit" value="ログ消去" onClick="return confirm('ログ消去してもよろしいですか?');"/>
</form>
</div>
</a>
</li>
<li>
- <a href="{{indexurl}}?action=spamsubmission&ticket={{ticket|}}">
+ <a href="{{indexurl}}?action=report&ticket={{ticket|}}">
<img src="{{plugindirurl}}icons/i_edit.gif" />
- Spam submission (Bulkfeeds)
+ Bug report
</a>
</li>
</ul>
</a>
</li>
<li>
- <a href="{{indexurl}}?action=spamsubmission&ticket={{ticket|}}">
+ <a href="{{indexurl}}?action=report&ticket={{ticket|}}">
<img src="{{plugindirurl}}icons/i_edit.gif" />
- Bulkfeeds¤Ø¤ÎspamÊó¹ð
+ Æ°ºî³ÎǧÊó¹ð
</a>
</li>
</ul>
</a>
</li>
<li>
- <a href="{{indexurl}}?action=spamsubmission&ticket={{ticket|}}">
+ <a href="{{indexurl}}?action=report&ticket={{ticket|}}">
<img src="{{plugindirurl}}icons/i_edit.gif" />
- Bulkfeedsへのspam報告
+ 動作確認報告
</a>
</li>
</ul>
+++ /dev/null
-<h2>spam submission</h2>
-<form action="{{indexurl}}" method="post">
- <input type="hidden" name="action" value="spamsubmission" />
- <input type="hidden" name="type" value="send" />
- <input type="hidden" name="ticket" value="{{ticket|}}" />
- <table>
- <tr><th>Report Spam</th></tr>
- <tr><td><textarea name="url" rows="6" cols="60"></textarea></td></tr>
- <tr><td><div align="right"><input type="submit" name="submit" value="submit" /></div></td></tr>
- </table>
-</form>
+++ /dev/null
-<h2>Bulkfeeds¤Ø¤ÎspamÊó¹ð</h2>
-<form action="{{indexurl}}" method="post">
- <input type="hidden" name="action" value="spamsubmission" />
- <input type="hidden" name="type" value="send" />
- <input type="hidden" name="ticket" value="{{ticket|}}" />
- <table>
- <tr><th>spamÊó¹ð(£±¹Ô¤Ë£±¤Ä¤ÎURL¤òµ½Ò¤·¤Þ¤¹)</th></tr>
- <tr><td><textarea name="url" rows="6" cols="60"></textarea></td></tr>
- <tr><td><div align="right"><input type="submit" name="submit" value="submit" /></div></td></tr>
- </table>
-</form>
+++ /dev/null
-<h2>Bulkfeedsへのspam報告</h2>
-<form action="{{indexurl}}" method="post">
- <input type="hidden" name="action" value="spamsubmission" />
- <input type="hidden" name="type" value="send" />
- <input type="hidden" name="ticket" value="{{ticket|}}" />
- <table>
- <tr><th>spam報告(1行に1つのURLを記述します)</th></tr>
- <tr><td><textarea name="url" rows="6" cols="60"></textarea></td></tr>
- <tr><td><div align="right"><input type="submit" name="submit" value="submit" /></div></td></tr>
- </table>
-</form>
+++ /dev/null
-<h2>Spam submission (Bulkfeeds)</h2>
-<h3>Result</h3>
-<pre>{{message|}}</pre>
\ No newline at end of file
+++ /dev/null
-<h2>Bulkfeedsへのspam報告</h2>
-<h3>報告結果(「Thanks for the submision.」の文字があれば成功しています。)</h3>
-<pre>{{message|}}</pre>
\ No newline at end of file
--- /dev/null
+<?php
+// vim: tabstop=2:shiftwidth=2
+
+/**
+ * Feedback.php ($Revision: 1.1 $)
+ *
+ * by hsur ( http://blog.cles.jp/np_cles )
+ * $Id: Feedback.php,v 1.1 2008-05-04 00:41:54 hsur Exp $
+*/
+
+/*
+ * Copyright (C) 2006 CLES. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives
+ * permission to link the code of this program with those files in the PEAR
+ * library that are licensed under the PHP License (or with modified versions
+ * of those files that use the same license as those files), and distribute
+ * linked combinations including the two. You must obey the GNU General Public
+ * License in all respects for all of the code used other than those files in
+ * the PEAR library that are licensed under the PHP License. If you modify
+ * this file, you may extend this exception to your version of the file,
+ * but you are not obligated to do so. If you do not wish to do so, delete
+ * this exception statement from your version.
+*/
+
+class cles_Feedback {
+ var $oPluginAdmin;
+ function CLES_Feedback(&$pluginAdmin){
+ $this->oPluginAdmin = $pluginAdmin;
+ }
+
+ function getMenuStr(){
+ return mb_convert_encoding('動作確認/不具合報告', _CHARSET, 'UTF-8');
+ }
+
+ function printForm($extra = '') {
+ ob_start();
+
+ global $nucleus, $CONF;
+
+ echo "<h2>動作確認/不具合報告</h2>";
+ echo '<p>下記より、作者への動作確認/不具合の報告を行うことができます。</p>';
+
+ // js
+ echo '<script langage="JavaScript">
+ function selectall(){
+ var elements = document.getElementsByTagName(\'input\');
+ for( var i=0; i < elements.length; i++){
+ var e = elements[i];
+ if( e.type == \'checkbox\' ){
+ e.checked = true;
+ }
+ }
+ return false;
+ }
+ </script>';
+
+ echo "<h3>収集する情報と公開について</h3>";
+ echo '<p>デフォルトで必要最低限の環境情報(赤字のもの)を開発者のサーバへ送信します。<br />
+ <span style="font-weight:bold; color:red">差し支えない範囲で環境情報の提供にご協力ください。</span></p>
+ <p>※ 収集した情報は統計処理、及びプラグインのBugFixのみに利用されます。また統計処理した結果については公表することがあります。</p>';
+ echo '<p><a href="#" onclick="javascript:selectall();return false;">全て送信する場合はここをクリック</a></p>';
+
+ echo "<h3>サイト固有コードについて</h3>";
+ echo '<p>動作報告の重複を取り除くため、管理画面のURLのmd5を計算したものを送信しています。この情報から管理画面のURLを復元することはできないようになっています。<a href="http://computers.yahoo.co.jp/dict/security/hash/677.html" target="_blank">md5の解説についてはこちらをご覧ください。(Yahoo!コンピュータ用語辞典)</a></p>';
+
+ // form
+ echo '<form method="post" action="http://blog.cles.jp/support/report.php">' . "\n";
+
+ // table
+ echo "<table>\n";
+ echo "<tr>\n";
+ echo "<th>項目の説明</th>\n";
+ echo "<th>送信される値</th>\n";
+ echo "<th><a href=\"#\" onclick=\"javascript:selectall();return false;\">全て送信する</th>\n";
+ echo "</tr>\n";
+
+ $res = sql_query("show variables like 'version'");
+ $assoc = mysql_fetch_assoc($res);
+ $mysqlVersion = $assoc['Value'];
+
+ if( function_exists('gd_info') )
+ $gdinfo = @gd_info();
+ else
+ $gdinfo['GD Version'] = 'GD is not supported';
+
+ global $CONF;
+
+ $this->_printtr('siteid', 'サイトの固有コード', md5(trim($CONF['AdminURL'])));
+ $this->_printtr('plugin_name', 'プラグイン名', $this->oPluginAdmin->plugin->getName());
+ $this->_printtr('plugin_version', 'プラグインのバージョン', $this->oPluginAdmin->plugin->getVersion());
+ $this->_printtr('plugin_info', 'プラグインの情報', $extra, true);
+ $this->_printtr('nucleus_version', 'Nucleusのバージョン', $nucleus['version'], true);
+ $this->_printtr('nucleus_charset', 'Nucleusのキャラクタセット', _CHARSET);
+ $this->_printtr('php_version', 'PHPのバージョン', PHP_VERSION, true);
+ $this->_printtr('php_sapi', 'PHPの種類', php_sapi_name());
+ $this->_printtr('php_os', 'OSの種類', PHP_OS, true);
+ $this->_printtr('php_safemode', 'セーフモードの有無', ini_get('safe_mode') ? 'on' : 'off');
+ $this->_printtr('php_gd_version', 'GDのバージョン', $gdinfo['GD Version'], true);
+ $this->_printtr('php_gd_support', 'サポートしているイメージタイプ', implode(',', $this->_supportedImageTypes()) );
+ $this->_printtr('mysql_version', 'MySQLのバージョン', $mysqlVersion, true);
+
+ echo "<tr>\n";
+ echo "<td>このプラグインは機能しましたか?</td>\n";
+ echo '<td colsan="2"><input type="radio" name="user_intention" value="ok" />はい <br/> <input type="radio" name="intention" value="ng" />いいえ'."</td>\n";
+ echo "</tr>\n";
+
+ echo "<tr>\n";
+ echo "<td>不具合の内容をお寄せください<br /><em>必ず回答が必要な質問については、<a href=\"http://japan.nucleuscms.org/bb/\">Nucleusサポートフォーラム</a>もしくは<a href=\"http://blog.cles.jp/np_cles/\">作者ページ</a>でご質問ください。</em></td>\n";
+ echo '<td colspan="2"><textarea name="user_freetext" rows="10" cols="70"></textarea>'."</td>\n";
+ echo "</tr>\n";
+
+ echo "<tr>\n";
+ echo "<td>よろしければサイトのURLを教えてください</td>\n";
+ echo '<td colspan="2"><textarea name="user_url" rows="1" cols="70"></textarea>'."</td>\n";
+ echo "</tr>\n";
+
+ echo "<tr>\n";
+ echo "<td>リンク集作成の際、リンクをはらせていただけますか?</td>\n";
+ echo '<td colspan="2"><input type="radio" name="user_disclose" value="yes" />はい <br/> <input type="radio" name="intention" value="no" />いいえ'."</td>\n";
+ echo "</tr>\n";
+
+ echo '<tr><td colspan="3"><div align="right"><input type="submit" name="submit" value="動作確認を送信する" /></div></td></tr>';
+ echo "</table>\n";
+ echo "</form>\n";
+
+ $contents = ob_get_contents();
+ ob_end_clean();
+ echo mb_convert_encoding($contents, _CHARSET, 'UTF-8');
+ }
+
+ function _printtr($name, $desc, $value, $canDisable = false) {
+ echo "<tr>\n";
+
+ if ($canDisable) {
+ echo "<td>".$desc."</td>\n";
+ echo "<td>".htmlspecialchars($value)."</td>\n";
+ echo '<td><input type="checkbox" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" /></td>'."\n";
+ } else {
+ echo '<td><span style="font-weight:bold; color:red">'.$desc."</span></td>\n";
+ echo '<td><span style="font-weight:bold; color:red">'.htmlspecialchars($value)."</span></td>\n";
+ echo '<td><input type="checkbox" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" readonly="readonly" checked="checked"/></span></td>'."\n";
+ }
+ echo "</tr>\n";
+ }
+
+ function _supportedImageTypes() {
+ if( !function_exists('gd_info') ) return "";
+
+ $aSupportedTypes = array ();
+ $aPossibleImageTypeBits = array (IMG_GIF => 'GIF', IMG_JPG => 'JPG', IMG_PNG => 'PNG', IMG_WBMP => 'WBMP');
+
+ foreach ($aPossibleImageTypeBits as $iImageTypeBits => $sImageTypeString) {
+ if (imagetypes() & $iImageTypeBits) {
+ $aSupportedTypes[] = $sImageTypeString;
+ }
+ }
+
+ return $aSupportedTypes;
+ }
+
+}