<?php require_once '../thinkedit.init.php'; require_once ROOT . '/class/php_parser.class.php'; $parser = new php_parser(); echo '<pre>'; //echo $parser->save('config.php', $thinkedit->config); //echo $parser->toPhpHumanFriendly($thinkedit->config); $parser->save('config.php', $thinkedit->config); die; echo '<hr>'; $test = $parser->load('config.php'); print_r($test); die; $config = $thinkedit->config; function toPhp($data, $path = false) { if (is_array($data)) { foreach ($data as $key => $value) { if (is_array($value)) { $path[] = $key; //echo $key . ' : <br/>'; toPhp($value, $path); } else { echo '$config'; foreach ($path as $item) { echo "['" . $item . "']"; } echo ' = ' . $value . '<br>'; } }
</form> '; // include template : include_once 'install.template.php'; exit; } } /***************************** Paths and urls *****************************/ if (!isset($thinkedit->config['site']['root_url'])) { // if form has been sent, update config if ($url->get('root_url')) { $path_config['site']['root_url'] = $url->get('root_url'); require_once ROOT . '/class/php_parser.class.php'; $parser = new php_parser(); $parser->save(ROOT . '/config/path.php', $path_config); $out['info'] = 'The configuration (in /config/path.php) file has been saved'; $out['content'] = '<a href="">Go to next step</a>'; include_once 'install.template.php'; exit; } else { $url = new url(); $root_url = $url->self; // remove parts of the url (/install/index.php is not needed) $root_url = str_replace('/index.php', '', $root_url); $root_url = str_replace('install', '', $root_url); $out['title'] = 'Root url'; $out['help'] = 'Verify the url to your thinkedit installation'; $out['content'] = ' <form method="post"> URL :<br/> <input type="text" name="root_url" value="' . $root_url . '" size="50"> <br/><br/>
exit; } } /***************************** DB connection *****************************/ // Can we connect to DB ? // If not, show DB config screen + connect error info if (!$thinkedit->db->canConnect()) { // if form has been sent, update config if ($url->get('db_database')) { $config['site']['database']['main']['host'] = $url->get('db_host'); $config['site']['database']['main']['database'] = $url->get('db_database'); $config['site']['database']['main']['login'] = $url->get('db_login'); $config['site']['database']['main']['password'] = $url->get('db_password'); require_once ROOT . '/class/php_parser.class.php'; $parser = new php_parser(); $parser->save(ROOT . '/config/db.php', $config); $out['info'] = 'The configuration (in /config/db.php) file has been saved'; include_once 'install.template.php'; exit; } else { $out['title'] = 'I cannot connect to DB server or select DB'; $out['help'] = '(re)enter your database settings here, and ensure that the database exists and the login and password are ok'; $out['content'] = ' <form method="post"> Host : <input type="text" name="db_host" value="localhost"> <br/> Database name : <input type="text" name="db_database"> <br/> Login : <input type="text" name="db_login"> <br/> Password : <input type="text" name="db_password"> <br/> <input type="submit">