using more UTF-8, optimized the initial froxlor.sql statements, refs #1117

Signed-off-by: Arnold Bechtoldt <mail@arnoldbechtoldt.com>
This commit is contained in:
Arnold Bechtoldt
2012-08-17 15:47:27 +02:00
parent f575e94ddb
commit 68308c4fca
14 changed files with 350 additions and 541 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
packages/*
temp/*
templates/*
install/update.log
.buildpath
.project
.settings/

File diff suppressed because it is too large Load Diff

View File

@@ -1923,3 +1923,31 @@ if(isFroxlorVersion('0.9.28-svn2')) {
updateToVersion('0.9.28-svn3');
}
if(isFroxlorVersion('0.9.28-svn3'))
{
showUpdateStep("Updating from 0.9.28-svn3 to 0.9.28-svn4", true);
lastStepStatus(0);
$update_default_theme = isset($_POST['update_default_theme']) ? $_POST['update_default_theme'] : 'Froxlor';
showUpdateStep('Setting default panel theme \'' . $update_default_theme . '\'', true);
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '".$db->escape($update_default_theme)."' WHERE varname = 'default_theme';");
lastStepStatus(0);
showUpdateStep('Altering Froxlor database and tables to use UTF-8. This may take a while..', true);
$db->query('ALTER DATABASE ' . $db->getDbName() . ' CHARACTER SET utf8 COLLATE utf8_general_ci');
$handle = $db->query('SHOW TABLES');
while ($row = $db->fetch_array($handle))
{
foreach ($row as $table)
{
$db->query('ALTER TABLE ' . $table . ' CHARACTER SET utf8 COLLATE utf8_general_ci;');
}
}
lastStepStatus(0);
updateToVersion('0.9.28-svn4');
}

View File

@@ -423,10 +423,32 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$question = '<strong>Select default panel theme:</strong>&nbsp;';
$question.= '<select name="update_default_theme">';
$themes = getThemes();
foreach($themes as $theme) {
$question.= makeoption($theme, $theme, 'Froxlor');
foreach($themes as $cur_theme) // $theme is already in use
{
$question.= makeoption($cur_theme, $cur_theme, 'Froxlor');
}
$question.= '</select>';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if(versionInUpdate($current_version, '0.9.28-svn4'))
{
$has_preconfig = true;
$description = 'This version introduces a lot of profound changes:';
$description .= '<br /><ul><li>Improving the whole template system</li><li>Full UTF-8 support</li><li><strong>Removing support for the former default theme \'Classic\'</strong></li></ul>';
$description .= '<br /><br />Notice: This update will <strong>alter your Froxlor database to use UTF-8</strong> as default charset. ';
$description .= 'Even though this is already tested, we <span style="color:#ff0000;font-weight:bold;">strongly recommend</span> to ';
$description .= 'test this update in a testing environment using your existing database.<br /><br />';
$question = '<strong>Select your default panel theme:</strong>&nbsp;';
$question.= '<select name="update_default_theme">';
$themes = getThemes();
foreach($themes as $cur_theme)
{
$question.= makeoption($cur_theme, $cur_theme, 'Froxlor');
}
$question.= '</select>';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}

View File

@@ -3187,7 +3187,7 @@ class ApsParser
{
$Temp.= '<textarea name="text" rows="10" cols="55">';
$FileContent = file_get_contents('./packages/' . $Row['Path'] . '/license.txt');
$Temp.= htmlentities($FileContent, ENT_QUOTES, 'ISO-8859-1');
$Temp.= htmlentities($FileContent, ENT_QUOTES, 'UTF-8');
$Temp.= '</textarea>';
$Groupname = $lng['aps']['license'];
$Fieldname = $lng['aps']['license'];
@@ -3378,7 +3378,7 @@ class ApsParser
if($license->text->name)$Temp = $license->text->name . '<br/>';
$Temp.= '<form name="license" action="#"><textarea name="text" rows="10" cols="70">';
$FileContent = file_get_contents('./packages/' . $Row['Path'] . '/license.txt');
$Temp.= htmlentities($FileContent, ENT_QUOTES, 'ISO-8859-1');
$Temp.= htmlentities($FileContent, ENT_QUOTES, 'UTF-8');
$Temp.= '</textarea></form>';
$Fieldname = $lng['aps']['license'];
$Fieldvalue = $Temp;

View File

@@ -56,7 +56,7 @@ class PHPMailer {
* Sets the CharSet of the message.
* @var string
*/
public $CharSet = 'iso-8859-1';
public $CharSet = 'UTF-8';
/**
* Sets the Content-type of the message.

View File

@@ -89,7 +89,7 @@ class ticket
// initialize purifier
require_once dirname(dirname(__FILE__)).'/htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', 'ISO-8859-1'); // for now
$config->set('Core.Encoding', 'UTF-8'); //htmlpurifier uses utf-8 anyway as default
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
$this->_purifier = new HTMLPurifier($config);

View File

@@ -31,7 +31,7 @@
* @author Florian Lippert <flo@syscp.org>
*/
function html_entity_decode_array($subject, $fields = '', $complete = false, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1')
function html_entity_decode_array($subject, $fields = '', $complete = false, $quote_style = ENT_COMPAT, $charset = 'UTF-8')
{
if(is_array($subject))
{

View File

@@ -27,9 +27,21 @@
function html_entity_decode_complete($string)
{
while($string != html_entity_decode($string))
global $theme;
if($theme == 'Classic')
{
$string = html_entity_decode($string);
while($string != html_entity_decode($string))
{
$string = html_entity_decode($string);
}
}
else
{
while($string != html_entity_decode($string, ENT_COMPAT | ENT_HTML5, 'UTF-8'))
{
$string = html_entity_decode($string, ENT_COMPAT | ENT_HTML5, 'UTF-8');
}
}
return $string;

View File

@@ -29,7 +29,7 @@
* @author Florian Lippert <flo@syscp.org>
*/
function htmlentities_array($subject, $fields = '', $quote_style = ENT_QUOTES, $charset = 'ISO-8859-1')
function htmlentities_array($subject, $fields = '', $quote_style = ENT_QUOTES, $charset = 'UTF-8')
{
if(is_array($subject))
{

View File

@@ -17,7 +17,7 @@
*
*/
header("Content-Type: text/html; charset=iso-8859-1");
header("Content-Type: text/html; charset=UTF-8");
// prevent Froxlor pages from being cached
header("Cache-Control: no-store, no-cache, must-revalidate");
@@ -67,27 +67,27 @@ unset($value);
unset($key);
$filename = basename($_SERVER['PHP_SELF']);
if(!file_exists('./lib/userdata.inc.php'))
if(!file_exists('lib/userdata.inc.php'))
{
$config_hint = file_get_contents('./templates/Froxlor/misc/configurehint.tpl');
$config_hint = file_get_contents('templates/Froxlor/misc/configurehint.tpl');
die($config_hint);
}
if(!is_readable('./lib/userdata.inc.php'))
if(!is_readable('lib/userdata.inc.php'))
{
die('You have to make the file "./lib/userdata.inc.php" readable for the http-process!');
die('You have to make the file "lib/userdata.inc.php" readable for the http-process!');
}
/**
* Includes the Usersettings eg. MySQL-Username/Passwort etc.
*/
require ('./lib/userdata.inc.php');
require ('lib/userdata.inc.php');
if(!isset($sql)
|| !is_array($sql))
{
$config_hint = file_get_contents('./templates/Froxlor/misc/configurehint.tpl');
$config_hint = file_get_contents('templates/Froxlor/misc/configurehint.tpl');
die($config_hint);
}
@@ -103,13 +103,13 @@ if(isset($sql['root_user']) && isset($sql['root_password']) && (!isset($sql_root
* Includes the Functions
*/
require ('./lib/functions.php');
require ('lib/functions.php');
/**
* Includes the MySQL-Tabledefinitions etc.
*/
require ('./lib/tables.inc.php');
require ('lib/tables.inc.php');
/**
* Includes the MySQL-Connection-Class
@@ -177,7 +177,7 @@ if(get_magic_quotes_gpc())
* Selects settings from MySQL-Table
*/
$settings_data = loadConfigArrayDir('./actions/admin/settings/');
$settings_data = loadConfigArrayDir('actions/admin/settings/');
$settings = loadSettings($settings_data, $db);
/**
@@ -449,7 +449,7 @@ if(AREA == 'admin' || AREA == 'customer')
}
else
{
$navigation_data = loadConfigArrayDir('./lib/navigation/');
$navigation_data = loadConfigArrayDir('lib/navigation/');
$navigation = buildNavigation($navigation_data[AREA], $userinfo);
}
unset($navigation_data);

View File

@@ -73,6 +73,6 @@ define('PACKAGE_ENABLED', 2);
// VERSION INFO
$version = '0.9.28-svn3';
$version = '0.9.28-svn4';
$dbversion = '2';
$branding = '';

View File

@@ -1,3 +1,3 @@
!Classic/
!Froxlor/
Froxlor/assets/img/logo_custom.png
!misc/

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<if $settings['panel']['no_robots'] == '0'>
<meta name="robots" content="noindex, nofollow, noarchive" />
<meta name="GOOGLEBOT" content="nosnippet" />