<?php
$own_dir = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ?
"https" : "http") . "://" . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
?><!DOCTYPE html>
<html lang="en">
<head>
<title>OIDplus setup</title>
<meta name="robots" content="noindex">
<link rel
="stylesheet" href
="setup.css">
<script src="../3p/sha3_js/sha3.js"></script><!-- https://github.com/emn178/js-sha3 -->
<script src="setup.js"></script>
</head>
<body onload="rebuild()">
<h1>OIDplus setup - Database connectivity</h1>
<div id="step1">
<h2>Step 1: Enter setup information</h2>
<form id="step1_form">
<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>
<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>
<p>---</p>
Database plugin: <select name="db_plugin" onChange="dbplugin_changed()" id="db_plugin">
<option value="MySQL" selected="true">MySQL</option>
<option value="PDO">PDO</option>
<option value="ODBC">ODBC</option>
</select>
<script>
owndir = '<?php echo $own_dir; ?>';
rebuild_callbacks = [];
rebuild_config_callbacks = [];
plugin_combobox_change_callbacks = [];
function dbplugin_changed() {
var e = document.getElementById("db_plugin");
var strPlugin = e.options[e.selectedIndex].value;
for (var i = 0; i < plugin_combobox_change_callbacks.length; i++) {
var f = plugin_combobox_change_callbacks[i];
f(strPlugin);
}
rebuild();
}
</script>
<div style="margin-left:50px">
<?php
$files = glob(__DIR__
.'/../plugins/database/*/setup.part.html');
foreach ($files as $file) {
}
if (count($files) == 0) {
echo '<p><font color="red">ATTENTION: No database plugins found!</font></p>';
}
?>
</div>
<script>
dbplugin_changed();
</script>
<p>Tablename prefix (e.g. <b>oidplus_</b>):<br><input id="tablename_prefix" type="text" value="oidplus_" onkeypress="rebuild()" onkeyup="rebuild()"></p>
<p>---</p>
<p><input id="recaptcha_enabled" type="checkbox" onclick="rebuild()"> <label for="recaptcha_enabled">RECAPTCHA Enabled</label></p>
<p>RECAPTCHA Public key<br><input id="recaptcha_public" type="text" onkeypress="rebuild()" onkeyup="rebuild()"></p>
<p>RECAPTCHA Private key<br><input id="recaptcha_private" type="text" onkeypress="rebuild()" onkeyup="rebuild()"></p>
<p>---</p>
<p>SSL enforcement<br><select name="enforce_ssl" id="enforce_ssl" onclick="rebuild()">
<option value="0">No SSL available (don't redirect)</option>
<option value="1">Enforce SSL (always redirect)</option>
<option value="2" selected>Intelligent SSL detection (redirect if port 443 is open)</option>
</select></p>
</form>
</div>
<div id="step2">
<h2>Step 2: Import data</h2>
<p><b>If you already have an OIDplus database and just want to rebuild the config file, please skip this step.</b></p>
<p>Otherwise, import one of the following MySQL dumps in your database:</p>
<p><ul>
<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>
<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>
</ul></p>
<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>
</div>
<div id="step3">
<h2>Step 3: Save config.inc.php file</h2>
<p>Save following contents into the file <b>includes/config.inc.php</b>:</p>
<code><font color="darkblue"><div id="config"></div></font></code>
</div>
<div id="step4">
<h2>Step 4: Continue to next step</h2>
<p><input type="button" onclick="document.location='../'" value="Continue"></p>
<!-- <p><a href="../">Run the OIDplus system</a></p> -->
</div>
</body>
</html>