Welcome Guest, Not a member yet? Register   Sign In
Extending forum Validator broke the core files
#1

[eluser]Unknown[/eluser]
Hello, I extended the forum validation and created a separate function to match a specific layout. It is working fine, however the core forum validation error messages are weird. Not sure how I broke them, any help would be great!

MY_Form_validation in applications/library/
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed.');

class MY_Form_validation extends CI_Form_validation {


public function __construct()
{
parent::__construct();
}  
  // matches_pattern()
  // Ensures a string matches a basic pattern
  // # numeric, ? alphabetical, ~ any character
  function matches_pattern($str, $pattern) {
    $characters = array(
      '[', ']', '\\', '^', '$',
      '.', '|', '+', '(', ')',
      '#', '?', '~'            // Our additional characters
    );

    $regex_characters = array(
      '\[', '\]', '\\\\', '\^', '\$',
      '\.', '\|', '\+', '\(', '\)',
      '[0-9]', '[a-zA-Z]', '.' // Our additional characters
    );

    $pattern = str_replace($characters, $regex_characters, $pattern);
    if (preg_match('/^' . $pattern . '$/', $str)) return TRUE;
    return FALSE;
  }
}

Language File under lanugage/english/
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed.');

$lang['matches_pattern'] = "The %s field does not match the required pattern.";

Again, the actual validation of my custom script is working fine, however the core validation error messages are breaking
#2

[eluser]Unknown[/eluser]
Fixed it, problem was my lang file




Theme © iAndrew 2016 - Forum software by © MyBB