' . __($e->getMessage()) . '

'); } # Checks system capabilites require dirname(__FILE__).'/check.php'; if (!dcSystemCheck($con,$_e)) { $can_install = false; throw new Exception('

'.__('Dotclear cannot be installed.').'

'); } # Check if dotclear is already installed $schema = dbSchema::init($con); if (in_array($DBPREFIX.'version',$schema->getTables())) { throw new Exception(__('Dotclear is already installed.')); } # Does config.php.in exist? $config_in = dirname(__FILE__).'/../../inc/config.php.in'; if (!is_file($config_in)) { throw new Exception(sprintf(__('File %s does not exist.'),$config_in)); } # Can we write config.php if (!is_writable(dirname(DC_RC_PATH))) { throw new Exception(sprintf(__('Cannot write %s file.'),DC_RC_PATH)); } # Creates config.php file $full_conf = file_get_contents($config_in); writeConfigValue('DC_DBDRIVER',$DBDRIVER,$full_conf); writeConfigValue('DC_DBHOST',$DBHOST,$full_conf); writeConfigValue('DC_DBUSER',$DBUSER,$full_conf); writeConfigValue('DC_DBPASSWORD',$DBPASSWORD,$full_conf); writeConfigValue('DC_DBNAME',$DBNAME,$full_conf); writeConfigValue('DC_DBPREFIX',$DBPREFIX,$full_conf); $admin_url = preg_replace('%install/wizard.php$%','',$_SERVER['REQUEST_URI']); writeConfigValue('DC_ADMIN_URL',http::getHost().$admin_url,$full_conf); writeConfigValue('DC_MASTER_KEY',md5(uniqid()),$full_conf); $fp = @fopen(DC_RC_PATH,'wb'); if ($fp === false) { throw new Exception(sprintf(__('Cannot write %s file.'),DC_RC_PATH)); } fwrite($fp,$full_conf); fclose($fp); chmod(DC_RC_PATH, 0666); $con->close(); http::redirect('index.php?wiz=1'); } catch (Exception $e) { $err = $e->getMessage(); } } function writeConfigValue($name,$val,&$str) { $val = str_replace("'","\'",$val); $str = preg_replace('/(\''.$name.'\')(.*?)$/ms','$1,\''.$val.'\');',$str); } header('Content-Type: text/html; charset=UTF-8'); ?> <?php echo __('Dotclear installation wizard'); ?>
'.__('Dotclear installation wizard').''. '
'; if (!empty($err)) { echo '

'.__('Errors:').'

'.$err.'
'; } else { echo '

'.__('Welcome').'

'. '

'.__('To complete your Dotclear installation and start writing on your blog, '. 'we just need to know how to access your database and who you are. '. 'Just fill this two steps wizard with this information and we will be done.').'

'. '

'.__('Attention:').' '. __('this wizard may not function on every host. If it does not work for you, '. 'please refer to '. 'the documentation to learn how to create the config.php '. 'file manually.').'

'; } echo '

'.__('System information').'

'. '

'.__('Please provide the following information needed to create your configuration file.').'

'. '
'. '

'. '

'. '

'. '

'. '

'. '

'. '

'. '
'; ?>