X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Ftoplevel%2Fboot.php;fp=htdocs%2Ftoplevel%2Fboot.php;h=825e6169701edb4956378509953fa50752293c52;hb=6855525e48fad5de270500a5445c4f4ff85d8bda;hp=0000000000000000000000000000000000000000;hpb=e69709aa8ee6108a1197e46b45367ba8dab55a52;p=diogenes.git diff --git a/htdocs/toplevel/boot.php b/htdocs/toplevel/boot.php new file mode 100644 index 0000000..825e616 --- /dev/null +++ b/htdocs/toplevel/boot.php @@ -0,0 +1,50 @@ +toplevel(false); +$page->assign('greeting',__("Initial setup")); + +// check we are using native Diogenes authentication +if ((count($globals->tauth) != 1) or empty($globals->tauth["native"])) { + $page->assign('page_content', __("Sorry, this feature is only available using native Diogenes authentication.")); + $page->display(''); + exit; +} + +// check there are currently no admins +$res = $globals->db->query("select username from {$globals->tauth["native"]} where perms='admin'"); +if (list($username) = mysql_fetch_row($res)) { + $page->assign('page_content', __("The database is already configured.")); + $page->display(''); + exit; +} + +$editor = new DiogenesTableEditor("diogenes_auth","user_id"); + +$editor->add_join_table("diogenes_perm","uid",true); + +$editor->describe("username", __("username"), true); +$editor->describe("firstname", __("first name"), true); +$editor->describe("lastname", __("last name"), true); +$editor->describe("password", __("password"), false, "password"); +$editor->describe("perms", __("permissions"), true, "set"); + +$editor->lock("username", "root"); +$editor->lock("perms", "admin"); +if (empty($_REQUEST['action']) or ($_REQUEST['action'] != 'update')) +{ + $_REQUEST['action'] = 'edit'; +} + +$editor->run($page,'page_content'); + +// check if we have completed initial setup +$res = $globals->db->query("select username from {$globals->tauth["native"]} where perms='admin'"); +if (list($username) = mysql_fetch_row($res)) { + $page->assign('page_content', __("The initial setup of the database was performed successfuly.")); +} + +$page->display(''); +?>