#1464 - PHP installer doesn't keep the admin username/password when you 'recheck requirements'

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@43975 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
aoneil 2007-10-29 22:12:21 +00:00
parent e9ae0ff4b7
commit 4e94efeaaa
2 changed files with 29 additions and 18 deletions

View File

@ -120,14 +120,14 @@
<h4>SilverStripe Administration Account</h4> <h4>SilverStripe Administration Account</h4>
<p id="AdminAccount"> <p id="AdminAccount">
<label for="username">Administrator email:</label> <label for="admin_username">Administrator email:</label>
<span class="middleColumn"><input type="text" class="text" name="username" id="username" value="admin" /></span> <span class="middleColumn"><input type="text" class="text" name="admin[username]" id="admin_username" value="<?php echo $adminConfig['username']; ?>" /></span>
<label for="password">Administrator password:</label> <label for="admin_password">Administrator password:</label>
<span class="middleColumn"><input type="text" class="text" name="password" id="password" value="password" /></span> <span class="middleColumn"><input type="text" class="text" name="admin[password]" id="admin_password" value="<?php echo $adminConfig['password']; ?>" /></span>
<label for="firstname">Administrator first name:</label> <label for="admin_firstname">Administrator first name:</label>
<span class="middleColumn"><input type="text" class="text" name="firstname" id="firstname" value="" /></span> <span class="middleColumn"><input type="text" class="text" name="admin[firstname]" id="admin_firstname" value="<?php echo $adminConfig['firstname']; ?>" /></span>
<label for="surname">Administrator surname:</label> <label for="admin_surname">Administrator surname:</label>
<span class="middleColumn"><input type="text" class="text" name="surname" id="surname" value="" /></span> <span class="middleColumn"><input type="text" class="text" name="admin[surname]" id="admin_surname" value="<?php echo $adminConfig['surname']; ?>" /></span>
</p> </p>
<p class="adminAcc"> <p class="adminAcc">
We will set up 1 administrator account for you automatically. Enter the email address and password. If you'd We will set up 1 administrator account for you automatically. Enter the email address and password. If you'd

View File

@ -17,6 +17,17 @@ if(isset($_REQUEST['mysql'])) {
"password" => "", "password" => "",
"database" => "SS_mysite", "database" => "SS_mysite",
); );
}
if(isset($_REQUEST['admin'])) {
$adminConfig = $_REQUEST['admin'];
} else {
$adminConfig = array(
'username' => 'admin',
'password' => 'password',
'firstname' => '',
'surname' => ''
);
} }
$alreadyInstalled = (file_exists('mysite/_config.php') || file_exists('tutorial/_config.php')); $alreadyInstalled = (file_exists('mysite/_config.php') || file_exists('tutorial/_config.php'));
@ -633,23 +644,23 @@ PHP
ManifestBuilder::compileManifest(); ManifestBuilder::compileManifest();
$dbAdmin = new DatabaseAdmin(); $dbAdmin = new DatabaseAdmin();
$dbAdmin->init(); $dbAdmin->init();
$_REQUEST['username'] = $_REQUEST['admin']['username'];
$_REQUEST['password'] = $_REQUEST['admin']['password'];
$dbAdmin->doBuild(true); $dbAdmin->doBuild(true);
$adminmember = DataObject::get_one('Member',"`Email`= '".$_REQUEST['username']."'"); $adminmember = DataObject::get_one('Member',"`Email`= '".$_REQUEST['admin']['username']."'");
if($adminmember){ if($adminmember) {
if($adminmember->_isAdmin()){ $adminmember->FirstName = $_REQUEST['admin']['firstname'];
$adminmember->FirstName = $_REQUEST['firstname']; $adminmember->Surname = $_REQUEST['admin']['surname'];
$adminmember->Surname = $_REQUEST['surname']; $adminmember->write();
$adminmember->write();
}
} }
echo "<li>Checking mod_rewrite works</li>"; echo "<li>Checking mod_rewrite works</li>";
$_SESSION['username'] = $_REQUEST['username']; $_SESSION['username'] = $_REQUEST['admin']['username'];
$_SESSION['password'] = $_REQUEST['password']; $_SESSION['password'] = $_REQUEST['admin']['password'];
if($this->checkModRewrite()) { if($this->checkModRewrite()) {