// // Proxy layer compatibility hack, if there is one. // if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; } /* +----------------------------------------------------------------+ *\ |* | SETUP | *| \* +----------------------------------------------------------------+ */ ob_start(); header('Content-type: text/html; charset=UTF-8'); require dirname(__FILE__) . '/../config/cintient.conf.php'; require CINTIENT_SMARTY_INCLUDE; session_start(); // session_start *has* to come after the custom autoloading SystemEvent::setSeverityLevel(CINTIENT_LOG_SEVERITY); // // Global stuff // // Get to the part of the URL that matters $currentUrl = 'http://' . $_SERVER['HTTP_HOST'] . strtok($_SERVER['REQUEST_URI'], '?'); $GLOBALS['uri'] = substr($currentUrl, strlen(CINTIENT_BASE_URL)); if (substr($GLOBALS['uri'], -1) != '/') { $GLOBALS['uri'] .= '/'; } SystemEvent::raise(SystemEvent::DEBUG, "Handling request. [URI={$GLOBALS['uri']}" . (empty($_SERVER['QUERY_STRING']) ? '' : '?' . html_entity_decode($_SERVER['QUERY_STRING'])) . "]", "WebHandler"); $GLOBALS['section'] = null; $GLOBALS['settings'] = SystemSettings::load(); // Pull up system settings $GLOBALS['smarty'] = null; $GLOBALS['subSection'] = null;
if (file_exists($defaults['configurationNewFile'])) { if (!@copy($defaults['configurationNewFile'], $defaults['configurationNewFile'] . '_' . $dateMarker)) { $ok = false; $msg = "Couldn't backup an existing configuration file {$defaults['configurationNewFile']}. Check dir permissions."; sendResponse($ok, $msg); } @unlink($defaults['configurationNewFile']); } file_put_contents($defaults['configurationNewFile'], $modifiedConfFile); // // From here on Cintient itself will handle the rest of the installation // require $defaults['configurationNewFile']; error_reporting(-1); ini_set('display_errors', 'off'); SystemEvent::setSeverityLevel(SystemEvent::INFO); // // Check for upgrade or clean install // $upgrade = false; list($ok, $_) = appWorkDir($get['appWorkDir']); if ($ok === 2) { $upgrade = true; } // // Authentication (user must be root) // if ($upgrade) { $_POST = array(); $_POST['authenticationForm'] = array(); $_POST['authenticationForm']['username'] = array();