define('TBL_MODULES', TBL_PREFIX . 'modules'); define('TBL_PAGES', TBL_PREFIX . 'userpages'); include_once 'core/user.class.php'; include_once 'core/language.class.php'; include_once 'core/database.class.php'; include_once 'core/config.class.php'; include_once 'core/pages.class.php'; $SQL = file_get_contents('install/sql/news.sql'); $SQL .= file_get_contents('install/sql/pages.sql'); $SQL .= file_get_contents('install/sql/users.sql'); $SQL = str_replace('%prefix%', 'morgos_', $SQL); $i10nMan = new languages('languages/'); $DBMan = new genericDatabase($i10nMan); $config = new config($i10nMan); $config->addConfigItemsFromFile('site.config.php'); $DB = $DBMan->load($config->getConfigItem('/database/type')); $DB->connect($config->getConfigItem('/database/host'), $config->getConfigItem('/database/user'), $config->getConfigItem('/database/password')); $DB->select_db($config->getConfigItem('/database/name')); $arrayOfSQL = explode(';', $SQL); foreach ($arrayOfSQL as $query) { $query = trim($query); if (empty($query)) { continue; } $result = $DB->query($query); if ($result === false) { trigger_error('ERROR: ' . $i10nMan->translate('Query')); } } $pages = new pages($DB, $i10nMan); // module, needAuthorize, needAuthorizeAsAdmin, place, placeinadmin, listedInAdmin, parent, islink = true
saveParam($_POST, 'database-type'); saveParam($_POST, 'database-host'); saveParam($_POST, 'database-user'); saveParam($_POST, 'database-name'); saveParam($_POST, 'admin-account'); saveParam($_POST, 'admin-email'); if ($_POST['admin-password'] != $_POST['admin-password2']) { trigger_error('ERROR: ' . $i10nMan->translate('Provided passwords doesn\'t match.')); } else { $canrun = true; } global $errors; $curErrors = $errors; include_once 'core/database.class.php'; $DBMan = new genericDatabase($i10nMan); $DB = $DBMan->load($_POST['database-type']); $DB->connect($_POST['database-host'], $_POST['database-user'], $_POST['database-password']); if ($errors == $curErrors) { $canrun = true; } break; case PHASE_INSTALLDB: $t = checkParam($_POST, 'admin-email', 'Admin email'); if ($t == false) { break; } $t = checkParam($_POST, 'admin-password', 'Admin password'); if ($t == false) { break; } $t = checkParam($_POST, 'admin-account', 'Admin account');
function __construct() { $this->notices = array(); $this->running = false; if (versionCompare(PHP_VERSION, '5.0', '>=')) { set_error_handler(array($this, "errorHandler")); } else { set_error_handler('errorHandler'); } if (!file_exists('site.config.php')) { header('Location: install.php'); } if (is_readable('site.config.php')) { if (file_exists('.install')) { if (is_dir('.install')) { trigger_error('ERROR: ' . $this->i10nMan->translate('Remove dir install.php and than continue')); } } $reqFiles = array(); $reqFiles[] = 'core/compatible.php'; $reqFiles[] = 'core/config.class.php'; $reqFiles[] = 'core/database.class.php'; $reqFiles[] = 'core/language.class.php'; $reqFiles[] = 'core/pages.class.php'; $reqFiles[] = 'core/signals.class.php'; $reqFiles[] = 'core/uimanager.class.php'; $reqFiles[] = 'core/uimanager.functions.php'; $reqFiles[] = 'core/uimanager.vars.php'; $reqFiles[] = 'core/user.class.php'; $reqFiles[] = 'admin.php'; $reqFiles[] = 'index.php'; $reqFiles[] = 'skins/default/tinymce'; //testFiles ($reqFiles); include_once 'core/config.class.php'; include_once 'core/language.class.php'; include_once 'core/signals.class.php'; $this->i10nMan = new languages('languages/'); $this->signalMan = new signalManager($this->i10nMan); $this->signalMan->addSignal('loadPage'); $this->signalMan->addSignal('login'); $this->signalMan->addSignal('logout'); $this->signalMan->addSignal('registeruser'); $this->config = new config($this->i10nMan); $this->config->addConfigItemsFromFile('site.config.php'); if (!defined('TBL_PREFIX')) { define('TBL_PREFIX', 'morgos_'); define('TBL_MODULES', TBL_PREFIX . 'modules'); define('TBL_PAGES', TBL_PREFIX . 'userpages'); } include_once 'core/database.class.php'; include_once 'core/user.class.php'; include_once 'core/news.class.php'; include_once 'core/pages.class.php'; $DBManager = new genericDatabase($this->i10nMan); $this->genDB = $DBManager->load($this->config->getConfigItem('/database/type', TYPE_STRING)); $this->genDB->connect($this->config->getConfigItem('/database/host', TYPE_STRING), $this->config->getConfigItem('/database/user', TYPE_STRING), $this->config->getConfigItem('/database/password', TYPE_STRING)); $this->genDB->select_db($this->config->getConfigItem('/database/name', TYPE_STRING)); $this->pages = new pages($this->genDB, $this->i10nMan); $this->news = new news($this->genDB, $this->i10nMan); if (!$this->i10nMan->loadLanguage('english')) { trigger_error('ERROR: ' . $this->i10nMan->translate('Couldn\'t init internationalization.')); } $this->user = NULL; $this->loadedExtensions = array(); $this->initAllExtensions(); $this->prependSidebar = array(); $this->appendSidebar = array(); $this->prependSidebar['ALL_MODULES'] = array(); $this->appendSidebar['ALL_MODULES'] = array(); $this->prependSubbar = array(); $this->appendSubbar = array(); $this->prependSubbar['ALL_MODULES'] = array(); $this->appendSubbar['ALL_MODULES'] = array(); foreach ($this->config->getConfigDir('/extensions') as $extension => $load) { if ($load == true) { $result = $this->loadExtension(substr($extension, strlen('/extensions/'))); if ($result == false) { $this->setRunning(true); trigger_error('WARNING: ' . $this->i10nMan->translate('Couldn\'t load extension.')); $this->setRunning(false); } } } } else { header('Location: install.php'); } }