. */ // Installation procedure define('IS_INSTALL', true); require_once dirname(__FILE__) . '/include/init.php'; if (file_exists(BASE_PATH . '/config.local.php')) { header('location: ./'); exit; } $dirs = array('datas', 'datas/pages', 'datas/documents', 'datas/templates/', 'datas/plugins', '', 'cache', 'cache/compiled', 'cache/compiled_admin', 'cache/pages'); foreach ($dirs as $dir) { if (!is_writable(BASE_PATH . '/' . $dir)) { die("L'application n'a pas le droit d'écrire dans le répertoire ".BASE_PATH . "/" . $dir.", pourtant elle en a besoin."); } } if (!empty($_POST['user']) && !empty($_POST['pass'])) { if (!preg_match('/^[a-z0-9A-Z]+$/', $_POST['user']) OR !preg_match('/^[a-z0-9A-Z]+$/', $_POST['pass'])) { die('Erreur: caractères autorisés: a-z, A-Z, 0-9.'); } $cfg = file_get_contents(BASE_PATH . '/config.inc.php'); $cfg = str_replace('myLogin', $_POST['user'], $cfg); $cfg = str_replace('myPassword', $_POST['pass'], $cfg); // On enregistre les données if (!@file_put_contents(BASE_PATH . '/config.local.php', $cfg)) { die('Impossible d\'écrire la configuration ! Vérifiez les permissions du répertoire.'); } // On crée le système de redirection via 404 $path = dirname($_SERVER['SCRIPT_NAME']); if ($path == '/') $path = ''; file_put_contents('.htaccess', "\nErrorDocument 404 ".$path."/index.php\n"); // On logue l'utilisateur ainsi créé require_once(BASE_PATH . '/config.local.php'); require_once(BASE_PATH . '/include/class.nanokubbe.php'); $nk = new NanoKubbe; $nk->login($_POST['user'], $_POST['pass']); // Et on crée une page home :) $nk->savePage('Home', "Faites un essai !\n\nEditez cette page en cliquant sur Editer."); header('Location: ./'); exit; } $tpl->template_dir = BASE_PATH . '/admin/templates'; $tpl->compile_dir = BASE_PATH . '/cache/compiled_admin'; $tpl->cache = 0; $tpl->display('install.tpl'); ?>