diff -r 78a94f7bb5e3 -r 54392ae2c222 install.php --- a/install.php Tue Nov 06 16:40:19 2007 -0500 +++ b/install.php Wed Nov 07 16:33:26 2007 -0500 @@ -25,6 +25,7 @@ define('IN_ENANO_INSTALL', 'true'); define('ENANO_VERSION', '1.1.1'); +define('ENANO_CODE_NAME', 'Germination'); // In beta versions, define ENANO_BETA_VERSION here // This is required to make installation work right @@ -65,14 +66,18 @@ require('includes/constants.php'); require('includes/rijndael.php'); require('includes/functions.php'); +require('includes/dbal.php'); +require('includes/lang.php'); +require('includes/json.php'); strip_magic_quotes_gpc(); -$neutral_color = 'C'; // // INSTALLER LIBRARY // +$neutral_color = 'C'; + function run_installer_stage($stage_id, $stage_name, $function, $failure_explanation, $allow_skip = true) { static $resumed = false; @@ -657,22 +662,37 @@ if($val) { if($cv) $color='CCFFCC'; else $color='AAFFAA'; - echo "$descTest passed"; + echo "$descTest passed"; } elseif(!$val && $warn) { if($cv) $color='FFFFCC'; else $color='FFFFAA'; - echo "$desc
$extended_descTest passed with warning"; + echo "$desc
$extended_descTest passed with warning"; $warned = true; } else { if($cv) $color='FFCCCC'; else $color='FFAAAA'; - echo "$desc
$extended_descTest failed"; + echo "$desc
$extended_descTest failed"; $failed = true; } } -function is_apache() { $r = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? true : false; return $r; } +function is_apache() +{ + return strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? true : false; +} require_once('includes/template.php'); -if(!isset($_GET['mode'])) $_GET['mode'] = 'welcome'; +// +// Startup localization +// + +// We need $db just for the _die function +$db = new mysql(); + +$lang = new Language('eng'); +$lang->load_file('./language/english/install.json'); + +if ( !isset($_GET['mode']) ) + $_GET['mode'] = 'welcome'; + switch($_GET['mode']) { case 'mysql_test': @@ -802,6 +822,20 @@ EOF; exit; break; + case 'langjs': + header('Content-type: text/javascript'); + $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + $lang_js = $json->encode($lang->strings); + // use EEOF here because jEdit misinterprets "typ'eof'" + echo <<load_theme('stpatty', 'shamrock', false); $modestrings = Array( - 'welcome' => 'Welcome', - 'license' => 'License Agreement', - 'sysreqs' => 'Server requirements', - 'database'=> 'Database information', - 'website' => 'Website configuration', - 'login' => 'Administration login', - 'confirm' => 'Confirm installation', - 'install' => 'Database installation', - 'finish' => 'Installation complete' + 'welcome' => $lang->get('welcome_modetitle'), + 'license' => $lang->get('license_modetitle'), + 'sysreqs' => $lang->get('sysreqs_modetitle'), + 'database'=> $lang->get('database_modetitle'), + 'website' => $lang->get('website_modetitle'), + 'login' => $lang->get('login_modetitle'), + 'confirm' => $lang->get('confirm_modetitle'), + 'install' => $lang->get('install_modetitle'), + 'finish' => $lang->get('finish_modetitle') ); $sideinfo = ''; @@ -852,6 +886,26 @@ exit; } +if ( defined('ENANO_IS_STABLE') ) + $branch = 'stable'; +else if ( defined('ENANO_IS_UNSTABLE') ) + $branch = 'unstable'; +else +{ + $version = explode('.', ENANO_VERSION); + if ( !isset($version[1]) ) + // unknown branch, really + $branch = 'unstable'; + else + { + $version[1] = intval($version[1]); + if ( $version[1] % 2 == 1 ) + $branch = 'unstable'; + else + $branch = 'stable'; + } +} + $template->header(); if(!isset($_GET['mode'])) $_GET['mode'] = 'license'; switch($_GET['mode']) @@ -861,63 +915,71 @@ ?>
[ Enano CMS Project logo ] -

