825e6169701edb4956378509953fa50752293c52
2 require_once 'diogenes.common.inc.php';
3 require_once 'diogenes.toplevel.inc.php';
4 require_once 'diogenes/diogenes.table-editor.inc.php';
6 $page = new $globals->toplevel(false
);
7 $page->assign('greeting',__("Initial setup"));
9 // check we are using native Diogenes authentication
10 if ((count($globals->tauth
) != 1) or empty($globals->tauth
["native"])) {
11 $page->assign('page_content', __("Sorry, this feature is only available using native Diogenes authentication."));
16 // check there are currently no admins
17 $res = $globals->db
->query("select username from {$globals->tauth["native
"]} where perms='admin'");
18 if (list($username) = mysql_fetch_row($res)) {
19 $page->assign('page_content', __("The database is already configured."));
24 $editor = new DiogenesTableEditor("diogenes_auth","user_id");
26 $editor->add_join_table("diogenes_perm","uid",true
);
28 $editor->describe("username", __("username"), true
);
29 $editor->describe("firstname", __("first name"), true
);
30 $editor->describe("lastname", __("last name"), true
);
31 $editor->describe("password", __("password"), false
, "password");
32 $editor->describe("perms", __("permissions"), true
, "set");
34 $editor->lock("username", "root");
35 $editor->lock("perms", "admin");
36 if (empty($_REQUEST['action']) or ($_REQUEST['action'] != 'update'))
38 $_REQUEST['action'] = 'edit';
41 $editor->run($page,'page_content');
43 // check if we have completed initial setup
44 $res = $globals->db
->query("select username from {$globals->tauth["native
"]} where perms='admin'");
45 if (list($username) = mysql_fetch_row($res)) {
46 $page->assign('page_content', __("The initial setup of the database was performed successfuly."));