patch_Validator.php.patch

Boris DE ANDRADE, 07/01/2015 06:53 PM

Download (1.33 KB)

View differences:

/usr/share/nethesis/Nethgui/System/Validator.php 2015-07-02 00:52:29.183966985 +0200
717 704

  
718 705
    private function evalEmail($value)
719 706
    {
720
        if (strlen($value) > 254) {
721
            $this->addFailureInfo('valid_email,too-long');
722
            return FALSE;
723
        }
724

  
725
        $parts = explode('@', $value, 2);
726

  
727
        if ( ! isset($parts[0]) || $parts[0] === '') {
728
            $this->addFailureInfo('valid_email,missing-localpart');
729
            return FALSE;
730
        }
731

  
732
        $localPart = $parts[0];
733

  
734
        if (strlen($localPart) > 64 || preg_match('/^[A-Za-z0-9_-](\.?[A-Za-z0-9_-]+)*$/', $localPart) == 0) {
735
            $this->addFailureInfo('valid_email,malformed-localpart');
736
            return FALSE;
737
        }
738

  
739
        if ( ! isset($parts[1])) {
740
            $this->addFailureInfo('valid_email,missing-domainpart');
741
            return FALSE;
742
        }
743

  
744
        $domainPart = $parts[1];
745

  
746
        if ( ! $this->evalHostname($domainPart, 0, PHP_INT_MAX)) {
747
            $this->addFailureInfo('valid_email,malformed-domainpart');
748
            return FALSE;
749
        }
750

  
707
        if ( filter_var($value, FILTER_VALIDATE_EMAIL)==FALSE) {
708
           return FALSE;
709
       }
751 710
        return TRUE;
752 711
    }