Welcome to Enano

-

version 1.1.1 – unstable

+

get('welcome_heading'); ?>

+

+ get("welcome_branch_$branch"); + + $v_string = sprintf('%s %s – %s', $lang->get('welcome_version'), ENANO_VERSION, $branch_l); + echo $v_string; + ?> +

You are about to install a NIGHTLY BUILD of Enano.
Nightly builds are NOT upgradeable and may contain serious flaws, security problems, or extraneous debugging information. Installing this version of Enano on a production site is NOT recommended.
'; - } + if ( defined('ENANO_CODE_NAME') ) + { + echo '

'; + echo $lang->get('welcome_aka', array( + 'codename' => strtolower(ENANO_CODE_NAME) + )); + echo '

'; + } ?>
- +
-

Welcome to the Enano installer.

-

Thank you for choosing Enano as your CMS. You've selected the finest in design, the strongest in security, and the latest in Web 2.0 toys. Trust us, you'll like it.

-

To get started, please read and accept the following license agreement. You've probably seen it before.

+

get('license_heading'); ?>

+

get('license_blurb_thankyou'); ?>

+

get('license_blurb_pleaseread'); ?>

-

GNU General Public License

-

Declaration of license usage

-

Enano is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

-

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License (below) for more details.

-

By clicking the button below or otherwise continuing the installation, you indicate your acceptance of this license agreement.

-

Human-readable version

-

Enano is distributed under certain licensing terms that we believe make it of the greatest possible use to the public. The license we distribute it under, the GNU General Public License, provides certain terms and conditions that, rather than limit your use of Enano, allow you to get the most out of it. If you would like to read the full text, it can be found below. Here is a human-readable version that we think is a little easier to understand.

- -

You may exercise the freedoms specified here provided that you comply with the express conditions of this license. The principal conditions are:

- -

Disclaimer: The above text is not a license. It is simply a handy reference for understanding the Legal Code (the full license) – it is a human-readable expression of some of its key terms. Think of it as the user-friendly interface to the Legal Code beneath. The above text itself has no legal value, and its contents do not appear in the actual license.
Text copied from the Creative Commons GPL Deed page

-

Notice for prerelease versions

-

This version of Enano is designed only for testing and evaluation purposes. It is not yet completely stable, and should not be used on production websites. As with any Enano version, Dan Fuhry and the Enano team cannot be responsible for any damage, physical or otherwise, to any property as a result of the use of Enano. While security is a number one priority, sometimes things slip through.

+

get('license_info_unstable_title'); ?>

+

get('license_info_unstable_body'); ?>

-

Lawyer-readable version

+

get('license_section_gpl_heading'); ?>

+ lang_code != 'eng' ): ?> +

get('license_gpl_blurb_inenglish'); ?>

+
- + + + + + +
+ + +

+ get('meta_lbl_before_continue'); ?>
+ • get('sysreqs_objective_scalebacks'); ?>
+ • get('license_objective_have_db_info'); ?> +

