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; $GLOBALS['templateFile'] = null; $GLOBALS['templateMethod'] = null; $GLOBALS['user'] = isset($_SESSION['userId']) ? User::getById($_SESSION['userId']) : null; $GLOBALS['project'] = (!empty($_SESSION['projectId']) || !empty($_GET['pid'])) && !empty($GLOBALS['user']) ? Project::getById($GLOBALS['user'], !empty($_GET['pid']) ? $_GET['pid'] : $_SESSION['projectId']) : null; $_SESSION['projectId'] = $GLOBALS['project'] instanceof Project ? $GLOBALS['project']->getId() : null; // // Smarty // $GLOBALS['smarty'] = new Smarty(); $GLOBALS['smarty']->setAllowPhpTag(true); $GLOBALS['smarty']->setCacheLifetime(0); $GLOBALS['smarty']->setDebugging(SMARTY_DEBUG);
$ok = false; $msg = "Could not setup SystemSettings object."; SystemEvent::raise(CINTIENT_LOG_SEVERITY_ERROR, $msg, "Installer"); sendResponse($ok, $msg); } // // Everything ok!!! // if (!Database::endTransaction()) { Database::rollbackTransaction(); $ok = false; $msg = "Problems commiting all changes to the database."; SystemEvent::raise(CINTIENT_LOG_SEVERITY_ERROR, $msg, "Installer"); sendResponse($ok, $msg); } $settings = SystemSettings::load(); $settings->setSetting(SystemSettings::VERSION, CINTIENT_INSTALLER_VERSION); if (!$upgrade) { // // Root user account // $user = new User(); $user->setEmail($get['email']); $user->setNotificationEmails($get['email'] . ','); $user->setName('Administrative Account'); $user->setUsername('root'); $user->setCos(2); $user->init(); $user->setPassword($get['password']); } // Just to make sure everything's neat and tidy, especially after