-
- Welcome to the FrontAccounting Installation Wizard.
-
-
-
-
+function do_install() {
+
+ global $path_to_root, $db_connections, $def_coy, $installed_extensions, $tb_pref_counter,
+ $dflt_lang, $installed_languages;
+
+ $coa = $_SESSION['inst_set']['coa'];
+ if (install_connect_db() && db_import($path_to_root.'/sql/'.$coa, $_SESSION['inst_set'])) {
+ $con = $_SESSION['inst_set'];
+ $table_prefix = $con['tbpref'];
+
+ $def_coy = 0;
+ $tb_pref_counter = 0;
+ $db_connections = array (0=> array (
+ 'name' => $con['name'],
+ 'host' => $con['host'],
+ 'port' => $con['port'],
+ 'dbname' => $con['dbname'],
+ 'collation' => $con['collation'],
+ 'tbpref' => $table_prefix,
+ 'dbuser' => $con['dbuser'],
+ 'dbpassword' => $con['dbpassword'],
+ ));
+
+ $_SESSION['wa_current_user']->cur_con = 0;
- Error: $con['name']));
+ $admin = get_user_by_login('admin');
+ update_user_prefs($admin['id'], array(
+ 'language' => $con['lang'],
+ 'password' => md5($con['pass']),
+ 'user_id' => $con['admin']));
+
+ if (!copy($path_to_root. "/config.default.php", $path_to_root. "/config.php")) {
+ display_error(_("Cannot save system configuration file 'config.php'."));
+ return false;
}
- ?>
-
-
- Step 1Please check the following requirements are met before continuing... |
-
- Enabled') { ?>
-
- Please note: PHP Session Support may appear disabled if your browser does not support cookies. |
-
-
-
- PHP Version > 4.1.0 |
-
- 4.1) {
- ?>YesNo
- |
- PHP Session Support |
- |
- PHP Safe Mode |
-
- EnabledDisabled
- |
-
-
-
-
- Step 2Please check the following files/folders are writeable before continuing... |
-
-
- config_db.php |
- Writeable'; } elseif(!file_exists($path_to_root.'/config_db.php')) { echo 'File Not Found'; } else { echo 'Unwriteable'; } ?> |
- inventory/manage/image/ |
- Writeable'; } elseif(!file_exists($path_to_root.'/inventory/manage/image/')) { echo 'Directory Not Found'; } else { echo 'Unwriteable'; } ?> |
-
-
- lang/ |
- Writeable'; } elseif(!file_exists($path_to_root.'/lang/')) { echo 'Directory Not Found'; } else { echo 'Unwriteable'; } ?> |
- reporting/pdf_files/ |
- Writeable'; } elseif(!file_exists($path_to_root.'/reporting/pdf_files/')) { echo 'Directory Not Found'; } else { echo 'Unwriteable'; } ?> |
-
-
- admin/backup/ |
- Writeable'; } elseif(!file_exists($path_to_root.'/admin/backup/')) { echo 'Directory Not Found'; } else { echo 'Unwriteable'; } ?> |
-
-
-
-
-
+
+ $err = write_config_db($table_prefix != "");
+
+ if ($err == -1) {
+ display_error(_("Cannot open 'config_db.php' configuration file."));
+ return false;
+ } else if ($err == -2) {
+ display_error(_("Cannot write to the 'config_db.php' configuration file."));
+ return false;
+ } else if ($err == -3) {
+ display_error(_("Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."));
+ return false;
+ }
+ // update default language
+ if (file_exists($path_to_root . "/lang/installed_languages.inc"))
+ include_once($path_to_root . "/lang/installed_languages.inc");
+ $dflt_lang = $_POST['lang'];
+ write_lang();
+ return true;
+ }
+ return false;
+}
+
+if (!isset($_SESSION['inst_set'])) // default settings
+ $_SESSION['inst_set'] = array(
+ 'host'=>'localhost',
+ 'port' => '', // 3306
+ 'dbuser' => 'root',
+ 'dbpassword' => '',
+ 'username' => 'admin',
+ 'tbpref' => '0_',
+ 'admin' => 'admin',
+ 'inst_lang' => 'C',
+ 'collation' => 'xx',
+ );
+
+if (!@$_POST['Tests'])
+ $_POST['Page'] = 1; // set to start page
+
+if (isset($_POST['back']) && (@$_POST['Page']>1)) {
+ if ($_POST['Page'] == 5)
+ $_POST['Page'] = 2;
+ else
+ $_POST['Page']--;
+}
+elseif (isset($_POST['continue'])) {
+ $_POST['Page'] = 2;
+}
+elseif (isset($_POST['db_test'])) {
+ if (get_post('host')=='') {
+ display_error(_('Host name cannot be empty.'));
+ set_focus('host');
+ }
+ elseif ($_POST['port'] != '' && !is_numeric($_POST['port'])) {
+ display_error(_('Database port have to be numeric or empty.'));
+ set_focus('port');
+ }
+ elseif ($_POST['dbuser']=='') {
+ display_error(_('Database user name cannot be empty.'));
+ set_focus('dbuser');
+ }
+ elseif ($_POST['dbname']=='') {
+ display_error(_('Database name cannot be empty.'));
+ set_focus('dbname');
+ }
+ else {
+ $_SESSION['inst_set'] = array_merge($_SESSION['inst_set'], array(
+ 'host' => $_POST['host'],
+ 'port' => $_POST['port'],
+ 'dbuser' => $_POST['dbuser'],
+ 'dbpassword' => $_POST['dbpassword'],
+ 'dbname' => $_POST['dbname'],
+ 'tbpref' => $_POST['tbpref'] ? '0_' : '',
+ 'sel_langs' => check_value('sel_langs'),
+ 'sel_coas' => check_value('sel_coas'),
+ 'collation' => $_POST['collation'],
+ ));
+ if (install_connect_db()) {
+ $_POST['Page'] = check_value('sel_langs') ? 3 :
+ (check_value('sel_coas') ? 4 : 5);
+ }
+ }
+ if (!file_exists($path_to_root . "/lang/installed_languages.inc")) {
+ $installed_languages = array (
+ 0 => array ('code' => 'C', 'name' => 'English', 'encoding' => 'iso-8859-1'));
+ $dflt_lang = 'C';
+ write_lang();
+ }
+}
+elseif(get_post('install_langs'))
+{
+ $ret = true;
+ if (isset($_POST['langs']))
+ foreach($_POST['langs'] as $package => $ok) {
+ $ret &= install_language($package);
+ }
+ if ($ret) {
+ $_POST['Page'] = $_SESSION['inst_set']['sel_coas'] ? 4 : 5;
+ }
+}
+elseif(get_post('install_coas'))
+{
+ $ret = true;
+ $next_extension_id = 0;
- |
-
-