2 && $_REQUEST['password'] == $_REQUEST['password2']) { install_do($_REQUEST['install'],$_REQUEST['allow_register'],$_REQUEST['hostname'],$_REQUEST['password']); } else { install_start($_REQUEST['allow_register'],$_REQUEST['hostname'],$_REQUEST['password'],$_REQUEST['password2']); } function install_start($allow_register,$hostname,$password,$password2) { if (isset($hostname) && !$_REQUEST['hostname']) { $errorHostname = lang_translate('installer-install-hostname-error','You must specify a hostname!'); } if (isset($password) || isset($_REQUEST['password2'])) { if (!$password) { $errorPassword = lang_translate('installer-install-passwords-required','The root password is required!'); $password2 = ''; } elseif (strlen($password) < 3) { $errorPassword = lang_translate('installer-install-passwords-characters','The root password needs to be more than three characters!'); $password = ''; $password2 = ''; } elseif ($password != $password2) { $errorPassword = lang_translate('installer-install-passwords-notmatch','The root passwords do not match!'); $password2 = ''; } } $content = '
' . lang_translate('installer-install-password-root','Root password') . '
' . $errorPassword . '
' . lang_translate('installer-install-password-retype','Retype password') . '
' . lang_translate('installer-install-hostname','Hostname') . '
' . $errorHostname . '
' . lang_translate('installer-install-allow-creation','Allow users to create accounts') . '
'; output_do($content,'install',lang_translate('installer-install-title','Please fill out the following form to install eyeOS:')); } function install_do($install,$allow_register,$hostname,$password) { if ($allow_register == 'on') { $allow_register = 1; } else { $allow_register = 0; } if ($install != '2') { // Untar install.eyepackage if (TYPE_INSTALL === 1) { include_once(INSTALL_DIR . 'pcl-tar.eyecode'); if (!PclTarExtract(INSTALL_PACKAGE,'./','','tgz')) { output_errors(array(lang_translate('installer-install-error-extract','The install files could not be extracted. To install eyeOS manually, rename "[package]" to "package.tar.gz" and extract the contents into the same directory.',array('[package]' => INSTALL_PACKAGE)))); } } // Rename dir $hash = 'eyeOS' . substr(md5(uniqid(rand())),0,10); if (!path_move('./eyeOS/','./' . $hash . '/')) { output_errors(lang_translate('installer-install-error-renaming','Could not rename the directory "./eyeOS/". Please, rename it manually to "[hash]".',array('[hash]' => $hash)),array('./index.php?install=2&hash=' . $hash,lang_translate('installer-install-continue','Continue...')),0); } } else { $hash = $_REQUEST['hash']; } // Create module files $xml = xml_xml2array(file_get_contents(INSTALL_DIR . 'files/modules.xml')); foreach ($xml['modules'][0] as $module => $files) { @mkdir('./' . $module . '/'); foreach ($files[0] as $file => $content) { file_put_contents('./' . $module . '/' . $file,base64_decode($content[0])); } } // system.xml $systemxml = xml_xml2array(file_get_contents('./' . $hash . '/system/conf/system.xml')); $systemxml['CONFIG'][0]['ALLOW_USER_REGISTER'][0] = $allow_register; $systemxml['CONFIG'][0]['EYEOS_HOSTNAME'][0] = $hostname; if (strpos(realpath('./'),'\\')) { $systemxml['CONFIG'][0]['OFFICE_COMMAND'][0] = 'C:\\Program Files\\OpenOffice.org 2.4\\program\\'; $systemxml['CONFIG'][0]['OFFICE_SEPARATOR_ARG'][0] = '"'; } file_put_contents('./' . $hash . '/system/conf/system.xml',xml_array2xml($systemxml)); // root.xml $rootxml = xml_xml2array(file_get_contents('./' . $hash . '/accounts/rt4/root.xml')); $rootxml['eyeUser'][0]['password'][0] = md5($password . md5($password)); $rootxml['eyeUser'][0]['createDate'][0] = time(); file_put_contents('./' . $hash . '/accounts/rt4/root.xml',xml_array2xml($rootxml)); // index.php copy(INSTALL_DIR . 'files/index.txt','./index.php'); // settings.php $settingsphp = file_get_contents(INSTALL_DIR . 'files/settings.txt'); $settingsphp = str_replace("define('REAL_EYE_ROOT','eyeOS');","define('REAL_EYE_ROOT','" . $hash . "');",$settingsphp); file_put_contents('./settings.php',$settingsphp); // Remove the installer output_remove(); } ?>