diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2011-03-11 21:55:46 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2011-03-11 21:55:46 -0500 |
commit | df096b6b52f9198561d689b505a8c74a0d0f86b6 (patch) | |
tree | 4adba820df1420e71fca9022df93dfeddcd9b9cc /phpBB/includes/functions_user.php | |
parent | db70d613bcdca69be7b634d742ec79dc3f9725de (diff) | |
parent | 2f57bfb6f297e9711bacb607faf6e33ab516db33 (diff) | |
download | forums-df096b6b52f9198561d689b505a8c74a0d0f86b6.tar forums-df096b6b52f9198561d689b505a8c74a0d0f86b6.tar.gz forums-df096b6b52f9198561d689b505a8c74a0d0f86b6.tar.bz2 forums-df096b6b52f9198561d689b505a8c74a0d0f86b6.tar.xz forums-df096b6b52f9198561d689b505a8c74a0d0f86b6.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/9970] Rename validate_language() to validate_language_iso_name().
[ticket/9970] Do not allow switching to languages not installed on reg. page.
[ticket/9970] Check whether language pack is installed.
[ticket/9970] User language input is checked for existance
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r-- | phpBB/includes/functions_user.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index dd96530265..e8db807154 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1422,6 +1422,31 @@ function validate_match($string, $optional = false, $match = '') } /** +* Validate Language Pack ISO Name +* +* Tests whether a language name is valid and installed +* +* @param string $lang_iso The language string to test +* +* @return bool|string Either false if validation succeeded or +* a string which will be used as the error message +* (with the variable name appended) +*/ +function validate_language_iso_name($lang_iso) +{ + global $db; + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($lang_iso) . "'"; + $result = $db->sql_query($sql); + $lang_id = (int) $db->sql_fetchfield('lang_id'); + $db->sql_freeresult($result); + + return ($lang_id) ? false : 'WRONG_DATA'; +} + +/** * Check to see if the username has been taken, or if it is disallowed. * Also checks if it includes the " character, which we don't allow in usernames. * Used for registering, changing names, and posting anonymously with a username |