diff --git a/actions/admin/settings/110.accounts.php b/actions/admin/settings/110.accounts.php index e03cfe9b..eb2a24a6 100644 --- a/actions/admin/settings/110.accounts.php +++ b/actions/admin/settings/110.accounts.php @@ -107,7 +107,7 @@ return array( 'settinggroup' => 'panel', 'varname' => 'password_special_char', 'type' => 'string', - 'default' => '!?<>§$%&+#=@', + 'default' => '!?<>§$%+#=@', 'save_method' => 'storeSettingField', ), 'panel_password_regex' => array( diff --git a/install/froxlor.sql b/install/froxlor.sql index 1acc18ca..57a8d249 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -539,7 +539,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'password_numeric', '0'), ('panel', 'password_special_char_required', '0'), ('panel', 'password_special_char', '!?<>§$%+#=@'), - ('panel', 'version', '0.9.34-dev2'); + ('panel', 'version', '0.9.34-dev3'); DROP TABLE IF EXISTS `panel_tasks`; diff --git a/install/lib/class.FroxlorInstall.php b/install/lib/class.FroxlorInstall.php index b35e08a0..1faa8703 100644 --- a/install/lib/class.FroxlorInstall.php +++ b/install/lib/class.FroxlorInstall.php @@ -903,6 +903,16 @@ class FroxlorInstall { $content .= $this->_status_message('green', $this->_lng['requirements']['installed']); } + // check for bstring-extension + $content .= $this->_status_message('begin', $this->_lng['requirements']['phpmbstring']); + + if (!extension_loaded('mbstring')) { + $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']); diff --git a/install/lng/english.lng.php b/install/lng/english.lng.php index 4c9c4c68..239e006a 100644 --- a/install/lng/english.lng.php +++ b/install/lng/english.lng.php @@ -32,6 +32,7 @@ $lng['requirements']['phpfilter'] = 'PHP filter-extension...'; $lng['requirements']['phpposix'] = 'PHP posix-extension...'; $lng['requirements']['phpbcmath'] = 'PHP bcmath-extension...'; $lng['requirements']['phpcurl'] = 'PHP curl-extension...'; +$lng['requirements']['phpmbstring'] = 'PHP mbstring-extension...'; $lng['requirements']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!'; $lng['requirements']['curldescription'] = 'Version-check and news-feed may not work correctly!'; $lng['requirements']['openbasedir'] = 'open_basedir...'; diff --git a/install/lng/french.lng.php b/install/lng/french.lng.php index 9f040e33..b78ab7cc 100644 --- a/install/lng/french.lng.php +++ b/install/lng/french.lng.php @@ -32,6 +32,7 @@ $lng['requirements']['phpfilter'] = 'extension PHP filter ...'; $lng['requirements']['phpposix'] = 'extension PHP posix ...'; $lng['requirements']['phpbcmath'] = 'extension PHP bcmath ...'; $lng['requirements']['phpcurl'] = 'extension PHP curl...'; +$lng['requirements']['phpmbstring'] = 'extension PHP mbstring...'; $lng['requirements']['bcmathdescription'] = 'Les fonctions de calcul de traffic ne fonctionneront pas correctement!'; $lng['requirements']['curldescription'] = 'Les vérifications de version et les flux d\'information peuvent ne pas fonctionner correctement!'; $lng['requirements']['openbasedir'] = 'open_basedir...'; diff --git a/install/lng/german.lng.php b/install/lng/german.lng.php index d73ebb2e..4dc9347e 100644 --- a/install/lng/german.lng.php +++ b/install/lng/german.lng.php @@ -32,6 +32,7 @@ $lng['requirements']['phpfilter'] = 'PHP filter-Erweiterung...'; $lng['requirements']['phpposix'] = 'PHP posix-Erweiterung...'; $lng['requirements']['phpbcmath'] = 'PHP bcmath-Erweiterung...'; $lng['requirements']['phpcurl'] = 'PHP curl-Erweiterung...'; +$lng['requirements']['phpmbstring'] = 'PHP mbstring-Erweiterung...'; $lng['requirements']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollständig zur Verfügung!'; $lng['requirements']['curldescription'] = 'Versions-Prüfung und News-Feed stehen nicht vollständig zur Verfügung!'; $lng['requirements']['openbasedir'] = 'open_basedir genutzt wird...'; 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 451817fc..a01d7f24 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -2887,9 +2887,9 @@ if (isFroxlorVersion('0.9.33-rc2')) { if (isFroxlorVersion('0.9.33-rc3')) { - showUpdateStep("Updating from 0.9.33-rc3 to 0.9.33 final"); - lastStepStatus(0); - updateToVersion('0.9.33'); + showUpdateStep("Updating from 0.9.33-rc3 to 0.9.33 final"); + lastStepStatus(0); + updateToVersion('0.9.33'); } @@ -2903,7 +2903,7 @@ if (isFroxlorVersion('0.9.33')) { if (isFroxlorVersion('0.9.33.1')) { - showUpdateStep("Updating from 0.9.33.1 to 0.9.34-dev1"); + showUpdateStep("Updating from 0.9.33.1 to 0.9.34-dev1", false); showUpdateStep("Updating table structure of domains"); Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` MODIFY `parentdomainid` int(11) NOT NULL default '0'"); @@ -2940,7 +2940,7 @@ if (isFroxlorVersion('0.9.33.1')) { if (isFroxlorVersion('0.9.34-dev1')) { - showUpdateStep("Updating from 0.9.34-dev1 to 0.9.34-dev2"); + showUpdateStep("Updating from 0.9.34-dev1 to 0.9.34-dev2", false); showUpdateStep("Adding new settings for apache-itk-mpm"); Settings::AddNew("system.apacheitksupport", '0'); @@ -2956,3 +2956,21 @@ if (isFroxlorVersion('0.9.34-dev1')) { updateToVersion('0.9.34-dev2'); } + +if (isFroxlorVersion('0.9.34-dev2')) { + + showUpdateStep("Updating from 0.9.34-dev2 to 0.9.34-dev3", false); + + $do_update = true; + showUpdateStep("Checking for required PHP mbstring-extension"); + if (!extension_loaded('mbstring')) { + $do_update = false; + lastStepStatus(2, 'not installed'); + } else { + lastStepStatus(0); + } + + if ($do_update) { + updateToVersion('0.9.34-dev3'); + } +} diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php index ab31dffb..8cea5c65 100644 --- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php +++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php @@ -686,4 +686,18 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) { $question.= makeyesno('system_send_cron_errors', '1', '0', '0').'
'; eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); } + + if (versionInUpdate($current_version, '0.9.34-dev3')) { + $has_preconfig = true; + $description = 'Froxlor now requires the PHP mbstring-extension as we need to be multibyte-character safe in some cases'; + $question = 'PHP mbstring is currently: '; + if (!extension_loaded('mbstring')) { + $question .= 'not installed/loaded'; + $question .= '
Please install the PHP mbstring extension in order to finish the update'; + } else { + $question .= 'installed/loaded'; + } + $question .= '
'; + eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); + } } diff --git a/lib/functions/froxlor/function.generatePassword.php b/lib/functions/froxlor/function.generatePassword.php index 04e64b20..14ec5ffe 100644 --- a/lib/functions/froxlor/function.generatePassword.php +++ b/lib/functions/froxlor/function.generatePassword.php @@ -18,29 +18,48 @@ /** * Generates a random password */ -function generatePassword() { - $alpha_lower = 'abcdefghijklmnopqrstuvwxyz'; - $alpha_upper = strtoupper($alpha_lower); - $numeric = '0123456789'; - $special = Settings::Get('panel.password_special_char'); - $length = Settings::Get('panel.password_min_length') > 3 ? Settings::Get('panel.password_min_length') : 10; +function generatePassword() +{ + $alpha_lower = 'abcdefghijklmnopqrstuvwxyz'; + $alpha_upper = strtoupper($alpha_lower); + $numeric = '0123456789'; + $special = Settings::Get('panel.password_special_char'); + $length = Settings::Get('panel.password_min_length') > 3 ? Settings::Get('panel.password_min_length') : 10; - $pw = str_shuffle($alpha_lower); - $n = floor(($length)/4); + $pw = special_shuffle($alpha_lower); + $n = floor(($length) / 4); - if (Settings::Get('panel.password_alpha_upper')) { - $pw .= substr(str_shuffle($alpha_upper), 0, $n); - } + if (Settings::Get('panel.password_alpha_upper')) { + $pw .= mb_substr(special_shuffle($alpha_upper), 0, $n); + } - if (Settings::Get('panel.password_numeric')) { - $pw .= substr(str_shuffle($numeric), 0, $n); - } + if (Settings::Get('panel.password_numeric')) { + $pw .= mb_substr(special_shuffle($numeric), 0, $n); + } - if (Settings::Get('panel.password_special_char_required')) { - $pw .= substr(str_shuffle($special), 0, $n); - } + if (Settings::Get('panel.password_special_char_required')) { + $pw .= mb_substr(special_shuffle($special), 0, $n); + } - $pw = substr($pw, -$length); + $pw = mb_substr($pw, - $length); - return str_shuffle($pw); + return special_shuffle($pw); +} + +/** + * multibyte-character safe shuffle function + * + * @param string $str + * + * @return string + */ +function special_shuffle($str = null) +{ + $len = mb_strlen($str); + $sploded = array(); + while ($len -- > 0) { + $sploded[] = mb_substr($str, $len, 1); + } + shuffle($sploded); + return join('', $sploded); } diff --git a/lib/tables.inc.php b/lib/tables.inc.php index 323dca11..151eaac8 100644 --- a/lib/tables.inc.php +++ b/lib/tables.inc.php @@ -50,7 +50,4 @@ define('TABLE_PANEL_DOMAINREDIRECTS', 'domain_redirect_codes'); define('TABLE_PANEL_DOMAIN_SSL_SETTINGS', 'domain_ssl_settings'); define('TABLE_DOMAINTOIP', 'panel_domaintoip'); -// VERSION INFO -$version = '0.9.34-dev2'; -$dbversion = '2'; -$branding = ''; +require dirname(__FILE__).'/version.inc.php'; diff --git a/lib/version.inc.php b/lib/version.inc.php new file mode 100644 index 00000000..a11fa0fc --- /dev/null +++ b/lib/version.inc.php @@ -0,0 +1,25 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package System + * + */ + +// Main version variable +$version = '0.9.34-dev3'; + +// Database version (unused, old stuff from SysCP) +$dbversion = '2'; + +// Distribution branding-tag (used for Debian etc.) +$branding = '';