function parsePhpFolder($folder)
 {
     //die($folder);
     $complete_config = array();
     require_once 'php_parser.class.php';
     $parser = new php_parser();
     // test if folder is found
     if (file_exists($folder)) {
         $ressource = opendir($folder);
         // find files in this folder
         while (($file = readdir($ressource)) !== false) {
             // debug($file, 'xml_parser::parse_folder files');
             if (is_file($folder . '/' . $file)) {
                 $path_parts = pathinfo($file);
                 // if it's an yaml file, parse it and store thge results in an array
                 if ($path_parts['extension'] == 'php') {
                     $we_have_config_files = true;
                     $config = $parser->load($folder . '/' . $file);
                     if (!$config) {
                         trigger_error("we have a parsing error with {$file}");
                     }
                     if (is_array($config)) {
                         /*
                         echo '<pre>Complete config';
                         echo '<hr>';
                         print_r ($complete_config);
                         */
                         //$complete_config = array_merge($complete_config, $config);
                         array_merge_2($complete_config, $config);
                         /*
                         echo '<pre>Complete config after';
                         echo '<hr>';
                         print_r ($complete_config);
                         */
                     }
                 }
             }
         }
         if (isset($we_have_config_files)) {
             //echo '<pre>';
             //print_r($complete_config);
             return $complete_config;
         } else {
             trigger_error("thinkedit::parsePhpFolder() no config files found - aborting");
             die;
             return false;
         }
     } else {
         trigger_error("thinkedit::parsePhpFolder() : {$folder} is not found - aborting");
         die;
         return false;
     }
 }
				<input type="submit">
				
				</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">
<?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>';
            }
        }
 /**
 Will parse all subfoders of the plugin folder to find config.php config files
 They are merged with the main config file 
 */
 function parsePhpPluginFolder($folder = '/plugin/')
 {
     $complete_config = array();
     require_once 'php_parser.class.php';
     $parser = new php_parser();
     $folder = ROOT . $folder;
     // test if folder is found
     if (file_exists($folder)) {
         $ressource = opendir($folder);
         // find files in this folder
         while (($file = readdir($ressource)) !== false) {
             $plugin_folder = $folder . '/' . $file;
             if (is_dir($plugin_folder)) {
                 $plugin_config_file = $plugin_folder . '/config.php';
                 if (file_exists($plugin_config_file)) {
                     $config = $parser->load($plugin_config_file);
                     if ($config) {
                         array_merge_2($complete_config, $config);
                     }
                 }
                 if (!isset($config)) {
                     //trigger_error("we have a parsing error with $file");
                 }
             }
         }
     }
     return $complete_config;
 }
        include_once 'install.template.php';
        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">