developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #1065: ticket_1065.diff

File ticket_1065.diff, 2.7 KB (added by bricet, 11 years ago)
  • lib/jelix/utils/jFilter.class.php

    diff -r f3e3249784a8 lib/jelix/utils/jFilter.class.php
    a b  
    172172#if ENABLE_PHP_FILTER
    173173        return filter_var($val, FILTER_VALIDATE_EMAIL) !== false;
    174174#else
    175         if (!preg_match("/^(?:(?:\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|(?:[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(?:\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@(?:(?:\\[(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9])))\\])|(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9])))|(?:(?:(?:[A-Za-z0-9\\-])+\\.)+[A-Za-z\\-]+))$/",$val)) return false;
     175        if (!preg_match("/^(?:(?:\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|(?:[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(?:\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@(?:(?:\\[(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9])))\\])|(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9])))|(?:(?:(?:[A-Za-z0-9\\-])+\\.)*[A-Za-z\\-]+))$/",$val)) return false;
    176176        return true;
    177177#endif
    178178    }
  • testapp/modules/jelix_tests/tests/utils.jfilter.html_cli.php

    diff -r f3e3249784a8 testapp/modules/jelix_tests/tests/utils.jfilter.html_cli.php
    a b  
    141141    }
    142142
    143143    public function testEmail(){
    144         $this->assertFalse(jFilter::isEmail('toto@mail'), "isEmail('toto@mail')");
     144        $this->assertFalse(jFilter::isEmail('toto@mail.'), "isEmail('toto@mail.')");
     145        $this->assertTrue(jFilter::isEmail('toto@mail'), "isEmail('toto@mail')");
    145146        $this->assertTrue(jFilter::isEmail('toto@mail.com'), "isEmail('toto@mail.com')");
    146147        $this->assertTrue(jFilter::isEmail('toto@mail.poer.dsmlqsd'), "isEmail('toto@mail.poer.dsmlqsd')");
    147148        $this->assertTrue(jFilter::isEmail('"bob john"@mail.com'), "isEmail('\"bob john\"@mail.com')");
     
    223224
    224225}
    225226
    226 ?>
    227  No newline at end of file
     227?>