define('SESSION_STARTED', true);
}
-// Function to set error
-function set_error($message)
+// Installer version of display_error function.
+//
+function display_error($message)
{
global $_POST;
if(isset($message) AND $message != '')
// Set error if no post vars found
if (!isset($_POST['company_name']))
{
- set_error('Please fill-in the form below');
+ display_error('Please fill-in the form below');
}
// End check to see if form was even submitted
// Check if user has entered the installation url
if (!isset($_POST['ba_url']) || $_POST['ba_url'] == '')
{
- set_error('Please enter an absolute URL');
+ display_error('Please enter an absolute URL');
}
else
{
// Get operating system
if (!isset($_POST['operating_system']) || $_POST['operating_system'] != 'linux' && $_POST['operating_system'] != 'windows')
{
- set_error('Please select a valid operating system');
+ display_error('Please select a valid operating system');
}
else
{
// Check if user has entered a database host
if (!isset($_POST['database_host']) || $_POST['database_host'] == '')
{
- set_error('Please enter a database host name');
+ display_error('Please enter a database host name');
}
else
{
// Check if user has entered a database username
if (!isset($_POST['database_username']) || $_POST['database_username'] == '')
{
- set_error('Please enter a database username');
+ display_error('Please enter a database username');
}
else
{
// Check if user has entered a database password
if (!isset($_POST['database_password']))
{
- set_error('Please enter a database password');
+ display_error('Please enter a database password');
}
else
{
// Check if user has entered a database name
if (!isset($_POST['database_name']) || $_POST['database_name'] == '')
{
- set_error('Please enter a database name');
+ display_error('Please enter a database name');
}
else
{
// Get company name
if (!isset($_POST['company_name']) || $_POST['company_name'] == '')
{
- set_error('Please enter a company name');
+ display_error('Please enter a company name');
}
else
{
// Check if the user has entered a correct path
if (!file_exists($path_to_root.'/sql/en_US-demo.sql'))
{
- set_error('It appears the Absolute path that you entered is incorrect');
+ display_error('It appears the Absolute path that you entered is incorrect');
}
// Get admin email and validate it
if (!isset($_POST['admin_email']) || $_POST['admin_email'] == '')
{
- set_error('Please enter an email for the Administrator account');
+ display_error('Please enter an email for the Administrator account');
}
else
{
}
else
{
- set_error('Please enter a valid email address for the Administrator account');
+ display_error('Please enter a valid email address for the Administrator account');
}
}
// Get the two admin passwords entered, and check that they match
if (!isset($_POST['admin_password']) || $_POST['admin_password'] == '')
{
- set_error('Please enter a password for the Administrator account');
+ display_error('Please enter a password for the Administrator account');
}
else
{
}
if (!isset($_POST['admin_repassword']) || $_POST['admin_repassword'] == '')
{
- set_error('Please make sure you re-enter the password for the Administrator account');
+ display_error('Please make sure you re-enter the password for the Administrator account');
}
else
{
}
if ($admin_password != $admin_repassword)
{
- set_error('Sorry, the two Administrator account passwords you entered do not match');
+ display_error('Sorry, the two Administrator account passwords you entered do not match');
}
// End admin user details code
$err = write_config_db($table_prefix != "");
if ($err == -1)
- set_error("Cannot open the configuration file ($config_filename)");
+ display_error("Cannot open the configuration file ($config_filename)");
else if ($err == -2)
- set_error("Cannot write to the configuration file ($config_filename)");
+ display_error("Cannot write to the configuration file ($config_filename)");
else if ($err == -3)
- set_error("The configuration file $config_filename is not writable. Change its permissions so it is, then re-run step 4.");
+ display_error("The configuration file $config_filename is not writable. Change its permissions so it is, then re-run step 4.");
// Try connecting to database
$db = mysql_connect($database_host, $database_username, $database_password);
if (!$db)
{
- set_error('Database host name, username and/or password incorrect. MySQL Error:<br />'.mysql_error());
+ display_error('Database host name, username and/or password incorrect. MySQL Error:<br />'.mysql_error());
}
if($install_tables == true)
mysql_select_db($database_name, $db);
}
$import_filename = $path_to_root."/sql/en_US-demo.sql";
- if (!db_import($import_filename, $db_connections[$id]))
- set_error("Import error, try to import $import_filename manually via phpMyAdmin");
+ db_import($import_filename, $db_connections[$id]);
}
else
{