$includes = glob(PSM_PATH_INC . '*.inc.php'); foreach ($includes as $file) { include_once $file; } // init db connection $db = new psm\Service\Database(); // sanity check! if (!defined('PSM_INSTALL') || !PSM_INSTALL) { if ($db->getDbHost() === null) { // no config file has been loaded, redirect the user to the install header('Location: install.php'); die; } // config file has been loaded, check if we have a connection if (!$db->status()) { die('Unable to establish database connection...'); } // attempt to load configuration from database if (!psm_load_conf()) { // unable to load from config table header('Location: install.php'); die; } // config load OK, make sure database version is up to date $installer = new \psm\Util\Install\Installer($db); if ($installer->isUpgradeRequired()) { die('Your database is for an older version and requires an upgrade, <a href="install.php">please click here</a> to update your database to the latest version.'); } } $lang = psm_get_conf('language', 'en_US'); psm_load_lang($lang);