More work on web setup form
This commit is contained in:
parent
6838694a8b
commit
acaf47c592
|
@ -167,15 +167,10 @@ $result = $r && $database;
|
|||
</h3>
|
||||
<p>
|
||||
<?php
|
||||
|
||||
if (!isset($extensions)) {
|
||||
$extensions = get_loaded_extensions();
|
||||
}
|
||||
|
||||
global $extensions;
|
||||
foreach ($extensions as $ext) {
|
||||
echo $ext . " | ";
|
||||
}
|
||||
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
class InstallWizardController extends Zend_Controller_Action {
|
||||
public function init() {
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
}
|
||||
|
||||
public function runAirtimeConfigurationAction() {
|
||||
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
|
@ -76,3 +72,17 @@ 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>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
|
||||
global $configRun;
|
||||
global $extensions;
|
||||
$configRun = false;
|
||||
$extensions = get_loaded_extensions();
|
||||
$airtimeSetup = false;
|
||||
|
||||
function showConfigCheckPage() {
|
||||
if (!isset($configRun) || !$configRun) {
|
||||
global $configRun;
|
||||
if (!$configRun) {
|
||||
// This will run any necessary setup we need if
|
||||
// configuration hasn't been initialized
|
||||
airtimeCheckConfiguration();
|
||||
|
@ -24,6 +26,7 @@ define('CONFIG_PATH', APPLICATION_PATH . 'configs/');
|
|||
|
||||
define('AIRTIME_CONFIG', 'airtime.conf');
|
||||
|
||||
require_once(LIB_PATH . "propel/runtime/lib/Propel.php");
|
||||
require_once(CONFIG_PATH . 'conf.php');
|
||||
require_once(SETUP_PATH . 'load.php');
|
||||
|
||||
|
@ -53,6 +56,7 @@ if (file_exists(BUILD_PATH . AIRTIME_CONFIG)) {
|
|||
}
|
||||
// Otherwise, we'll need to run our configuration setup
|
||||
else {
|
||||
$airtimeSetup = true;
|
||||
require_once(SETUP_PATH . 'setup-config.php');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue