Code Duplication    Length = 9-10 lines in 5 locations

addTicket.php 1 location

@@ 399-407 (lines=9) @@
396
        // Perform each validation
397
        $fields = array();
398
        $errors = array();
399
        foreach($v as $fieldname=>$validator) {
400
            if (!xhelpCheckRules($validator, $errors)) {
401
                //Mark field with error
402
                $fields[$fieldname]['haserrors'] = true;
403
                $fields[$fieldname]['errors'] = $errors;
404
            } else {
405
                $fields[$fieldname]['haserrors'] = false;
406
            }
407
        }
408
409
        if(!empty($errors)){
410
            $_xhelpSession->set('xhelp_validateError', $fields);

anon_addTicket.php 1 location

@@ 266-274 (lines=9) @@
263
    // Perform each validation
264
    $fields = array();
265
    $errors = array();
266
    foreach($v as $fieldname=>$validator) {
267
        if (!xhelpCheckRules($validator, $errors)) {
268
            //Mark field with error
269
            $fields[$fieldname]['haserrors'] = true;
270
            $fields[$fieldname]['errors'] = $errors;
271
        } else {
272
            $fields[$fieldname]['haserrors'] = false;
273
        }
274
    }
275
276
    if(!empty($errors)){
277
        $_xhelpSession->set('xhelp_validateError', $fields);

response.php 2 locations

@@ 84-93 (lines=10) @@
81
                // Perform each validation
82
                $fields = array();
83
                $errors = array();
84
                foreach($v as $fieldname=>$validator) {
85
                    if (!xhelpCheckRules($validator, $errors)) {
86
                        $hasErrors = true;
87
                        //Mark field with error
88
                        $fields[$fieldname]['haserrors'] = true;
89
                        $fields[$fieldname]['errors'] = $errors;
90
                    } else {
91
                        $fields[$fieldname]['haserrors'] = false;
92
                    }
93
                }
94
95
                if ($hasErrors) {
96
                    //Store field values in session
@@ 481-489 (lines=9) @@
478
        // Perform each validation
479
        $fields = array();
480
        $errors = array();
481
        foreach($v as $fieldname=>$validator){
482
            if(!xhelpCheckRules($validator, $errors)){
483
                // Mark field with error
484
                $fields[$fieldname]['haserrors'] = true;
485
                $fields[$fieldname]['errors'] = $errors;
486
            } else {
487
                $fields[$fieldname]['haserrors'] = false;
488
            }
489
        }
490
491
        if(!empty($errors)){
492
            $_xhelpSession->set('xhelp_validateError', $fields);

ticket.php 1 location

@@ 483-491 (lines=9) @@
480
            // Perform each validation
481
            $fields = array();
482
            $errors = array();
483
            foreach($v as $fieldname=>$validator) {
484
                if (!xhelpCheckRules($validator, $errors)) {
485
                    //Mark field with error
486
                    $fields[$fieldname]['haserrors'] = true;
487
                    $fields[$fieldname]['errors'] = $errors;
488
                } else {
489
                    $fields[$fieldname]['haserrors'] = false;
490
                }
491
            }
492
493
            if(!empty($errors)){
494
                $_xhelpSession->set('xhelp_validateError', $fields);