Index: /branches/version-2_13-dev/data/class/SC_CheckError.php
===================================================================
--- /branches/version-2_13-dev/data/class/SC_CheckError.php	(revision 22911)
+++ /branches/version-2_13-dev/data/class/SC_CheckError.php	(revision 22912)
@@ -27,10 +27,12 @@
  *----------------------------------------------------------------------
  */
-class SC_CheckError {
+class SC_CheckError
+{
     var $arrErr = array();
     var $arrParam;
 
     // チェック対象の値が含まれる配列をセットする。
-    function __construct($array = '') {
+    function __construct($array = '')
+    {
         if ($array != '') {
             $this->arrParam = $array;
@@ -41,5 +43,6 @@
     }
 
-    function doFunc($value, $arrFunc) {
+    function doFunc($value, $arrFunc)
+    {
         foreach ($arrFunc as $key) {
             $this->$key($value);
@@ -53,5 +56,6 @@
      * @return void
      */
-    function HTML_TAG_CHECK($value) {
+    function HTML_TAG_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -59,6 +63,10 @@
         $this->createParam($value);
         // HTMLに含まれているタグを抽出する
-        preg_match_all('/<\/?([a-z]+)/i', $this->arrParam[$value[1]], $arrTagIncludedHtml = array());
-
+        $arrTagIncludedHtml = array();
+        preg_match_all('/<\/?([a-z]+)/i', $this->arrParam[$value[1]], $arrTagIncludedHtml);
+        // 抽出結果を小文字に変換
+        foreach ($arrTagIncludedHtml[1] as $key => $matchedTag) {
+            $arrTagIncludedHtml[1][$key] = strtolower($matchedTag);
+        }
         $arrDiffTag = array_diff($arrTagIncludedHtml[1], $value[2]);
 
@@ -81,5 +89,6 @@
      * @return void
      */
-    function EXIST_CHECK($value) {
+    function EXIST_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -100,9 +109,10 @@
      * @return void
      */
-    function EXIST_CHECK_REVERSE($value) {
+    function EXIST_CHECK_REVERSE($value)
+    {
         if (isset($this->arrErr[$value[0]])) {
             return;
         }
-        // $this->createParam($value);
+        $this->createParam($value);
         if (strlen($this->arrParam[$value[0]]) == 0) {
             $this->arrErr[$value[0]] = '※ ' . $value[0] . 'が入力されていません。<br />';
@@ -117,5 +127,6 @@
      * @return void
      */
-    function SPTAB_CHECK($value) {
+    function SPTAB_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -134,5 +145,6 @@
      * @return void
      */
-    function NO_SPTAB($value) {
+    function NO_SPTAB($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -145,5 +157,6 @@
 
     /* ゼロで開始されている数値の判定 */
-    function ZERO_START($value) {
+    function ZERO_START($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -162,5 +175,6 @@
      * @return void
      */
-    function SELECT_CHECK($value) {
+    function SELECT_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -179,9 +193,10 @@
      * @return void
      */
-    function EQUAL_CHECK($value) {
+    function EQUAL_CHECK($value)
+    {
         if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {
             return;
         }
-        // $this->createParam($value);
+        $this->createParam($value);
         // 文字数の取得
         if ($this->arrParam[$value[2]] !== $this->arrParam[$value[3]]) {
@@ -197,9 +212,10 @@
      * @return void
      */
-    function DIFFERENT_CHECK($value) {
+    function DIFFERENT_CHECK($value)
+    {
         if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {
             return;
         }
-        // $this->createParam($value);
+        $this->createParam($value);
         // 文字数の取得
         if ($this->arrParam[$value[2]] == $this->arrParam[$value[3]]) {
@@ -215,9 +231,10 @@
      * @return void
      */
-    function GREATER_CHECK($value) {
+    function GREATER_CHECK($value)
+    {
         if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {
             return;
         }
-        // $this->createParam($value);
+        $this->createParam($value);
         // 文字数の取得
         if ($this->arrParam[$value[2]] != '' && $this->arrParam[$value[3]] != '' && ($this->arrParam[$value[2]] > $this->arrParam[$value[3]])) {
@@ -233,5 +250,6 @@
      * @return void
      */
-    function MAX_LENGTH_CHECK($value) {
+    function MAX_LENGTH_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -251,5 +269,6 @@
      * @return void
      */
-    function MIN_LENGTH_CHECK($value) {
+    function MIN_LENGTH_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -269,5 +288,6 @@
      * @return void
      */
-    function MAX_CHECK($value) {
+    function MAX_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -287,5 +307,6 @@
      * @return void
      */
-    function MIN_CHECK($value) {
+    function MIN_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -304,5 +325,6 @@
      * @return void
      */
-    function NUM_CHECK($value) {
+    function NUM_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -321,5 +343,6 @@
      * @return void
      */
-    function NUM_POINT_CHECK($value) {
+    function NUM_POINT_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -331,5 +354,6 @@
     }
 
-    function ALPHA_CHECK($value) {
+    function ALPHA_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -354,5 +378,6 @@
      * @return void
      */
-    function TEL_CHECK($value) {
+    function TEL_CHECK($value)
+    {
         $telItemLen = isset($value[4]) ? $value[4] : TEL_ITEM_LEN;
         $telLen = isset($value[5]) ? $value[5] : TEL_LEN;
@@ -395,5 +420,6 @@
         value[1]    : 判定対象要素名
     */
-    function FULL_EXIST_CHECK($value) {
+    function FULL_EXIST_CHECK($value)
+    {
         $max = count($value);
         $this->createParam($value);
@@ -423,5 +449,6 @@
         value[1]    : 判定対象要素名
     */
-    function ALL_EXIST_CHECK($value) {
+    function ALL_EXIST_CHECK($value)
+    {
         $max = count($value);
 
@@ -454,5 +481,6 @@
         value[1]    : 判定対象要素名
     */
-    function ONE_EXIST_CHECK($value) {
+    function ONE_EXIST_CHECK($value)
+    {
         $max = count($value);
         $this->createParam($value);
@@ -482,5 +510,6 @@
         value[1]    : 判定対象要素名
     */
-    function TOP_EXIST_CHECK($value) {
+    function TOP_EXIST_CHECK($value)
+    {
         $max = count($value);
         $this->createParam($value);
@@ -515,5 +544,6 @@
     // 入力文字がカナ以外ならエラーを返す
     // value[0] = 項目名 value[1] = 判定対象文字列
-    function KANA_CHECK($value) {
+    function KANA_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -528,5 +558,6 @@
     // 入力文字がカナ以外ならエラーを返す
     // value[0] = 項目名 value[1] = 判定対象文字列
-    function KANABLANK_CHECK($value) {
+    function KANABLANK_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -541,5 +572,6 @@
     // 入力文字が英数字以外ならエラーを返す
     // value[0] = 項目名 value[1] = 判定対象文字列
-    function ALNUM_CHECK($value) {
+    function ALNUM_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -554,5 +586,6 @@
     // 入力文字が英数記号以外ならエラーを返す
     // value[0] = 項目名 value[1] = 判定対象文字列
-    function GRAPH_CHECK($value) {
+    function GRAPH_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -567,5 +600,6 @@
     // 入力値で0が許されない場合エラーを返す
     // value[0] = 項目名 value[1] = 判定対象
-    function ZERO_CHECK($value) {
+    function ZERO_CHECK($value)
+    {
         $this->createParam($value);
         if ($this->arrParam[$value[1]] == '0') {
@@ -577,5 +611,6 @@
     // 入力文字の桁数判定　→　最小桁数＜入力文字列＜最大桁数
     // value[0] = 項目名 value[1] = 判定対象文字列 value[2] = 最小桁数 value[3] = 最大桁数
-    function NUM_RANGE_CHECK($value) {
+    function NUM_RANGE_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -592,5 +627,6 @@
     // 入力文字の桁数判定　→　入力文字列 = 桁数　以外はNGの場合
     // value[0] = 項目名 value[1] = 判定対象文字列 value[2] = 桁数
-    function NUM_COUNT_CHECK($value) {
+    function NUM_COUNT_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -611,5 +647,6 @@
      * @return void
      */
-    function EMAIL_CHECK($value) {
+    function EMAIL_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -660,5 +697,6 @@
     //　メールアドレスに使用する文字を正規表現で判定する
     //  value[0] = 項目名 value[1] = 判定対象メールアドレス
-    function EMAIL_CHAR_CHECK($value) {
+    function EMAIL_CHAR_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -673,5 +711,6 @@
     //　URLを正規表現で判定する。デフォルトでhttp://があってもOK
     //  value[0] = 項目名 value[1] = 判定対象URL
-    function URL_CHECK($value) {
+    function URL_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -684,5 +723,6 @@
     /*　IPアドレスの判定　*/
     //  value[0] = 項目名 value[1] = 判定対象IPアドレス文字列
-    function IP_CHECK($value) {
+    function IP_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -707,5 +747,6 @@
     // 受け取りがない場合エラーを返す
     // value[0] = 項目名 value[1] = 判定対象 value[2]=array(拡張子)
-    function FILE_EXT_CHECK($value) {
+    function FILE_EXT_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]]) || count($value[2]) == 0) {
             return;
@@ -733,5 +774,6 @@
     // 受け取りがない場合エラーを返す
     // value[0] = 項目名 value[1] = 判定対象  value[2] = 指定ディレクトリ
-    function FIND_FILE($value) {
+    function FIND_FILE($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -756,5 +798,6 @@
     // 受け取りがない場合エラーを返す
     // value[0] = 項目名 value[1] = 判定対象  value[2] = 指定サイズ(KB)
-    function FILE_EXIST_CHECK($value) {
+    function FILE_EXIST_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -769,5 +812,6 @@
     // 受け取りがない場合エラーを返す
     // value[0] = 項目名 value[1] = 判定対象  value[2] = 指定サイズ(KB)
-    function FILE_SIZE_CHECK($value) {
+    function FILE_SIZE_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -787,5 +831,6 @@
     // 入力文字が英数字,'_','-'以外ならエラーを返す
     // value[0] = 項目名 value[1] = 判定対象文字列
-    function FILE_NAME_CHECK($value) {
+    function FILE_NAME_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -800,5 +845,6 @@
     // 入力文字が英数字,'_','-'以外ならエラーを返す
     // value[0] = 項目名 value[1] = 判定対象文字列
-    function FILE_NAME_CHECK_BY_NOUPLOAD($value) {
+    function FILE_NAME_CHECK_BY_NOUPLOAD($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -815,5 +861,6 @@
     // value[2] = MM
     // value[3] = DD
-    function CHECK_DATE($value) {
+    function CHECK_DATE($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -838,5 +885,6 @@
     // value[4] = HH
     // value[5] = mm
-    function CHECK_DATE2($value) {
+    function CHECK_DATE2($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -858,5 +906,6 @@
     // value[1] = YYYY
     // value[2] = MM
-    function CHECK_DATE3($value) {
+    function CHECK_DATE3($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -879,5 +928,6 @@
     // value[2] = MM
     // value[3] = DD
-    function CHECK_BIRTHDAY($value) {
+    function CHECK_BIRTHDAY($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -886,6 +936,5 @@
         $this->createParam($value);
         // 年が入力されている。
-        if ($this->arrParam[$value[1]] > 0) {
-
+        if (strlen($this->arrParam[$value[1]]) >= 1) {
             // 年の数字チェック、最小数値制限チェック
             $this->doFunc(array($value[0].'(年)', $value[1], BIRTH_YEAR), array('NUM_CHECK', 'MIN_CHECK'));
@@ -924,11 +973,11 @@
     // value[6] = end_month
     // value[7] = end_day
-    function CHECK_SET_TERM($value) {
-
+    function CHECK_SET_TERM($value)
+    {
         // 期間指定
         if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[5]])) {
             return;
         }
-        // $this->createParam($value);
+        $this->createParam($value);
         if ((strlen($this->arrParam[$value[2]]) > 0 || strlen($this->arrParam[$value[3]]) > 0 || strlen($this->arrParam[$value[4]]) > 0) && ! checkdate($this->arrParam[$value[3]], $this->arrParam[$value[4]], $this->arrParam[$value[2]])) {
             $this->arrErr[$value[2]] = '※ ' . $value[0] . 'を正しく指定してください。<br />';
@@ -938,5 +987,4 @@
         }
         if ((strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]]) > 0) &&  (strlen($this->arrParam[$value[5]]) > 0 || strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]]) > 0)) {
-
             $date1 = $this->arrParam[$value[2]] .sprintf('%02d', $this->arrParam[$value[3]]) .sprintf('%02d',$this->arrParam[$value[4]]) .'000000';
             $date2 = $this->arrParam[$value[5]] .sprintf('%02d', $this->arrParam[$value[6]]) .sprintf('%02d',$this->arrParam[$value[7]]) .'235959';
@@ -974,11 +1022,11 @@
 
     /*-----------------------------------------------------------------*/
-    function CHECK_SET_TERM2($value) {
-
+    function CHECK_SET_TERM2($value)
+    {
         // 期間指定
         if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[8]])) {
             return;
         }
-        // $this->createParam($value);
+        $this->createParam($value);
         if ((strlen($this->arrParam[$value[2]]) > 0 || strlen($this->arrParam[$value[3]]) > 0 || strlen($this->arrParam[$value[4]]) > 0 || strlen($this->arrParam[$value[5]]) > 0) && ! checkdate($this->arrParam[$value[3]], $this->arrParam[$value[4]], $this->arrParam[$value[2]])) {
             $this->arrErr[$value[2]] = '※ ' . $value[0] . 'を正しく指定してください。<br />';
@@ -988,5 +1036,4 @@
         }
         if ((strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]]) > 0 && strlen($this->arrParam[$value[5]]) > 0) &&  (strlen($this->arrParam[$value[8]]) > 0 || strlen($this->arrParam[$value[9]]) > 0 || strlen($this->arrParam[$value[10]]) > 0 || strlen($this->arrParam[$value[11]]) > 0)) {
-
             $date1 = $this->arrParam[$value[2]] .sprintf('%02d', $this->arrParam[$value[3]]) .sprintf('%02d',$this->arrParam[$value[4]]) .sprintf('%02d',$this->arrParam[$value[5]]).sprintf('%02d',$this->arrParam[$value[6]]).sprintf('%02d',$this->arrParam[$value[7]]);
             $date2 = $this->arrParam[$value[8]] .sprintf('%02d', $this->arrParam[$value[9]]) .sprintf('%02d',$this->arrParam[$value[10]]) .sprintf('%02d',$this->arrParam[$value[11]]).sprintf('%02d',$this->arrParam[$value[12]]).sprintf('%02d',$this->arrParam[$value[13]]);
@@ -1017,11 +1064,11 @@
     // value[4] = end_year
     // value[5] = end_month
-    function CHECK_SET_TERM3($value) {
-
+    function CHECK_SET_TERM3($value)
+    {
         // 期間指定
         if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[4]])) {
             return;
         }
-        // $this->createParam($value);
+        $this->createParam($value);
         if ((strlen($this->arrParam[$value[2]]) > 0 || strlen($this->arrParam[$value[3]]) > 0) && ! checkdate($this->arrParam[$value[3]], 1, $this->arrParam[$value[2]])) {
             $this->arrErr[$value[2]] = '※ ' . $value[0] . 'を正しく指定してください。<br />';
@@ -1031,5 +1078,4 @@
         }
         if ((strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && (strlen($this->arrParam[$value[4]]) > 0 || strlen($this->arrParam[$value[5]]) > 0))) {
-
             $date1 = $this->arrParam[$value[2]] .sprintf('%02d', $this->arrParam[$value[3]]);
             $date2 = $this->arrParam[$value[4]] .sprintf('%02d', $this->arrParam[$value[5]]);
@@ -1042,5 +1088,6 @@
 
     //ディレクトリ存在チェック
-    function DIR_CHECK($value) {
+    function DIR_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -1053,5 +1100,6 @@
 
     // ドメインチェック
-    function DOMAIN_CHECK($value) {
+    function DOMAIN_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -1065,5 +1113,6 @@
     //　メールアドレスを正規表現で判定する
     // value[0] = 項目名 value[1] = 判定対象メールアドレス
-    function MOBILE_EMAIL_CHECK($value) {
+    function MOBILE_EMAIL_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -1084,5 +1133,6 @@
      * @return void
      */
-    function CHECK_REGIST_CUSTOMER_EMAIL($value) {
+    function CHECK_REGIST_CUSTOMER_EMAIL($value)
+    {
         if (isset($this->arrErr[$value[1]])) {
             return;
@@ -1110,5 +1160,6 @@
      * @example $objErr->doFunc(array('URL', 'contents', $arrReviewDenyURL), array('PROHIBITED_STR_CHECK'));
      */
-    function PROHIBITED_STR_CHECK($value) {
+    function PROHIBITED_STR_CHECK($value)
+    {
         if (isset($this->arrErr[$value[1]]) || empty($this->arrParam[$value[1]])) {
             return;
@@ -1118,6 +1169,6 @@
         $prohibitedStr = str_replace(array('|', '/'), array('\|', '\/'), $value[2]);
 
-        $pattern = '/' . join('|', $prohibitedStr) . '/i';
-        if (preg_match_all($pattern, $targetStr, $matches = array())) {
+        $pattern = '/' . join('\b|\b', $prohibitedStr) . '\b/i';
+        if (preg_match_all($pattern, $targetStr, $matches)) {
             $this->arrErr[$value[1]] = '※ ' . $value[0] . 'は入力できません。<br />';
         }
@@ -1131,9 +1182,10 @@
      * @return void
      */
-    function EVAL_CHECK($value) {
+    function EVAL_CHECK($value)
+    {
         if (isset($this->arrErr[$value[0]])) {
             return;
         }
-        // $this->createParam($value);
+        $this->createParam($value);
         if ($this->evalCheck($value[1]) === false) {
             $this->arrErr[$value[0]] = '※ ' . $value[0] . ' の形式が不正です。<br />';
@@ -1152,5 +1204,6 @@
      * @return bool パラメーターとして適切な文字列か
      */
-    function evalCheck($value) {
+    function evalCheck($value)
+    {
         return @eval('return is_scalar(' . $value . ');');
     }
@@ -1163,18 +1216,11 @@
      * @return void
      */
-    function createParam($value) {
-         foreach ($value as $val_key => $key) {
-             if ($val_key != 0 && (is_string($key) || is_int($key))) {
-                 if (!is_numeric($key) && preg_match('/^[a-z0-9_]+$/i', $key)) {
-                     if (!isset($this->arrParam[$key])) $this->arrParam[$key] = '';
-                     if (strlen($this->arrParam[$key]) > 0
-                           && (preg_match('/^[[:alnum:]\-\_]*[\.\/\\\\]*\.\.(\/|\\\\)/',$this->arrParam[$key]) || !preg_match('/\A[^\x00-\x08\x0b\x0c\x0e-\x1f\x7f]+\z/u', $this->arrParam[$key]))) {
-                         $this->arrErr[$value[1]] = '※ ' . $value[0] . 'に禁止された記号の並びまたは制御文字が入っています。<br />';
-                     }
-                 } else if (preg_match('/[^a-z0-9_]/i', $key)) {
-                     trigger_error('', E_USER_ERROR);
-                 }
-             }
-         }
+    function createParam($value)
+    {
+        foreach ($value as $key) {
+            if (is_string($key) || is_int($key)) {
+                if (!isset($this->arrParam[$key]))  $this->arrParam[$key] = '';
+            }
+        }
     }
 
@@ -1186,5 +1232,6 @@
      * @return boolean 値が10進数の数値表現のみの場合 true
      */
-    function numelicCheck($string) {
+    function numelicCheck($string)
+    {
         /*
          * XXX 10進数の数値表現か否かを調べたいだけだが,
@@ -1193,4 +1240,5 @@
          */
         $string = (string) $string;
+
         return strlen($string) > 0 && !ctype_digit($string);
     }