+
+ + + '; - run_test('return false;', 'Your server does not meet the requirements for Enano to run.', 'As a precaution, Enano will not install until the above requirements have been met. Contact your server administrator or hosting company and convince them to upgrade. Good luck.'); + run_test('return false;', $lang->get('sysreqs_summary_fail_title'), $lang->get('sysreqs_summary_fail_body')); echo '
'; } } @@ -1018,7 +1091,7 @@ v = verify(); if(!v) { - alert('One or more of the form fields is incorrect. Please correct any information in the form that has an "X" next to it.'); + alert($lang.get('meta_msg_err_verification')); return false; } var frm = document.forms.dbinfo; @@ -1041,10 +1114,10 @@ document.getElementById('s_db_name').src='images/good.gif'; document.getElementById('s_db_auth').src='images/good.gif'; document.getElementById('s_db_root').src='images/good.gif'; - if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = 'Warning:<\/b> The database you specified does not exist. It will be created during installation.'; - if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = 'Warning:<\/b> The specified regular user does not exist or the password is incorrect. The user will be created during installation. If the user already exists, the password will be reset.'; + if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = $lang.get('database_msg_warn_creating_db'); + if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = $lang.get('database_msg_warn_creating_user'); document.getElementById('s_mysql_version').src='images/good.gif'; - document.getElementById('e_mysql_version').innerHTML = 'Your version of MySQL meets Enano requirements.'; + document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_info_mysql_good'); } else { @@ -1055,50 +1128,50 @@ document.getElementById('s_db_name').src='images/unknown.gif'; document.getElementById('s_db_auth').src='images/unknown.gif'; document.getElementById('s_db_root').src='images/unknown.gif'; - document.getElementById('e_db_host').innerHTML = 'Error:<\/b> The database server "'+document.forms.dbinfo.db_host.value+'" couldn\'t be contacted.
'+t; - document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.'; + document.getElementById('e_db_host').innerHTML = $lang.get('database_msg_err_mysql_connect', { db_host: document.forms.dbinfo.db_host.value, mysql_error: t }); + document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version'); break; case 'auth': document.getElementById('s_db_host').src='images/good.gif'; document.getElementById('s_db_name').src='images/unknown.gif'; document.getElementById('s_db_auth').src='images/bad.gif'; document.getElementById('s_db_root').src='images/unknown.gif'; - document.getElementById('e_db_auth').innerHTML = 'Error:<\/b> Access to MySQL under the specified credentials was denied.
'+t; - document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.'; + document.getElementById('e_db_auth').innerHTML = $lang.get('database_msg_err_mysql_auth', { mysql_error: t }); + document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version'); break; case 'perm': document.getElementById('s_db_host').src='images/good.gif'; document.getElementById('s_db_name').src='images/bad.gif'; document.getElementById('s_db_auth').src='images/good.gif'; document.getElementById('s_db_root').src='images/unknown.gif'; - document.getElementById('e_db_name').innerHTML = 'Error:<\/b> Access to the specified database using those login credentials was denied.
'+t; - document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.'; + document.getElementById('e_db_name').innerHTML = $lang.get('database_msg_err_mysql_dbperm', { mysql_error: t }); + document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version'); break; case 'name': document.getElementById('s_db_host').src='images/good.gif'; document.getElementById('s_db_name').src='images/bad.gif'; document.getElementById('s_db_auth').src='images/good.gif'; document.getElementById('s_db_root').src='images/unknown.gif'; - document.getElementById('e_db_name').innerHTML = 'Error:<\/b> The specified database does not exist
'+t; - document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.'; + document.getElementById('e_db_name').innerHTML = $lang.get('database_msg_err_mysql_dbexist', { mysql_error: t }); + document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version'); break; case 'root': document.getElementById('s_db_host').src='images/good.gif'; document.getElementById('s_db_name').src='images/unknown.gif'; document.getElementById('s_db_auth').src='images/unknown.gif'; document.getElementById('s_db_root').src='images/bad.gif'; - document.getElementById('e_db_root').innerHTML = 'Error:<\/b> Access to MySQL under the specified credentials was denied.
'+t; - document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.'; + document.getElementById('e_db_root').innerHTML = $lang.get('database_msg_err_mysql_auth', { mysql_error: t }); + document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_warn_mysql_version'); break; case 'vers': document.getElementById('s_db_host').src='images/good.gif'; document.getElementById('s_db_name').src='images/good.gif'; document.getElementById('s_db_auth').src='images/good.gif'; document.getElementById('s_db_root').src='images/good.gif'; - if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = 'Warning:<\/b> The database you specified does not exist. It will be created during installation.'; - if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = 'Warning:<\/b> The specified regular user does not exist or the password is incorrect. The user will be created during installation. If the user already exists, the password will be reset.'; + if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = $lang.get('database_msg_warn_creating_db'); + if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = $lang.get('database_msg_warn_creating_user'); - document.getElementById('e_mysql_version').innerHTML = 'Error:<\/b> Your version of MySQL ('+t+') is older than 4.1.17. Enano will still work, but there is a known bug with the comment system and MySQL 4.1.11 that involves some comments not being displayed, due to an issue with the PHP function mysql_fetch_row().'; + document.getElementById('e_mysql_version').innerHTML = $lang.get('database_msg_err_mysql_version', { mysql_version: t }); document.getElementById('s_mysql_version').src='images/bad.gif'; default: alert(t); @@ -1171,45 +1244,150 @@ } window.onload = verify; -

Now we need some information that will allow Enano to contact your database server. Enano uses MySQL as a data storage backend, - and we need to have access to a MySQL server in order to continue.

-

If you do not have access to a MySQL server, and you are using your own server, you can download MySQL for free from - MySQL.com. Please note that, like Enano, MySQL is licensed under the GNU GPL. - If you need to modify MySQL and then distribute your modifications, you must either distribute them under the terms of the GPL - or purchase a proprietary license.

+

get('database_blurb_needdb'); ?>

+

get('database_blurb_howtomysql'); ?>

MySQL login information for this virtual appliance:

Database hostname: localhost
Database login: username "enano", password: "clurichaun" (without quotes)
Database name: enano_www1

'; + echo '

+ ' . $lang->get('database_vm_login_info', array( 'host' => 'localhost', 'user' => 'enano', 'pass' => 'clurichaun', 'name' => 'enano_www1' )) . ' +

'; } ?>
- - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Database information

Database hostname
This is the hostname (or sometimes the IP address) of your MySQL server. In many cases, this is "localhost".
Good/bad icon
Database name
The name of the actual database. If you don't already have a database, you can create one here, if you have the username and password of a MySQL user with administrative rights.
Good/bad icon
Database login
These fields should be the username and password of a user with "select", "insert", "update", "delete", "create table", and "replace" privileges for your database.
Good/bad icon

Optional information

Table prefix
The value that you enter here will be added to the beginning of the name of each Enano table. You may use lowercase letters (a-z), numbers (0-9), and underscores (_).
Good/bad icon
Database administrative login
If the MySQL database or username that you entered above does not exist yet, you can create them here, assuming that you have the login information for an administrative user (such as root). Leave these fields blank unless you need to use them.
Good/bad icon
MySQL versionMySQL version information will be checked when you click "Test Connection".Good/bad icon
Delete existing tables?
If this option is checked, all the tables that will be used by Enano will be dropped (deleted) before the schema is executed. Do NOT use this option unless specifically instructed to.
+

get('database_table_title'); ?>

+
+ get('database_field_hostname_title'); ?> +
get('database_field_hostname_body'); ?> +
+
+ + + Good/bad icon +
+ get('database_field_dbname_title'); ?>
+ get('database_field_dbname_body'); ?>
+ +
+ + + Good/bad icon +
+ get('database_field_dbauth_title'); ?>
+ get('database_field_dbauth_body'); ?>
+ +
+ + + Good/bad icon +
+ +
+

get('database_heading_optionalinfo'); ?>

+
+ get('database_field_tableprefix_title'); ?>
+ get('database_field_tableprefix_body'); ?> +
+ + + Good/bad icon +
+ get('database_field_rootauth_title'); ?>
+ get('database_field_rootauth_body'); ?>
+ +
+ + + Good/bad icon +
+ +
+ get('database_field_mysqlversion_title'); ?> + + get('database_field_mysqlversion_blurb_willbechecked'); ?> + + Good/bad icon +
+ get('database_field_droptables_title'); ?>
+ get('database_field_droptables_body'); ?> +
+ +
+ +
+ + + + + +
+ + +

+ get('meta_lbl_before_continue'); ?>
+ • get('database_objective_test'); ?>
+ • get('database_objective_uncrypt'); ?> +

+
+
restart the installation.'; $template->footer(); exit; @@ -1272,7 +1450,7 @@ @@ -1385,7 +1563,7 @@ @@ -1498,7 +1676,7 @@