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); }
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(); }
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 '#'; } }