require_once INSTALL_FUNCTIONS . DS . 'database.php'; //Inclusion des fonctions de paramétrage de la base de données $bddcheck = check_connexion($datas['host'], $datas['login'], $datas['password'], $datas['database']); //On check la connexion à la bdd if ($bddcheck) { require_once LIBS . DS . 'config_magik.php'; //Import de la librairie de gestion des fichiers de configuration $cfg = new ConfigMagik(CONFIGS_FILES . DS . 'database.ini', true, true); //Création d'une instance, si le fichier database.ini n'existe pas il sera créé $datas['prefix'] = ""; //Par défaut à vide //On va parcourir les données postées et mettre à jour le fichier ini foreach ($datas as $k => $v) { $cfg->set($k, $v, $section); } $cfg->save(); //On sauvegarde le fichier de configuration } } } ?> <div id="right"> <div id="main"> <div class="box"> <div class="title"> <h2>CONFIGURATION DE LA BASE DE DONNEES</h2> </div> <div class="content nopadding"> <?php //Si la bdd n'est pas importée, cas par défaut on arrive sur la page
} } } try { $section = $config->get($section_name); //Get the entire section so that we can check the variables in it. foreach ($section as $title => $value) { //Here we go through all variables in the section and delete the ones that are in there but not in the $_GET variables //Used mostly for deleting things. if (!isset($_GET[$title]) && $config->get($title, $section_name) !== NULL) { $title = urlencode($title); try { $config = new ConfigMagik('config.ini', true, true); $config->removeKey($title, $section_name); //$title removed; $config->save(); } catch (Exception $e) { echo 'Unable to remove variable ' . $title . ' on section' . $section_name . '<br>'; echo $e; } } } } catch (Exception $e) { echo $e; } echo true; return true; } } else { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">