Rev 305 | Rev 309 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
82 | daniel-mar | 1 | <?php |
2 | |||
236 | daniel-mar | 3 | require_once __DIR__ . '/../includes/oidplus.inc.php'; |
82 | daniel-mar | 4 | |
5 | ?><!DOCTYPE html> |
||
2 | daniel-mar | 6 | <html lang="en"> |
7 | |||
8 | <head> |
||
157 | daniel-mar | 9 | <title>OIDplus Setup</title> |
104 | daniel-mar | 10 | <meta name="robots" content="noindex"> |
157 | daniel-mar | 11 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
2 | daniel-mar | 12 | <link rel="stylesheet" href="setup.css"> |
13 | <script src="../3p/sha3_js/sha3.js"></script><!-- https://github.com/emn178/js-sha3 --> |
||
14 | <script src="setup.js"></script> |
||
15 | </head> |
||
16 | |||
104 | daniel-mar | 17 | <body onload="rebuild()"> |
2 | daniel-mar | 18 | |
157 | daniel-mar | 19 | <h1>OIDplus Setup - Configuration File Generator</h1> |
2 | daniel-mar | 20 | |
294 | daniel-mar | 21 | <p>Thank you very much for choosing OIDplus! This setup assistant will help you creating or updating the file <b>userdata/baseconfig/config.inc.php</b>. |
157 | daniel-mar | 22 | Setup does not automatically write to this file. Instead, you need to copy-paste the contents into the file. |
23 | Once OIDplus setup is finished, you can change the config file by hand, or run this setup assistant again.</p> |
||
24 | |||
299 | daniel-mar | 25 | <h2 id="systemCheckCaption" style="display:none">System check</h2> |
26 | |||
27 | <div id="dirAccessWarning"></div> |
||
28 | |||
29 | <script> |
||
301 | daniel-mar | 30 | function RemoveLastDirectoryPartOf(the_url) { |
31 | var the_arr = the_url.split('/'); |
||
32 | if (the_arr.pop() == '') the_arr.pop(); |
||
33 | return( the_arr.join('/') ); |
||
34 | } |
||
299 | daniel-mar | 35 | function checkAccess(dir) { |
305 | daniel-mar | 36 | var url = '../' + dir; |
37 | var visibleUrl = RemoveLastDirectoryPartOf(window.location.href) + '/' + dir; // xhr.responseURL not available in IE |
||
301 | daniel-mar | 38 | |
299 | daniel-mar | 39 | var xhr = new XMLHttpRequest(); |
40 | xhr.onreadystatechange = function() { |
||
41 | if (xhr.readyState === 4) { |
||
42 | if (xhr.status === 200) { |
||
43 | document.getElementById('systemCheckCaption').style.display = 'block'; |
||
301 | daniel-mar | 44 | document.getElementById('dirAccessWarning').innerHTML = document.getElementById('dirAccessWarning').innerHTML + 'Attention: The following directory is world-readable: <a target="_blank" href="'+url+'">'+visibleUrl+'</a> ! You need to configure your web server to restrict access to this directory! (For Apache see <i>.htaccess</i>, for Microsoft IIS see <i>web.config</i>, for Nginx see <i>nginx.conf</i>)<br>'; |
299 | daniel-mar | 45 | } |
46 | } |
||
47 | }; |
||
48 | |||
301 | daniel-mar | 49 | xhr.open('GET', url); |
299 | daniel-mar | 50 | xhr.send(); |
51 | } |
||
52 | |||
53 | document.getElementById('dirAccessWarning').innerHTML = ""; |
||
305 | daniel-mar | 54 | checkAccess('userdata/index.html'); |
55 | checkAccess('dev/index.html'); |
||
56 | checkAccess('includes/index.html'); |
||
57 | //checkAccess('plugins/publicPages/100_whois/whois/cli/index.html'); |
||
299 | daniel-mar | 58 | </script> |
59 | |||
2 | daniel-mar | 60 | <div id="step1"> |
61 | <h2>Step 1: Enter setup information</h2> |
||
157 | daniel-mar | 62 | |
63 | <h3>Administrator password</h3> |
||
64 | |||
2 | daniel-mar | 65 | <form id="step1_form"> |
104 | daniel-mar | 66 | <p>Which admin password do you want?<br><input id="admin_password" type="password" autocomplete="new-password" onkeypress="rebuild()" onkeyup="rebuild()"> <span id="password_warn"></span></p> |
67 | <p>Please repeat the password input:<br><input id="admin_password2" type="password" autocomplete="new-password" onkeypress="rebuild()" onkeyup="rebuild()"> <span id="password_warn2"></span></p> |
||
150 | daniel-mar | 68 | |
157 | daniel-mar | 69 | <h3>Database connectivity</h3> |
150 | daniel-mar | 70 | |
258 | daniel-mar | 71 | <p><a href="../plugins/database/database_connectivity_diagram.png" target="_blank"><img src="../plugins/database/database_connectivity_diagram.png" width="20%" alt="Database connectivity diagram" title="Database connectivity diagram"></a></p> |
250 | daniel-mar | 72 | |
150 | daniel-mar | 73 | Database plugin: <select name="db_plugin" onChange="dbplugin_changed()" id="db_plugin"> |
236 | daniel-mar | 74 | |
75 | <?php |
||
76 | |||
277 | daniel-mar | 77 | OIDplus::registerAllPlugins('database', 'OIDplusDatabasePlugin', null); |
236 | daniel-mar | 78 | foreach (get_declared_classes() as $c) { |
246 | daniel-mar | 79 | if (is_subclass_of($c, 'OIDplusDatabasePlugin')) { |
275 | daniel-mar | 80 | $selected = $c::id() == 'MySQL' ? ' selected="true"' : ''; |
81 | echo '<option value="'.htmlentities($c::id()).'"'.$selected.'>'.htmlentities($c::id()).'</option>'; |
||
236 | daniel-mar | 82 | } |
83 | } |
||
84 | |||
85 | ?> |
||
150 | daniel-mar | 86 | </select> |
87 | |||
88 | <script> |
||
89 | |||
236 | daniel-mar | 90 | setupdir = '<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI']; ?>'; |
150 | daniel-mar | 91 | rebuild_callbacks = []; |
92 | rebuild_config_callbacks = []; |
||
93 | plugin_combobox_change_callbacks = []; |
||
94 | |||
95 | function dbplugin_changed() { |
||
96 | var e = document.getElementById("db_plugin"); |
||
97 | var strPlugin = e.options[e.selectedIndex].value; |
||
98 | |||
99 | for (var i = 0; i < plugin_combobox_change_callbacks.length; i++) { |
||
100 | var f = plugin_combobox_change_callbacks[i]; |
||
101 | f(strPlugin); |
||
102 | } |
||
103 | |||
104 | rebuild(); |
||
105 | } |
||
106 | |||
107 | </script> |
||
108 | |||
109 | <div style="margin-left:50px"> |
||
110 | |||
111 | <?php |
||
112 | |||
294 | daniel-mar | 113 | OIDplus::registerAllPlugins('sqlSlang', 'OIDplusSqlSlangPlugin', null); |
274 | daniel-mar | 114 | $sql_slang_selection = array(); |
115 | foreach (get_declared_classes() as $c) { |
||
116 | if (is_subclass_of($c, 'OIDplusSqlSlangPlugin')) { |
||
117 | $obj = new $c; |
||
118 | $slang_id = $obj::id(); |
||
307 | daniel-mar | 119 | $pluginManifest = OIDplus::getpluginManifest($obj); |
120 | $human_friendly_name = empty($pluginManifest->getName()) ? $pluginManifest->getName() : get_class($obj); |
||
274 | daniel-mar | 121 | $sql_slang_selection[] = '<option value="'.$slang_id.'">'.$human_friendly_name.'</option>'; |
122 | } |
||
123 | } |
||
124 | $sql_slang_selection = implode("\n", $sql_slang_selection); |
||
125 | |||
305 | daniel-mar | 126 | $found_db_plugins = 0; |
127 | OIDplus::registerAllPlugins('database', 'OIDplusDatabasePlugin', null); |
||
128 | foreach (get_declared_classes() as $c) { |
||
129 | if (is_subclass_of($c, 'OIDplusDatabasePlugin')) { |
||
130 | $found_db_plugins++; |
||
131 | $cont = $c::setupHTML(); |
||
132 | $cont = str_replace('<!-- %SQL_SLANG_SELECTION% -->', $sql_slang_selection, $cont); |
||
133 | echo $cont; |
||
277 | daniel-mar | 134 | } |
135 | } |
||
136 | |||
305 | daniel-mar | 137 | if ($found_db_plugins == 0) { |
236 | daniel-mar | 138 | echo '<p><font color="red">ERROR: No database plugins were found! You CANNOT use OIDplus without database connection.</font></p>'; |
150 | daniel-mar | 139 | } |
140 | |||
141 | ?> |
||
142 | |||
143 | </div> |
||
144 | |||
145 | <script> |
||
146 | dbplugin_changed(); |
||
147 | </script> |
||
148 | |||
104 | daniel-mar | 149 | <p>Tablename prefix (e.g. <b>oidplus_</b>):<br><input id="tablename_prefix" type="text" value="oidplus_" onkeypress="rebuild()" onkeyup="rebuild()"></p> |
157 | daniel-mar | 150 | |
151 | <h3>ReCAPTCHA</h3> |
||
152 | |||
153 | <p><input id="recaptcha_enabled" type="checkbox" onclick="rebuild()"> <label for="recaptcha_enabled">reCAPTCHA enabled</label> (<a href="https://developers.google.com/recaptcha/intro" target="_blank">more information and obtain key</a>)</p> |
||
154 | <p>reCAPTCHA Public key<br><input id="recaptcha_public" type="text" onkeypress="rebuild()" onkeyup="rebuild()"></p> |
||
155 | <p>reCAPTCHA Private key<br><input id="recaptcha_private" type="text" onkeypress="rebuild()" onkeyup="rebuild()"></p> |
||
156 | |||
157 | <h3>TLS</h3> |
||
158 | |||
104 | daniel-mar | 159 | <p>SSL enforcement<br><select name="enforce_ssl" id="enforce_ssl" onclick="rebuild()"> |
80 | daniel-mar | 160 | <option value="0">No SSL available (don't redirect)</option> |
161 | <option value="1">Enforce SSL (always redirect)</option> |
||
82 | daniel-mar | 162 | <option value="2" selected>Intelligent SSL detection (redirect if port 443 is open)</option> |
80 | daniel-mar | 163 | </select></p> |
2 | daniel-mar | 164 | </form> |
165 | </div> |
||
166 | |||
167 | <div id="step2"> |
||
237 | daniel-mar | 168 | <h2>Step 2: Initialize database</h2> |
239 | daniel-mar | 169 | <p><font color="red"><b>If you already have an OIDplus database and just want to rebuild the config file, please skip this step.</b></font></p> |
81 | daniel-mar | 170 | <p>Otherwise, import one of the following MySQL dumps in your database:</p> |
2 | daniel-mar | 171 | <p><ul> |
150 | daniel-mar | 172 | <li><a href="struct_empty.sql.php" id="struct_1" target="_blank">Empty OIDplus database without example data</a><span id="struct_cli_1"></span><br><br></li> |
173 | <li><a href="struct_with_examples.sql.php" id="struct_2" target="_blank">OIDplus database with example data</a><span id="struct_cli_2"></span><br><br></li> |
||
174 | |||
2 | daniel-mar | 175 | </ul></p> |
150 | daniel-mar | 176 | <p><font color="red">Warning: All data from the previous OIDplus instance will be deleted during the import.<br>If you already have an OIDplus database, skip to Step 3.</font></p> |
80 | daniel-mar | 177 | |
2 | daniel-mar | 178 | </div> |
179 | |||
180 | <div id="step3"> |
||
294 | daniel-mar | 181 | <h2>Step 3: Save userdata/baseconfig/config.inc.php file</h2> |
182 | <p>Save following contents into the file <b>userdata/baseconfig/config.inc.php</b>:</p> |
||
2 | daniel-mar | 183 | <code><font color="darkblue"><div id="config"></div></font></code> |
184 | </div> |
||
185 | |||
186 | <div id="step4"> |
||
80 | daniel-mar | 187 | <h2>Step 4: Continue to next step</h2> |
154 | daniel-mar | 188 | <p><input type="button" onclick="window.location.href='../'" value="Continue"></p> |
80 | daniel-mar | 189 | <!-- <p><a href="../">Run the OIDplus system</a></p> --> |
2 | daniel-mar | 190 | </div> |
191 | |||
192 | </body> |
||
193 | </html> |