示例#1
0
 public function setLanguage($iso)
 {
     if (false === ($lang = GWF_Language::getByISO($iso))) {
         return false;
     }
     GWF_Language::setCurrentLanguage($lang);
     return true;
 }
 private static function initB()
 {
     if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         return false;
     }
     $iso = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
     if (false === ($lang = self::getByISO($iso))) {
         return false;
     }
     return GWF_Language::setCurrentLanguage($lang);
 }
示例#3
0
文件: Form.php 项目: sinfocol/gwf3
 private function onLoggedIn(GWF_User $user, $isAjax)
 {
     $last_url = GWF_Session::getLastURL();
     if (false === GWF_Session::onLogin($user, isset($_POST['bind_ip']))) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     require_once GWF_CORE_PATH . 'module/Login/GWF_LoginHistory.php';
     GWF_LoginHistory::insertEvent($user->getID());
     # save last login time
     $user->saveVar('user_lastlogin', time());
     if ($this->module->cfgCleanupAlways()) {
         GWF_LoginFailure::cleanupUser($user->getID());
     }
     if ($isAjax) {
         return sprintf('1:%s', GWF_Session::getSessID());
     } else {
         GWF_Session::set('GWF_LOGIN_BACK', $last_url);
         if (false !== ($lang = $user->getLanguage())) {
             GWF_Language::setCurrentLanguage($lang);
         }
         if (0 < ($fails = GWF_LoginFailure::getFailCount($user, $this->module->cfgTryExceed()))) {
             GWF_Session::set('GWF_LOGIN_FAILS', $fails);
         }
         GWF_Website::redirect(GWF_WEB_ROOT . 'welcome');
     }
 }
示例#4
0
 /**
  * On flush simply rebuild completely from source (english). On update merge the stuff nicely.
  * @param GWF_Language $lang
  * @param string $path
  * @param array $help
  * @param boolean $flush
  * @return boolean
  */
 private static function createHelpLangFileB(GWF_Language $lang, $path, array &$help, $flush = false)
 {
     GWF_Language::setCurrentLanguage($lang);
     # TODO: Rewrite shadowhelp lang files.
     return true;
 }