当前位置: 首页>>代码示例>>PHP>>正文


PHP Xoops::getConfig方法代码示例

本文整理汇总了PHP中Xoops::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Xoops::getConfig方法的具体用法?PHP Xoops::getConfig怎么用?PHP Xoops::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xoops的用法示例。


在下文中一共展示了Xoops::getConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sessionStart

 /**
  * Configure and start the session
  *
  * @return void
  */
 public function sessionStart()
 {
     /**
      * Revisit this once basics are working
      *
      * grab session_id from https login form
      *
      *  if ($xoops->getConfig('use_ssl')
      *      && isset($_POST[$xoops->getConfig('sslpost_name')])
      *      && $_POST[$xoops->getConfig('sslpost_name')] != ''
      *  ) {
      *      session_id($_POST[$xoops->getConfig('sslpost_name')]);
      *  } else { set session_name...}
      */
     $name = $this->xoops->getConfig('session_name');
     $name = empty($name) ? 'xoops_session' : $name;
     $expire = (int) $this->xoops->getConfig('session_expire');
     $expire = $expire > 0 ? $expire : 300;
     $path = \XoopsBaseConfig::get('cookie-path');
     $domain = \XoopsBaseConfig::get('cookie-domain');
     $secure = $this->httpRequest->is('ssl');
     session_name($name);
     session_cache_expire($expire);
     session_set_cookie_params(0, $path, $domain, $secure, true);
     $sessionHandler = new Handler();
     session_set_save_handler($sessionHandler);
     //session_register_shutdown();
     register_shutdown_function(array($this, 'sessionShutdown'));
     session_start();
     // if session is empty, make sure it isn't using a passed in id
     if (empty($_SESSION)) {
         $this->regenerateSession();
     }
     // Make sure the session hasn't expired, and destroy it if it has
     if (!$this->validateSession()) {
         $this->clearSession();
         return;
     }
     // Check to see if the session shows sign of hijacking attempt
     if (!$this->fingerprint->checkSessionPrint($this)) {
         $this->regenerateSession();
         // session data already cleared, just needs new id
         return;
     }
     // establish valid user data in session, possibly clearing or adding from
     // RememberMe mechanism as needed
     $this->sessionUser->establish();
     // Give a 5% chance of the session id changing on any authenticated request
     //if ($this->has('xoopsUserId') && (rand(1, 100) <= 5)) {
     if (rand(1, 100) <= 5) {
         $this->expireSession();
     }
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:58,代码来源:Manager.php

示例2: writeUserCookie

 /**
  * Update cookie status for current session
  *
  * @param array|string $cookieData usercookie value
  * @param integer      $expire     seconds until usercookie expires
  *
  * @return void
  **/
 protected function writeUserCookie($cookieData, $expire = 2592000)
 {
     $usercookie = $this->xoops->getConfig('usercookie');
     if (empty($usercookie)) {
         return;
         // remember me is not configured
     }
     if (is_array($cookieData)) {
         $cookieData = implode('-', $cookieData);
     }
     $httpRequest = HttpRequest::getInstance();
     $path = \XoopsBaseConfig::get('cookie-path');
     $domain = \XoopsBaseConfig::get('cookie-domain');
     $secure = $httpRequest->is('ssl');
     setcookie($usercookie, $cookieData, $this->now + $expire, $path, $domain, $secure, true);
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:24,代码来源:RememberMe.php


注:本文中的Xoops::getConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。