diff --git a/control.php b/control.php
index b3cb488..5d8d652 100644
--- a/control.php
+++ b/control.php
@@ -36,9 +36,18 @@
*
*/
+//
+require_once("setup/wizard/install_util.php");
+// Check if system has been installed
+$iu = new InstallUtil();
+if(!$iu->isSystemInstalled()) {
+ $iu->redirect("setup/wizard");
+ exit(0);
+}
+
// main library routines and defaults
require_once('config/dmsDefaults.php');
-require_once("setup/wizard/install_util.php");
+
/**
* Controller page -- controls the web application by responding to a set of
* defined actions. The controller performs session handling, page-level
@@ -49,12 +58,6 @@ require_once("setup/wizard/install_util.php");
// -------------------------------
// page start
// -------------------------------
-// Check if system has been installed
-$iu = new InstallUtil();
-if(!$iu->isSystemInstalled()) {
- redirect("setup/wizard");
- exit(0);
-}
$action = $_REQUEST['action'];
diff --git a/setup/wizard/index.php b/setup/wizard/index.php
index c169dbf..fcdfc41 100755
--- a/setup/wizard/index.php
+++ b/setup/wizard/index.php
@@ -41,7 +41,19 @@
*/
require_once("install_util.php");
$ui = new InstallUtil();
- if(!$ui->isSystemInstalled()) {
+ $bypass = false;
+ // Bypass
+// if(isset($_GET['bypass'])) {
+// $bypass = $_GET['bypass'];
+// $_SESSION['bypass'] = $bypass;
+// }
+
+// if(isset($_SESSION['bypass'])) {
+//
+// $bypass = $_SESSION['bypass'];
+// }
+
+ if(!$ui->isSystemInstalled() || $bypass) {
require("installer.php");
} else {
echo "System has been installed Goto Login";
diff --git a/setup/wizard/install_util.php b/setup/wizard/install_util.php
index 73dce37..7ac6ce2 100644
--- a/setup/wizard/install_util.php
+++ b/setup/wizard/install_util.php
@@ -13,5 +13,133 @@ class InstallUtil {
return true;
}
+
+ /**
+ * Redirect
+ *
+ * This function redirects the client. This is done by issuing
+ * a "Location" header and exiting if wanted. If you set $rfc2616 to true
+ * HTTP will output a hypertext note with the location of the redirect.
+ *
+ * @static
+ * @access public
+ * @return mixed Returns true on succes (or exits) or false if headers
+ * have already been sent.
+ * @param string $url URL where the redirect should go to.
+ * @param bool $exit Whether to exit immediately after redirection.
+ * @param bool $rfc2616 Wheter to output a hypertext note where we're
+ * redirecting to (Redirecting to ....)
+ */
+ function redirect($url, $exit = true, $rfc2616 = false)
+ {
+ if (headers_sent()) {
+ return false;
+ }
+
+ $url = $this->absoluteURI($url);
+ header('Location: '. $url);
+
+ if ( $rfc2616 && isset($_SERVER['REQUEST_METHOD']) &&
+ $_SERVER['REQUEST_METHOD'] != 'HEAD') {
+ printf('Redirecting to: %s.', $url, $url);
+ }
+ if ($exit) {
+ exit;
+ }
+ return true;
+ }
+
+ /**
+ * Absolute URI
+ *
+ * This function returns the absolute URI for the partial URL passed.
+ * The current scheme (HTTP/HTTPS), host server, port, current script
+ * location are used if necessary to resolve any relative URLs.
+ *
+ * Offsets potentially created by PATH_INFO are taken care of to resolve
+ * relative URLs to the current script.
+ *
+ * You can choose a new protocol while resolving the URI. This is
+ * particularly useful when redirecting a web browser using relative URIs
+ * and to switch from HTTP to HTTPS, or vice-versa, at the same time.
+ *
+ * @author Philippe Jausions
+ * @static
+ * @access public
+ * @return string The absolute URI.
+ * @param string $url Absolute or relative URI the redirect should go to.
+ * @param string $protocol Protocol to use when redirecting URIs.
+ * @param integer $port A new port number.
+ */
+ function absoluteURI($url = null, $protocol = null, $port = null)
+ {
+ // filter CR/LF
+ $url = str_replace(array("\r", "\n"), ' ', $url);
+
+ // Mess around with already absolute URIs
+ if (preg_match('!^([a-z0-9]+)://!i', $url)) {
+ if (empty($protocol) && empty($port)) {
+ return $url;
+ }
+ if (!empty($protocol)) {
+ $url = $protocol .':'. end($array = explode(':', $url, 2));
+ }
+ if (!empty($port)) {
+ $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i',
+ '\1:'. $port, $url);
+ }
+ return $url;
+ }
+
+ $host = 'localhost';
+ if (!empty($_SERVER['HTTP_HOST'])) {
+ list($host) = explode(':', $_SERVER['HTTP_HOST']);
+ } elseif (!empty($_SERVER['SERVER_NAME'])) {
+ list($host) = explode(':', $_SERVER['SERVER_NAME']);
+ }
+
+ if (empty($protocol)) {
+ if (isset($_SERVER['HTTPS']) && !strcasecmp($_SERVER['HTTPS'], 'on')) {
+ $protocol = 'https';
+ } else {
+ $protocol = 'http';
+ }
+ if (!isset($port) || $port != intval($port)) {
+ $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80;
+ }
+ }
+
+ if ($protocol == 'http' && $port == 80) {
+ unset($port);
+ }
+ if ($protocol == 'https' && $port == 443) {
+ unset($port);
+ }
+
+ $server = $protocol .'://'. $host . (isset($port) ? ':'. $port : '');
+
+ if (!strlen($url)) {
+ $url = isset($_SERVER['REQUEST_URI']) ?
+ $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
+ }
+
+ if ($url{0} == '/') {
+ return $server . $url;
+ }
+
+ // Check for PATH_INFO
+ if (isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) &&
+ $_SERVER['PHP_SELF'] != $_SERVER['PATH_INFO']) {
+ $path = dirname(substr($_SERVER['PHP_SELF'], 0, -strlen($_SERVER['PATH_INFO'])));
+ } else {
+ $path = dirname($_SERVER['PHP_SELF']);
+ }
+
+ if (substr($path = strtr($path, '\\', '/'), -1) != '/') {
+ $path .= '/';
+ }
+
+ return $server . $path . $url;
+ }
}
?>
\ No newline at end of file
diff --git a/setup/wizard/installer.php b/setup/wizard/installer.php
index d968625..e8f7e7f 100755
--- a/setup/wizard/installer.php
+++ b/setup/wizard/installer.php
@@ -129,6 +129,13 @@ class Installer {
$this->session = $session;
}
+ public function setSessionVars() {
+ if(isset($_GET['bypass'])) {
+ $bypass = $_GET['bypass'];
+ $this->session->set('bypass', $bypass);
+ }
+ }
+
/**
* Main control to handle the flow of install
*
@@ -140,7 +147,8 @@ class Installer {
public function step() {
$this->readXml(); // Xml steps
$this->xmlStepsToArray(); // String steps
- $this->resetSessions(); // Make sure
+ $this->resetSessions(); // Make sure
+ $this->setSessionVars();
$response = $this->landing();
switch($response) {
case 'next':
@@ -494,5 +502,5 @@ class Installer {
}
$ins = new installer(new Session()); // Instantiate the installer
$ins->step(); // Run step
-//$ins->showSession();
+$ins->showSession();
?>
\ No newline at end of file