This repository was archived by the owner on Aug 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
129 lines (108 loc) · 3.46 KB
/
index.php
File metadata and controls
129 lines (108 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
ob_end_clean();
ob_start();
header('Content-type: text/html; charset=utf-8' );
$startSetup = false;
include_once('Installer.php');
$setup = new Installer();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<header>
<h1>Group-Office</h1>
<small>Installation</small>
</header>
<?php if($setup->isInstalled()): ?>
<section>
<fieldset>
<h2>Group-Office is already installed</h2>
<p>If you want to reinstall please (re)move your config.php file and use an empty database with an empty data folder</p>
</fieldset>
</section>
<?php elseif(!$_POST): ?>
<section>
<form method="POST" action="">
<fieldset>
<h2>Create an admin account</h2>
<label>
<input type="text" name="admin_user" value="<?=$setup->admin_user;?>" placeholder="Username" required />
</label>
<label>
<input type="password" name="admin_pass" value="<?=$setup->admin_pass;?>" placeholder="Password" required />
</label>
</fieldset>
<fieldset>
<h2>Data folder</h2>
<label>
<input type="text" name="data_folder" value="<?=$setup->data_folder;?>" required />
</label>
</fieldset>
<fieldset>
<h2>Configure the database</h2>
<label>
<input type="text" name="db_user" value="<?=$setup->db_user;?>" placeholder="Database user" required />
</label>
<label>
<input type="password" name="db_pass" value="<?=$setup->db_pass;?>" placeholder="Database password" />
</label>
<label>
<input type="text" name="db_name" value="<?=$setup->db_name;?>" placeholder="Database name" required />
</label>
<label>
<input type="text" name="db_host" value="<?=$setup->db_host;?>" placeholder="Database host" required />
</label>
</fieldset>
<button>Start setup</button>
</form>
</section>
<?php else: ?>
<?php $tests = $setup->systemTests(); ?>
<section>
<fieldset>
<h2>System check</h2>
<ul class="tests">
<?php foreach($tests as $test): ?>
<?php if(!$test['pass']): if($test['fatal']) {$fatal = true;} ?>
<li<?= $test['fatal']?' class="error"':''?>><b><?= $test['name'] . '</b><br><small>' . $test['feedback'];?></small></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</fieldset>
</section>
<section>
<?php if(empty($fatal)): $startSetup = true; ?>
<script type="text/javascript">
var loading = setInterval(function() { document.getElementById('process').textContent += ' .'; }, 100);
</script>
<fieldset>
<h2>Process</h2>
<span id="process">Installing Group-Office.</span>
</fieldset>
<button id="btnContinue" onclick="window.location.href = '../';" style="display:none;">Start Group-Office</button>
<?php else: ?>
<button id="btnRetry" onclick="window.location.reload();">Retry</button>
<?php endif; ?>
</section>
<?php endif; ?>
<footer>Group-Office ‐ Online Groupware Platform</footer>
</body>
</html>
<?php
ob_flush();
flush();
if($startSetup) {
echo '<script type="text/javascript">
clearInterval(loading);';
$result = $setup->start() ;
if($result !== true){
echo 'document.getElementById(\'process\').textContent = \'Installation failed:\ '. $result. '\';' ;
} else {
echo 'document.getElementById(\'process\').textContent = \'Installation complete\';
document.getElementById(\'btnContinue\').style="";';
}
echo '</script>';
} ?>