Username.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2005 Dokeos S.A.
  6. Copyright (c) Bart Mollet, Hogeschool Gent
  7. For a full list of contributors, see "credits.txt".
  8. The full license can be read in "license.txt".
  9. This program is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU General Public License
  11. as published by the Free Software Foundation; either version 2
  12. of the License, or (at your option) any later version.
  13. See the GNU General Public License for more details.
  14. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  15. Mail: info@dokeos.com
  16. ==============================================================================
  17. */
  18. require_once 'HTML/QuickForm/Rule.php';
  19. /**
  20. * QuickForm rule to check if a username is of the correct format
  21. */
  22. class HTML_QuickForm_Rule_Username extends HTML_QuickForm_Rule {
  23. /**
  24. * Function to check if a username is of the correct format
  25. * @see HTML_QuickForm_Rule
  26. * @param string $username Wanted username
  27. * @return boolean True if username is of the correct format
  28. * @author Modified by Ivan Tcholakov, 15-SEP-2009. The validation rule is served by the UserManager class as of this moment.
  29. */
  30. function validate($username, $options) {
  31. return UserManager::is_username_valid($username);
  32. }
  33. }