2000-12-13 11:27:14 +01:00
|
|
|
<?php
|
|
|
|
// Little file to setup a demo install
|
|
|
|
/* $Id $ */
|
|
|
|
|
|
|
|
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home", "noapi" => True);
|
|
|
|
include("./inc/functions.inc.php");
|
|
|
|
include("../header.inc.php");
|
|
|
|
|
|
|
|
// Authorize the user to use setup app and load the database
|
|
|
|
// Does not return unless user is authorized
|
2000-12-27 23:04:44 +01:00
|
|
|
if (!$phpgw_setup->auth("Config")){
|
2000-12-13 11:27:14 +01:00
|
|
|
Header("Location: index.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $submit) {
|
2000-12-28 10:52:13 +01:00
|
|
|
$phpgw_setup->show_header("Demo Server Setup");
|
2000-12-13 11:27:14 +01:00
|
|
|
?>
|
2000-12-28 10:52:13 +01:00
|
|
|
<table border="1" width="100%" cellspacing="0" cellpadding="2">
|
|
|
|
<tr><td>
|
|
|
|
This will create 1 admin account and 3 demo accounts<br>
|
|
|
|
The username/passwords are: demo/guest, demo2/guest and demo3/guest.<br>
|
|
|
|
<b>!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!</b><br>
|
|
|
|
</td></tr>
|
|
|
|
<tr><td align="left" bgcolor="486591"><font color="fefefe">Details for Admin account</td><td align="right" bgcolor="486591"> </td></tr>
|
|
|
|
<tr><td>
|
|
|
|
<form method="POST" acion="<?php echo $PHP_SELF; ?>">
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Admin username</td>
|
|
|
|
<td><input type="text" name="username"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Admin first name</td>
|
|
|
|
<td><input type="text" name="fname"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Admin last name</td>
|
|
|
|
<td><input type="text" name="lname"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Admin password</td>
|
|
|
|
<td><input type="password" name="passwd"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2"><input type="submit" name="submit" value="Submit"> </td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
</td></tr></table>
|
2000-12-13 11:27:14 +01:00
|
|
|
<?php
|
|
|
|
}else{
|
2000-12-27 10:05:13 +01:00
|
|
|
$phpgw_setup->loaddb();
|
2000-12-13 11:27:14 +01:00
|
|
|
/* First clear out exsisting tables */
|
2000-12-14 12:32:02 +01:00
|
|
|
$defaultprefs = 'a:5:{s:6:"common";a:1:{s:0:"";s:2:"en";}s:11:"addressbook";a:1:{s:0:"";s:4:"True";}i:8;a:1:{s:0:"";s:13:"workdaystarts";}i:15;a:1:{s:0:"";s:11:"workdayends";}s:6:"Monday";a:1:{s:0:"";s:13:"weekdaystarts";}}';
|
2000-12-27 10:05:13 +01:00
|
|
|
$phpgw_setup->db->query("delete from accounts");
|
|
|
|
$phpgw_setup->db->query("delete from preferences");
|
|
|
|
$phpgw_setup->db->query("delete from phpgw_acl");
|
2000-12-13 11:27:14 +01:00
|
|
|
|
|
|
|
/* Create records for demo accounts */
|
|
|
|
$sql = "insert into accounts";
|
2001-01-31 18:31:18 +01:00
|
|
|
$sql .= "(account_id, account_lid, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
|
|
|
|
$sql .= "values (1, 'demo', '084e0343a0486ff05530df6c705c8bb4', 'Demo', 'Account', ".time().", 'A')";
|
2000-12-27 10:05:13 +01:00
|
|
|
$phpgw_setup->db->query($sql);
|
|
|
|
$phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('1', '$defaultprefs')");
|
2001-01-31 18:31:18 +01:00
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', 1, 'u', 0)" ;
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', 1, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', 1, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', 1, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', 1, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', 1, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', 1, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', 1, 'u', 1)";
|
|
|
|
|
2000-12-13 11:27:14 +01:00
|
|
|
|
|
|
|
$sql = "insert into accounts";
|
2001-01-31 18:31:18 +01:00
|
|
|
$sql .= "(account_id, account_lid, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
|
|
|
|
$sql .= "values (2, 'demo2', '084e0343a0486ff05530df6c705c8bb4', 'Demo2', 'Account', ".time().", 'A')";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', 2, 'u', 0)" ;
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', 2, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', 2, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', 2, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', 2, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', 2, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', 2, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', 2, 'u', 1)";
|
2000-12-13 11:27:14 +01:00
|
|
|
|
|
|
|
$sql = "insert into accounts";
|
2001-01-31 18:31:18 +01:00
|
|
|
$sql .= "(account_id, account_lid, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
|
|
|
|
$sql .= "values (3, 'demo3', '084e0343a0486ff05530df6c705c8bb4', 'Demo3', 'Account', ".time().", 'A')";
|
2000-12-27 10:05:13 +01:00
|
|
|
$phpgw_setup->db->query($sql);
|
|
|
|
$phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('1', '$defaultprefs')");
|
2001-01-31 18:31:18 +01:00
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', 3, 'u', 0)" ;
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', 3, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', 3, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', 3, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', 3, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', 3, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', 3, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', 3, 'u', 1)";
|
2000-12-13 11:27:14 +01:00
|
|
|
|
|
|
|
/* Create records for administrator account */
|
|
|
|
$sql = "insert into accounts";
|
2001-01-31 18:31:18 +01:00
|
|
|
$sql .= "(account_id, account_lid, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
|
|
|
|
$sql .= "values (4, '$username', '".md5($passwd)."', '$fname', '$lname', ".time().", 'A')";
|
2000-12-27 10:05:13 +01:00
|
|
|
$phpgw_setup->db->query($sql);
|
|
|
|
$phpgw_setup->db->query("insert into preferences (preference_owner, preference_value) values ('1', '$defaultprefs')");
|
2001-01-31 18:31:18 +01:00
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '2', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('admin', 'run', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('filemanager', 'run', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('calendar', 'run', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('email', 'run', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('notes', 'run', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('nntp', 'run', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('todo', 'run', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('transy', 'run', 4, 'u', 1)";
|
|
|
|
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('manual', 'run', 4, 'u', 1)";
|
2000-12-13 11:27:14 +01:00
|
|
|
|
2000-12-28 10:52:13 +01:00
|
|
|
Header("Location: index.php");
|
|
|
|
exit;
|
2000-12-13 11:27:14 +01:00
|
|
|
}
|
|
|
|
?>
|