public function RunModule() { echo '<h1>' . $this->GetTitle() . '</h1>'; echo '<div class="layoutListSection module-content">'; uConfig::ShowConfig(); echo '</div>'; }
public function RunModule() { uConfig::DownMaintenance(); }
if ($this->localisations[$key] === true) { return $key; } return $this->localisations[$key]; } public function offsetSet($key, $val) { if ($val === TRUE) { $val = $key; } $key = strtolower($key); $this->localisations[$key] = $val; } public function offsetExists($key) { return array_key_exists($key, $this->localisations); } public function offsetUnset($key) { unset($this->localisations[$key]); } public static function InitLocale() { uLocale::ResetLocale(); if (self::$locale_limit === NULL) { uLocale::LimitLocale(array(DEFAULT_LOCALE)); } } } uConfig::AddConfigVar('DEFAULT_LOCALE', 'Default Locale', 'en_GB', uLocale::ListLocale('%t, %l')); uEvents::AddCallback('ConfigDefined', 'uLocale::InitLocale');
ini_set('default_charset', CHARSET_ENCODING); header('Content-type: text/html; charset=' . CHARSET_ENCODING); header('Vary: if-none-match, accept-encoding'); ob_start('utopia::output_buffer', 2); register_shutdown_function('utopia::Finish'); timer_start('Static Initialise'); $allmodules = utopia::GetModulesOf('iUtopiaModule'); foreach ($allmodules as $row) { // must run second due to requiring GLOB_MOD to be setup fully timer_start('Init: ' . $row['module_name']); $row['module_name']::Initialise(); timer_end('Init: ' . $row['module_name']); } timer_end('Static Initialise'); uConfig::DefineConfig(); uConfig::ValidateConfig(); uEvents::TriggerEvent('ConfigDefined'); timer_start('Before Init'); uEvents::TriggerEvent('BeforeInit'); timer_end('Before Init'); timer_start('Table Initialise'); uTableDef::TableExists(null); // cache table exists $allmodules = utopia::GetModulesOf('uTableDef'); foreach ($allmodules as $row) { // must run second due to requiring GLOB_MOD to be setup fully timer_start('Init: ' . $row['module_name']); $obj = utopia::GetInstance($row['module_name']); $obj->AssertTable(); // setup Parents timer_end('Init: ' . $row['module_name']);
static function ValidateConfig() { $showConfig = true; if (self::$oConfig || $_POST) { // only validate config if there is a config to validate. $showConfig = false; foreach (self::$configVars as $key => $info) { $val = defined($key) ? constant($key) : null; if (empty($val)) { self::$configVars[$key]['notice'] = "Must not be empty."; } if ($info['type'] & CFG_TYPE_PATH && !is_dir(PATH_ABS_ROOT . $val)) { self::$configVars[$key]['notice'] = "Must be a valid directory."; } if ($key == 'ADMIN_EMAIL' && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i', $val)) { self::$configVars[$key]['notice'] = "Must be a valid email address."; } } try { // database::query('SHOW TABLES FROM `'.SQL_DBNAME.'`'); } catch (Exception $e) { self::$configVars['SQL_SERVER']['notice'] = $e->getMessage(); } } $changed = false; foreach (self::$configVars as $key => $info) { if (!defined($key)) { $showConfig = true; } if (isset($info['notice'])) { $showConfig = true; } if (!isset(self::$oConfig[$key]) || self::$oConfig[$key] !== constant($key)) { $changed = true; } } if ($showConfig) { if (!file_exists(PATH_ABS_CONFIG)) { self::ShowConfig(); } self::DownMaintenance(); } if ($changed) { self::SaveConfig(); } self::$isValid = TRUE; return true; }