From d055c1ca7217b18d384625c7d3b316827c1d108e Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Sun, 13 Oct 2013 10:45:09 +0200 Subject: [PATCH] re-work the whole install-process, now templates- and class-based; set Sparkle as default theme; set version to 0.9.29.1-dev4 Signed-off-by: Michael Kaufmann (d00p) --- install/froxlor.sql | 13 +- install/install.php | 952 +------------- install/lib/class.FroxlorInstall.php | 1169 +++++++++++++++++ install/lng/english.lng.php | 124 +- install/lng/french.lng.php | 79 -- install/lng/german.lng.php | 144 +- install/templates/dataform.tpl | 11 + install/templates/dataform2.tpl | 13 + install/templates/dataitem.tpl | 4 + install/templates/dataitemchk.tpl | 4 + install/templates/datasection.tpl | 1 + install/templates/footer.tpl | 7 + install/templates/header.tpl | 18 + install/templates/lngform.tpl | 16 + install/templates/page.tpl | 11 + install/templates/pagebottom.tpl | 4 + install/templates/textarea.tpl | 5 + .../updates/froxlor/0.9/update_0.9.inc.php | 53 +- lib/tables.inc.php | 2 +- 19 files changed, 1416 insertions(+), 1214 deletions(-) create mode 100644 install/lib/class.FroxlorInstall.php delete mode 100644 install/lng/french.lng.php create mode 100644 install/templates/dataform.tpl create mode 100644 install/templates/dataform2.tpl create mode 100644 install/templates/dataitem.tpl create mode 100644 install/templates/dataitemchk.tpl create mode 100644 install/templates/datasection.tpl create mode 100644 install/templates/footer.tpl create mode 100644 install/templates/header.tpl create mode 100644 install/templates/lngform.tpl create mode 100644 install/templates/page.tpl create mode 100644 install/templates/pagebottom.tpl create mode 100644 install/templates/textarea.tpl diff --git a/install/froxlor.sql b/install/froxlor.sql index a21183e7..4ebf4ff1 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -92,7 +92,6 @@ CREATE TABLE `panel_admins` ( `domains_see_all` tinyint(1) NOT NULL default '0', `caneditphpsettings` tinyint(1) NOT NULL default '0', `change_serversettings` tinyint(1) NOT NULL default '0', - `edit_billingdata` tinyint(1) NOT NULL DEFAULT '0', `diskspace` int(15) NOT NULL default '0', `diskspace_used` int(15) NOT NULL default '0', `mysqls` int(15) NOT NULL default '0', @@ -124,7 +123,7 @@ CREATE TABLE `panel_admins` ( `aps_packages_used` int(5) NOT NULL default '0', `email_autoresponder` int(5) NOT NULL default '0', `email_autoresponder_used` int(5) NOT NULL default '0', - `theme` varchar(255) NOT NULL default 'Froxlor', + `theme` varchar(255) NOT NULL default 'Sparkle', PRIMARY KEY (`adminid`), UNIQUE KEY `loginname` (`loginname`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; @@ -187,7 +186,7 @@ CREATE TABLE `panel_customers` ( `perlenabled` tinyint(1) NOT NULL default '0', `email_autoresponder` int(5) NOT NULL default '0', `email_autoresponder_used` int(5) NOT NULL default '0', - `theme` varchar(255) NOT NULL default 'Froxlor', + `theme` varchar(255) NOT NULL default 'Sparkle', `backup_allowed` TINYINT( 1 ) NOT NULL DEFAULT '1', `backup_enabled` TINYINT( 1 ) NOT NULL DEFAULT '0', PRIMARY KEY (`customerid`), @@ -495,10 +494,6 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'diskquota_repquota_path', '/usr/sbin/repquota'), ('system', 'diskquota_quotatool_path', '/usr/bin/quotatool'), ('system', 'diskquota_customer_partition', '/dev/root'), - ('system', 'logrotate_enabled', '0'), - ('system', 'logrotate_binary', '/usr/sbin/logrotate'), - ('system', 'logrotate_interval', 'weekly'), - ('system', 'logrotate_keep', '4'), ('system', 'mod_fcgid_idle_timeout', '30'), ('system', 'perl_path', '/usr/bin/perl'), ('system', 'mod_fcgid_ownvhost', '0'), @@ -530,7 +525,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'allow_domain_change_admin', '0'), ('panel', 'allow_domain_change_customer', '0'), ('panel', 'frontend', 'froxlor'), - ('panel', 'default_theme', 'Froxlor'), + ('panel', 'default_theme', 'Sparkle'), ('panel', 'password_min_length', '0'), ('panel', 'adminmail_defname', 'Froxlor Administrator'), ('panel', 'adminmail_return', ''), @@ -543,7 +538,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'phpconfigs_hidestdsubdomain', '0'), ('panel', 'allow_theme_change_admin', '1'), ('panel', 'allow_theme_change_customer', '1'), - ('panel', 'version', '0.9.29.1-dev2'); + ('panel', 'version', '0.9.29.1-dev4'); DROP TABLE IF EXISTS `panel_tasks`; diff --git a/install/install.php b/install/install.php index b70aea25..58e03083 100644 --- a/install/install.php +++ b/install/install.php @@ -2,7 +2,6 @@ /** * This file is part of the Froxlor project. - * Copyright (c) 2003-2009 the SysCP Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors). * * For the full copyright and license information, please view the COPYING @@ -10,957 +9,14 @@ * COPYING file online at http://files.froxlor.org/misc/COPYING.txt * * @copyright (c) the authors - * @author Florian Lippert (2003-2009) + * @author Michael Kaufmann * @author Froxlor team (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Install * */ -/** - * Most elements are taken from the phpBB (www.phpbb.com) - * installer, (c) 1999 - 2004 phpBB Group. - */ +require 'lib/class.FroxlorInstall.php'; -// ensure that default timezone is set -if(function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) -{ - @date_default_timezone_set(@date_default_timezone_get()); -} - -if(file_exists('../lib/userdata.inc.php')) -{ - /** - * Includes the Usersettings eg. MySQL-Username/Passwort etc. to test if Froxlor is already installed - */ - - require ('../lib/userdata.inc.php'); - - if(isset($sql) - && is_array($sql) - ) { - $installed_hint = file_get_contents('../templates/Froxlor/misc/alreadyinstalledhint.tpl'); - die($installed_hint); - } -} - -/** - * Include the functions - */ - -require ('../lib/functions.php'); - -/** - * Include the MySQL-Table-Definitions - */ - -require ('../lib/tables.inc.php'); - -/** - * Language Managament - */ - -$languages = Array( - 'german' => 'Deutsch', - 'english' => 'English', - 'french' => 'Francais' -); -$standardlanguage = 'english'; - -if(isset($_GET['language']) - && isset($languages[$_GET['language']])) -{ - $language = $_GET['language']; -} -elseif(isset($_POST['language']) - && isset($languages[$_POST['language']])) -{ - $language = $_POST['language']; -} -else -{ - $language = $standardlanguage; -} - -if(file_exists('./lng/' . $language . '.lng.php')) -{ - /** - * Includes file /lng/$language.lng.php if it exists - */ - - require ('./lng/' . $language . '.lng.php'); -} - -/** - * BEGIN FUNCTIONS ----------------------------------------------- - */ - -function page_header() { -?> - - - - - - - - - - - - Froxlor Server Management Panel - Installation - - - -
- -
- - - -'.$text; - } - else - { - echo ' - '.$text.' - '; - } -} - -function requirement_checks() { - - global $lng, $theme; - page_header(); - -?> -
-
- Froxlor Server Management Panel -
- -
-

Requirements

- -=")) - { - status_message('red', $lng['install']['notinstalled']); - $_die = true; - } - else - { - status_message('green', 'OK'); - } - - // Check if magic_quotes_runtime is active - status_message('begin', $lng['install']['phpmagic_quotes_runtime']); - if(get_magic_quotes_runtime()) - { - // Deactivate - set_magic_quotes_runtime(false); - status_message('orange', $lng['install']['active'] . '
' . $lng['install']['phpmagic_quotes_runtime_description']); - } - else - { - status_message('green', 'OK'); - } - - // check for mysql-extension - status_message('begin', $lng['install']['phpmysql']); - - if(!extension_loaded('mysql') && !extension_loaded('mysqlnd')) - { - status_message('red', $lng['install']['notinstalled']); - $_die = true; - } - else - { - status_message('green', 'OK'); - } - - // check for xml-extension - status_message('begin', $lng['install']['phpxml']); - - if(!extension_loaded('xml')) - { - status_message('red', $lng['install']['notinstalled']); - $_die = true; - } - else - { - status_message('green', 'OK'); - } - - // check for filter-extension - status_message('begin', $lng['install']['phpfilter']); - - if(!extension_loaded('filter')) - { - status_message('red', $lng['install']['notinstalled']); - $_die = true; - } - else - { - status_message('green', 'OK'); - } - - // check for posix-extension - status_message('begin', $lng['install']['phpposix']); - - if(!extension_loaded('posix')) - { - status_message('red', $lng['install']['notinstalled']); - $_die = true; - } - else - { - status_message('green', 'OK'); - } - - // check for bcmath extension - status_message('begin', $lng['install']['phpbcmath']); - - if(!extension_loaded('bcmath')) - { - status_message('orange', $lng['install']['notinstalled'] . '
' . $lng['install']['bcmathdescription']); - } - else - { - status_message('green', 'OK'); - } - - // check for open_basedir - status_message('begin', $lng['install']['openbasedir']); - $php_ob = @ini_get("open_basedir"); - - if(!empty($php_ob) - && $php_ob != '') - { - status_message('orange', $lng['install']['openbasedirenabled']); - } - else - { - status_message('green', 'OK'); - } - -?> -
- -

- -

-

- -

- -

- -

-

- -

- -
-
- -
-
- Froxlor Server Management Panel -
- -
-

Installation

- - 0) - { - $tables_exist = true; - } - } - - if($tables_exist) - { - $filename = "/tmp/froxlor_backup_" . date('YmdHi') . ".sql"; - - if(is_file("/usr/bin/mysqldump")) - { - $do_backup = true; - $mysql_dump = '/usr/bin/mysqldump'; - } - elseif(is_file("/usr/local/bin/mysqldump")) - { - $do_backup = true; - $mysql_dump = '/usr/local/bin/mysqldump'; - } - else - { - $do_backup = false; - status_message('red', $lng['install']['backing_up_binary_missing']); - } - - if($do_backup) { - - $command = $mysql_dump . " " . $mysql_database . " -u " . $mysql_root_user . " --password='" . $mysql_root_pass . "' --result-file=" . $filename; - $output = exec($command); - - if(stristr($output, "error")) - { - status_message('red', $lng['install']['backing_up_failed']); - } - else - { - status_message('green', 'OK'); - } - - } - } - - //so first we have to delete the database and the user given for the unpriv-user if they exit - - status_message('begin', $lng['install']['erasing_old_db']); - $db_root->query("DELETE FROM `mysql`.`user` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'"); - $db_root->query("DELETE FROM `mysql`.`db` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'"); - $db_root->query("DELETE FROM `mysql`.`tables_priv` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'"); - $db_root->query("DELETE FROM `mysql`.`columns_priv` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'"); - $db_root->query("DROP DATABASE IF EXISTS `" . $db_root->escape(str_replace('`', '', $mysql_database)) . "` ;"); - $db_root->query("FLUSH PRIVILEGES;"); - status_message('green', 'OK'); - - //then we have to create a new user and database for the froxlor unprivileged mysql access - - status_message('begin', $lng['install']['create_mysqluser_and_db']); - $db_root->query("CREATE DATABASE `" . $db_root->escape(str_replace('`', '', $mysql_database)) . "`"); - $mysql_access_host_array = array_map('trim', explode(',', $mysql_access_host)); - - if(in_array('127.0.0.1', $mysql_access_host_array) - && !in_array('localhost', $mysql_access_host_array)) - { - $mysql_access_host_array[] = 'localhost'; - } - - if(!in_array('127.0.0.1', $mysql_access_host_array) - && in_array('localhost', $mysql_access_host_array)) - { - $mysql_access_host_array[] = '127.0.0.1'; - } - - $mysql_access_host_array[] = $serverip; - foreach($mysql_access_host_array as $mysql_access_host) - { - $db_root->query("GRANT ALL PRIVILEGES ON `" . $db_root->escape(str_replace('`', '', $mysql_database)) . "`.* TO '" . $db_root->escape($mysql_unpriv_user) . "'@'" . $db_root->escape($mysql_access_host) . "' IDENTIFIED BY 'password'"); - $db_root->query("SET PASSWORD FOR '" . $db_root->escape($mysql_unpriv_user) . "'@'" . $db_root->escape($mysql_access_host) . "' = PASSWORD('" . $db_root->escape($mysql_unpriv_pass) . "')"); - } - - $db_root->query("FLUSH PRIVILEGES;"); - $mysql_access_host = implode(',', $mysql_access_host_array); - status_message('green', 'OK'); - - //now a new database and the new froxlor-unprivileged-mysql-account have been created and we can fill it now with the data. - - status_message('begin', $lng['install']['testing_new_db']); - $db = new db($mysql_host, $mysql_unpriv_user, $mysql_unpriv_pass, $mysql_database); - status_message('green', 'OK'); - status_message('begin', $lng['install']['importing_data']); - $db_schema = './froxlor.sql'; - $sql_query = @file_get_contents($db_schema, 'r'); - $sql_query = remove_remarks($sql_query); - $sql_query = split_sql_file($sql_query, ';'); - for ($i = 0;$i < sizeof($sql_query);$i++) - { - if(trim($sql_query[$i]) != '') - { - $result = $db->query($sql_query[$i]); - } - } - - status_message('green', 'OK'); - status_message('begin', 'System Servername...'); - - if(validate_ip($_SERVER['SERVER_NAME'], true) !== false) - { - status_message('red', $lng['install']['servername_should_be_fqdn']); - } - else - { - status_message('green', 'OK'); - } - - //now let's change the settings in our settings-table - - status_message('begin', $lng['install']['changing_data']); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = 'admin@" . $db->escape($servername) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'adminmail'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($serverip) . "' WHERE `settinggroup` = 'system' AND `varname` = 'ipaddress'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($servername) . "' WHERE `settinggroup` = 'system' AND `varname` = 'hostname'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($version) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'version'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($languages[$language]) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'standardlanguage'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($mysql_access_host) . "' WHERE `settinggroup` = 'system' AND `varname` = 'mysql_access_host'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($webserver) . "' WHERE `settinggroup` = 'system' AND `varname` = 'webserver'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($httpuser) . "' WHERE `settinggroup` = 'system' AND `varname` = 'httpuser'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($httpgroup) . "' WHERE `settinggroup` = 'system' AND `varname` = 'httpgroup'"); - - if($webserver == "apache2") - { - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/apache2/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/apache2/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/apache2/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/apache2 reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'"); - } - elseif($webserver == "lighttpd") - { - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/conf-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/froxlor-diroptions/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/lighttpd reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/lighttpd.pem' WHERE `settinggroup` = 'system' AND `varname` = 'ssl_cert_file'"); - } - elseif($webserver == "nginx") - { - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'"); - $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/nginx reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'"); - } - - // insert the lastcronrun to be the installation date - $query = 'UPDATE `%s` SET `value` = UNIX_TIMESTAMP() WHERE `settinggroup` = \'system\' AND `varname` = \'lastcronrun\''; - $query = sprintf($query, TABLE_PANEL_SETTINGS); - $db->query($query); - - // set specific times for some crons (traffic only at night, etc.) - $ts = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time())); - $db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_traffic.php';"); - $ts = mktime(1, 0, 0, date('m', time()), date('d', time()), date('Y', time())); - $db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_used_tickets_reset.php';"); - $db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_ticketarchive.php';"); - - // and lets insert the default ip and port - $query = "INSERT INTO `".TABLE_PANEL_IPSANDPORTS."` - SET `ip`= '".$db->escape($serverip)."', - `port` = '80', - `namevirtualhost_statement` = '1', - `vhostcontainer` = '1', - `vhostcontainer_servername_statement` = '1'"; - $db->query($query); - $defaultip = $db->insert_id(); - - // insert the defaultip - $query = 'UPDATE `%s` SET `value` = \'%s\' WHERE `settinggroup` = \'system\' AND `varname` = \'defaultip\''; - $query = sprintf($query, TABLE_PANEL_SETTINGS, $db->escape($defaultip)); - $db->query($query); - status_message('green', 'OK'); - - //last but not least create the main admin - status_message('begin', $lng['install']['adding_admin_user']); - $db->query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` SET - `loginname` = '" . $db->escape($admin_user) . "', - `password` = '" . md5($admin_pass1) . "', - `name` = 'Siteadmin', - `email` = 'admin@" . $db->escape($servername) . "', - `def_language` = '". $db->escape($languages[$language]) . "', - `customers` = -1, - `customers_used` = 0, - `customers_see_all` = 1, - `caneditphpsettings` = 1, - `domains` = -1, - `domains_used` = 0, - `domains_see_all` = 1, - `change_serversettings` = 1, - `diskspace` = -1024, - `diskspace_used` = 0, - `mysqls` = -1, - `mysqls_used` = 0, - `emails` = -1, - `emails_used` = 0, - `email_accounts` = -1, - `email_accounts_used` = 0, - `email_forwarders` = -1, - `email_forwarders_used` = 0, - `email_quota` = -1, - `email_quota_used` = 0, - `ftps` = -1, - `ftps_used` = 0, - `tickets` = -1, - `tickets_used` = 0, - `tickets_see_all` = 1, - `subdomains` = -1, - `subdomains_used` = 0, - `traffic` = -1048576, - `traffic_used` = 0, - `deactivated` = 0, - `aps_packages` = -1, - `aps_packages_used` = 0, - `email_autoresponder` = -1, - `email_autoresponder_used` = 0"); - status_message('green', 'OK'); - - //now we create the userdata.inc.php with the mysql-accounts - status_message('begin', $lng['install']['creating_configfile']); - $userdata = ""; - - //we test now if we can store the userdata.inc.php in ../lib - if($fp = @fopen('../lib/userdata.inc.php', 'w')) - { - $result = @fputs($fp, $userdata, strlen($userdata)); - @fclose($fp); - status_message('green', $lng['install']['creating_configfile_succ']); - chmod('../lib/userdata.inc.php', 0440); - } - elseif($fp = @fopen('/tmp/userdata.inc.php', 'w')) - { - $result = @fputs($fp, $userdata, strlen($userdata)); - @fclose($fp); - status_message('orange', $lng['install']['creating_configfile_temp']); - chmod('/tmp/userdata.inc.php', 0440); - } - else - { - status_message('red', $lng['install']['creating_configfile_failed']); - echo "\t\t\n\t\t\t\n\t\t\n"; - } - -?> -

