Esempio n. 1
0
 public static function clearCookie()
 {
     if (Request::singleton() instanceof HttpRequest) {
         $sPath = Request::singleton()->urlPath();
     } else {
         $sPath = '/';
     }
     $nCookieExpire = time() + 36000;
     setcookie(self::COOKIE_KEY_USERNAME, '', $nCookieExpire, $sPath);
     setcookie(self::COOKIE_KEY_LOGINTIME, '', $nCookieExpire, $sPath);
     setcookie(self::COOKIE_KEY_SIGNTURE, '', $nCookieExpire, $sPath);
 }
Esempio n. 2
0
 public function __construct(Application $aApp = null)
 {
     parent::__construct();
     foreach (self::$arrDataSources as $sVarName) {
         if (isset($GLOBALS[$sVarName])) {
             if (!($aDataSrc = DataSrc::flyweight(array('request', $sVarName), false))) {
                 $aDataSrc = new DataSrc($GLOBALS[$sVarName], true);
                 DataSrc::setFlyweight($aDataSrc, array('request', $sVarName));
             }
             $this->addChild($aDataSrc);
         }
     }
     // $_FILES
     $this->buildUploadFiles($aApp ?: Application::singleton());
     //
     $this->sRequestUrl = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $this->set(parent::DATANAME_USERCALL, true);
 }
Esempio n. 3
0
 public function render(File $aCompiledFile, IHashTable $aVariables = null, IOutputStream $aDevice = null, $bPreProcess = true, $bRendering = true)
 {
     if (!$aVariables) {
         $aVariables = $this->variables();
     }
     if (!$aDevice) {
         $aDevice = $this->outputStream();
         if (!$aDevice) {
             $aDevice = Response::singleton()->printer();
         }
     }
     // 模板变量
     $aRequest = Request::singleton();
     if (!$aVariables->has('theRequest')) {
         $aVariables->set('theRequest', $aRequest);
     }
     if (!$aVariables->has('theParams')) {
         $aVariables->set('theParams', Request::singleton());
     }
     $aVariables->set('theDevice', $aDevice);
     $aVariables->set('theUI', $this);
     include $aCompiledFile->path();
 }
Esempio n. 4
0
 /**
  * Enter description here ...
  * 
  * @return void
  */
 public function createRequestController(Request $aRequest)
 {
     $sControllerName = $aRequest->string($this->sControllerParam);
     $sControllerClass = $this->transControllerClass($sControllerName);
     return $sControllerClass ? new $sControllerClass($aRequest) : null;
 }
Esempio n. 5
0
 public function pageUrl($iPageNum)
 {
     $aRequest = Request::singleton();
     if ($aRequest instanceof HttpRequest) {
         $str = $aRequest->urlQuery();
         $arrQuery = explode('&', $str);
         $strKeyName = $this->formName();
         $bFlag = false;
         $arrQuery1 = array_map(function ($str) use($strKeyName, &$bFlag, $iPageNum) {
             if (substr($str, 0, strlen($strKeyName)) === $strKeyName) {
                 $bFlag = true;
                 return $strKeyName . '=' . (string) $iPageNum;
             } else {
                 return $str;
             }
         }, $arrQuery);
         if (!$bFlag) {
             $arrQuery1[] = $this->formName() . '=' . (string) $iPageNum;
         }
         return '?' . implode('&', $arrQuery1);
     } else {
         return '#';
     }
 }