Rev 1050 | Rev 1056 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1050 | Rev 1055 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | use ViaThinkSoft\OIDplus\OIDplusGui; |
21 | use ViaThinkSoft\OIDplus\OIDplusGui; |
22 | use ViaThinkSoft\OIDplus\OIDplusException; |
22 | use ViaThinkSoft\OIDplus\OIDplusException; |
23 | 23 | ||
24 | require_once __DIR__ . '/../../../../includes/oidplus.inc.php'; |
24 | require_once __DIR__ . '/../../../../includes/oidplus.inc.php'; |
25 | 25 | ||
- | 26 | set_exception_handler(array(OIDplusGui::class, 'html_exception_handler')); |
|
- | 27 | ||
26 | ob_start(); // allow cookie headers to be sent |
28 | ob_start(); // allow cookie headers to be sent |
27 | 29 | ||
28 | header('Content-Type:text/html; charset=UTF-8'); |
30 | header('Content-Type:text/html; charset=UTF-8'); |
29 | 31 | ||
30 | OIDplus::init(true); |
32 | OIDplus::init(true); |
Line 32... | Line 34... | ||
32 | 34 | ||
33 | if (OIDplus::baseConfig()->getValue('DISABLE_PLUGIN_ViaThinkSoft\OIDplus\OIDplusPageAdminOOBE', false)) { |
35 | if (OIDplus::baseConfig()->getValue('DISABLE_PLUGIN_ViaThinkSoft\OIDplus\OIDplusPageAdminOOBE', false)) { |
34 | throw new OIDplusException(_L('This plugin was disabled by the system administrator!')); |
36 | throw new OIDplusException(_L('This plugin was disabled by the system administrator!')); |
35 | } |
37 | } |
36 | 38 | ||
- | 39 | OIDplus::handleLangArgument(); |
|
- | 40 | ||
37 | ob_start(); |
41 | ob_start(); |
38 | 42 | ||
39 | $step = 1; |
43 | $step = 1; |
40 | $errors_happened = false; |
44 | $errors_happened = false; |
41 | $edits_possible = true; |
45 | $edits_possible = true; |
42 | 46 | ||
43 | echo '<!DOCTYPE html>'; |
- | |
44 | echo '<html lang="'.substr(OIDplus::getCurrentLang(),0,2).'">'; |
- | |
45 | - | ||
46 | echo '<head>'; |
- | |
47 | echo ' <title>'._L('OIDplus Setup').'</title>'; |
- | |
48 | echo ' <meta name="robots" content="noindex">'; |
- | |
49 | echo ' <meta name="viewport" content="width=device-width, initial-scale=1.0">'; |
- | |
50 | echo ' <script src="../../../../oidplus.min.js.php"></script>'; |
- | |
51 | echo ' <script src="../../../../polyfill.min.js.php"></script>'; |
- | |
52 | echo ' <link rel="stylesheet" href="../../../../setup/setup.min.css.php">'; |
- | |
53 | echo ' <link rel="shortcut icon" type="image/x-icon" href="../../../../favicon.ico.php">'; |
- | |
54 | echo '</head>'; |
- | |
55 | - | ||
56 | echo '<body>'; |
- | |
57 | - | ||
58 | echo '<h1>'._L('OIDplus Setup - Initial Settings').'</h1>'; |
- | |
59 | - | ||
60 | OIDplus::handleLangArgument(); |
- | |
61 | echo OIDplus::gui()->getLanguageBox(null, false); |
- | |
62 | - | ||
63 | echo '<p>'._L('If you can read this, then your database login credentials are correct.').'</p>'; |
47 | echo '<p>'._L('If you can read this, then your database login credentials are correct.').'</p>'; |
64 | 48 | ||
65 | echo '<p>'._L('The following settings need to be configured once.<br>After setup is complete, you can change all these settings through the admin login area, if necessary.').'</p>'; |
49 | echo '<p>'._L('The following settings need to be configured once.<br>After setup is complete, you can change all these settings through the admin login area, if necessary.').'</p>'; |
66 | 50 | ||
67 | echo '<form method="POST" action="oobe.php">'; |
51 | echo '<form method="POST" action="oobe.php">'; |
68 | echo '<input type="hidden" name="sent" value="1">'; |
52 | echo '<input type="hidden" name="sent" value="1">'; |
69 | 53 | ||
70 | if (OIDplus::getActiveCaptchaPlugin()->isVisible()) echo '<p><u>'._L('Step %1: Solve CAPTCHA',$step++).'</u></p>'; |
54 | if (OIDplus::getActiveCaptchaPlugin()->isVisible()) echo '<h2>'._L('Step %1: Solve CAPTCHA',$step++).'</h2>'; |
71 | if (isset($_POST['sent'])) { |
55 | if (isset($_POST['sent'])) { |
72 | try { |
56 | try { |
73 | OIDplus::getActiveCaptchaPlugin()->captchaVerify($_POST); |
57 | OIDplus::getActiveCaptchaPlugin()->captchaVerify($_POST); |
74 | } catch (\Exception $e) { |
58 | } catch (\Exception $e) { |
75 | echo '<p><font color="red"><b>'.htmlentities($e->getMessage()).'</b></font></p>'; |
59 | echo '<p><font color="red"><b>'.htmlentities($e->getMessage()).'</b></font></p>'; |
Line 77... | Line 61... | ||
77 | $edits_possible = false; |
61 | $edits_possible = false; |
78 | } |
62 | } |
79 | } |
63 | } |
80 | echo OIDplus::getActiveCaptchaPlugin()->captchaGenerate(_L('Before logging in, please solve the following CAPTCHA'), _L('If the CAPTCHA does not work (e.g. because of wrong keys, please run <a href="%1">setup part 1</a> again or edit %2 manually).',OIDplus::webpath(null,OIDplus::PATH_RELATIVE).'setup/','userdata/baseconfig/config.inc.php')); |
64 | echo OIDplus::getActiveCaptchaPlugin()->captchaGenerate(_L('Before logging in, please solve the following CAPTCHA'), _L('If the CAPTCHA does not work (e.g. because of wrong keys, please run <a href="%1">setup part 1</a> again or edit %2 manually).',OIDplus::webpath(null,OIDplus::PATH_RELATIVE).'setup/','userdata/baseconfig/config.inc.php')); |
81 | 65 | ||
82 | echo '<p><u>'._L('Step %1: Authenticate',$step++).'</u></p>'; |
66 | echo '<h2>'._L('Step %1: Authenticate',$step++).'</h2>'; |
83 | 67 | ||
84 | if (OIDplus::authUtils()->isAdminLoggedIn()) { |
68 | if (OIDplus::authUtils()->isAdminLoggedIn()) { |
85 | 69 | ||
86 | echo '<p><font color="green">You are already logged in as administrator.</font></p>'; |
70 | echo '<p><font color="green">You are already logged in as administrator.</font></p>'; |
87 | 71 | ||
Line 107... | Line 91... | ||
107 | #------------------------ |
91 | #------------------------ |
108 | 92 | ||
109 | # --- |
93 | # --- |
110 | 94 | ||
111 | function step_admin_email($step, $do_edits, &$errors_happened) { |
95 | function step_admin_email($step, $do_edits, &$errors_happened) { |
112 | echo '<p><u>'._L('Step %1: Please enter the email address of the system administrator',$step).'</u></p>'; |
96 | echo '<h2>'._L('Step %1: Please enter the email address of the system administrator',$step).'</h2>'; |
113 | echo '<input type="text" name="admin_email" value="'; |
97 | echo '<input type="text" name="admin_email" value="'; |
114 | 98 | ||
115 | $msg = ''; |
99 | $msg = ''; |
116 | if (isset($_POST['sent'])) { |
100 | if (isset($_POST['sent'])) { |
117 | echo htmlentities(isset($_POST['admin_email']) ? $_POST['admin_email'] : ''); |
101 | echo htmlentities(isset($_POST['admin_email']) ? $_POST['admin_email'] : ''); |
Line 132... | Line 116... | ||
132 | step_admin_email($step++, $do_edits, $errors_happened); |
116 | step_admin_email($step++, $do_edits, $errors_happened); |
133 | 117 | ||
134 | # --- |
118 | # --- |
135 | 119 | ||
136 | function step_system_title($step, $do_edits, &$errors_happened) { |
120 | function step_system_title($step, $do_edits, &$errors_happened) { |
137 | echo '<p><u>'._L('Step %1: What title should your Registration Authority / OIDplus instance have?',$step).'</u></p>'; |
121 | echo '<h2>'._L('Step %1: What title should your Registration Authority / OIDplus instance have?',$step).'</h2>'; |
138 | echo '<input type="text" name="system_title" value="'; |
122 | echo '<input type="text" name="system_title" value="'; |
139 | 123 | ||
140 | $msg = ''; |
124 | $msg = ''; |
141 | if (isset($_POST['sent'])) { |
125 | if (isset($_POST['sent'])) { |
142 | echo htmlentities(isset($_POST['system_title']) ? $_POST['system_title'] : ''); |
126 | echo htmlentities(isset($_POST['system_title']) ? $_POST['system_title'] : ''); |
Line 164... | Line 148... | ||
164 | } |
148 | } |
165 | } |
149 | } |
166 | 150 | ||
167 | # --- |
151 | # --- |
168 | 152 | ||
169 | echo '<p><u>'._L('Step %1: Save settings and start OIDplus',$step).'</u></p>'; |
153 | echo '<h2>'._L('Step %1: Save settings and start OIDplus',$step).'</h2>'; |
170 | echo '<input type="submit" value="'._L('Save and start OIDplus!').'">'; |
154 | echo '<input type="submit" value="'._L('Save and start OIDplus!').'">'; |
171 | echo '</form>'; |
155 | echo '</form>'; |
172 | 156 | ||
173 | $pki_status = OIDplus::getPkiStatus(); |
157 | $pki_status = OIDplus::getPkiStatus(); |
174 | 158 | ||
175 | if ($pki_status) { |
159 | if ($pki_status) { |
176 | 160 | ||
177 | echo '<p><u>'._L('Your OIDplus system ID (derived from the public key) is:').'</u></p>'; |
161 | echo '<h2>'._L('Your OIDplus system ID (derived from the public key) is:').'</h2>'; |
178 | 162 | ||
179 | echo '<b>'; |
163 | echo '<b>'; |
180 | $sysid_oid = OIDplus::getSystemId(true); |
164 | $sysid_oid = OIDplus::getSystemId(true); |
181 | if (!$sysid_oid) $sysid_oid = _L('Unknown!'); |
165 | if (!$sysid_oid) $sysid_oid = _L('Unknown!'); |
182 | echo htmlentities($sysid_oid); |
166 | echo htmlentities($sysid_oid); |
183 | echo '</b>'; |
167 | echo '</b>'; |
184 | 168 | ||
185 | echo '<p><u>'._L('Your public key is:').'</u></p>'; |
169 | echo '<h2>'._L('Your public key is:').'</h2>'; |
186 | 170 | ||
187 | $val = OIDplus::getSystemPublicKey(); |
171 | $val = OIDplus::getSystemPublicKey(); |
188 | if ($val) { |
172 | if ($val) { |
189 | echo '<pre>'.htmlentities($val).'</pre>'; |
173 | echo '<pre>'.htmlentities($val).'</pre>'; |
190 | } else { |
174 | } else { |
Line 206... | Line 190... | ||
206 | OIDplus::config()->setValue('oobe_main_done', '1'); |
190 | OIDplus::config()->setValue('oobe_main_done', '1'); |
207 | OIDplus::invoke_shutdown(); |
191 | OIDplus::invoke_shutdown(); |
208 | header('Location:../../../../'); |
192 | header('Location:../../../../'); |
209 | } else { |
193 | } else { |
210 | OIDplus::invoke_shutdown(); |
194 | OIDplus::invoke_shutdown(); |
- | 195 | ||
- | 196 | $page_title_1 = _L('OIDplus Setup'); |
|
- | 197 | $page_title_2 = _L('Initial settings'); |
|
- | 198 | $static_icon = 'img/main_icon.png'; |
|
211 | echo $cont; |
199 | $static_content = $cont; |
- | 200 | $extra_head_tags = array(); |
|
- | 201 | $extra_head_tags[] = '<meta name="robots" content="noindex">'; |
|
- | 202 | //$extra_head_tags[] = '<link rel="stylesheet" href="../../../../setup/setup.min.css.php">'; |
|
- | 203 | //$extra_head_tags[] = '<script src="../../../../setup/setup.min.js.php" type="text/javascript"></script>'; |
|
- | 204 | ||
- | 205 | OIDplus::gui()->showSimplePage($page_title_1, $page_title_2, $static_icon, $static_content, $extra_head_tags); |
|
212 | } |
206 | } |