" . nl2br(htmlspecialchars($userdata)) . "

-

- -

-

- -

-
-
- -
-
- Froxlor Server Management Panel -
-
-

-
-
- Froxlor - Install -

-   - -

-

- - -

-
-
- -
-
-

-
-
- Froxlor - Install -

- -

-

-   - -

-

-   - -

-

-   - -

-

-   - -

-

-   - -

-

-   - -

-

- -

-

-   - -

-

-   - -

-

-   - -

-

- -

-

-   - -

-

-   - -

-

-   - />Apache2 -

-

-   - />LigHTTPd -

-

-   - />Nginx -

-

-   - -

-

-   - -

-

- - - - -

-
-
- -
-
-run(); diff --git a/install/lib/class.FroxlorInstall.php b/install/lib/class.FroxlorInstall.php new file mode 100644 index 00000000..5a2f7b5f --- /dev/null +++ b/install/lib/class.FroxlorInstall.php @@ -0,0 +1,1169 @@ + + * @author Froxlor team (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Classes + * + * @since 0.9.29.1 + * + */ + +/** + * Class FroxlorInstall + * + * Does the dirty work + * + * @copyright (c) the authors + * @author Michael Kaufmann + * @author Froxlor team (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Install + * + */ +class FroxlorInstall { + + /** + * define froxlor basepath e.g. /var/www/froxlor + * + * @var string + */ + private $_basepath = null; + + /** + * theme to use for the installation process + * + * @var string + */ + private $_theme = 'Sparkle'; + + /** + * language array + * + * @var array + */ + private $_lng = null; + + /** + * install data + * + * @var array + */ + private $_data = null; + + /** + * supported languages for install + */ + private $_languages = array( + 'german' => 'Deutsch', + 'english' => 'English' + ); + + /** + * currently used language + * @var unknown + */ + private $_activelng = 'english'; + + /** + * Class constructor + */ + public function __construct() { + $this->_basepath = dirname(dirname(dirname(__FILE__))); + $this->_data = array(); + } + + /** + * FC + */ + public function run() { + // send headers + $this->_sendHeaders(); + // check if we have a valid installation already + $this->_checkUserdataFile(); + // include the functions + require $this->_basepath.'/lib/functions.php'; + // include the MySQL-Table-Definitions + require $this->_basepath.'/lib/tables.inc.php'; + // include language + $this->_includeLanguageFile(); + // show the action + $this->_showPage(); + } + + /** + * build up and show the install-process-pages + */ + private function _showPage() { + // set theme for templates + $theme = $this->_theme; + eval("echo \"" . $this->_getTemplate("header") . "\";"); + // check install-state + if ((isset($_POST['installstep']) + && $_POST['installstep'] == '1') + || (isset($_GET['check']) && $_GET['check'] == '1') + ) { + $pagetitle = $this->_lng['install']['title']; + if ($this->_checkPostData()) { + // ceck data and create userdata etc.etc.etc. + $result = $this->_doInstall(); + } elseif (isset($_GET['check']) && $_GET['check'] == '1') { + // gather data + $result = $this->_showDataForm(); + } else { + // this should not happen + $result = array( + 'pagecontent' => "How did you manage to get here? Well, you shouldn't be here. Go back!", + 'pagenavigation' => '' + ); + } + } else { + // check for system-requirements first + $pagetitle = $this->_lng['requirements']['title']; + $result = $this->_requirementCheck(); + } + // output everything + $pagecontent = $result['pagecontent']; + $pagenavigation = $result['pagenavigation']; + eval("echo \"" . $this->_getTemplate("page") . "\";"); + $current_year = date('Y', time()); + eval("echo \"" . $this->_getTemplate("footer") . "\";"); + } + + /** + * gather data from $_POST if set; return true if all is set, + * false otherwise + * + * @return boolean + */ + private function _checkPostData() { + $this->_guessServerName(); + $this->_guessServerIP(); + $this->_guessWebserver(); + + $this->_getPostField('mysql_host', '127.0.0.1'); + $this->_getPostField('mysql_database', 'froxlor'); + $this->_getPostField('mysql_unpriv_user', 'froxlor'); + $this->_getPostField('mysql_unpriv_pass'); + $this->_getPostField('mysql_root_user', 'root'); + $this->_getPostField('mysql_root_pass'); + $this->_getPostField('admin_user', 'admin'); + $this->_getPostField('admin_pass1'); + $this->_getPostField('admin_pass2'); + $posixusername = posix_getpwuid(posix_getuid()); + $this->_getPostField('httpuser', $posixusername['name']); + $posixgroup = posix_getgrgid(posix_getgid()); + $this->_getPostField('httpgroup', $posixgroup['name']); + + if ($this->_data['mysql_host'] == 'localhost' + || $this->_data['mysql_host'] == '127.0.0.1' + ) { + $this->_data['mysql_access_host'] = $this->_data['mysql_host']; + } else { + $this->_data['mysql_access_host'] = $this->_data['serverip']; + } + + if (isset($_POST['installstep']) + && $_POST['installstep'] == '1' + && $this->_data['admin_pass1'] == $this->_data['admin_pass2'] + && $this->_data['admin_pass1'] != '' + && $this->_data['admin_pass2'] != '' + && $this->_data['mysql_unpriv_pass'] != '' + && $this->_data['mysql_root_pass'] != '' + && $this->_data['servername'] != '' + && $this->_data['serverip'] != '' + && $this->_data['httpuser'] != '' + && $this->_data['httpgroup'] != '' + && $this->_data['mysql_unpriv_user'] != $this->_data['mysql_root_user'] + ) { + return true; + } + return false; + } + + /** + * no missing fields or data -> perform actual install + * + * @return array + */ + private function _doInstall() { + + $content = ""; + + // check system-hostname to be a FQDN + $content .= $this->_status_message('begin', $this->_lng['install']['system_servername']); + if ($this->_validate_ip($_SERVER['SERVER_NAME'], true) !== false) { + $content .= $this->_status_message('red', $this->_lng['install']['servername_should_be_fqdn']); + } else { + $content .= $this->_status_message('green', 'OK'); + } + + // check for mysql-root-connection + $content .= $this->_status_message('begin', $this->_lng['install']['testing_mysql']); + $db_root = new db( + $this->_data['mysql_host'], + $this->_data['mysql_root_user'], + $this->_data['mysql_root_pass'], + '' + ); + // ok, if we are here, the database class is build up + // (otherwise it would have already die'd this script) + $content .= $this->_status_message('green', "OK"); + + // check for existing db + $content .= $this->_backupExistingDatabase($db_root); + // create unprivileged user and the database itself + $content .= $this->_createDatabaseAndUser($db_root); + // importing data to new database + $content .= $this->_importDatabaseData(); + // create DB object for new database + $db = new db( + $this->_data['mysql_host'], + $this->_data['mysql_unpriv_user'], + $this->_data['mysql_unpriv_pass'], + $this->_data['mysql_database'] + ); + // change settings accordingly + $content .= $this->_doSettings($db); + // create entries + $content .= $this->_doDataEntries($db); + // create config-file + $content .= $this->_createUserdataConf($db); + + $content .= "
"; + + // check if we have unrecoverable errors + $navigation = ''; + $msgcolor = 'green'; + $message = $this->_lng['install']['froxlor_succ_installed']; + $link = '../index.php'; + $linktext = $this->_lng['click_here_to_login']; + + eval("\$navigation .= \"" . $this->_getTemplate("pagebottom") . "\";"); + + return array('pagecontent' => $content, 'pagenavigation' => $navigation); + } + + /** + * Create userdata.inc.php file + */ + private function _createUserdataConf() { + + $content = ""; + + $content .= $this->_status_message('begin', $this->_lng['install']['creating_configfile']); + $userdata = "_data['mysql_host'], "'\\") . "';\n"; + $userdata.= "\$sql['user']='" . addcslashes($this->_data['mysql_unpriv_user'], "'\\") . "';\n"; + $userdata.= "\$sql['password']='" . addcslashes($this->_data['mysql_unpriv_pass'], "'\\") . "';\n"; + $userdata.= "\$sql['db']='" . addcslashes($this->_data['mysql_database'], "'\\") . "';\n"; + $userdata.= "\$sql_root[0]['caption']='Default';\n"; + $userdata.= "\$sql_root[0]['host']='" . addcslashes($this->_data['mysql_host'], "'\\") . "';\n"; + $userdata.= "\$sql_root[0]['user']='" . addcslashes($this->_data['mysql_root_user'], "'\\") . "';\n"; + $userdata.= "\$sql_root[0]['password']='" . addcslashes($this->_data['mysql_root_pass'], "'\\") . "';\n"; + $userdata.= "?>"; + + // test if we can store the userdata.inc.php in ../lib + if ($fp = @fopen(dirname(dirname(dirname(__FILE__))).'/lib/userdata.inc.php', 'w')) { + $result = @fputs($fp, $userdata, strlen($userdata)); + @fclose($fp); + $content .= $this->_status_message('green', 'OK'); + chmod('../lib/userdata.inc.php', 0440); + } + elseif ($fp = @fopen('/tmp/userdata.inc.php', 'w')) { + $result = @fputs($fp, $userdata, strlen($userdata)); + @fclose($fp); + $content .= $this->_status_message('orange', $this->_lng['install']['creating_configfile_temp']); + chmod('/tmp/userdata.inc.php', 0440); + } else { + $content .= $this->_status_message('red', $this->_lng['install']['creating_configfile_failed']); + $escpduserdata = nl2br(htmlspecialchars($userdata)); + eval("\$content .= \"" . $this->_getTemplate("textarea") . "\";"); + } + + return $content; + } + + /** + * create corresponding entries in froxlor database + * + * @param object $db + * + * @return string status messages + */ + private function _doDataEntries(&$db) { + + $content = ""; + + $content .= $this->_status_message('begin', $this->_lng['install']['creating_entries']); + + // and lets insert the default ip and port + $query = "INSERT INTO `".TABLE_PANEL_IPSANDPORTS."` + SET `ip`= '".$db->escape($this->_data['serverip'])."', + `port` = '80', + `namevirtualhost_statement` = '1', + `vhostcontainer` = '1', + `vhostcontainer_servername_statement` = '1'"; + $db->query($query); + $defaultip = $db->insert_id(); + + // insert the defaultip + $query = "UPDATE `".TABLE_PANEL_SETTINGS."` + SET `value` = '".$defaultip."' + WHERE `settinggroup` = 'system' AND `varname` = 'defaultip'"; + $db->query($query); + + $content .= $this->_status_message('green', 'OK'); + + //last but not least create the main admin + $content .= $this->_status_message('begin', $this->_lng['install']['adding_admin_user']); + $db->query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` SET + `loginname` = '" . $db->escape($this->_data['admin_user']) . "', + `password` = '" . md5($this->_data['admin_pass1']) . "', + `name` = 'Froxlor-Administrator', + `email` = 'admin@" . $db->escape($this->_data['servername']) . "', + `def_language` = '". $db->escape($this->_languages[$this->_activelng]) . "', + `customers` = -1, + `customers_see_all` = 1, + `caneditphpsettings` = 1, + `domains` = -1, + `domains_see_all` = 1, + `change_serversettings` = 1, + `diskspace` = -1024, + `mysqls` = -1, + `emails` = -1, + `email_accounts` = -1, + `email_forwarders` = -1, + `email_quota` = -1, + `ftps` = -1, + `tickets` = -1, + `tickets_see_all` = 1, + `subdomains` = -1, + `traffic` = -1048576, + `can_manage_aps_packages` = 1, + `aps_packages` = -1, + `email_autoresponder` = -1 + "); + + $content .= $this->_status_message('green', 'OK'); + + return $content; + } + + /** + * change settings according to users input + * + * @param object $db + * + * @return string status messages + */ + private function _doSettings(&$db) { + + $content = ""; + + $content .= $this->_status_message('begin', $this->_lng['install']['changing_data']); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = 'admin@" . $db->escape($this->_data['servername']) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'adminmail'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($this->_data['serverip']) . "' WHERE `settinggroup` = 'system' AND `varname` = 'ipaddress'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($this->_data['servername']) . "' WHERE `settinggroup` = 'system' AND `varname` = 'hostname'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($this->_languages[$this->_activelng]) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'standardlanguage'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($this->_data['mysql_access_host']) . "' WHERE `settinggroup` = 'system' AND `varname` = 'mysql_access_host'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($this->_data['webserver']) . "' WHERE `settinggroup` = 'system' AND `varname` = 'webserver'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($this->_data['httpuser']) . "' WHERE `settinggroup` = 'system' AND `varname` = 'httpuser'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($this->_data['httpgroup']) . "' WHERE `settinggroup` = 'system' AND `varname` = 'httpgroup'"); + + // necessary changes for webservers != apache2 + if ($this->_data['webserver'] == "lighttpd") { + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/conf-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/froxlor-diroptions/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/lighttpd reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/lighttpd.pem' WHERE `settinggroup` = 'system' AND `varname` = 'ssl_cert_file'"); + } elseif ($this->_data['webserver'] == "nginx") { + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/nginx reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'"); + $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/nginx.pem' WHERE `settinggroup` = 'system' AND `varname` = 'ssl_cert_file'"); + } + + // insert the lastcronrun to be the installation date + $query = "UPDATE `".TABLE_PANEL_SETTINGS."` SET `value` = UNIX_TIMESTAMP() + WHERE `settinggroup` = 'system' AND `varname` = 'lastcronrun'"; + $db->query($query); + + // set specific times for some crons (traffic only at night, etc.) + $ts = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time())); + $db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_traffic.php';"); + $ts = mktime(1, 0, 0, date('m', time()), date('d', time()), date('Y', time())); + $db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_used_tickets_reset.php';"); + $db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_ticketarchive.php';"); + + $content .= $this->_status_message('green', 'OK'); + + return $content; + } + + /** + * Import froxlor.sql into database + * + * @param object $db_root + * + * @return string status messages + */ + private function _importDatabaseData() { + $content = ""; + + $content .= $this->_status_message('begin', $this->_lng['install']['testing_new_db']); + $db = new db( + $this->_data['mysql_host'], + $this->_data['mysql_unpriv_user'], + $this->_data['mysql_unpriv_pass'], + $this->_data['mysql_database'] + ); + $content .= $this->_status_message('green', 'OK'); + + $content .= $this->_status_message('begin', $this->_lng['install']['importing_data']); + $db_schema = dirname(dirname(__FILE__)).'/froxlor.sql'; + $sql_query = @file_get_contents($db_schema); + $sql_query = $this->_remove_remarks($sql_query); + $sql_query = $this->_split_sql_file($sql_query, ';'); + for ($i = 0; $i < sizeof($sql_query); $i++) { + if (trim($sql_query[$i]) != '') { + $result = $db->query($sql_query[$i]); + } + } + $db->close(); + + $content .= $this->_status_message('green', 'OK'); + } + + /** + * Create database and database-user + * + * @param object $db_root + * + * @return string status messages + */ + private function _createDatabaseAndUser(&$db_root) { + + $content = ""; + + // so first we have to delete the database and + // the user given for the unpriv-user if they exit + $content .= $this->_status_message('begin', $this->_lng['install']['prepare_db']); + $db_root->query("DELETE FROM `mysql`.`user` WHERE `User` = '" . $db_root->escape($this->_data['mysql_unpriv_user']) . "' AND `Host` = '" . $db_root->escape($this->_data['mysql_access_host']) . "'"); + $db_root->query("DELETE FROM `mysql`.`db` WHERE `User` = '" . $db_root->escape($this->_data['mysql_unpriv_user']) . "' AND `Host` = '" . $db_root->escape($this->_data['mysql_access_host']) . "'"); + $db_root->query("DELETE FROM `mysql`.`tables_priv` WHERE `User` = '" . $db_root->escape($this->_data['mysql_unpriv_user']) . "' AND `Host` = '" . $db_root->escape($this->_data['mysql_access_host']) . "'"); + $db_root->query("DELETE FROM `mysql`.`columns_priv` WHERE `User` = '" . $db_root->escape($this->_data['mysql_unpriv_user']) . "' AND `Host` = '" . $db_root->escape($this->_data['mysql_access_host']) . "'"); + $db_root->query("DROP DATABASE IF EXISTS `" . $db_root->escape(str_replace('`', '', $this->_data['mysql_database'])) . "` ;"); + $db_root->query("FLUSH PRIVILEGES;"); + $content .= $this->_status_message('green', 'OK'); + + // we have to create a new user and database for the froxlor unprivileged mysql access + $content .= $this->_status_message('begin', $this->_lng['install']['create_mysqluser_and_db']); + $db_root->query("CREATE DATABASE `" . $db_root->escape(str_replace('`', '', $this->_data['mysql_database'])) . "`"); + $mysql_access_host_array = array_map('trim', explode(',', $this->_data['mysql_access_host'])); + + if (in_array('127.0.0.1', $mysql_access_host_array) + && !in_array('localhost', $mysql_access_host_array) + ) { + $mysql_access_host_array[] = 'localhost'; + } + + if (!in_array('127.0.0.1', $mysql_access_host_array) + && in_array('localhost', $mysql_access_host_array) + ) { + $mysql_access_host_array[] = '127.0.0.1'; + } + + $mysql_access_host_array[] = $this->_data['serverip']; + foreach ($mysql_access_host_array as $mysql_access_host) { + $db_root->query("GRANT ALL PRIVILEGES ON `" . $db_root->escape(str_replace('`', '', $this->_data['mysql_database'])) . "`.* TO '" . $db_root->escape($this->_data['mysql_unpriv_user']) . "'@'" . $db_root->escape($mysql_access_host) . "' IDENTIFIED BY 'password'"); + $db_root->query("SET PASSWORD FOR '" . $db_root->escape($this->_data['mysql_unpriv_user']) . "'@'" . $db_root->escape($mysql_access_host) . "' = PASSWORD('" . $db_root->escape($this->_data['mysql_unpriv_pass']) . "')"); + } + + $db_root->query("FLUSH PRIVILEGES;"); + $this->_data['mysql_access_host'] = implode(',', $mysql_access_host_array); + $content .= $this->_status_message('green', 'OK'); + + return $content; + } + + /** + * Check if an old database exists and back it up if necessary + * + * @param object $db_root + * + * @return string status messages + */ + private function _backupExistingDatabase(&$db_root) { + + $content = ""; + + // check for existing of former database + $tables_exist = false; + $sql = "SHOW TABLES FROM `".$this->_data['mysql_database']."`"; + $result = $db_root->query($sql); + + // check result + if ($result !== false && $db_root->num_rows($result) > 0) { + $tables_exist = true; + } + + if ($tables_exist) { + // tell whats going on + $content .= $this->_status_message('begin', $this->_lng['install']['backup_old_db']); + + // create temporary backup-filename + $filename = "/tmp/froxlor_backup_" . date('YmdHi') . ".sql"; + + // look for mysqldump + $do_backup = false; + if (file_exists("/usr/bin/mysqldump")) { + $do_backup = true; + $mysql_dump = '/usr/bin/mysqldump'; + } elseif (file_exists("/usr/local/bin/mysqldump")) { + $do_backup = true; + $mysql_dump = '/usr/local/bin/mysqldump'; + } + + if ($do_backup) { + $command = $mysql_dump." ".$this->_data['mysql_database']." -u " . $this->_data['mysql_root_user'] . " -password='" . $this->_data['mysql_root_pass'] . "' --result-file=" . $filename; + $output = exec($command); + if (stristr($output, "error")) { + $content .= $this->_status_message('red', $this->_lng['install']['backup_failed']); + } else { + $content .= $this->_status_message('green', 'OK ('.$filename.')'); + } + } else { + $content .= $this->_status_message('red', $this->_lng['install']['backup_binary_missing']); + } + } + + return $content; + } + + /** + * show form to collect all needed data for the install + */ + private function _showDataForm() { + + $content = ""; + // form action + $formaction = htmlspecialchars($_SERVER['PHP_SELF']); + if (isset($_GET['check'])) { + $formaction .= '?check='.(int)$_GET['check']; + } + // language selection + $language_options = ''; + while (list($language_file, $language_name) = each($this->_languages)) { + $language_options.= makeoption($language_name, $language_file, $this->_activelng, true, true); + } + // get language-form-template + eval("\$content .= \"" . $this->_getTemplate("lngform") . "\";"); + + // form-data + $formdata = ""; + /** + * Database + */ + $section = $this->_lng['install']['database']; + eval("\$formdata .= \"" . $this->_getTemplate("datasection") . "\";"); + // host + $formdata .= $this->_getSectionItemString('mysql_host', true); + // database + $formdata .= $this->_getSectionItemString('mysql_database', true); + // unpriv-user has to be different from root + if ($this->_data['mysql_unpriv_user'] == $this->_data['mysql_root_user']) { + $style = 'color:blue;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('mysql_unpriv_user', true, $style); + // is we posted and no password was given -> red + if (!empty($_POST['installstep']) && $this->_data['mysql_unpriv_pass'] == '') { + $style = 'color:red;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('mysql_unpriv_pass', true, $style, 'password'); + // unpriv-user has to be different from root + if ($this->_data['mysql_unpriv_user'] == $this->_data['mysql_root_user']) { + $style = 'color:blue;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('mysql_root_user', true, $style); + // is we posted and no password was given -> red + if (!empty($_POST['installstep']) && $this->_data['mysql_root_pass'] == '') { + $style = 'color:red;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('mysql_root_pass', true, $style, 'password'); + + /** + * admin data + */ + $section = $this->_lng['install']['admin_account']; + eval("\$formdata .= \"" . $this->_getTemplate("datasection") . "\";"); + // user + $formdata .= $this->_getSectionItemString('admin_user', true); + // check for admin passwords to be equal + if (!empty($_POST['installstep']) && + ($this->_data['admin_pass1'] == '' + || $this->_data['admin_pass1'] != $this->_data['admin_pass2']) + ) { + $style = 'color:red;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('admin_pass1', true, $style, 'password'); + // check for admin passwords to be equal + if (!empty($_POST['installstep']) && + ($this->_data['admin_pass2'] == '' + || $this->_data['admin_pass1'] != $this->_data['admin_pass2']) + ) { + $style = 'color:red;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('admin_pass2', true, $style, 'password'); + + /** + * Server data + */ + $section = $this->_lng['install']['serversettings']; + eval("\$formdata .= \"" . $this->_getTemplate("datasection") . "\";"); + // servername + if (!empty($_POST['installstep']) && $this->_data['servername'] == '') { + $style = 'color:red;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('servername', true, $style); + // serverip + if (!empty($_POST['installstep']) && $this->_data['serverip'] == '') { + $style = 'color:red;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('serverip', true, $style); + // webserver + if (!empty($_POST['installstep']) && $this->_data['webserver'] == '') { + $websrvstyle = 'color:red;'; + } else { $websrvstyle = ''; + } + // apache + $formdata .= $this->_getSectionItemCheckbox('apache2', ($this->_data['webserver'] == 'apache2'), $websrvstyle); + // lighttpd + $formdata .= $this->_getSectionItemCheckbox('lighttpd', ($this->_data['webserver'] == 'lighttpd'), $websrvstyle); + // nginx + $formdata .= $this->_getSectionItemCheckbox('nginx', ($this->_data['webserver'] == 'nginx'), $websrvstyle); + // webserver-user + if (!empty($_POST['installstep']) && $this->_data['httpuser'] == '') { + $style = 'color:red;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('httpuser', true, $style); + // webserver-group + if (!empty($_POST['installstep']) && $this->_data['httpgroup'] == '') { + $style = 'color:red;'; + } else { $style = ''; + } + $formdata .= $this->_getSectionItemString('httpgroup', true, $style); + + // get data-form-template + $language = htmlspecialchars($this->_activelng); + eval("\$content .= \"" . $this->_getTemplate("dataform2") . "\";"); + + $navigation = ''; + return array('pagecontent' => $content, 'pagenavigation' => $navigation); + } + + /** + * generate form input field + * + * @param string $fieldname + * @param boolean $required + * @param string $style optional css + * @param string $type optional type of input-box (default: text) + * + * @return string + */ + private function _getSectionItemString($fieldname = null, $required = false, $style = "", $type = 'text') { + $fieldlabel = $this->_lng['install'][$fieldname]; + $fieldvalue = htmlspecialchars($this->_data[$fieldname]); + if ($required) { + $required = ' required="required"'; + } + $sectionitem = ""; + eval("\$sectionitem .= \"" . $this->_getTemplate("dataitem") . "\";"); + return $sectionitem; + } + + /** + * generate form checkbox field + * + * @param string $fieldname + * @param boolean $required + * @param string $style + * + * @return string + */ + private function _getSectionItemCheckbox($fieldname = null, $checked = false, $style = "") { + $fieldlabel = $this->_lng['install'][$fieldname]; + if ($checked) { + $checked = 'checked="checked"'; + } + $sectionitem = ""; + eval("\$sectionitem .= \"" . $this->_getTemplate("dataitemchk") . "\";"); + return $sectionitem; + } + + /** + * check for requirements froxlor needs + */ + private function _requirementCheck() { + + // indicator whether we need to abort or not + $_die = false; + + $content = ""; + + // check for correct php version + $content .= $this->_status_message('begin', $this->_lng['requirements']['phpversion']); + + if (version_compare("5.2.0", PHP_VERSION, ">=")) { + $content .= $this->_status_message('red', $this->_lng['requirements']['notfound'].' ('.PHP_VERSION.')'); + $_die = true; + } else { + $content .= $this->_status_message('green', PHP_VERSION); + } + + // Check if magic_quotes_runtime is active + $content .= $this->_status_message('begin', $this->_lng['requirements']['phpmagic_quotes_runtime']); + if (get_magic_quotes_runtime()) { + // deactivate it + set_magic_quotes_runtime(false); + $content .= $this->_status_message('orange', $this->_lng['requirements']['not_true'] . "
". $this->_lng['requirements']['phpmagic_quotes_runtime_description']); + } else { + $content .= $this->_status_message('green', 'off'); + } + + // check for mysql-extension + // @FIXME mysql extension will soon be deprecated and removed!!! + $content .= $this->_status_message('begin', $this->_lng['requirements']['phpmysql']); + + if (!extension_loaded('mysql') && !extension_loaded('mysqlnd')) { + $content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']); + $_die = true; + } else { + $content .= $this->_status_message('green', $this->_lng['requirements']['installed']); + } + + // check for xml-extension + $content .= $this->_status_message('begin', $this->_lng['requirements']['phpxml']); + + if (!extension_loaded('xml')) { + $content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']); + $_die = true; + } else { + $content .= $this->_status_message('green', $this->_lng['requirements']['installed']); + } + + // check for filter-extension + $content .= $this->_status_message('begin', $this->_lng['requirements']['phpfilter']); + + if (!extension_loaded('filter')) { + $content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']); + $_die = true; + } else { + $content .= $this->_status_message('green', $this->_lng['requirements']['installed']); + } + + // check for posix-extension + $content .= $this->_status_message('begin', $this->_lng['requirements']['phpposix']); + + if (!extension_loaded('posix')) { + $content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']); + $_die = true; + } else { + $content .= $this->_status_message('green', $this->_lng['requirements']['installed']); + } + + // check for bcmath extension + $content .= $this->_status_message('begin', $this->_lng['requirements']['phpbcmath']); + + if (!extension_loaded('bcmath')) { + $content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "
" . $this->_lng['requirements']['bcmathdescription']); + } else { + $content .= $this->_status_message('green', $this->_lng['requirements']['installed']); + } + + // check for open_basedir + $content .= $this->_status_message('begin', $this->_lng['requirements']['openbasedir']); + $php_ob = @ini_get("open_basedir"); + if (!empty($php_ob) && $php_ob != '') { + $content .= $this->_status_message('orange', $this->_lng['requirements']['activated'] . "
" . $this->_lng['requirements']['openbasedirenabled']); + } else { + $content .= $this->_status_message('green', 'off'); + } + $content .= "
"; + + // check if we have unrecoverable errors + $navigation = ''; + if ($_die) { + $msgcolor = 'red'; + $message = $this->_lng['requirements']['diedbecauseofrequirements']; + $link = htmlspecialchars($_SERVER['PHP_SELF']); + $linktext = $this->_lng['click_here_to_refresh']; + } else { + $msgcolor = 'green'; + $message = $this->_lng['requirements']['froxlor_succ_checks']; + $link = htmlspecialchars($_SERVER['PHP_SELF']).'?check=1'; + $linktext = $this->_lng['click_here_to_continue']; + } + eval("\$navigation .= \"" . $this->_getTemplate("pagebottom") . "\";"); + + return array('pagecontent' => $content, 'pagenavigation' => $navigation); + } + + /** + * send no-caching headers and set the default timezone + */ + private function _sendHeaders() { + // no caching + header("Cache-Control: no-store, no-cache, must-revalidate"); + header("Pragma: no-cache"); + header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time())); + header('Expires: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time())); + + // ensure that default timezone is set + if (function_exists("date_default_timezone_set") + && function_exists("date_default_timezone_get") + ) { + @date_default_timezone_set(@date_default_timezone_get()); + } + } + + /** + * check for the userdata - if it exists then froxlor is + * already installed and we show a nice note + */ + private function _checkUserDataFile() { + $userdata = $this->_basepath.'/lib/userdata.inc.php'; + if (file_exists($userdata)) { + // includes the usersettings (MySQL-Username/Passwort) + // to test if Froxlor is already installed + require $this->_basepath.'/lib/userdata.inc.php'; + + if (isset($sql) + && is_array($sql) + ) { + // use sparkle theme for the notice + $installed_hint = file_get_contents($this->_basepath.'/templates/Sparkle/misc/alreadyinstalledhint.tpl'); + die($installed_hint); + } + } + } + + /** + * include the chose language or else default (english) + */ + private function _includeLanguageFile() { + // set default + $standardlanguage = 'english'; + + // check either _GET or _POST + if (isset($_GET['language']) + && isset($this->_languages[$_GET['language']]) + ) { + $this->_activelng = $_GET['language']; + } elseif (isset($_POST['language']) + && isset($this->_languages[$_POST['language']]) + ) { + $this->_activelng = $_POST['language']; + } else { + // try to guess the right language + $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); + switch ($lang) { + case "de": + $this->_activelng = 'german'; + break; + case "fr": + $this->_activelng = 'french'; + break; + default: + $this->_activelng = $standardlanguage; + break; + } + } + + $lngfile = $this->_basepath.'/install/lng/' . $this->_activelng . '.lng.php'; + if (file_exists($lngfile)) { + // includes file /lng/$language.lng.php if it exists + require $lngfile; + $this->_lng = $lng; + } + } + + /** + * Get template from filesystem + * + * @param string $template name of the template including subdirectory + * + * @return string + */ + private function _getTemplate($template = null) { + // build filename + $filename = $this->_basepath.'/install/templates/' . $template . '.tpl'; + // check existance + if(file_exists($filename) + && is_readable($filename) + ) { + $templatefile = addcslashes(file_get_contents($filename), '"\\'); + // loop through template more than once in case we have an "if"-statement in another one + while (preg_match('/(.*)(<\/if>|(.*)<\/if>)/Uis', $templatefile)) { + $templatefile = preg_replace('/(.*)(<\/if>|(.*)<\/if>)/Uis', '".( ($1) ? ("$2") : ("$4") )."', $templatefile); + } + } else { + $templatefile = 'TEMPLATE NOT FOUND: ' . $filename; + } + + return $templatefile; + } + + /** + * output status + * + * @param string $case + * @param string $text + * + * @return string + */ + private function _status_message($case, $text) { + if ($case == 'begin') { + return ''.$text; + } else { + return ''.$text.''; + } + } + + /** + * get/guess servername + */ + private function _guessServerName() { + // from form? + if (!empty($_POST['servername'])) { + $this->_data['servername'] = $_POST['servername']; + return; + // from $_SERVER + } else if (!empty($_SERVER['SERVER_NAME'])) { + // no ips + if ($this->_validate_ip($_SERVER['SERVER_NAME']) == false) { + $this->_data['servername'] = $_SERVER['SERVER_NAME']; + return; + } + } + // empty + $this->_data['servername'] = ''; + } + + /** + * get/guess serverip + */ + private function _guessServerIP() { + // from form + if (!empty($_POST['serverip'])) { + $this->_data['serverip'] = $_POST['serverip']; + return; + // from $_SERVER + } elseif(!empty($_SERVER['SERVER_ADDR'])) { + $this->_data['serverip'] = $_SERVER['SERVER_ADDR']; + return; + } + // empty + $this->_data['serverip'] = ''; + } + + /** + * get/guess webserver-software + */ + private function _guessWebserver() { + // post + if (!empty($_POST['webserver'])) { + $this->_data['webserver'] = $_POST['webserver']; + } else { + if (strtoupper(@php_sapi_name()) == "APACHE2HANDLER" + || stristr($_SERVER['SERVER_SOFTWARE'], "apache/2") + ) { + $this->_data['webserver'] = 'apache2'; + } elseif(substr(strtoupper(@php_sapi_name()), 0, 8) == "LIGHTTPD" + || stristr($_SERVER['SERVER_SOFTWARE'], "lighttpd") + ) { + $this->_data['webserver'] = 'lighttpd'; + } elseif(substr(strtoupper(@php_sapi_name()), 0, 8) == "NGINX" + || stristr($_SERVER['SERVER_SOFTWARE'], "nginx") + ) { + $this->_data['webserver'] = 'nginx'; + } else { + // we don't need to bail out, since unknown does not affect any critical installation routines + $this->_data['webserver'] = 'unknown'; + } + } + } + + /** + * check if POST field is set and get value for the + * internal data array, if not set use either '' or $default if != null + * + * @param string $fieldname + * @param string $default + * + */ + private function _getPostField($fieldname = null, $default = null) { + // initialize + $this->_data[$fieldname] = ''; + // set default + if ($default !== null) { + $this->_data[$fieldname] = $default; + } + // check field + if (!empty($_POST[$fieldname])) { + $this->_data[$fieldname] = $_POST[$fieldname]; + } + } + + /** + * check whether the given parameter is an ip-address or not + * + * @param string $ip + * + * @return boolean|string + */ + private function _validate_ip($ip = null) { + if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false + && filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false + && filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE) === false + ) { + return false; + } + return $ip; + } + + /** + * remove marks from sql + * + * @param string $sql + * + * @return string + */ + private function _remove_remarks($sql) { + + $lines = explode("\n", $sql); + // try to keep mem. use down + $sql = ""; + $linecount = count($lines); + $output = ""; + for ($i = 0; $i < $linecount; $i++) { + if ($i != ($linecount - 1) + || strlen($lines[$i]) > 0 + ) { + if (substr($lines[$i], 0, 1) != "#") { + $output .= $lines[$i] . "\n"; + } else { + $output .= "\n"; + } + // Trading a bit of speed for lower mem. use here. + $lines[$i] = ""; + } + } + return $output; + } + + /** + * split_sql_file will split an uploaded sql file into single sql statements. + * Note: expects trim() to have already been run on $sql + * + * The whole function has been taken from the phpbb installer, + * copyright by the phpbb team, phpbb in summer 2004. + */ + private function _split_sql_file($sql, $delimiter) { + + // Split up our string into "possible" SQL statements. + $tokens = explode($delimiter, $sql); + + // try to save mem. + $sql = ""; + $output = array(); + + // we don't actually care about the matches preg gives us. + $matches = array(); + + // this is faster than calling count($oktens) every time thru the loop. + $token_count = count($tokens); + for ($i = 0; $i < $token_count; $i++) { + // Don't wanna add an empty string as the last thing in the array. + if (($i != ($token_count - 1)) + || (strlen($tokens[$i] > 0)) + ) { + // This is the total number of single quotes in the token. + $total_quotes = preg_match_all("/'/", $tokens[$i], $matches); + + // Counts single quotes that are preceded by an odd number of backslashes, + // which means they're escaped quotes. + $escaped_quotes = preg_match_all("/(?= 5.2'; +$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...'; +$lng['requirements']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off". We have disabled it temporary for now please fix the coresponding php.ini.'; +$lng['requirements']['phpmysql'] = 'MySQL-extension...'; +$lng['requirements']['phpxml'] = 'PHP XML-extension...'; +$lng['requirements']['phpfilter'] = 'PHP filter-extension...'; +$lng['requirements']['phpposix'] = 'PHP posix-extension...'; +$lng['requirements']['phpbcmath'] = 'PHP bcmath-extension...'; +$lng['requirements']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!'; +$lng['requirements']['openbasedir'] = 'open_basedir...'; +$lng['requirements']['openbasedirenabled'] = 'Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor in the coresponding php.ini'; +$lng['requirements']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Try to fix them and retry.'; +$lng['requirements']['froxlor_succ_checks'] = 'All requirements are satisfied'; -$lng['install']['language'] = 'Installation - Language'; -$lng['install']['welcome'] = 'Welcome to Froxlor Installation'; +$lng['install']['title'] = 'Froxlor install - chose language'; +$lng['install']['language'] = 'Installation language'; +$lng['install']['lngbtn_go'] = 'Change language'; +$lng['install']['title'] = 'Froxlor install - setup'; $lng['install']['welcometext'] = 'Thank you for choosing Froxlor. Please fill out the following fields with the required information to start the installation.
Attention: If the database you chose for Froxlor already exists on your System, it will be erased with all containing data!'; -$lng['install']['database'] = 'Database'; -$lng['install']['mysql_hostname'] = 'MySQL-Hostname'; -$lng['install']['mysql_database'] = 'MySQL-Database'; +$lng['install']['database'] = 'Database connection'; +$lng['install']['mysql_host'] = 'MySQL-Hostname'; +$lng['install']['mysql_database'] = 'Database name'; $lng['install']['mysql_unpriv_user'] = 'Username for the unprivileged MySQL-account'; $lng['install']['mysql_unpriv_pass'] = 'Password for the unprivileged MySQL-account'; $lng['install']['mysql_root_user'] = 'Username for the MySQL-root-account'; $lng['install']['mysql_root_pass'] = 'Password for the MySQL-root-account'; $lng['install']['admin_account'] = 'Administrator Account'; $lng['install']['admin_user'] = 'Administrator Username'; -$lng['install']['admin_pass'] = 'Administrator Password'; -$lng['install']['admin_pass_confirm'] = 'Administrator-Password (confirm)'; +$lng['install']['admin_pass1'] = 'Administrator Password'; +$lng['install']['admin_pass2'] = 'Administrator-Password (confirm)'; $lng['install']['serversettings'] = 'Server settings'; $lng['install']['servername'] = 'Server name (FQDN)'; $lng['install']['serverip'] = 'Server IP'; +$lng['install']['webserver'] = 'Webserver'; +$lng['install']['apache2'] = 'Apache 2'; +$lng['install']['lighttpd'] = 'LigHTTPd'; +$lng['install']['nginx'] = 'NGINX'; $lng['install']['httpuser'] = 'HTTP username'; $lng['install']['httpgroup'] = 'HTTP groupname'; -$lng['install']['apacheversion'] = 'Apacheversion'; -$lng['install']['next'] = 'Next'; -$lng['install']['installdata'] = 'Installation - Data'; - -/** - * Progress - */ - -$lng['install']['testing_mysql'] = 'Testing if MySQL-root-username and password are correct...'; -$lng['install']['erasing_old_db'] = 'Erasing old Database...'; -$lng['install']['backup_old_db'] = 'Create backup of the old Database...'; -$lng['install']['backing_up'] = 'Backing up'; -$lng['install']['backing_up_binary_missing'] = '/usr/bin/mysqldump is missing'; -$lng['install']['create_mysqluser_and_db'] = 'Creating MySQL-database and username...'; -$lng['install']['testing_new_db'] = 'Testing if MySQL-database and username have been created correctly...'; -$lng['install']['importing_data'] = 'Importing data into MySQL-database...'; -$lng['install']['changing_data'] = 'Changing imported data...'; -$lng['install']['adding_admin_user'] = 'Adding Administrator Account...'; -$lng['install']['creating_configfile'] = 'Creating configfile...'; -$lng['install']['creating_configfile_succ'] = 'OK, userdata.inc.php was saved in lib/.'; -$lng['install']['creating_configfile_temp'] = 'File was saved in /tmp/userdata.inc.php, please move to lib/.'; -$lng['install']['creating_configfile_failed'] = 'Cannot create lib/userdata.inc.php, please create it manually with the following data:'; -$lng['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.'; -$lng['install']['click_here_to_login'] = 'Click here to login.'; -$lng['install']['phpmysql'] = 'Testing if PHP MySQL-extension is installed...'; -$lng['install']['phpfilter'] = 'Testing if PHP filter-extension is installed...'; -$lng['install']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Aborting...'; -$lng['install']['notinstalled'] = 'not installed!'; -$lng['install']['phpbcmath'] = 'Testing if PHP bcmath-extension is installed...'; -$lng['install']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!'; -$lng['install']['openbasedir'] = 'Testing if open_basedir is enabled...'; -$lng['install']['openbasedirenabled'] = 'enabled. Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor'; - -/** - * ADDED IN 1.2.19-svn7 - */ +$lng['install']['system_servername'] = 'System ServerName'; $lng['install']['servername_should_be_fqdn'] = 'The servername should be a FQDN and not an IP address'; +$lng['install']['testing_mysql'] = 'Checking MySQL-root access...'; +$lng['install']['backup_old_db'] = 'Creating backup of old database...'; +$lng['install']['backup_binary_missing'] = 'Could not find mysqldump'; +$lng['install']['backup_failed'] = 'Could not backup database'; +$lng['install']['prepare_db'] = 'Preparing database...'; +$lng['install']['create_mysqluser_and_db'] = 'Creating database and username...'; +$lng['install']['testing_new_db'] = 'Testing if database and user have been created correctly...'; +$lng['install']['importing_data'] = 'Importing data...'; +$lng['install']['changing_data'] = 'Adjusting settings...'; +$lng['install']['creating_entries'] = 'Inserting new values...'; +$lng['install']['adding_admin_user'] = 'Creating admin-account...'; +$lng['install']['creating_configfile'] = 'Creating configfile...'; +$lng['install']['creating_configfile_temp'] = 'File was saved in /tmp/userdata.inc.php, please move to lib/.'; +$lng['install']['creating_configfile_failed'] = 'Could not create lib/userdata.inc.php, please create it manually with the following content:'; +$lng['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.'; -/** - * Renamed in 1.2.19-svn40 - */ - -$lng['install']['webserver'] = 'Webserver'; - -/* - * Added in Froxlor 0.9 - */ -$lng['install']['phpversion'] = 'Checking for PHP version >= 5.2'; -$lng['install']['phpposix'] = 'Testing if PHP posix-extension is installed...'; - -/* - * Added in Froxlor 0.9.4 - */ -$lng['install']['click_here_to_refresh'] = 'Re-check'; -$lng['install']['click_here_to_continue'] = 'Continue installation'; -$lng['install']['froxlor_succ_checks'] = 'All requirements are satisfied'; - -/* - * Added in Froxlor 0.9.13 - */ -$lng['install']['phpmagic_quotes_runtime'] = 'Checking whether magic_quotes_runtime is off'; -$lng['install']['active'] = 'no'; -$lng['install']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off" in order to avoid strange behavior of Froxlor. Disabling it for now (this is only temporary, please fix our php.ini).'; -$lng['install']['phpxml'] = 'Testing if PHP XML-extension is installed...'; -?> +$lng['click_here_to_refresh'] = 'Click here to check again'; +$lng['click_here_to_continue'] = 'Click here to continue'; +$lng['click_here_to_login'] = 'Click here to login.'; diff --git a/install/lng/french.lng.php b/install/lng/french.lng.php deleted file mode 100644 index ad3d9862..00000000 --- a/install/lng/french.lng.php +++ /dev/null @@ -1,79 +0,0 @@ - - * @author Romain MARIADASSOU - * @author Froxlor Team - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Language - * - */ - -/** - * Begin - */ - -$lng['install']['language'] = 'Langue d\'installation'; -$lng['install']['welcome'] = 'Bienvenue � l\'installation de Froxlor'; -$lng['install']['welcometext'] = 'Merci beaucoup d\'avoir choisi Froxlor. Pour installer Froxlor remplissez les cases ci-dessous avec les informations demand�es.
Attention : Si vous entrez le nom d\'une base de donn�es existante, celle-ci sera effac�e !'; -$lng['install']['database'] = 'Base de donn�es'; -$lng['install']['mysql_hostname'] = 'Nom d\'h�te du serveur MySQL'; -$lng['install']['mysql_database'] = 'Base de donn�es MySQL'; -$lng['install']['mysql_unpriv_user'] = 'Utilisateur pour l\'acc�s non privil�gi� � MySQL'; -$lng['install']['mysql_unpriv_pass'] = 'Mot de passe pour l\'acc�s non privil�gi� � MySQL'; -$lng['install']['mysql_root_user'] = 'Utilisateur pour l\'acc�s root � MySQL'; -$lng['install']['mysql_root_pass'] = 'Mot de passe pour l\'acc�s root � MySQL'; -$lng['install']['admin_account'] = 'Acc�s administratif'; -$lng['install']['admin_user'] = 'Login de l\'administrateur'; -$lng['install']['admin_pass'] = 'Mot de passe de l\'administrateur'; -$lng['install']['admin_pass_confirm'] = 'Mot de passe de l\'administrateur (confirmation)'; -$lng['install']['serversettings'] = 'Configuration du serveur'; -$lng['install']['servername'] = 'Nom du serveur (FQDN)'; -$lng['install']['serverip'] = 'Adresse IP du serveur'; -$lng['install']['apacheversion'] = 'Version du serveur Apache'; -$lng['install']['next'] = 'Continuer'; -$lng['install']['installdata'] = 'Installation - Data'; - -/** - * Progress - */ - -$lng['install']['testing_mysql'] = 'V�rification du login root de MySQL ...'; -$lng['install']['erasing_old_db'] = 'Effacement de l\'ancienne base de donn�es ...'; -$lng['install']['create_mysqluser_and_db'] = 'Cr�ation de la base de donn�es puis des utilisateurs ...'; -$lng['install']['testing_new_db'] = 'V�rification de la base de donn�es et des utilisateurs ...'; -$lng['install']['importing_data'] = 'Importation des informations dans la base de donn�es ...'; -$lng['install']['changing_data'] = 'Modification des donn�es import�s ...'; -$lng['install']['adding_admin_user'] = 'Ajout de l\'utilisateur administrateur ...'; -$lng['install']['creating_configfile'] = 'Cr�ation du fichier de configuration ...'; -$lng['install']['creating_configfile_succ'] = 'OK, userdata.inc.php a �t� sauvegard� dans le dossier lib/ de Froxlor.'; -$lng['install']['creating_configfile_temp'] = 'Le fichier a �t� sauvegard� dans /tmp/userdata.inc.php, veuillez le d�placer / copier dans le dossier lib/ de Froxlor.'; -$lng['install']['creating_configfile_failed'] = 'Erreur en cr�ant le fichier lib/userdata.inc.php, veuillez le cr�er avec le contenu ci-dessous :'; -$lng['install']['froxlor_succ_installed'] = 'Froxlor a �t� install� correctement.'; -$lng['install']['click_here_to_login'] = 'Cliquez ici pour vous rendre � l\'invite de connexion.'; -$lng['install']['httpuser'] = 'Nom du utilisateur du HTTP'; -$lng['install']['httpgroup'] = 'Nom du la group du HTTP'; - -/** - * ADDED IN 1.2.19-svn7 - */ - -$lng['install']['servername_should_be_fqdn'] = 'Le nom du serveur doit être un nom FQDN, pas une adresse IP'; - -/** - * Renamed in 1.2.19-svn40 - */ - -$lng['install']['webserver'] = 'Version du serveur'; - -$lng['install']['phpxml'] = 'Tester si PHP XML-extension est install�e...'; -?> diff --git a/install/lng/german.lng.php b/install/lng/german.lng.php index 0007c232..a6b681e0 100644 --- a/install/lng/german.lng.php +++ b/install/lng/german.lng.php @@ -2,107 +2,85 @@ /** * This file is part of the Froxlor project. - * Copyright (c) 2003-2007 the SysCP Team (see authors). + * Copyright (c) 2003-2009 the SysCP Team (see authors). * 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.syscp.org/misc/COPYING.txt + * COPYING file online at http://files.froxlor.org/misc/COPYING.txt * * @copyright (c) the authors - * @author Florian Lippert (2003-2007) - * @author Froxlor Team (2010-) + * @author Florian Lippert (2003-2009) + * @author Froxlor team (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Language * */ -/** - * Begin - */ +$lng['requirements']['title'] = 'Prüfe Systemvoraussetzungen...'; +$lng['requirements']['installed'] = 'installiert'; +$lng['requirements']['not_true'] = 'nein'; +$lng['requirements']['notfound'] = 'nicht gefunden'; +$lng['requirements']['notinstalled'] = 'nicht installiert'; +$lng['requirements']['activated'] = 'ist aktiviert.'; +$lng['requirements']['phpversion'] = 'PHP Version >= 5.2'; +$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime'; +$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"). Die Einstellung wurde temporär deaktiviert, bitte ändern Sie diese in der entsprechenden php.ini.'; +$lng['requirements']['phpmysql'] = 'PHP MySQL-Erweiterung...'; +$lng['requirements']['phpxml'] = 'PHP XML-Erweiterung...'; +$lng['requirements']['phpfilter'] = 'PHP filter-Erweiterung...'; +$lng['requirements']['phpposix'] = 'PHP posix-Erweiterung...'; +$lng['requirements']['phpbcmath'] = 'PHP bcmath-Erweiterung...'; +$lng['requirements']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollständig zur Verfügung!'; +$lng['requirements']['openbasedir'] = 'open_basedir genutzt wird...'; +$lng['requirements']['openbasedirenabled'] = 'Froxlor wird mit aktiviertem open_basedir nicht vollständig funktionieren. Bitte deaktivieren Sie open_basedir für Froxlor in der entsprechenden php.ini'; +$lng['requirements']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Versuchen Sie die angezeigten Problem zu beheben und versuchen Sie es erneut.'; +$lng['requirements']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erfüllt'; -$lng['install']['language'] = 'Installations - Sprache'; -$lng['install']['welcome'] = 'Willkommen zur Froxlor Installation'; -$lng['install']['welcometext'] = 'Vielen Dank dass Sie sich für Froxlor entschieden haben. Um Ihre Installation von Froxlor zu starten, füllen Sie bitte alle Felder unten mit den geforderten Angaben.
Achtung: Eine eventuell bereits existierende Datenbank, die den selben Namen hat wie den, den Sie unten eingeben werden, wird mit allen enthaltenen Daten gelöscht!'; -$lng['install']['database'] = 'Datenbank'; -$lng['install']['mysql_hostname'] = 'MySQL-Hostname'; -$lng['install']['mysql_database'] = 'MySQL-Datenbank'; -$lng['install']['mysql_unpriv_user'] = 'Benutzername für den unprivilegierten MySQL-Account'; -$lng['install']['mysql_unpriv_pass'] = 'Passwort für den unprivilegierten MySQL-Account'; -$lng['install']['mysql_root_user'] = 'Benutzername für den MySQL-Root-Account'; -$lng['install']['mysql_root_pass'] = 'Passwort für den MySQL-Root-Account'; +$lng['install']['lngtitle'] = 'Froxlor Installation - Sprache auswählen'; +$lng['install']['language'] = 'Sprache für die Installation'; +$lng['install']['lngbtn_go'] = 'Sprache ändern'; +$lng['install']['title'] = 'Froxlor Installation - Einrichtung'; +$lng['install']['welcometext'] = 'Vielen Dank dass Sie sich für Froxlor entschieden haben. Um die Installation von Froxlor zu starten, füllen Sie bitte alle Felder mit den geforderten Angaben aus.
Achtung: Eine eventuell existierende Datenbank, die den selben Namen hat wie den Gewählten, wird mit allen enthaltenen Daten gelöscht!'; +$lng['install']['database'] = 'Datenbankverbindung'; +$lng['install']['mysql_host'] = 'MySQL-Hostname'; +$lng['install']['mysql_database'] = 'Datenbank Name'; +$lng['install']['mysql_unpriv_user'] = 'Benutzername für den unprivilegierten MySQL-Account'; +$lng['install']['mysql_unpriv_pass'] = 'Passwort für den unprivilegierten MySQL-Account'; +$lng['install']['mysql_root_user'] = 'Benutzername für den MySQL-Root-Account'; +$lng['install']['mysql_root_pass'] = 'Passwort für den MySQL-Root-Account'; $lng['install']['admin_account'] = 'Admin-Zugang'; $lng['install']['admin_user'] = 'Administrator-Benutzername'; -$lng['install']['admin_pass'] = 'Administrator-Passwort'; -$lng['install']['admin_pass_confirm'] = 'Administrator-Passwort (Bestätigung)'; +$lng['install']['admin_pass1'] = 'Administrator-Passwort'; +$lng['install']['admin_pass2'] = 'Administrator-Passwort (Bestätigung)'; $lng['install']['serversettings'] = 'Servereinstellungen'; $lng['install']['servername'] = 'Servername (FQDN)'; $lng['install']['serverip'] = 'Server-IP'; -$lng['install']['apacheversion'] = 'Apacheversion'; -$lng['install']['next'] = 'Fortfahren'; -$lng['install']['installdata'] = 'Installation - Daten'; - -/** - * Progress - */ - -$lng['install']['testing_mysql'] = 'Teste, ob die MySQL-Root-Benutzerdaten richtig sind...'; -$lng['install']['erasing_old_db'] = 'Entferne alte Datenbank...'; -$lng['install']['backup_old_db'] = 'Sichere bisherige Datenbank...'; -$lng['install']['backing_up'] = 'Sicherung läft'; -$lng['install']['backing_up_binary_missing'] = '/usr/bin/mysqldump nicht vorhanden'; -$lng['install']['create_mysqluser_and_db'] = 'Erstelle Datenbank und Benutzer...'; -$lng['install']['testing_new_db'] = 'Teste, ob die Datenbank und Passwort korrekt angelegt wurden...'; -$lng['install']['importing_data'] = 'Importiere Daten in die MySQL-Datenbank...'; -$lng['install']['changing_data'] = 'Passe die importierten Daten an...'; -$lng['install']['adding_admin_user'] = 'Füge den Admin-Benutzer hinzu...'; -$lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...'; -$lng['install']['creating_configfile_succ'] = 'OK, userdata.inc.php wurde in lib/ gespeichert.'; -$lng['install']['creating_configfile_temp'] = 'Datei wurde in /tmp/userdata.inc.php gespeichert, bitte nach lib/ verschieben.'; -$lng['install']['creating_configfile_failed'] = 'Konnte lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:'; -$lng['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.'; -$lng['install']['click_here_to_login'] = 'Hier geht es weiter zum Login-Fenster.'; -$lng['install']['phpmysql'] = 'Teste, ob die PHP MySQL-Erweiterung installiert ist...'; -$lng['install']['phpfilter'] = 'Teste, ob die PHP Filter-Erweiterung installiert ist...'; -$lng['install']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Breche ab...'; -$lng['install']['notinstalled'] = 'nicht installiert!'; -$lng['install']['phpbcmath'] = 'Teste, ob die PHP bcmath-Erweiterung installiert ist...'; -$lng['install']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollständig zur Verfügung!'; -$lng['install']['openbasedir'] = 'Teste, ob open_basedir genutzt wird...'; -$lng['install']['openbasedirenabled'] = 'aktiviert. Froxlor wird mit aktiviertem open_basedir nicht vollständig funktionieren. Bitte deaktivieren Sie open_basedir für Froxlor'; +$lng['install']['webserver'] = 'Webserver'; +$lng['install']['apache2'] = 'Apache 2'; +$lng['install']['lighttpd'] = 'LigHTTPd'; +$lng['install']['nginx'] = 'NGINX'; $lng['install']['httpuser'] = 'HTTP Username'; $lng['install']['httpgroup'] = 'HTTP Gruppenname'; -/** - * ADDED IN 1.2.19-svn7 - */ +$lng['install']['system_servername'] = 'System ServerName'; +$lng['install']['servername_should_be_fqdn'] = 'Der Servername sollte ein vollqualifizierter Domainname sein und keine IP Adresse.'; +$lng['install']['testing_mysql'] = 'Teste MySQL-Root Zugang...'; +$lng['install']['backup_old_db'] = 'Sicherung vorheriger Datenbank...'; +$lng['install']['backup_binary_missing'] = 'Konnte mysqldump nicht finden'; +$lng['install']['backup_failed'] = 'Sicherung fehlgeschlagen'; +$lng['install']['prepare_db'] = 'Datenbank wird vorbereitet...'; +$lng['install']['create_mysqluser_and_db'] = 'Erstelle Datenbank und Benutzer...'; +$lng['install']['testing_new_db'] = 'Teste, ob Datenbank und Benutzer korrekt angelegt wurden...'; +$lng['install']['importing_data'] = 'Importiere Daten...'; +$lng['install']['changing_data'] = 'Einstellungen anpassen...'; +$lng['install']['creating_entries'] = 'Trage neue Werte ein...'; +$lng['install']['adding_admin_user'] = 'Erstelle Admin-Benutzer...'; +$lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...'; +$lng['install']['creating_configfile_temp'] = 'Datei wurde in /tmp/userdata.inc.php gespeichert, bitte nach lib/ verschieben.'; +$lng['install']['creating_configfile_failed'] = 'Konnte lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:'; +$lng['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.'; -$lng['install']['servername_should_be_fqdn'] = 'Der Servername sollte eine FQDN sein und keine IP Adresse sein'; - -/** - * Renamed in 1.2.19-svn40 - */ - -$lng['install']['webserver'] = 'Webserver'; - -/* - * Added in Froxlor 0.9 - */ -$lng['install']['phpversion'] = 'Prüfe PHP Version >= 5.2'; -$lng['install']['phpposix'] = 'Teste, ob die PHP Posix-Erweiterung installiert ist...'; - -/* - * Added in Froxlor 0.9.4 - */ -$lng['install']['click_here_to_refresh'] = 'Erneut prüfen'; -$lng['install']['click_here_to_continue'] = 'Installation fortführen'; -$lng['install']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erfüllt'; - -/* - * Added in Froxlor 0.9.13 - */ -$lng['install']['phpmagic_quotes_runtime'] = 'Prüfe ob magic_quotes_runtime ausgeschalten ist'; -$lng['install']['active'] = 'nein'; -$lng['install']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"), um merkwürdige Verhalten von Froxlor zu umgehen. Sie wurde deaktiviert (nur temporär, bitte php.ini anpassen).'; -$lng['install']['phpxml'] = 'Teste, ob die PHP XML-Erweiterung installiert ist...'; -?> +$lng['click_here_to_refresh'] = 'Hier klicken, um erneut zu prüfen'; +$lng['click_here_to_continue'] = 'Installation fortführen'; +$lng['click_here_to_login'] = 'Hier geht es weiter zum Login-Fenster.'; diff --git a/install/templates/dataform.tpl b/install/templates/dataform.tpl new file mode 100644 index 00000000..074db61e --- /dev/null +++ b/install/templates/dataform.tpl @@ -0,0 +1,11 @@ +
+
+ {$this->_lng['install']['title']} + {$formdata} +

+ + +

+
+
+ diff --git a/install/templates/dataform2.tpl b/install/templates/dataform2.tpl new file mode 100644 index 00000000..80b30848 --- /dev/null +++ b/install/templates/dataform2.tpl @@ -0,0 +1,13 @@ +
+
+ {$this->_lng['install']['welcometext']} + {$formdata} +

+ + + + +

+
+
+ diff --git a/install/templates/dataitem.tpl b/install/templates/dataitem.tpl new file mode 100644 index 00000000..6332d437 --- /dev/null +++ b/install/templates/dataitem.tpl @@ -0,0 +1,4 @@ +

+   + +

diff --git a/install/templates/dataitemchk.tpl b/install/templates/dataitemchk.tpl new file mode 100644 index 00000000..a814fb5c --- /dev/null +++ b/install/templates/dataitemchk.tpl @@ -0,0 +1,4 @@ +

+ + {$fieldlabel} +

diff --git a/install/templates/datasection.tpl b/install/templates/datasection.tpl new file mode 100644 index 00000000..764ea7a1 --- /dev/null +++ b/install/templates/datasection.tpl @@ -0,0 +1 @@ +

{$section}

diff --git a/install/templates/footer.tpl b/install/templates/footer.tpl new file mode 100644 index 00000000..8d43a17b --- /dev/null +++ b/install/templates/footer.tpl @@ -0,0 +1,7 @@ + + + + diff --git a/install/templates/header.tpl b/install/templates/header.tpl new file mode 100644 index 00000000..a6c6c20d --- /dev/null +++ b/install/templates/header.tpl @@ -0,0 +1,18 @@ + + + + + + + + + + Froxlor Server Management Panel - Installation + + + +
diff --git a/install/templates/lngform.tpl b/install/templates/lngform.tpl new file mode 100644 index 00000000..1e9c16a9 --- /dev/null +++ b/install/templates/lngform.tpl @@ -0,0 +1,16 @@ +
+
+ {$this->_lng['install']['lngtitle']} +

+   + +

+

+ + +

+
+
+ diff --git a/install/templates/page.tpl b/install/templates/page.tpl new file mode 100644 index 00000000..65aad877 --- /dev/null +++ b/install/templates/page.tpl @@ -0,0 +1,11 @@ +
+
+ Froxlor Server Management Panel +
+ +
+

{$pagetitle}

+ {$pagecontent} + {$pagenavigation} +
+
diff --git a/install/templates/pagebottom.tpl b/install/templates/pagebottom.tpl new file mode 100644 index 00000000..66d7ceac --- /dev/null +++ b/install/templates/pagebottom.tpl @@ -0,0 +1,4 @@ +

{$message}

+ diff --git a/install/templates/textarea.tpl b/install/templates/textarea.tpl new file mode 100644 index 00000000..1a5661c2 --- /dev/null +++ b/install/templates/textarea.tpl @@ -0,0 +1,5 @@ + + +

{$escpduserdata}

+ + diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index 914b9c9d..a57aa5b6 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -2116,13 +2116,13 @@ if (isFroxlorVersion('0.9.29-dev3')) { showUpdateStep("Adding new tables to database", true); $db->query("CREATE TABLE IF NOT EXISTS `domain_ssl_settings` ( - `id` int(5) NOT NULL auto_increment, - `domainid` int(11) NOT NULL, - `ssl_cert_file` text NOT NULL, - `ssl_key_file` text NOT NULL, - `ssl_ca_file` text NOT NULL, - `ssl_cert_chainfile` text NOT NULL, - PRIMARY KEY (`id`) + `id` int(5) NOT NULL auto_increment, + `domainid` int(11) NOT NULL, + `ssl_cert_file` text NOT NULL, + `ssl_key_file` text NOT NULL, + `ssl_ca_file` text NOT NULL, + `ssl_cert_chainfile` text NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;"); lastStepStatus(0); @@ -2163,10 +2163,10 @@ if (isFroxlorVersion('0.9.29')) { showUpdateStep("Adding new ip to domain - mapping-table"); $db->query("DROP TABLE IF EXISTS `panel_domaintoip`;"); $sql = "CREATE TABLE `".TABLE_DOMAINTOIP."` ( - `id_domain` int(11) unsigned NOT NULL, - `id_ipandports` int(11) unsigned NOT NULL, - PRIMARY KEY (`id_domain`, `id_ipandports`) - ) ENGINE=MyISAM ;"; + `id_domain` int(11) unsigned NOT NULL, + `id_ipandports` int(11) unsigned NOT NULL, + PRIMARY KEY (`id_domain`, `id_ipandports`) + ) ENGINE=MyISAM ;"; $db->query($sql); lastStepStatus(0); @@ -2176,23 +2176,23 @@ if (isFroxlorVersion('0.9.29')) { while ($row = $db->fetch_array($result)) { if ((int)$row['ipandport'] != 0) { $db->query("INSERT INTO `".TABLE_DOMAINTOIP."` SET - `id_domain` = " . (int)$row['id'] . ", - `id_ipandports` = " . (int)$row['ipandport']); + `id_domain` = " . (int)$row['id'] . ", + `id_ipandports` = " . (int)$row['ipandport']); } if ((int)$row['ssl_ipandport'] != 0) { $db->query("INSERT INTO `".TABLE_DOMAINTOIP."` SET - `id_domain` = " . (int)$row['id'] . ", - `id_ipandports` = " . (int)$row['ssl_ipandport']); + `id_domain` = " . (int)$row['id'] . ", + `id_ipandports` = " . (int)$row['ssl_ipandport']); } // Subdomains also have ssl ports if the parent has - elseif ((int)$row['ssl_ipandport'] == 0 - && (int)$row['ssl_redirect'] != 0 - && (int)$row['parentdomainid'] != 0 + elseif ((int)$row['ssl_ipandport'] == 0 + && (int)$row['ssl_redirect'] != 0 + && (int)$row['parentdomainid'] != 0 ) { $db->query("INSERT INTO `".TABLE_DOMAINTOIP."` SET - `id_domain` = " . (int)$row['id'] . ", - `id_ipandports` = ( - SELECT `ssl_ipandport` FROM `" . TABLE_PANEL_DOMAINS . "` + `id_domain` = " . (int)$row['id'] . ", + `id_ipandports` = ( + SELECT `ssl_ipandport` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `id` = '".(int)$row['parentdomainid']."');" ); } @@ -2233,3 +2233,14 @@ if (isFroxlorVersion('0.9.29.1-dev2')) { updateToVersion('0.9.29.1-dev3'); } + +if (isFroxlorVersion('0.9.29.1-dev3')) { + showUpdateStep("Updating from 0.9.29.1-dev3 to 0.9.29.1-dev4", true); + lastStepStatus(0); + + showUpdateStep("Removing old billing-field from admin-users"); + $db->query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `edit_billingdata`"); + lastStepStatus(0); + + updateToVersion('0.9.29.1-dev4'); +} diff --git a/lib/tables.inc.php b/lib/tables.inc.php index 3e663c72..09ab2855 100644 --- a/lib/tables.inc.php +++ b/lib/tables.inc.php @@ -74,6 +74,6 @@ define('PACKAGE_LOCKED', 1); define('PACKAGE_ENABLED', 2); // VERSION INFO -$version = '0.9.29.1-dev3'; +$version = '0.9.29.1-dev4'; $dbversion = '2'; $branding = '';