コード例 #1
0
ファイル: decorator.php プロジェクト: ming-hai/XoopsCore
 /**
  * @param string $name
  */
 public function loadLanguage($name)
 {
     $helper = Menus::getInstance();
     $language = XoopsLocale::getLegacyLanguage();
     $path = $helper->path("decorators/{$name}/language");
     if (!($ret = XoopsLoad::loadFile("{$path}/{$language}/decorator.php"))) {
         $ret = XoopsLoad::loadFile("{$path}/english/decorator.php");
     }
     return $ret;
 }
コード例 #2
0
ファイル: Locale.php プロジェクト: redmexico/XoopsCore
 /**
  * @param   string   $name       Name of language file to be loaded, without extension
  * @param   mixed    $domain     string: Module dirname; global language file will be loaded if $domain is set to 'global' or not specified
  *                               array:  example; array('Frameworks/moduleclasses/moduleadmin')
  * @param   string   $language   Language to be loaded, current language content will be loaded if not specified
  *
  * @return  boolean
  */
 public static function loadLanguage($name, $domain = '', $language = null)
 {
     if (empty($name)) {
         return false;
     }
     $language = empty($language) ? XoopsLocale::getLegacyLanguage() : $language;
     // expanded domain to multiple categories, e.g. module:system, framework:filter, etc.
     if (empty($domain) || 'global' == $domain) {
         $path = '';
     } else {
         $path = is_array($domain) ? array_shift($domain) : "modules/{$domain}";
     }
     $xoops = Xoops::getInstance();
     $fullPath = $xoops->path("{$path}/language/{$language}/{$name}.php");
     if (!($ret = XoopsLoad::loadFile($fullPath))) {
         $fullPath2 = $xoops->path("{$path}/language/english/{$name}.php");
         $ret = XoopsLoad::loadFile($fullPath2);
     }
     return $ret;
 }
コード例 #3
0
ファイル: Xoops.php プロジェクト: elitet/XoopsCore
 /**
  * XOOPS language loader wrapper
  * Temporary solution, not encouraged to use
  *
  * @param string $name     Name of language file to be loaded, without extension
  * @param mixed  $domain   string: Module dirname; global language file will be loaded if
  *                           $domain is set to 'global' or not specified
  *                          array:  example; array('Frameworks/moduleclasses/moduleadmin')
  * @param string $language Language to be loaded, current language content will be loaded if not specified
  *
  * @return  boolean
  */
 public function loadLanguage($name, $domain = '', $language = null)
 {
     if (empty($name)) {
         return false;
     }
     $language = empty($language) ? XoopsLocale::getLegacyLanguage() : $language;
     // expanded domain to multiple categories, e.g. module:Fsystem, framework:filter, etc.
     if (empty($domain) || 'global' === $domain) {
         $path = '';
     } else {
         $path = is_array($domain) ? array_shift($domain) . '/' : "modules/{$domain}/";
     }
     $path .= 'language';
     if (!XoopsLoad::fileExists($file = $this->path("{$path}/{$language}/{$name}.php"))) {
         if (!XoopsLoad::fileExists($file = $this->path("{$path}/english/{$name}.php"))) {
             return false;
         }
     }
     $ret = (include_once $file);
     return $ret;
 }
コード例 #4
0
ファイル: xoopseditor.php プロジェクト: redmexico/XoopsCore
 /**
  * XoopsEditorHandler::_loadEditor()
  *
  * @param string $name
  * @param mixed $options
  * @return XoopsEditor|null
  */
 private function _loadEditor($name, $options = null)
 {
     $xoops = Xoops::getInstance();
     $editor = null;
     if (empty($name) || !array_key_exists($name, $this->getList())) {
         return $editor;
     }
     $editor_path = $this->root_path . '/' . $name;
     if (XoopsLoad::fileExists($file = $editor_path . '/language/' . XoopsLocale::getLegacyLanguage() . '.php')) {
         include_once $file;
     } else {
         if (XoopsLoad::fileExists($file = $editor_path . '/language/english.php')) {
             include_once $file;
         }
     }
     if (XoopsLoad::fileExists($file = $editor_path . '/editor_registry.php')) {
         include $file;
     } else {
         return $editor;
     }
     if (empty($config['order'])) {
         return $editor;
     }
     include_once $config['file'];
     $editor = new $config['class']($options);
     return $editor;
 }
コード例 #5
0
ファイル: common.php プロジェクト: RanLee/XoopsCore
 */
$xFrameOptions = isset($xoopsConfig['xFrameOptions']) ? $xoopsConfig['xFrameOptions'] : 'sameorigin';
$xoops->events()->triggerEvent('core.include.common.xframeoption');
if (!headers_sent() && !empty($xFrameOptions)) {
    header('X-Frame-Options: ' . $xFrameOptions);
}
/**
 * Check Bad Ip Addressed against database and block bad ones, requires configs loaded
 */
$xoops->security()->checkBadips();
/**
 * Load Language settings and defines
 */
$xoops->loadLocale();
//For legacy
$xoops->setConfig('language', XoopsLocale::getLegacyLanguage());
date_default_timezone_set(XoopsLocale::getTimezone());
setlocale(LC_ALL, XoopsLocale::getLocale());
/**
 * User Sessions
 */
$member_handler = $xoops->getHandlerMember();
$xoops->session()->sessionStart();
/**
 * Gather some info about the logged in user
 */
if ($xoops->session()->has('xoopsUserId')) {
    $uid = $xoops->session()->get('xoopsUserId');
    $xoops->user = $member_handler->getUser($uid);
    if ($xoops->user instanceof \XoopsUser) {
        if ((int) $xoops->user->getVar('last_login') + 60 * 5 < time()) {