summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--installer/views/get_db_info.html.php39
-rw-r--r--installer/views/install.html.php3
-rw-r--r--installer/views/var_dir_status.html.php30
-rw-r--r--installer/web.php21
4 files changed, 43 insertions, 50 deletions
diff --git a/installer/views/get_db_info.html.php b/installer/views/get_db_info.html.php
index adc775a4..ada0793c 100644
--- a/installer/views/get_db_info.html.php
+++ b/installer/views/get_db_info.html.php
@@ -1,4 +1,32 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
+<h1> Welcome! </h1>
+<p>
+ Installing Gallery is very easy. We just need to know how to talk
+ to your MySQL database, and we need a place to store your photos on
+ your web host.
+</p>
+
+
+<fieldset>
+ <legend>Photo Storage</legend>
+ <?php if (!installer::var_writable()): ?>
+ <p class="error">
+ We're having trouble creating a place for your photos. Can you
+ help? Please create a directory called "var" using <code>mkdir var</code> in your
+ gallery3 directory, then run <code>chmod 777 var</code>. That
+ should fix it.
+ <br/><br/>
+ <a href="index.php">Check again</a>
+ </p>
+ <?php else: ?>
+ <p class="success">
+ We've found a place to store your photos:
+ <code class="location"> <?= VARPATH ?> </code>
+ </p>
+ <?php endif ?>
+</fieldset>
+
+<?php if (installer::var_writable()): ?>
<form method="post" action="index.php?step=save_db_info">
<fieldset>
<legend>Database</legend>
@@ -13,7 +41,7 @@
Database Name
</td>
<td>
- <input name="dbname" value="<?= $dbname ?>"/>
+ <input name="dbname" value="gallery3"/>
</td>
</tr>
<tr>
@@ -21,7 +49,7 @@
User
</td>
<td>
- <input name="dbuser" value="<?= $user ?>"/>
+ <input name="dbuser" value="root"/>
</td>
</tr>
<tr>
@@ -29,7 +57,7 @@
Password
</td>
<td>
- <input name="dbpass" value="<?= $password ?>"/>
+ <input name="dbpass" value=""/>
</td>
</tr>
<tr>
@@ -37,7 +65,7 @@
Host
</td>
<td>
- <input name="dbhost" value="<?= $host ?>"/>
+ <input name="dbhost" value="localhost"/>
</td>
</tr>
<tr>
@@ -45,7 +73,7 @@
Table Prefix
</td>
<td>
- <input name="prefix" value="<?= $prefix ?>"/>
+ <input name="prefix" value=""/>
</td>
</tr>
<tr>
@@ -56,3 +84,4 @@
</table>
</fieldset>
</form>
+<?php endif ?>
diff --git a/installer/views/install.html.php b/installer/views/install.html.php
index 31112c28..a0eddaf3 100644
--- a/installer/views/install.html.php
+++ b/installer/views/install.html.php
@@ -8,8 +8,7 @@
<div id="outer">
<img src="../modules/gallery/images/gallery.png" />
<div id="inner">
- <?= $content ?>
- <?= empty($database_form) ? "" : $database_form ?>
+ <?php print $content ?>
</div>
<div id="footer">
<p>
diff --git a/installer/views/var_dir_status.html.php b/installer/views/var_dir_status.html.php
deleted file mode 100644
index 8211e13c..00000000
--- a/installer/views/var_dir_status.html.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.") ?>
-<h1> Welcome! </h1>
-<p>
- Installing Gallery is very easy. We just need to know how to talk
- to your MySQL database, and we need a place to store your photos on
- your web host.
-</p>
-
-
-<fieldset>
- <legend>Photo Storage</legend>
- <?php if (empty($writable)): ?>
- <p class="error">
- We're having trouble creating a place for your photos. Can you
- help? Please create a directory called "var" using <code>mkdir var</code> in your
- gallery3 directory, then run <code>chmod 777 var</code>. That
- should fix it.
- <br/><br/>
- <a href="index.php">Check again</a>
- <br /><br/>
- <i>(Please fix the photo storage problem before continuing)</i>
- </p>
- <?php else: ?>
- <p class="success">
- We've found a place to store your photos:
- <code class="location"> <?= VARPATH ?> </code>
- </p>
- <?php endif ?>
-</fieldset>
-
diff --git a/installer/web.php b/installer/web.php
index fd75d352..78784539 100644
--- a/installer/web.php
+++ b/installer/web.php
@@ -20,12 +20,6 @@
if (installer::already_installed()) {
$content = render("success.html.php");
} else {
- $config = array("host" => empty($_POST["dbhost"]) ? "localhost" : $_POST["dbhost"],
- "user" => empty($_POST["dbuser"]) ? "root" : $_POST["dbuser"],
- "password" => empty($_POST["dbpass"]) ? "" : $_POST["dbpass"],
- "dbname" => empty($_POST["dbname"]) ? "gallery3" : $_POST["dbname"],
- "prefix" => empty($_POST["prefix"]) ? "" : $_POST["prefix"],
- "type" => function_exists("mysqli_set_charset") ? "mysqli" : "mysql");
switch (@$_GET["step"]) {
default:
case "welcome":
@@ -33,13 +27,18 @@ if (installer::already_installed()) {
if ($errors) {
$content = render("environment_errors.html.php", array("errors" => $errors));
} else {
- $request_db_info = $is_var_writable = installer::var_writable();
- $content = render("var_dir_status.html.php", array("writable" => $is_var_writable));
+ $content = render("get_db_info.html.php");
}
break;
case "save_db_info":
- $request_db_info = true;
+ $config = array("host" => $_POST["dbhost"],
+ "user" => $_POST["dbuser"],
+ "password" => $_POST["dbpass"],
+ "dbname" => $_POST["dbname"],
+ "prefix" => $_POST["prefix"],
+ "type" => function_exists("mysqli_set_charset") ? "mysqli" : "mysql");
+
if (!installer::connect($config)) {
$content = render("invalid_db_info.html.php");
} else if (!installer::select_db($config)) {
@@ -59,7 +58,6 @@ if (installer::already_installed()) {
$content = render("success.html.php", array("user" => $user, "password" => $password));
installer::create_private_key($config);
- $request_db_info = false;
} catch (Exception $e) {
$content = oops($e->getMessage());
}
@@ -68,9 +66,6 @@ if (installer::already_installed()) {
}
}
-if (empty($errors) && !empty($request_db_info)) {
- $database_form = render("get_db_info.html.php", $config);
-}
include("views/install.html.php");
function render($view, $args=array()) {