* Internally the output character set is used. Other characters are
* encoded using Unicode entities according to HTML 4.0.
*
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * Before 1.5.2 functions were stored in functions/i18n.php. Script is moved
+ * because it executes some code in order to detect functions supported by
+ * existing PHP installation and implements fallback functions when required
+ * functions are not available. Scripts in functions/ directory should not
+ * setup anything when they are loaded.
+ * @copyright © 1999-2007 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
* @see http://www.php.net/setlocale
*/
function sq_setlocale($category,$locale) {
- // string with only one locale
- if (is_string($locale))
- return setlocale($category,$locale);
-
- if (! check_php_version(4,3)) {
+ if (is_string($locale)) {
+ // string with only one locale
+ $ret = setlocale($category,$locale);
+ } elseif (! check_php_version(4,3)) {
+ // older php version (second setlocale argument must be string)
$ret=false;
$index=0;
while ( ! $ret && $index<count($locale)) {
// php 4.3.0 or better, use entire array
$ret=setlocale($category,$locale);
}
+
+ /* safety checks */
+ if (preg_match("/^.*\/.*\/.*\/.*\/.*\/.*$/",$ret)) {
+ /**
+ * Welcome to We-Don't-Follow-Own-Fine-Manual department
+ * OpenBSD 3.8, 3.9-current and maybe later versions
+ * return invalid response to setlocale command.
+ * SM bug report #1427512.
+ */
+ $ret = false;
+ }
return $ret;
}
* @param string $string
* @param string $charset
* @param boolean $htmlencode keep htmlspecialchars encoding
- * @param string
+ * @return string
*/
function charset_encode($string,$charset,$htmlencode=true) {
global $default_charset;
}
}
}
-?>
\ No newline at end of file