Changeset 21441 for branches/version-2_12-dev/data/class/SC_CheckError.php
- Timestamp:
- 2012/02/06 11:05:15 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_CheckError.php
r21420 r21441 33 33 // チェック対象の値が含まれる配列をセットする。 34 34 function SC_CheckError($array = "") { 35 if ($array != "") {35 if ($array != "") { 36 36 $this->arrParam = $array; 37 37 } else { … … 42 42 43 43 function doFunc($value, $arrFunc) { 44 foreach ( 44 foreach ($arrFunc as $key ) { 45 45 $this->$key($value); 46 46 } … … 54 54 */ 55 55 function HTML_TAG_CHECK($value) { 56 if (isset($this->arrErr[$value[1]])) {56 if (isset($this->arrErr[$value[1]])) { 57 57 return; 58 58 } … … 61 61 preg_match_all("/<([\/]?[a-z]+)/", $this->arrParam[$value[1]], $arrTag); 62 62 63 foreach ($arrTag[1] as $val) {63 foreach ($arrTag[1] as $val) { 64 64 $find = false; 65 65 66 foreach ($value[2] as $tag) {66 foreach ($value[2] as $tag) { 67 67 $tag = preg_replace('/^\\//', '\/', $tag); 68 if (preg_match("/^" . $tag . "$/i", $val)) {68 if (preg_match("/^" . $tag . "$/i", $val)) { 69 69 $find = true; 70 70 break; … … 72 72 } 73 73 74 if (!$find) {74 if (!$find) { 75 75 $this->arrErr[$value[1]] = "※ " . $value[0] . "に許可されていないタグ[" . strtoupper($val) . "]が含まれています。<br />"; 76 76 return; … … 91 91 } 92 92 $this->createParam($value); 93 if (!is_array($this->arrParam[$value[1]]) && strlen($this->arrParam[$value[1]]) == 0 ) {93 if (!is_array($this->arrParam[$value[1]]) && strlen($this->arrParam[$value[1]]) == 0 ) { 94 94 $this->arrErr[$value[1]] = "※ " . $value[0] . "が入力されていません。<br />"; 95 95 } else if (is_array($this->arrParam[$value[1]]) && count($this->arrParam[$value[1]]) == 0) { … … 106 106 */ 107 107 function EXIST_CHECK_REVERSE( $value ) { 108 if (isset($this->arrErr[$value[0]])) {109 return; 110 } 111 $this->createParam($value); 112 if ( strlen($this->arrParam[$value[0]]) == 0 ){108 if (isset($this->arrErr[$value[0]])) { 109 return; 110 } 111 $this->createParam($value); 112 if (strlen($this->arrParam[$value[0]]) == 0 ) { 113 113 $this->arrErr[$value[0]] = "※ " . $value[0] . "が入力されていません。<br />"; 114 114 } … … 123 123 */ 124 124 function SPTAB_CHECK( $value ) { 125 if (isset($this->arrErr[$value[1]])) {126 return; 127 } 128 $this->createParam($value); 129 if (strlen($this->arrParam[$value[1]]) != 0 && preg_match("/^[ \t\r\n]+$/", $this->arrParam[$value[1]])){125 if (isset($this->arrErr[$value[1]])) { 126 return; 127 } 128 $this->createParam($value); 129 if (strlen($this->arrParam[$value[1]]) != 0 && preg_match("/^[ \t\r\n]+$/", $this->arrParam[$value[1]])) { 130 130 $this->arrErr[$value[1]] = "※ " . $value[0] . "にスペース、タブ、改行のみの入力はできません。<br />"; 131 131 } … … 140 140 */ 141 141 function NO_SPTAB( $value ) { 142 if (isset($this->arrErr[$value[1]])) {143 return; 144 } 145 $this->createParam($value); 146 if (strlen($this->arrParam[$value[1]]) != 0 && preg_match("/[ \t\r\n]+/u", $this->arrParam[$value[1]])){142 if (isset($this->arrErr[$value[1]])) { 143 return; 144 } 145 $this->createParam($value); 146 if (strlen($this->arrParam[$value[1]]) != 0 && preg_match("/[ \t\r\n]+/u", $this->arrParam[$value[1]])) { 147 147 $this->arrErr[$value[1]] = "※ " . $value[0] . "にスペース、タブ、改行は含めないで下さい。<br />"; 148 148 } … … 151 151 /* ゼロで開始されている数値の判定 */ 152 152 function ZERO_START($value) { 153 if (isset($this->arrErr[$value[1]])) {154 return; 155 } 156 $this->createParam($value); 157 if (strlen($this->arrParam[$value[1]]) != 0 && preg_match("/^[0]+[0-9]+$/", $this->arrParam[$value[1]])){153 if (isset($this->arrErr[$value[1]])) { 154 return; 155 } 156 $this->createParam($value); 157 if (strlen($this->arrParam[$value[1]]) != 0 && preg_match("/^[0]+[0-9]+$/", $this->arrParam[$value[1]])) { 158 158 $this->arrErr[$value[1]] = "※ " . $value[0] . "に0で始まる数値が入力されています。<br />"; 159 159 } … … 168 168 */ 169 169 function SELECT_CHECK( $value ) { 170 if (isset($this->arrErr[$value[1]])) {171 return; 172 } 173 $this->createParam($value); 174 if ( strlen($this->arrParam[$value[1]]) == 0 ){170 if (isset($this->arrErr[$value[1]])) { 171 return; 172 } 173 $this->createParam($value); 174 if (strlen($this->arrParam[$value[1]]) == 0 ) { 175 175 $this->arrErr[$value[1]] = "※ " . $value[0] . "が選択されていません。<br />"; 176 176 } … … 185 185 */ 186 186 function EQUAL_CHECK( $value ) { 187 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {187 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) { 188 188 return; 189 189 } 190 190 $this->createParam($value); 191 191 // 文字数の取得 192 if ($this->arrParam[$value[2]] !== $this->arrParam[$value[3]]) {192 if ($this->arrParam[$value[2]] !== $this->arrParam[$value[3]]) { 193 193 $this->arrErr[$value[2]] = "※ " . $value[0] . "と" . $value[1] . "が一致しません。<br />"; 194 194 } … … 203 203 */ 204 204 function DIFFERENT_CHECK( $value ) { 205 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {205 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) { 206 206 return; 207 207 } 208 208 $this->createParam($value); 209 209 // 文字数の取得 210 if ($this->arrParam[$value[2]] == $this->arrParam[$value[3]]) {210 if ($this->arrParam[$value[2]] == $this->arrParam[$value[3]]) { 211 211 $this->arrErr[$value[2]] = "※ " . $value[0] . "と" . $value[1] . "は、同じ値を使用できません。<br />"; 212 212 } … … 221 221 */ 222 222 function GREATER_CHECK($value) { 223 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {223 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) { 224 224 return; 225 225 } 226 226 $this->createParam($value); 227 227 // 文字数の取得 228 if ($this->arrParam[$value[2]] != "" && $this->arrParam[$value[3]] != "" && ($this->arrParam[$value[2]] > $this->arrParam[$value[3]])) {228 if ($this->arrParam[$value[2]] != "" && $this->arrParam[$value[3]] != "" && ($this->arrParam[$value[2]] > $this->arrParam[$value[3]])) { 229 229 $this->arrErr[$value[2]] = "※ " . $value[0] . "は" . $value[1] . "より大きい値を入力できません。<br />"; 230 230 } … … 239 239 */ 240 240 function MAX_LENGTH_CHECK( $value ) { 241 if (isset($this->arrErr[$value[1]])) {241 if (isset($this->arrErr[$value[1]])) { 242 242 return; 243 243 } 244 244 $this->createParam($value); 245 245 // 文字数の取得 246 if (mb_strlen($this->arrParam[$value[1]]) > $value[2] ) {246 if (mb_strlen($this->arrParam[$value[1]]) > $value[2] ) { 247 247 $this->arrErr[$value[1]] = "※ " . $value[0] . "は" . $value[2] . "字以下で入力してください。<br />"; 248 248 } … … 257 257 */ 258 258 function MIN_LENGTH_CHECK( $value ) { 259 if (isset($this->arrErr[$value[1]])) {259 if (isset($this->arrErr[$value[1]])) { 260 260 return; 261 261 } 262 262 $this->createParam($value); 263 263 // 文字数の取得 264 if (mb_strlen($this->arrParam[$value[1]]) < $value[2] ) {264 if (mb_strlen($this->arrParam[$value[1]]) < $value[2] ) { 265 265 $this->arrErr[$value[1]] = "※ " . $value[0] . "は" . $value[2] . "字以上で入力してください。<br />"; 266 266 } … … 275 275 */ 276 276 function MAX_CHECK( $value ) { 277 if (isset($this->arrErr[$value[1]])) {277 if (isset($this->arrErr[$value[1]])) { 278 278 return; 279 279 } 280 280 $this->createParam($value); 281 281 // 文字数の取得 282 if ($this->arrParam[$value[1]] > $value[2] ) {282 if ($this->arrParam[$value[1]] > $value[2] ) { 283 283 $this->arrErr[$value[1]] = "※ " . $value[0] . "は" . $value[2] . "以下で入力してください。<br />"; 284 284 } … … 293 293 */ 294 294 function MIN_CHECK( $value ) { 295 if (isset($this->arrErr[$value[1]])) {296 return; 297 } 298 $this->createParam($value); 299 if ($this->arrParam[$value[1]] < $value[2] ) {295 if (isset($this->arrErr[$value[1]])) { 296 return; 297 } 298 $this->createParam($value); 299 if ($this->arrParam[$value[1]] < $value[2] ) { 300 300 $this->arrErr[$value[1]] = "※ " . $value[0] . "は" . $value[2] . "以上で入力してください。<br />"; 301 301 } … … 310 310 */ 311 311 function NUM_CHECK( $value ) { 312 if (isset($this->arrErr[$value[1]])) {313 return; 314 } 315 $this->createParam($value); 316 if ( 312 if (isset($this->arrErr[$value[1]])) { 313 return; 314 } 315 $this->createParam($value); 316 if ($this->numelicCheck($this->arrParam[$value[1]]) ) { 317 317 $this->arrErr[$value[1]] = "※ " . $value[0] . "は数字で入力してください。<br />"; 318 318 } … … 327 327 */ 328 328 function NUM_POINT_CHECK( $value ) { 329 if (isset($this->arrErr[$value[1]])) {330 return; 331 } 332 $this->createParam($value); 333 if ( 329 if (isset($this->arrErr[$value[1]])) { 330 return; 331 } 332 $this->createParam($value); 333 if (strlen($this->arrParam[$value[1]]) > 0 && !is_numeric($this->arrParam[$value[1]])) { 334 334 $this->arrErr[$value[1]] = "※ " . $value[0] . "は数字で入力してください。<br />"; 335 335 } … … 337 337 338 338 function ALPHA_CHECK($value) { 339 if (isset($this->arrErr[$value[1]])) {340 return; 341 } 342 $this->createParam($value); 343 if (strlen($this->arrParam[$value[1]]) > 0 && !ctype_alpha($this->arrParam[$value[1]])) {339 if (isset($this->arrErr[$value[1]])) { 340 return; 341 } 342 $this->createParam($value); 343 if (strlen($this->arrParam[$value[1]]) > 0 && !ctype_alpha($this->arrParam[$value[1]])) { 344 344 $this->arrErr[$value[1]] = "※ " . $value[0] . "は半角英字で入力してください。<br />"; 345 345 } … … 369 369 $cnt = 0; 370 370 371 for ($i = 1; $i <= 3; $i++) {372 if (strlen($this->arrParam[$value[$i]]) > 0) {371 for ($i = 1; $i <= 3; $i++) { 372 if (strlen($this->arrParam[$value[$i]]) > 0) { 373 373 $cnt++; 374 374 } … … 376 376 377 377 // すべての項目が満たされていない場合を判定(一部だけ入力されている状態) 378 if ($cnt > 0 && $cnt < 3) {378 if ($cnt > 0 && $cnt < 3) { 379 379 $this->arrErr[$value[1]] .= "※ " . $value[0] . "はすべての項目を入力してください。<br />"; 380 380 } 381 381 382 382 $total_count = 0; 383 for ($i = 1; $i <= 3; $i++) {384 if (strlen($this->arrParam[$value[$i]]) > 0 && strlen($this->arrParam[$value[$i]]) > $telItemLen) {383 for ($i = 1; $i <= 3; $i++) { 384 if (strlen($this->arrParam[$value[$i]]) > 0 && strlen($this->arrParam[$value[$i]]) > $telItemLen) { 385 385 $this->arrErr[$value[$i]] .= "※ " . $value[0] . $i . "は" . $telItemLen . "字以内で入力してください。<br />"; 386 386 } else if ($this->numelicCheck($this->arrParam[$value[1]])) { … … 404 404 $this->createParam($value); 405 405 // 既に該当項目にエラーがある場合は、判定しない。 406 for ($i = 1; $i < $max; $i++) {407 if (isset($this->arrErr[$value[$i]])) {406 for ($i = 1; $i < $max; $i++) { 407 if (isset($this->arrErr[$value[$i]])) { 408 408 return; 409 409 } … … 413 413 414 414 // すべての項目がブランクでないか、すべての項目が入力されていない場合はエラーとする。 415 for ($i = 1; $i < $max; $i++) {416 if (strlen($this->arrParam[$value[$i]]) <= 0) {415 for ($i = 1; $i < $max; $i++) { 416 if (strlen($this->arrParam[$value[$i]]) <= 0) { 417 417 $blank = true; 418 418 } 419 419 } 420 420 421 if ($blank) {421 if ($blank) { 422 422 $this->arrErr[$value[1]] = "※ " . $value[0] . "が入力されていません。<br />"; 423 423 } … … 432 432 433 433 // 既に該当項目にエラーがある場合は、判定しない。 434 for ($i = 1; $i < $max; $i++) {435 if (isset($this->arrErr[$value[$i]])) {434 for ($i = 1; $i < $max; $i++) { 435 if (isset($this->arrErr[$value[$i]])) { 436 436 return; 437 437 } … … 442 442 443 443 // すべての項目がブランクでないか、すべての項目が入力されていない場合はエラーとする。 444 for ($i = 1; $i < $max; $i++) {445 if (strlen($this->arrParam[$value[$i]]) <= 0) {444 for ($i = 1; $i < $max; $i++) { 445 if (strlen($this->arrParam[$value[$i]]) <= 0) { 446 446 $blank = true; 447 447 } else { … … 450 450 } 451 451 452 if ($blank && $input) {452 if ($blank && $input) { 453 453 $this->arrErr[$value[1]] = "※ " . $value[0] . "はすべての項目を入力して下さい。<br />"; 454 454 } … … 463 463 $this->createParam($value); 464 464 // 既に該当項目にエラーがある場合は、判定しない。 465 for ($i = 1; $i < $max; $i++) {466 if (isset($this->arrErr[$value[$i]])) {465 for ($i = 1; $i < $max; $i++) { 466 if (isset($this->arrErr[$value[$i]])) { 467 467 return; 468 468 } … … 472 472 473 473 // すべての項目がブランクでないか、すべての項目が入力されていない場合はエラーとする。 474 for ($i = 1; $i < $max; $i++) {475 if (strlen($this->arrParam[$value[$i]]) > 0) {474 for ($i = 1; $i < $max; $i++) { 475 if (strlen($this->arrParam[$value[$i]]) > 0) { 476 476 $input = true; 477 477 } 478 478 } 479 479 480 if (!$input) {480 if (!$input) { 481 481 $this->arrErr[$value[1]] = "※ " . $value[0] . "が入力されていません。<br />"; 482 482 } … … 492 492 493 493 // 既に該当項目にエラーがある場合は、判定しない。 494 for ($i = 1; $i < $max; $i++) {495 if (isset($this->arrErr[$value[$i]])) {494 for ($i = 1; $i < $max; $i++) { 495 if (isset($this->arrErr[$value[$i]])) { 496 496 return; 497 497 } … … 502 502 503 503 // すべての項目がブランクでないか、すべての項目が入力されていない場合はエラーとする。 504 for ($i = 1; $i < $max; $i++) {505 if (strlen($this->arrParam[$value[$i]]) <= 0) {504 for ($i = 1; $i < $max; $i++) { 505 if (strlen($this->arrParam[$value[$i]]) <= 0) { 506 506 $blank = true; 507 507 } else { 508 if ($blank) {508 if ($blank) { 509 509 $error = true; 510 510 } … … 512 512 } 513 513 514 if ($error) {514 if ($error) { 515 515 $this->arrErr[$value[1]] = "※ " . $value[0] . "は先頭の項目から順番に入力して下さい。<br />"; 516 516 } … … 521 521 // value[0] = 項目名 value[1] = 判定対象文字列 522 522 function KANA_CHECK( $value ) { 523 if (isset($this->arrErr[$value[1]])) {524 return; 525 } 526 $this->createParam($value); 527 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[ァ-ヶヲ-゚ー]+$/u", $this->arrParam[$value[1]])) {523 if (isset($this->arrErr[$value[1]])) { 524 return; 525 } 526 $this->createParam($value); 527 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[ァ-ヶヲ-゚ー]+$/u", $this->arrParam[$value[1]])) { 528 528 $this->arrErr[$value[1]] = "※ " . $value[0] . "はカタカナで入力してください。<br />"; 529 529 } … … 534 534 // value[0] = 項目名 value[1] = 判定対象文字列 535 535 function KANABLANK_CHECK( $value ) { 536 if (isset($this->arrErr[$value[1]])) {537 return; 538 } 539 $this->createParam($value); 540 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^([ \t\r\n]|[ァ-ヶ]|[ー])+$/u", $this->arrParam[$value[1]])) {536 if (isset($this->arrErr[$value[1]])) { 537 return; 538 } 539 $this->createParam($value); 540 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^([ \t\r\n]|[ァ-ヶ]|[ー])+$/u", $this->arrParam[$value[1]])) { 541 541 $this->arrErr[$value[1]] = "※ " . $value[0] . "はカタカナで入力してください。<br />"; 542 542 } … … 547 547 // value[0] = 項目名 value[1] = 判定対象文字列 548 548 function ALNUM_CHECK( $value ) { 549 if (isset($this->arrErr[$value[1]])) {550 return; 551 } 552 $this->createParam($value); 553 if (strlen($this->arrParam[$value[1]]) > 0 && !ctype_alnum($this->arrParam[$value[1]]) ) {549 if (isset($this->arrErr[$value[1]])) { 550 return; 551 } 552 $this->createParam($value); 553 if (strlen($this->arrParam[$value[1]]) > 0 && !ctype_alnum($this->arrParam[$value[1]]) ) { 554 554 $this->arrErr[$value[1]] = "※ " . $value[0] . "は英数字で入力してください。<br />"; 555 555 } … … 560 560 // value[0] = 項目名 value[1] = 判定対象文字列 561 561 function GRAPH_CHECK( $value ) { 562 if (isset($this->arrErr[$value[1]])) {563 return; 564 } 565 $this->createParam($value); 566 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[[:graph:]|[:space:]]+$/i", $this->arrParam[$value[1]] ) ) {562 if (isset($this->arrErr[$value[1]])) { 563 return; 564 } 565 $this->createParam($value); 566 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[[:graph:]|[:space:]]+$/i", $this->arrParam[$value[1]] ) ) { 567 567 $this->arrErr[$value[1]] = "※ " . $value[0] . "は英数記号で入力してください。<br />"; 568 568 } … … 574 574 function ZERO_CHECK( $value ) { 575 575 $this->createParam($value); 576 if ($this->arrParam[$value[1]] == "0" ){576 if ($this->arrParam[$value[1]] == "0" ) { 577 577 $this->arrErr[$value[1]] = "※ " . $value[0] . "は1以上を入力してください。<br />"; 578 578 } … … 583 583 // value[0] = 項目名 value[1] = 判定対象文字列 value[2] = 最小桁数 value[3] = 最大桁数 584 584 function NUM_RANGE_CHECK( $value ) { 585 if (isset($this->arrErr[$value[1]])) {585 if (isset($this->arrErr[$value[1]])) { 586 586 return; 587 587 } … … 589 589 // $this->arrParam[$value[0]] = mb_convert_kana($this->arrParam[$value[0]], 'n'); 590 590 $count = strlen($this->arrParam[$value[1]]); 591 if (( $count > 0 ) && $value[2] > $count || $value[3] < $count ) {591 if (( $count > 0 ) && $value[2] > $count || $value[3] < $count ) { 592 592 $this->arrErr[$value[1]] = "※ $value[0]は$value[2]桁~$value[3]桁で入力して下さい。<br />"; 593 593 } … … 598 598 // value[0] = 項目名 value[1] = 判定対象文字列 value[2] = 桁数 599 599 function NUM_COUNT_CHECK( $value ) { 600 if (isset($this->arrErr[$value[1]])) {600 if (isset($this->arrErr[$value[1]])) { 601 601 return; 602 602 } 603 603 $this->createParam($value); 604 604 $count = strlen($this->arrParam[$value[1]]); 605 if (($count > 0) && $count != $value[2] ) {605 if (($count > 0) && $count != $value[2] ) { 606 606 $this->arrErr[$value[1]] = "※ $value[0]は$value[2]桁で入力して下さい。<br />"; 607 607 } … … 617 617 */ 618 618 function EMAIL_CHECK( $value ){ 619 if (isset($this->arrErr[$value[1]])) {619 if (isset($this->arrErr[$value[1]])) { 620 620 return; 621 621 } … … 667 667 // value[0] = 項目名 value[1] = 判定対象メールアドレス 668 668 function EMAIL_CHAR_CHECK( $value ){ 669 if (isset($this->arrErr[$value[1]])) {670 return; 671 } 672 $this->createParam($value); 673 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[a-zA-Z0-9_\.@\+\?-]+$/i",$this->arrParam[$value[1]]) ) {669 if (isset($this->arrErr[$value[1]])) { 670 return; 671 } 672 $this->createParam($value); 673 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[a-zA-Z0-9_\.@\+\?-]+$/i",$this->arrParam[$value[1]]) ) { 674 674 $this->arrErr[$value[1]] = "※ " . $value[0] . "に使用する文字を正しく入力してください。<br />"; 675 675 } … … 680 680 // value[0] = 項目名 value[1] = 判定対象URL 681 681 function URL_CHECK( $value ){ 682 if (isset($this->arrErr[$value[1]])) {683 return; 684 } 685 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("@^https?://+($|[a-zA-Z0-9_~=:&\?\.\/-])+$@i", $this->arrParam[$value[1]] ) ) {682 if (isset($this->arrErr[$value[1]])) { 683 return; 684 } 685 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("@^https?://+($|[a-zA-Z0-9_~=:&\?\.\/-])+$@i", $this->arrParam[$value[1]] ) ) { 686 686 $this->arrErr[$value[1]] = "※ " . $value[0] . "を正しく入力してください。<br />"; 687 687 } … … 691 691 // value[0] = 項目名 value[1] = 判定対象IPアドレス文字列 692 692 function IP_CHECK( $value ){ 693 if (isset($this->arrErr[$value[1]])) {693 if (isset($this->arrErr[$value[1]])) { 694 694 return; 695 695 } 696 696 //改行コードが含まれている場合には配列に変換 697 697 $params = str_replace("\r","",$this->arrParam[$value[1]]); 698 if (!empty($params)){699 if (strpos($params,"\n") === false){698 if (!empty($params)) { 699 if (strpos($params,"\n") === false) { 700 700 $params .= "\n"; 701 701 } 702 702 $params = explode("\n",$params); 703 foreach ($params as $param){703 foreach ($params as $param) { 704 704 $param = trim($param); 705 if (long2ip(ip2long($param)) != trim($param) && !empty($param)) {705 if (long2ip(ip2long($param)) != trim($param) && !empty($param)) { 706 706 $this->arrErr[$value[1]] = "※ " . $value[0] . "に正しい形式のIPアドレスを入力してください。<br />"; 707 707 } … … 714 714 // value[0] = 項目名 value[1] = 判定対象 value[2]=array(拡張子) 715 715 function FILE_EXT_CHECK( $value ) { 716 if (isset($this->arrErr[$value[1]]) || count($value[2]) == 0) {717 return; 718 } 719 $this->createParam($value); 720 721 if ($_FILES[$value[1]]['name'] != "" ) {716 if (isset($this->arrErr[$value[1]]) || count($value[2]) == 0) { 717 return; 718 } 719 $this->createParam($value); 720 721 if ($_FILES[$value[1]]['name'] != "" ) { 722 722 $errFlag = 1; 723 723 $array_ext = explode(".", $_FILES[$value[1]]['name']); … … 725 725 $strExt = ""; 726 726 727 foreach ( $value[2] as $checkExt ){727 foreach ($value[2] as $checkExt ) { 728 728 $ext = ""; 729 729 … … 731 731 $count_period = substr_count($checkExt, "."); 732 732 733 if ($count_period > 0) {734 for ($i = max(array_keys($array_ext)) - $count_period; $i < count($array_ext); $i++) {733 if ($count_period > 0) { 734 for ($i = max(array_keys($array_ext)) - $count_period; $i < count($array_ext); $i++) { 735 735 $ext .= $array_ext[$i] . "."; 736 736 } … … 742 742 $ext = strtolower($ext); 743 743 744 if ( 744 if ($ext == $checkExt) { 745 745 $errFlag = 0; 746 746 } 747 747 748 if ($strExt == "") {748 if ($strExt == "") { 749 749 $strExt.= $checkExt; 750 750 } else { … … 762 762 // value[0] = 項目名 value[1] = 判定対象 value[2] = 指定ディレクトリ 763 763 function FIND_FILE( $value ) { 764 if (isset($this->arrErr[$value[1]])) {765 return; 766 } 767 768 $this->createParam($value); 769 if ($value[2] != "") {764 if (isset($this->arrErr[$value[1]])) { 765 return; 766 } 767 768 $this->createParam($value); 769 if ($value[2] != "") { 770 770 $dir = $value[2]; 771 771 } else { … … 776 776 $path = str_replace("//", "/", $path); 777 777 778 if ($this->arrParam[$value[1]] != "" && !file_exists($path)){778 if ($this->arrParam[$value[1]] != "" && !file_exists($path)) { 779 779 $this->arrErr[$value[1]] = "※ " . $path . "が見つかりません。<br />"; 780 780 } … … 785 785 // value[0] = 項目名 value[1] = 判定対象 value[2] = 指定サイズ(KB) 786 786 function FILE_EXIST_CHECK( $value ) { 787 if (isset($this->arrErr[$value[1]])) {788 return; 789 } 790 $this->createParam($value); 791 if (!($_FILES[$value[1]]['size'] != "" && $_FILES[$value[1]]['size'] > 0)){787 if (isset($this->arrErr[$value[1]])) { 788 return; 789 } 790 $this->createParam($value); 791 if (!($_FILES[$value[1]]['size'] != "" && $_FILES[$value[1]]['size'] > 0)) { 792 792 $this->arrErr[$value[1]] = "※ " . $value[0] . "をアップロードして下さい。<br />"; 793 793 } … … 798 798 // value[0] = 項目名 value[1] = 判定対象 value[2] = 指定サイズ(KB) 799 799 function FILE_SIZE_CHECK( $value ) { 800 if (isset($this->arrErr[$value[1]])) {801 return; 802 } 803 $this->createParam($value); 804 if ( $_FILES[$value[1]]['size'] > $value[2] * 1024 ){800 if (isset($this->arrErr[$value[1]])) { 801 return; 802 } 803 $this->createParam($value); 804 if ($_FILES[$value[1]]['size'] > $value[2] * 1024 ) { 805 805 $byte = 'KB'; 806 if ($value[2] >= 1000 ) {806 if ($value[2] >= 1000 ) { 807 807 $value[2] = $value[2] / 1000; 808 808 $byte = 'MB'; … … 816 816 // value[0] = 項目名 value[1] = 判定対象文字列 817 817 function FILE_NAME_CHECK( $value ) { 818 if (isset($this->arrErr[$value[1]])) {819 return; 820 } 821 $this->createParam($value); 822 if (strlen($_FILES[$value[1]]['name']) > 0 && !preg_match("/^[[:alnum:]_\.-]+$/i", $_FILES[$value[1]]['name']) ) {818 if (isset($this->arrErr[$value[1]])) { 819 return; 820 } 821 $this->createParam($value); 822 if (strlen($_FILES[$value[1]]['name']) > 0 && !preg_match("/^[[:alnum:]_\.-]+$/i", $_FILES[$value[1]]['name']) ) { 823 823 $this->arrErr[$value[1]] = "※ " . $value[0] . "のファイル名に日本語やスペースは使用しないで下さい。<br />"; 824 824 } … … 829 829 // value[0] = 項目名 value[1] = 判定対象文字列 830 830 function FILE_NAME_CHECK_BY_NOUPLOAD( $value ) { 831 if (isset($this->arrErr[$value[1]])) {832 return; 833 } 834 $this->createParam($value); 835 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[[:alnum:]_\.-]+$/i", $this->arrParam[$value[1]]) || preg_match("/[\\]/" ,$this->arrParam[$value[1]])) {831 if (isset($this->arrErr[$value[1]])) { 832 return; 833 } 834 $this->createParam($value); 835 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^[[:alnum:]_\.-]+$/i", $this->arrParam[$value[1]]) || preg_match("/[\\]/" ,$this->arrParam[$value[1]])) { 836 836 $this->arrErr[$value[1]] = "※ " . $value[0] . "のファイル名に日本語やスペースは使用しないで下さい。<br />"; 837 837 } … … 844 844 // value[3] = DD 845 845 function CHECK_DATE($value) { 846 if (isset($this->arrErr[$value[1]])) {846 if (isset($this->arrErr[$value[1]])) { 847 847 return; 848 848 } 849 849 $this->createParam($value); 850 850 // 少なくともどれか一つが入力されている。 851 if ($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0 || $this->arrParam[$value[3]] > 0) {851 if ($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0 || $this->arrParam[$value[3]] > 0) { 852 852 // 年月日のどれかが入力されていない。 853 if (!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0)) {853 if (!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0)) { 854 854 $this->arrErr[$value[1]] = "※ " . $value[0] . "はすべての項目を入力して下さい。<br />"; 855 } else if ( 855 } else if (! checkdate($this->arrParam[$value[2]], $this->arrParam[$value[3]], $this->arrParam[$value[1]])) { 856 856 $this->arrErr[$value[1]] = "※ " . $value[0] . "が正しくありません。<br />"; 857 857 } … … 867 867 // value[5] = mm 868 868 function CHECK_DATE2($value) { 869 if (isset($this->arrErr[$value[1]])) {869 if (isset($this->arrErr[$value[1]])) { 870 870 return; 871 871 } 872 872 $this->createParam($value); 873 873 // 少なくともどれか一つが入力されている。 874 if ($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0 || $this->arrParam[$value[3]] > 0 || $this->arrParam[$value[4]] >= 0 || $this->arrParam[$value[5]] >= 0) {874 if ($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0 || $this->arrParam[$value[3]] > 0 || $this->arrParam[$value[4]] >= 0 || $this->arrParam[$value[5]] >= 0) { 875 875 // 年月日時のどれかが入力されていない。 876 if (!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]]) > 0 && strlen($this->arrParam[$value[5]]) > 0 )) {876 if (!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]]) > 0 && strlen($this->arrParam[$value[5]]) > 0 )) { 877 877 $this->arrErr[$value[1]] = "※ " . $value[0] . "はすべての項目を入力して下さい。<br />"; 878 } else if ( 878 } else if (! checkdate($this->arrParam[$value[2]], $this->arrParam[$value[3]], $this->arrParam[$value[1]])) { 879 879 $this->arrErr[$value[1]] = "※ " . $value[0] . "が正しくありません。<br />"; 880 880 } … … 887 887 // value[2] = MM 888 888 function CHECK_DATE3($value) { 889 if (isset($this->arrErr[$value[1]])) {889 if (isset($this->arrErr[$value[1]])) { 890 890 return; 891 891 } 892 892 $this->createParam($value); 893 893 // 少なくともどれか一つが入力されている。 894 if ($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0) {894 if ($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0) { 895 895 // 年月日時のどれかが入力されていない。 896 if (!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0)) {896 if (!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0)) { 897 897 $this->arrErr[$value[1]] = "※ " . $value[0] . "はすべての項目を入力して下さい。<br />"; 898 } else if ( 898 } else if (! checkdate($this->arrParam[$value[2]], 1, $this->arrParam[$value[1]])) { 899 899 $this->arrErr[$value[1]] = "※ " . $value[0] . "が正しくありません。<br />"; 900 900 } … … 955 955 956 956 // 期間指定 957 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[5]])) {957 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[5]])) { 958 958 return; 959 959 } 960 960 $this->createParam($value); 961 961 $error = 0; 962 if ( 962 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]]) ) { 963 963 $this->arrErr[$value[2]] = "※ " . $value[0] . "を正しく指定してください。<br />"; 964 964 } 965 if ( 965 if ((strlen($this->arrParam[$value[5]]) > 0 || strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]] ) > 0) && ! checkdate($this->arrParam[$value[6]], $this->arrParam[$value[7]], $this->arrParam[$value[5]]) ) { 966 966 $this->arrErr[$value[5]] = "※ " . $value[1] . "を正しく指定してください。<br />"; 967 967 } 968 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) ){968 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) ) { 969 969 970 970 $date1 = $this->arrParam[$value[2]] .sprintf("%02d", $this->arrParam[$value[3]]) .sprintf("%02d",$this->arrParam[$value[4]]) ."000000"; … … 1006 1006 1007 1007 // 期間指定 1008 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[8]])) {1008 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[8]])) { 1009 1009 return; 1010 1010 } 1011 1011 $this->createParam($value); 1012 1012 $error = 0; 1013 if ( 1013 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]]) ) { 1014 1014 $this->arrErr[$value[2]] = "※ " . $value[0] . "を正しく指定してください。<br />"; 1015 1015 } 1016 if ( 1016 if ((strlen($this->arrParam[$value[8]]) > 0 || strlen($this->arrParam[$value[9]]) > 0 || strlen($this->arrParam[$value[10]] ) > 0 || strlen($this->arrParam[$value[11]] ) > 0) && ! checkdate($this->arrParam[$value[9]], $this->arrParam[$value[10]], $this->arrParam[$value[8]]) ) { 1017 1017 $this->arrErr[$value[8]] = "※ " . $value[1] . "を正しく指定してください。<br />"; 1018 1018 } 1019 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) ){1019 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) ) { 1020 1020 1021 1021 $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]]); … … 1025 1025 $this->arrErr[$value[2]] = "※ " .$value[0]. "と" .$value[1]. "の期間指定が不正です。<br />"; 1026 1026 } 1027 if ($date1 == $date2) {1027 if ($date1 == $date2) { 1028 1028 $this->arrErr[$value[2]] = "※ " .$value[0]. "と" .$value[1]. "の期間指定が不正です。<br />"; 1029 1029 } … … 1050 1050 1051 1051 // 期間指定 1052 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[4]])) {1052 if (isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[4]])) { 1053 1053 return; 1054 1054 } 1055 1055 $this->createParam($value); 1056 1056 $error = 0; 1057 if ( 1057 if ((strlen($this->arrParam[$value[2]]) > 0 || strlen($this->arrParam[$value[3]]) > 0) && ! checkdate($this->arrParam[$value[3]], 1, $this->arrParam[$value[2]]) ) { 1058 1058 $this->arrErr[$value[2]] = "※ " . $value[0] . "を正しく指定してください。<br />"; 1059 1059 } 1060 if ( 1060 if ((strlen($this->arrParam[$value[4]]) > 0 || strlen($this->arrParam[$value[5]]) > 0) && ! checkdate($this->arrParam[$value[5]], 1, $this->arrParam[$value[4]]) ) { 1061 1061 $this->arrErr[$value[4]] = "※ " . $value[1] . "を正しく指定してください。<br />"; 1062 1062 } 1063 if ( 1063 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 ))) { 1064 1064 1065 1065 $date1 = $this->arrParam[$value[2]] .sprintf("%02d", $this->arrParam[$value[3]]); … … 1074 1074 //ディレクトリ存在チェック 1075 1075 function DIR_CHECK ($value) { 1076 if (isset($this->arrErr[$value[1]])) {1077 return; 1078 } 1079 $this->createParam($value); 1080 if (!is_dir($this->arrParam[$value[1]])) {1076 if (isset($this->arrErr[$value[1]])) { 1077 return; 1078 } 1079 $this->createParam($value); 1080 if (!is_dir($this->arrParam[$value[1]])) { 1081 1081 $this->arrErr[$value[1]] = "※ 指定した" . $value[0] . "は存在しません。<br />"; 1082 1082 } … … 1085 1085 // ドメインチェック 1086 1086 function DOMAIN_CHECK ($value) { 1087 if (isset($this->arrErr[$value[1]])) {1088 return; 1089 } 1090 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^\.[^.]+\..+/i", $this->arrParam[$value[1]])) {1087 if (isset($this->arrErr[$value[1]])) { 1088 return; 1089 } 1090 if (strlen($this->arrParam[$value[1]]) > 0 && !preg_match("/^\.[^.]+\..+/i", $this->arrParam[$value[1]])) { 1091 1091 $this->arrErr[$value[1]] = "※ " . $value[0] . "の形式が不正です。<br />"; 1092 1092 } … … 1097 1097 // value[0] = 項目名 value[1] = 判定対象メールアドレス 1098 1098 function MOBILE_EMAIL_CHECK( $value ){ 1099 if (isset($this->arrErr[$value[1]])) {1099 if (isset($this->arrErr[$value[1]])) { 1100 1100 return; 1101 1101 } 1102 1102 $this->createParam($value); 1103 1103 $objMobile = new SC_Helper_Mobile_Ex(); 1104 if (strlen($this->arrParam[$value[1]]) > 0 && !$objMobile->gfIsMobileMailAddress($this->arrParam[$value[1]])) {1104 if (strlen($this->arrParam[$value[1]]) > 0 && !$objMobile->gfIsMobileMailAddress($this->arrParam[$value[1]])) { 1105 1105 $this->arrErr[$value[1]] = "※ " . $value[0] . "は携帯電話のものではありません。<br />"; 1106 1106 } … … 1116 1116 */ 1117 1117 function CHECK_REGIST_CUSTOMER_EMAIL ($value) { 1118 if (isset($this->arrErr[$value[1]])) {1118 if (isset($this->arrErr[$value[1]])) { 1119 1119 return; 1120 1120 } … … 1122 1122 1123 1123 $register_user_flg = SC_Helper_Customer_Ex::sfCheckRegisterUserFromEmail($this->arrParam[$value[1]]); 1124 switch ($register_user_flg) {1124 switch ($register_user_flg) { 1125 1125 case 1: 1126 1126 $this->arrErr[$value[1]] .= "※ すでに会員登録で使用されている" . $value[0] . "です。<br />"; … … 1142 1142 */ 1143 1143 function PROHIBITED_STR_CHECK( $value ) { 1144 if (isset($this->arrErr[$value[1]]) || empty($this->arrParam[$value[1]]) ) {1144 if (isset($this->arrErr[$value[1]]) || empty($this->arrParam[$value[1]]) ) { 1145 1145 return; 1146 1146 } … … 1150 1150 1151 1151 $pattern = '/' . join('|', $prohibitedStr) . '/i'; 1152 if (preg_match_all($pattern, $this->arrParam[$value[1]], $matches)) {1152 if (preg_match_all($pattern, $this->arrParam[$value[1]], $matches)) { 1153 1153 $this->arrErr[$value[1]] = "※ " . $value[0] . "は入力できません。<br />"; 1154 1154 } … … 1182 1182 function evalCheck($value) { 1183 1183 // falseは、正当な式と評価する。 1184 if ($value === 'false') {1184 if ($value === 'false') { 1185 1185 return true; 1186 1186 }
Note: See TracChangeset
for help on using the changeset viewer.