Rev 258 | Rev 275 | 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 | |
157 | daniel-mar | 21 | <p>Thank you very much for choosing OIDplus! This setup assistant will help you creating or updating the file <b>includes/config.inc.php</b>. |
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 | |||
2 | daniel-mar | 25 | <div id="step1"> |
26 | <h2>Step 1: Enter setup information</h2> |
||
157 | daniel-mar | 27 | |
28 | <h3>Administrator password</h3> |
||
29 | |||
2 | daniel-mar | 30 | <form id="step1_form"> |
104 | daniel-mar | 31 | <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> |
32 | <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 | 33 | |
157 | daniel-mar | 34 | <h3>Database connectivity</h3> |
150 | daniel-mar | 35 | |
258 | daniel-mar | 36 | <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 | 37 | |
150 | daniel-mar | 38 | Database plugin: <select name="db_plugin" onChange="dbplugin_changed()" id="db_plugin"> |
236 | daniel-mar | 39 | |
40 | <?php |
||
41 | |||
42 | $ary = glob(__DIR__ . '/../plugins/database/'.'*'.'/plugin.inc.php'); |
||
43 | foreach ($ary as $a) include $a; |
||
44 | |||
45 | foreach (get_declared_classes() as $c) { |
||
246 | daniel-mar | 46 | if (is_subclass_of($c, 'OIDplusDatabasePlugin')) { |
236 | daniel-mar | 47 | $selected = $c::name() == 'MySQL' ? ' selected="true"' : ''; |
48 | echo '<option value="'.htmlentities($c::name()).'"'.$selected.'>'.htmlentities($c::name()).'</option>'; |
||
49 | } |
||
50 | } |
||
51 | |||
52 | ?> |
||
150 | daniel-mar | 53 | </select> |
54 | |||
55 | <script> |
||
56 | |||
236 | daniel-mar | 57 | setupdir = '<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI']; ?>'; |
150 | daniel-mar | 58 | rebuild_callbacks = []; |
59 | rebuild_config_callbacks = []; |
||
60 | plugin_combobox_change_callbacks = []; |
||
61 | |||
62 | function dbplugin_changed() { |
||
63 | var e = document.getElementById("db_plugin"); |
||
64 | var strPlugin = e.options[e.selectedIndex].value; |
||
65 | |||
66 | for (var i = 0; i < plugin_combobox_change_callbacks.length; i++) { |
||
67 | var f = plugin_combobox_change_callbacks[i]; |
||
68 | f(strPlugin); |
||
69 | } |
||
70 | |||
71 | rebuild(); |
||
72 | } |
||
73 | |||
74 | </script> |
||
75 | |||
76 | <div style="margin-left:50px"> |
||
77 | |||
78 | <?php |
||
79 | |||
274 | daniel-mar | 80 | $ary = glob(__DIR__ . '/../plugins/sql_slang/'.'*'.'/plugin.inc.php'); |
81 | foreach ($ary as $a) include $a; |
||
82 | $sql_slang_selection = array(); |
||
83 | foreach (get_declared_classes() as $c) { |
||
84 | if (is_subclass_of($c, 'OIDplusSqlSlangPlugin')) { |
||
85 | $obj = new $c; |
||
86 | $slang_id = $obj::id(); |
||
87 | $human_friendly_name = $obj::getPluginInformation()['name']; |
||
88 | $sql_slang_selection[] = '<option value="'.$slang_id.'">'.$human_friendly_name.'</option>'; |
||
89 | } |
||
90 | } |
||
91 | $sql_slang_selection = implode("\n", $sql_slang_selection); |
||
92 | |||
150 | daniel-mar | 93 | $files = glob(__DIR__.'/../plugins/database/*/setup.part.html'); |
94 | foreach ($files as $file) { |
||
274 | daniel-mar | 95 | $cont = file_get_contents($file); |
96 | $cont = str_replace('<!-- %SQL_SLANG_SELECTION% -->', $sql_slang_selection, $cont); |
||
97 | echo $cont; |
||
150 | daniel-mar | 98 | } |
99 | if (count($files) == 0) { |
||
236 | daniel-mar | 100 | echo '<p><font color="red">ERROR: No database plugins were found! You CANNOT use OIDplus without database connection.</font></p>'; |
150 | daniel-mar | 101 | } |
102 | |||
103 | ?> |
||
104 | |||
105 | </div> |
||
106 | |||
107 | <script> |
||
108 | dbplugin_changed(); |
||
109 | </script> |
||
110 | |||
104 | daniel-mar | 111 | <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 | 112 | |
113 | <h3>ReCAPTCHA</h3> |
||
114 | |||
115 | <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> |
||
116 | <p>reCAPTCHA Public key<br><input id="recaptcha_public" type="text" onkeypress="rebuild()" onkeyup="rebuild()"></p> |
||
117 | <p>reCAPTCHA Private key<br><input id="recaptcha_private" type="text" onkeypress="rebuild()" onkeyup="rebuild()"></p> |
||
118 | |||
119 | <h3>TLS</h3> |
||
120 | |||
104 | daniel-mar | 121 | <p>SSL enforcement<br><select name="enforce_ssl" id="enforce_ssl" onclick="rebuild()"> |
80 | daniel-mar | 122 | <option value="0">No SSL available (don't redirect)</option> |
123 | <option value="1">Enforce SSL (always redirect)</option> |
||
82 | daniel-mar | 124 | <option value="2" selected>Intelligent SSL detection (redirect if port 443 is open)</option> |
80 | daniel-mar | 125 | </select></p> |
2 | daniel-mar | 126 | </form> |
127 | </div> |
||
128 | |||
129 | <div id="step2"> |
||
237 | daniel-mar | 130 | <h2>Step 2: Initialize database</h2> |
239 | daniel-mar | 131 | <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 | 132 | <p>Otherwise, import one of the following MySQL dumps in your database:</p> |
2 | daniel-mar | 133 | <p><ul> |
150 | daniel-mar | 134 | <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> |
135 | <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> |
||
136 | |||
2 | daniel-mar | 137 | </ul></p> |
150 | daniel-mar | 138 | <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 | 139 | |
2 | daniel-mar | 140 | </div> |
141 | |||
142 | <div id="step3"> |
||
143 | <h2>Step 3: Save config.inc.php file</h2> |
||
144 | <p>Save following contents into the file <b>includes/config.inc.php</b>:</p> |
||
145 | <code><font color="darkblue"><div id="config"></div></font></code> |
||
146 | </div> |
||
147 | |||
148 | <div id="step4"> |
||
80 | daniel-mar | 149 | <h2>Step 4: Continue to next step</h2> |
154 | daniel-mar | 150 | <p><input type="button" onclick="window.location.href='../'" value="Continue"></p> |
80 | daniel-mar | 151 | <!-- <p><a href="../">Run the OIDplus system</a></p> --> |
2 | daniel-mar | 152 | </div> |
153 | |||
154 | </body> |
||
155 | </html> |