[cpo+] : Modifikationen

« zurück

Anpassung der Mindestanforderungen

Kategorie:Plus-Feature
Beschreibung:Die ursprüngliche Angabe PHP 4.1.1 trifft nicht mehr zu.
Umstellung auf mySQLi benötigt auch Prüfung auf mySQLi.
Anpassung der Texte.
Erstellt von:Markus Rösel
Geprüft von:
Veröffentlicht von:
CPO+ Version:4.1.6+1
Kurze Erläuterung der Codeanpassung:Änderung der minimalen PHP-Version auf PHP 5.3.
Prüfung auf mySQLi.
Anpassung und Übersetzung der Texte.

Code vorher:

[[ ********* File: _setup/step1.php ********* ]] echo '<table class="colored" style="width: 100%">'; echo '<thead><tr><th colspan="2"><span>'.___('Requirements').'</span></th></tr></thead>'; echo '<tbody>'; print('<tr><td class="leftrow">'.___('PHP version').'</td><td class="rightrow">'); print(sprintf(___('%s needs at minimum PHP version 4.1.2.'), htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15'))); if (!function_exists('version_compare')){ printf($nok.sprintf(___('The setup can not check your PHP version because of a missing version_compare() function. This usually is a sign for an older PHP version that is not ready to run %s. PHP returns a version of %s.'), htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15')), phpversion() ); $errors['version'] = print(___('Please upgrade your PHP to at least version 4.1.2.')); print($sol.$errors['version']); } else { if (version_compare(phpversion(), '4.1.2')<0) { printf($nok.sprintf(___('Your PHP Version is %s, which is too old and not ready to run %s.'), phpversion(), htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15')) ); $errors['version'] = print(___('Please upgrade your PHP to at least version 4.1.2.')); print($sol.$errors['version']); } else { printf($ok.sprintf(___('your PHP Version is %s, which is enough to satisfy the requirements of %s.'), phpversion(), htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15')) ); } } print('</td></tr>'); print('<tr><td>'.___('MySQL support').'</td><td class="rightrow">'); print(sprintf(___('%s needs PHP to support connections to the MySQL database.'), htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15'))); if (!function_exists('mysql_connect')) { print($nok.___('PHP does not support the function mysql_connect().')); $errors['mysql'] = ___('Please make sure your PHP does support MySQL functions. To do so you have to install the PHP MySQL module or recompile PHP with the correct parameters.'); print($sol.$errors['mysql']); } else { print($ok.___('your PHP supports MySQL functions.')); } print('</td></tr>');

Code nachher:

[[ ********* File: _setup/step1.php ********* ]] echo '<table class="colored" style="width: 100%">'; echo '<thead><tr><th colspan="2"><span>'.___('Requirements').'</span></th></tr></thead>'; echo '<tbody>'; $ver_required = '5.3'; print('<tr><td class="leftrow">'.___('PHP version').'</td><td class="rightrow">'); print(sprintf(___('%1$s needs at minimum PHP version %2$s.'), htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15'), $ver_required )); if (!function_exists('version_compare')){ printf($nok.sprintf(___('The setup can not check your PHP version because of a missing version_compare() function. This usually is a sign for an older PHP version that is not ready to run %s. PHP returns a version of %s.'), htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15')), phpversion() ); $errors['version'] = sprintf(___('Please upgrade your PHP to at least version %s.'), $ver_required); print($sol.$errors['version']); } else { if (version_compare(phpversion(), '5.3')<0) { printf($nok.sprintf(___('Your PHP Version is %1$s, which is too old and not ready to run %2$s.'), phpversion(), htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15')) ); $errors['version'] = sprintf(___('Please upgrade your PHP to at least version %s.'),$ver_required); print($sol.$errors['version']); } else { printf($ok.sprintf(___('your PHP Version is %1$s, which is enough to satisfy the requirements of %2$s.'), phpversion(), htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15')) ); } } print('</td></tr>'); print('<tr><td>'.___('MySQL support').' (MySQLi)'.'</td><td class="rightrow">'); print(sprintf(___('%s needs PHP to support connections to the MySQL database.').' (MySQLi)', htmlspecialchars($CPO['product'], ENT_COMPAT, 'ISO-8859-15'))); if (!function_exists('mysqli_connect')) { print($nok.___('PHP does not support the function mysqli_connect().')); $errors['mysql'] = ___('Please make sure your PHP does support MySQLi functions. To do so you have to install the PHP MySQLi module or recompile PHP with the correct parameters.'); print($sol.$errors['mysql']); } else { print($ok.___('your PHP supports MySQL functions.').' (MySQLi)'); } print('</td></tr>'); [[ ********* File: _include/lang/deutsch/common.inc.php ********* ]] // *********** ConPressoPlus ********** Additions/Alternatives '%1$s needs at minimum PHP version %2$s.' => '%1$s benötigt mindestens PHP-Version %2$s.', 'Please upgrade your PHP to at least version %s.' => 'Bitte aktualisieren Sie Ihr PHP auf mindestens Version %s.', 'Your PHP Version is %1$s, which is too old and not ready to run %2$s' => 'Ihre PHP-Version ist %s. Diese Version reicht für den Betrieb von %s leider nicht aus.', 'your PHP Version is %1$s, which is enough to satisfy the requirements of %2$s.' => 'Ihre PHP-Version ist %1$s. Diese Version ist für den Betrieb von %2$s ausreichend.',
« zurück