/// If config.php exists already then we are not needed.
-if (file_exists('./config.php')) {
+if (file_exists('./config.php')) {
header('Location: index.php');
+ die();
} else {
$configfile = './config.php';
}
} else {
$nextstage = $_POST['stage'] - 1;
}
-
+
if ($nextstage < 0) $nextstage = 0;
-
+
/// Store any posted data
foreach ($_POST as $setting=>$value) {
$INSTALL[$setting] = $value;
}
-
+
} else {
$goforward = true;
$nextstage = 0;
-
+
}
if ($INSTALL['stage'] == 2) {
error_reporting(0);
-
+
/// check wwwroot
if (($fh = @fopen($INSTALL['wwwroot'].'/install.php', 'r')) === false) {
$errormsg = get_string('wwwrooterror', 'install');
} else {
fclose($fh);
-
+
/// check dirroot
if (($fh = @fopen($INSTALL['dirroot'].'/install.php', 'r')) === false ) {
$CFG->dirroot = dirname(__FILE__);
$errormsg = get_string('dirrooterror', 'install');
} else {
fclose($fh);
-
+
$CFG->dirroot = $INSTALL['dirroot'];
/// check dataroot
$CFG->dataroot = $INSTALL['dataroot'];
if (make_upload_directory('sessions', false) === false ) {
$errormsg = get_string('datarooterror', 'install');
- }
+ }
}
}
-
+
if (!empty($errormsg)) $nextstage = 2;
if (empty($INSTALL['dbname'])) {
$INSTALL['dbname'] = 'moodle';
}
-
+
/// different format for postgres7 by socket
if ($INSTALL['dbtype'] == 'postgres7' and ($INSTALL['dbhost'] == 'localhost' || $INSTALL['dbhost'] == '127.0.0.1')) {
$INSTALL['dbhost'] = "user='{$INSTALL['dbuser']}' password='{$INSTALL['dbpass']}' dbname='{$INSTALL['dbname']}'";
$db = &ADONewConnection($INSTALL['dbtype']);
- error_reporting(0); // Hide errors
-
+ error_reporting(0); // Hide errors
+
if (! $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname'])) {
/// The following doesn't seem to work but we're working on it
- /// If you come up with a solution for creating a database in MySQL
+ /// If you come up with a solution for creating a database in MySQL
/// feel free to put it in and let us know
if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) {
switch ($INSTALL['dbtype']) { /// Try to create a database
<tr>
<td class="td_main" colspan="2">
-
+
<?php
if (!empty($errormsg)) echo "<p class=\"errormsg\" align=\"center\">$errormsg</p>\n";
-<?php
+<?php
//==========================================================================//
break;
case 1: /// Compatibilty check
$compatsuccess = true;
-
+
/// Check that PHP is of a sufficient version
print_compatibility_row(check_php_version("4.1.0"), get_string('PHPversion', 'install'), get_string('PHPversionerror', 'install'), 'phpversionhelp');
- /// Check safe mode
+ /// Check safe mode
print_compatibility_row(!ini_get_bool('safe_mode'), get_string('safemode', 'install'), get_string('safemodeerror', 'install'), 'safemodehelp');
/// Check session auto start
print_compatibility_row(!ini_get_bool('session.auto_start'), get_string('sessionautostart', 'install'), get_string('sessionautostarterror', 'install'), 'sessionautostarthelp');
default:
}
?>
-
- <tr>
- <td align="left">
- <?php echo ($nextstage > 0) ? "<input type=\"submit\" name=\"prev\" value=\"« ".get_string('previous')."\" />\n" : " \n" ?>
- </td>
- <?php if ($nextstage == 1) echo "<td> </td>\n"; ?>
- <td align="right">
- <?php echo ($nextstage < 5) ? "<input type=\"submit\" name=\"next\" value=\"".get_string('next')." »\" />\n" : " \n" ?>
- </td>
- </tr>
-
</table>
+
+ <div class="nav">
+ <div style="float: right;"><?php echo ($nextstage < 5) ? "<input type=\"submit\" name=\"next\" value=\"".get_string('next')." »\" />\n" : " \n" ?></div>
+ <div style="float: left;"><?php echo ($nextstage > 0) ? "<input type=\"submit\" name=\"prev\" value=\"« ".get_string('previous')."\" />\n" : " \n" ?></div>
+ <div style="clear: left; height: 2px;"> </div>
+ </div>
+
+
</form>
<?php
echo "onClick=\"return window.open('$url', 'Help', 'menubar=0,location=0,scrollbars,resizable,width=500,height=400')\">";
echo "</a>\n";
}
-
+
//==========================================================================//
<style type="text/css">
body { background-color: #ffeece; }
- p {
+ p {
font-family: helvetica, arial, sans-serif;
font-size: 10pt;
}
font-weight: bold;
color: #333333;
}
-
+ div.nav {
+ margin: 6px;
+ }
+
</style>
<?php