Changeset 20454 for branches/version-2_5-dev/data/class/SC_CheckError.php
- Timestamp:
- 2011/03/01 14:39:43 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_CheckError.php
r20451 r20454 61 61 62 62 foreach($value[2] as $tag) { 63 if( eregi("^" . $tag . "$", $val)) {63 if(preg_match("/^" . $tag . "$/i", $val)) { 64 64 $find = true; 65 65 } else { … … 77 77 // value[0] = 項目名 value[1] = 判定対象 78 78 function EXIST_CHECK( $value ) { // 受け取りがない場合エラーを返す 79 if (isset($this->arrErr[$value[1]])) {80 return; 81 } 82 $this->createParam($value); 83 if (!is_array($this->arrParam[$value[1]]) andstrlen($this->arrParam[$value[1]]) == 0 ){79 if (isset($this->arrErr[$value[1]])) { 80 return; 81 } 82 $this->createParam($value); 83 if (!is_array($this->arrParam[$value[1]]) && strlen($this->arrParam[$value[1]]) == 0 ){ 84 84 $this->arrErr[$value[1]] = "※ " . $value[0] . "が入力されていません。<br />"; 85 } else if(is_array($this->arrParam[$value[1]]) andcount($this->arrParam[$value[1]]) == 0) {85 } else if (is_array($this->arrParam[$value[1]]) && count($this->arrParam[$value[1]]) == 0) { 86 86 $this->arrErr[$value[1]] = "※ " . $value[0] . "が選択されていません。<br />"; 87 87 } … … 107 107 } 108 108 $this->createParam($value); 109 if(strlen($this->arrParam[$value[1]]) != 0 && ereg("^[ \t\r\n]+$", $this->arrParam[$value[1]])){109 if(strlen($this->arrParam[$value[1]]) != 0 && preg_match("/^[ \t\r\n]+$/", $this->arrParam[$value[1]])){ 110 110 $this->arrErr[$value[1]] = "※ " . $value[0] . "にスペース、タブ、改行のみの入力はできません。<br />"; 111 111 } … … 119 119 } 120 120 $this->createParam($value); 121 if(strlen($this->arrParam[$value[1]]) != 0 && mb_ereg("[ \t\r\n]+", $this->arrParam[$value[1]])){121 if(strlen($this->arrParam[$value[1]]) != 0 && preg_match("/[ \t\r\n]+/u", $this->arrParam[$value[1]])){ 122 122 $this->arrErr[$value[1]] = "※ " . $value[0] . "にスペース、タブ、改行は含めないで下さい。<br />"; 123 123 } … … 130 130 } 131 131 $this->createParam($value); 132 if(strlen($this->arrParam[$value[1]]) != 0 && ereg("^[0]+[0-9]+$", $this->arrParam[$value[1]])){132 if(strlen($this->arrParam[$value[1]]) != 0 && preg_match("/^[0]+[0-9]+$/", $this->arrParam[$value[1]])){ 133 133 $this->arrErr[$value[1]] = "※ " . $value[0] . "に0で始まる数値が入力されています。<br />"; 134 134 } … … 246 246 } 247 247 $this->createParam($value); 248 if ( strlen($this->arrParam[$value[1]]) > 0 && !EregI("^[[:digit:]]+$", $this->arrParam[$value[1]])) {248 if ( $this->numelicCheck($this->arrParam[$value[1]]) ) { 249 249 $this->arrErr[$value[1]] = "※ " . $value[0] . "は数字で入力してください。<br />"; 250 250 } 251 251 } 252 252 253 253 /* 小数点を含む数字の判定 */ 254 254 // value[0] = 項目名 value[1] = 判定対象文字列 255 255 function NUM_POINT_CHECK( $value ) { // 入力文字が数字以外ならエラーを返す … … 258 258 } 259 259 $this->createParam($value); 260 if ( strlen($this->arrParam[$value[1]]) > 0 && !EregI("^[[:digit:]]+[\.]?[[:digit:]]+$",$this->arrParam[$value[1]])) {260 if ( strlen($this->arrParam[$value[1]]) > 0 && !is_numeric($this->arrParam[$value[1]])) { 261 261 $this->arrErr[$value[1]] = "※ " . $value[0] . "は数字で入力してください。<br />"; 262 262 } … … 268 268 } 269 269 $this->createParam($value); 270 if( strlen($this->arrParam[$value[1]]) > 0 && ! EregI("^[[:alpha:]]+$",$this->arrParam[$value[1]])) {270 if( strlen($this->arrParam[$value[1]]) > 0 && !ctype_alpha($this->arrParam[$value[1]])) { 271 271 $this->arrErr[$value[1]] = "※ " . $value[0] . "は半角英字で入力してください。<br />"; 272 272 } … … 310 310 if(strlen($this->arrParam[$value[$i]]) > 0 && strlen($this->arrParam[$value[$i]]) > $telItemLen) { 311 311 $this->arrErr[$value[$i]] .= "※ " . $value[0] . $i . "は" . $telItemLen . "字以内で入力してください。<br />"; 312 } else if ( strlen($this->arrParam[$value[$i]]) > 0 && !EregI("^[[:digit:]]+$", $this->arrParam[$value[$i]])) {312 } else if ($this->numelicCheck($this->arrParam[$value[1]])) { 313 313 $this->arrErr[$value[$i]] .= "※ " . $value[0] . $i . "は数字で入力してください。<br />"; 314 314 } … … 451 451 } 452 452 $this->createParam($value); 453 if(strlen($this->arrParam[$value[1]]) > 0 && ! mb_ereg("^[ァ-ヶヲ-゚ー]+$", $this->arrParam[$value[1]])) {453 if(strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[ァ-ヶヲ-゚ー]+$/u", $this->arrParam[$value[1]])) { 454 454 $this->arrErr[$value[1]] = "※ " . $value[0] . "はカタカナで入力してください。<br />"; 455 455 } … … 463 463 } 464 464 $this->createParam($value); 465 if(strlen($this->arrParam[$value[1]]) > 0 && ! mb_ereg("^([ \t\r\n]|[ァ-ヶ]|[ー])+$", $this->arrParam[$value[1]])) {465 if(strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^([ \t\r\n]|[ァ-ヶ]|[ー])+$/u", $this->arrParam[$value[1]])) { 466 466 $this->arrErr[$value[1]] = "※ " . $value[0] . "はカタカナで入力してください。<br />"; 467 467 } … … 475 475 } 476 476 $this->createParam($value); 477 if( strlen($this->arrParam[$value[1]]) > 0 && ! EregI("^[[:alnum:]]+$", $this->arrParam[$value[1]]) ) {477 if( strlen($this->arrParam[$value[1]]) > 0 && !ctype_alnum($this->arrParam[$value[1]]) ) { 478 478 $this->arrErr[$value[1]] = "※ " . $value[0] . "は英数字で入力してください。<br />"; 479 479 } … … 487 487 } 488 488 $this->createParam($value); 489 if( strlen($this->arrParam[$value[1]]) > 0 && ! EregI("^[[:graph:]|[:space:]]+$", $this->arrParam[$value[1]] ) ) {489 if( strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[[:graph:]|[:space:]]+$/i", $this->arrParam[$value[1]] ) ) { 490 490 $this->arrErr[$value[1]] = "※ " . $value[0] . "は英数記号で入力してください。<br />"; 491 491 } … … 572 572 } 573 573 $this->createParam($value); 574 if(strlen($this->arrParam[$value[1]]) > 0 && ! ereg("^[a-zA-Z0-9_\.@\+\?-]+$",$this->arrParam[$value[1]]) ) {574 if(strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[a-zA-Z0-9_\.@\+\?-]+$/i",$this->arrParam[$value[1]]) ) { 575 575 $this->arrErr[$value[1]] = "※ " . $value[0] . "に使用する文字を正しく入力してください。<br />"; 576 576 } … … 583 583 return; 584 584 } 585 if( strlen($this->arrParam[$value[1]]) > 0 && ! ereg( "^https?://+($|[a-zA-Z0-9_~=:&\?\.\/-])+$", $this->arrParam[$value[1]] ) ) {585 if( strlen($this->arrParam[$value[1]]) > 0 && !preg_match( "/^https?://+($|[a-zA-Z0-9_~=:&\?\.\/-])+$/i", $this->arrParam[$value[1]] ) ) { 586 586 $this->arrErr[$value[1]] = "※ " . $value[0] . "を正しく入力してください。<br />"; 587 587 } … … 603 603 foreach($params as $param){ 604 604 $param = trim($param); 605 if(long2ip(ip2long($param)) != trim($param) and!empty($param)) {605 if(long2ip(ip2long($param)) != trim($param) && !empty($param)) { 606 606 $this->arrErr[$value[1]] = "※ " . $value[0] . "に正しい形式のIPアドレスを入力してください。<br />"; 607 607 } … … 977 977 } 978 978 979 // ディレクトリ存在チェック979 // ドメインチェック 980 980 function DOMAIN_CHECK ($value) { 981 981 if(isset($this->arrErr[$value[1]])) { 982 982 return; 983 983 } 984 if(strlen($this->arrParam[$value[1]]) > 0 && ! ereg("^\.[^.]+\..+", $this->arrParam[$value[1]])) {984 if(strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^\.[^.]+\..+/i", $this->arrParam[$value[1]])) { 985 985 $this->arrErr[$value[1]] = "※ " . $value[0] . "の形式が不正です。<br />"; 986 986 } … … 1098 1098 } 1099 1099 } 1100 1101 1102 /* 1103 * 値が数字だけかどうかチェックする 1104 * 1105 * @access private 1106 */ 1107 function numelicCheck($string) { 1108 return (strlen($string) > 0 && !ctype_digit($string)); 1109 } 1100 1110 } 1101 1111 ?>
Note: See TracChangeset
for help on using the changeset viewer.