示例#1
0
 /**
  * Loads a module.
  *
  * @param string $name the fully qualified class name of the module to load
  */
 public function loadModule($name)
 {
     $this->logger->log(LogLevel::INFO, 'SimpleID\\ModuleManager->loadModule: ' . $name);
     if (isset($this->modules[$name])) {
         return;
     }
     $info = $this->getModuleInfo($name);
     $module = new $name();
     $this->modules[$name] = $module;
     if (isset($info['asset_domain'])) {
         $this->f3->set('UI', $this->f3->get('UI') . PATH_SEPARATOR . $info['asset_dir']);
         $locale = LocaleManager::instance();
         $locale->addDomain($info['asset_domain'], $info['asset_dir']);
     }
 }
示例#2
0
    $f3->set('LOGS', dirname($config['log_file']) . '/');
}
$logger = new $config['logger']($config);
$f3->set('logger', $logger);
if (isset($config['f3_DEBUG'])) {
    $f3->set('DEBUG', $config['f3_DEBUG']);
}
// 6. Fix up HTTP request
fix_http_request($f3);
// For SimpleID 1.x compatibility
if (isset($_GET['q'])) {
    $f3->set('PATH', $_GET['q']);
    unset($_GET['q']);
}
// 7. Check for other configuration errors
$i18n = \SimpleID\Util\LocaleManager::instance();
if (@ini_get('register_globals') === 1 || @ini_get('register_globals') === '1' || strtolower(@ini_get('register_globals')) == 'on') {
    $f3->get('logger')->log(\Psr\Log\LogLevel::CRITICAL, 'register_globals is enabled in PHP configuration.');
    $f3->error(500, $i18n->t('register_globals is enabled in PHP configuration, which is not supported by SimpleID.  See the <a href="!url">manual</a> for further information.', array('!url' => 'http://simpleid.koinic.net/docs/2/system-requirements/')));
}
if (!\SimpleID\Crypt\BigNum::loaded()) {
    $f3->get('logger')->log(\Psr\Log\LogLevel::CRITICAL, 'gmp/bcmath PHP extension not loaded.');
    $f3->error(500, $i18n->t('One or more required PHP extensions (%extension) is not loaded.  See the <a href="!url">manual</a> for further information on system requirements.', array('%extension' => 'gmp/bcmath', '!url' => 'http://simpleid.koinic.net/docs/2/system-requirements/')));
}
if (!function_exists('preg_match')) {
    $f3->get('logger')->log(\Psr\Log\LogLevel::CRITICAL, 'pcre PHP extension not loaded.');
    $f3->error(500, $i18n->t('One or more required PHP extensions (%extension) is not loaded.  See the <a href="!url">manual</a> for further information on system requirements.', array('%extension' => 'pcre', '!url' => 'http://simpleid.koinic.net/docs/2/system-requirements/')));
}
if (!function_exists('session_start')) {
    $f3->get('logger')->log(\Psr\Log\LogLevel::CRITICAL, 'session PHP extension not loaded.');
    $f3->error(500, $i18n->t('One or more required PHP extensions (%extension) is not loaded.  See the <a href="!url">manual</a> for further information on system requirements.', array('%extension' => 'session', '!url' => 'http://simpleid.koinic.net/docs/2/system-requirements/')));
示例#3
0
文件: Module.php 项目: J0s3f/simpleid
 /**
  * Translates a string.
  *
  * @param string $string the string to translate
  * @param array $variables an array of replacements variables to be made after
  * a translation. Prefix the variable with a @ to make the replacement HTML safe,
  * a % to make the replacement HTML safe and surround with &lt;strong&gt; tags,
  * and ! to replace as is
  * @return string the translated string
  */
 protected function t($string, $variables = array())
 {
     $i18n = LocaleManager::instance();
     $translated = $i18n->dt_raw($this->domain, $string);
     if ($translated == $string && $this->domain != LocaleManager::DEFAULT_DOMAIN) {
         $translated = $i18n->t_raw($string);
     }
     return $i18n->expand($translated, $variables);
 }