OSDN Git Service

NP_DragAndDropUploader v1.1
[nucleus-jp/nucleus-plugins.git] / trunk / NP_DragAndDropUploader / sharedlibs / cles / Feedback.php
diff --git a/trunk/NP_DragAndDropUploader/sharedlibs/cles/Feedback.php b/trunk/NP_DragAndDropUploader/sharedlibs/cles/Feedback.php
new file mode 100644 (file)
index 0000000..c251c3c
--- /dev/null
@@ -0,0 +1,178 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Feedback.php ($Revision: 1.30 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Feedback.php,v 1.30 2008/05/18 07:01:25 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2006 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+class cles_Feedback {\r
+       var $oPluginAdmin;\r
+       function CLES_Feedback(&$pluginAdmin){\r
+               $this->oPluginAdmin = $pluginAdmin;\r
+       }\r
+       \r
+       function getMenuStr(){\r
+               return mb_convert_encoding('動作確認/不具合報告', _CHARSET, 'UTF-8');\r
+       }\r
+       \r
+       function printForm($extra = '') {\r
+               ob_start();\r
+               \r
+               global $nucleus, $CONF;\r
+               \r
+               echo "<h2>動作確認/不具合報告</h2>";\r
+               echo '<p>下記より、作者への動作確認/不具合の報告を行うことができます。</p>';\r
+\r
+               // js\r
+               echo '<script langage="JavaScript">\r
+//<![CDATA[\r
+function selectall(){\r
+       var elements = document.getElementsByTagName(\'input\');\r
+       for( var i=0; i < elements.length; i++){\r
+               var e = elements[i];\r
+               if( e.type == \'checkbox\' ){\r
+                       e.checked = true;\r
+               }\r
+       }\r
+       return false;\r
+}\r
+//]]>\r
+</script>';\r
+               \r
+               echo "<h3>収集する情報と公開について</h3>";\r
+               echo '<p>デフォルトで必要最低限の環境情報(赤字のもの)を開発者のサーバへ送信します。<br />\r
+                                                       <span style="font-weight:bold; color:red">差し支えない範囲で環境情報の提供にご協力ください。</span></p>\r
+                                                       <p>※ 収集した情報は統計処理、及びプラグインのBugFixのみに利用されます。また統計処理した結果については公表することがあります。</p>';\r
+               echo '<p><a href="#" onclick="javascript:selectall();return false;">全て送信する場合はここをクリック</a></p>';\r
+               \r
+               echo "<h3>サイト固有コードについて</h3>";\r
+               echo '<p>動作報告の重複を取り除くため、管理画面のURLのmd5を計算したものを送信しています。この情報から管理画面のURLを復元することはできないようになっています。<a href="http://e-words.jp/w/MD5.html" target="_blank">md5の解説についてはこちらをご覧ください。(e-WordsIT用語辞典)</a></p>';\r
+               \r
+               // form \r
+               echo '<form method="post" action="http://blog.cles.jp/support/report.php">' . "\n";\r
+\r
+               // table\r
+               echo "<table>\n";\r
+               echo "<tr>\n";\r
+               echo "<th>項目の説明</th>\n";\r
+               echo "<th>送信される値</th>\n";\r
+               echo "<th><a href=\"#\" onclick=\"javascript:selectall();return false;\">全てチェック</a></th>\n";\r
+               echo "</tr>\n";\r
+\r
+               $res = sql_query("show variables like 'version'");\r
+               $assoc = mysql_fetch_assoc($res);\r
+               $mysqlVersion = $assoc['Value'];\r
+               \r
+               if( function_exists('gd_info') )\r
+                       $gdinfo = @gd_info();\r
+               else\r
+                       $gdinfo['GD Version'] = 'GD is not supported';\r
+\r
+               global $CONF;\r
+\r
+               $this->_printtr('siteid', 'サイトの固有コード', md5(trim($CONF['AdminURL'])));\r
+               $this->_printtr('plugin_name', 'プラグイン名', $this->oPluginAdmin->plugin->getName());\r
+               $this->_printtr('plugin_version', 'プラグインのバージョン', $this->oPluginAdmin->plugin->getVersion());\r
+               $this->_printtr('plugin_info', '追加情報', $extra, true);\r
+               $this->_printtr('nucleus_version', 'Nucleusのバージョン', $nucleus['version'], true);\r
+               $this->_printtr('nucleus_charset', 'Nucleusのキャラクタセット', _CHARSET);\r
+               $this->_printtr('php_version', 'PHPのバージョン', PHP_VERSION, true);\r
+               $this->_printtr('php_sapi', 'PHPの種類', php_sapi_name());\r
+               $this->_printtr('php_os', 'OSの種類', PHP_OS, true);\r
+               $this->_printtr('php_safemode', 'セーフモードの有無', ini_get('safe_mode') ? 'on' : 'off');\r
+               $this->_printtr('php_gd_version', 'GDのバージョン', $gdinfo['GD Version'], true);\r
+               $this->_printtr('php_gd_support', 'サポートしているイメージタイプ', implode(',', $this->_supportedImageTypes()) );\r
+               $this->_printtr('mysql_version', 'MySQLのバージョン', $mysqlVersion, true);\r
+\r
+               echo "<tr>\n";\r
+               echo "<td colspan=\"2\">このプラグインは機能しましたか?</td>\n";\r
+               echo '<td><input type="radio" name="user_intention" value="ok" />はい <br/> <input type="radio" name="intention" value="ng" />いいえ'."</td>\n";\r
+               echo "</tr>\n";\r
+\r
+               echo "<tr>\n";\r
+               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";\r
+               echo '<td colspan="2"><textarea name="user_freetext" rows="10" cols="70"></textarea>'."</td>\n";\r
+               echo "</tr>\n";\r
+\r
+               echo "<tr>\n";\r
+               echo "<td>よろしければサイトのURLを教えてください</td>\n";\r
+               echo '<td colspan="2"><textarea name="user_url" rows="1" cols="70"></textarea>'."</td>\n";\r
+               echo "</tr>\n";\r
+               \r
+               echo "<tr>\n";\r
+               echo "<td colspan=\"2\">リンク集作成の際、リンクをはらせていただけますか?</td>\n";\r
+               echo '<td><input type="radio" name="user_disclose" value="yes" />はい <br/> <input type="radio" name="intention" value="no" />いいえ'."</td>\n";\r
+               echo "</tr>\n";\r
+\r
+               echo '<tr><td colspan="3"><div align="right"><a href="#" onclick="javascript:selectall();return false;">全てチェック</a> <input type="submit" name="submit" value="動作確認を送信する" /></div></td></tr>';\r
+               echo "</table>\n";\r
+               echo "</form>\n";\r
+               \r
+               $contents = ob_get_contents();\r
+               ob_end_clean();\r
+               echo mb_convert_encoding($contents, _CHARSET, 'UTF-8');\r
+       }\r
+       \r
+       function _printtr($name, $desc, $value, $canDisable = false) {\r
+               echo "<tr>\n";\r
+       \r
+               if ($canDisable) {\r
+                       echo "<td>".$desc."</td>\n";\r
+                       echo "<td>".htmlspecialchars($value)."</td>\n";\r
+                       echo '<td><input type="checkbox" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" /></td>'."\n";\r
+               } else {\r
+                       echo '<td><span style="font-weight:bold; color:red">'.$desc."</span></td>\n";\r
+                       echo '<td><span style="font-weight:bold; color:red">'.htmlspecialchars($value)."</span></td>\n";\r
+                       echo '<td>必須<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" readonly="readonly" checked="checked"/></td>'."\n";\r
+               }\r
+               echo "</tr>\n";\r
+       }\r
+       \r
+       function _supportedImageTypes() {\r
+               if( !function_exists('gd_info') ) return "";\r
+               \r
+               $aSupportedTypes = array ();\r
+               $aPossibleImageTypeBits = array (IMG_GIF => 'GIF', IMG_JPG => 'JPG', IMG_PNG => 'PNG', IMG_WBMP => 'WBMP');\r
+       \r
+               foreach ($aPossibleImageTypeBits as $iImageTypeBits => $sImageTypeString) {\r
+                       if (imagetypes() & $iImageTypeBits) {\r
+                               $aSupportedTypes[] = $sImageTypeString;\r
+                       }\r
+               }\r
+       \r
+               return $aSupportedTypes;\r
+       }\r
+\r
+}\r