More work on web setup form
This commit is contained in:
parent
6838694a8b
commit
acaf47c592
5 changed files with 31 additions and 38 deletions
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once(LIB_PATH . "propel/runtime/lib/Propel.php");
|
||||
|
||||
/**
|
||||
* Check to see if Airtime is properly configured.
|
||||
*
|
||||
|
@ -42,9 +40,7 @@ function airtimeCheckMvcDependencies() {
|
|||
* @return boolean true if the database dependencies exist
|
||||
*/
|
||||
function airtimeCheckDatabaseDependencies() {
|
||||
if (!isset($extensions)) {
|
||||
$extensions = get_loaded_extensions();
|
||||
}
|
||||
global $extensions;
|
||||
// Check the PHP extension list for the Postgres db extensions
|
||||
return (in_array('pdo_pgsql', $extensions)
|
||||
&& in_array('pgsql', $extensions));
|
||||
|
@ -75,4 +71,18 @@ function airtimeCheckDatabaseConfiguration() {
|
|||
*/
|
||||
function airtimeConfigureDatabase() {
|
||||
Propel::init(CONFIG_PATH . 'airtime-conf-production.php');
|
||||
}
|
||||
|
||||
function airtimeValidateDatabaseSettings($settings) {
|
||||
global $airtimeSetup;
|
||||
if (!$airtimeSetup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$dbUser = $settings["dbUser"];
|
||||
$dbPass = $settings["dbPass"];
|
||||
$dbName = $settings["dbName"];
|
||||
$dbHost = $settings["dbHost"];
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,12 +1,8 @@
|
|||
<?php
|
||||
|
||||
foreach($_POST as $e) {
|
||||
echo $e;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html style="background-color:#111141;">
|
||||
<html style="background-color: #111141;">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap-3.3.1.min.css">
|
||||
<script type="text/javascript" src="js/libs/jquery-1.8.3.min.js"></script>
|
||||
|
@ -17,19 +13,19 @@
|
|||
<h3 style="margin: 1em 0;">Database Settings</h3>
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="dbUser">Database Username</label>
|
||||
<input required class="form-control" type="text" id="dbUser" placeholder="Username"/>
|
||||
<input required class="form-control" type="text" name="dbUser" id="dbUser" placeholder="Username"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="dbPass">Database Password</label>
|
||||
<input required class="form-control" type="password" id="dbPass" placeholder="Password"/>
|
||||
<input required class="form-control" type="password" name="dbPass" id="dbPass" placeholder="Password"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="dbName">Database Name</label>
|
||||
<input required class="form-control" type="text" id="dbName" placeholder="Name"/>
|
||||
<input required class="form-control" type="text" name="dbName" id="dbName" placeholder="Name"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="dbHost">Database Host</label>
|
||||
<input required class="form-control" type="text" id="dbHost" placeholder="Host" value="localhost"/>
|
||||
<input required class="form-control" type="text" name="dbHost" id="dbHost" placeholder="Host" value="localhost"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" class="btn btn-default"/>
|
||||
|
@ -39,10 +35,10 @@
|
|||
<script>
|
||||
$("#dbSettingsForm").submit(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$.post('#', $('form').serialize(), function(data) {
|
||||
var d = $('#dbSettingsForm').serializeArray();
|
||||
$.post('setup/functions.php?fn=airtimeValidateDatabaseSettings', d, function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
}, "json");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue