1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-04 15:57:45 +02:00

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
This commit is contained in:
Oleg Pudeyev
2011-03-11 21:55:46 -05:00
3 changed files with 28 additions and 3 deletions

View File

@@ -1421,6 +1421,31 @@ function validate_match($string, $optional = false, $match = '')
return false;
}
/**
* 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.