Merged d00ps and my branch, renamed SysCP -> Froxlor in installer

This commit is contained in:
Florian Aders (EleRas)
2010-01-22 14:02:42 +00:00
parent eeec43ebd7
commit a46b99ea03
32 changed files with 228 additions and 87 deletions

View File

@@ -0,0 +1,32 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Aders <eleras@froxlor.org>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
* @version $Id$
*/
/**
* Convert a string to UTF-8 if needed
* @param string String to be converted
* @return string UTF-8 encoded string
*
* @author Florian Aders <eleras@froxlor.org>
*/
function convertUtf8 ($string) {
if (!isUtf8($string))
{
$string = utf8_encode($string);
}
return addslashes($string);
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Aders <eleras@froxlor.org>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
* @version $Id$
*/
/**
* Function which checks if a string is UTF8 encoded or not
* @param string String to be checked
* @return bool true if string is UTF8 encoded
*
* @author Florian Aders <eleras@froxlor.org>
*/
function isUtf8 ($string) {
// From http://w3.org/International/questions/qa-forms-utf-8.html
return preg_match('%^(?:
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*$%xs', $string
);
}