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


PHP Zend_Session::isStarted方法代码示例

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


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

示例1: start

 /**
  * Starts the session.
  */
 function start()
 {
     if (!\Zend_Session::isStarted()) {
         \Zend_Session::start();
     }
     // session started already
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:10,代码来源:CampSession.php

示例2: init

 public function init()
 {
     $data = $this->getRequestJson();
     if (!$data) {
         $data = $this->getRequest();
     }
     if (array_key_exists('session_uuid', $data)) {
         if (!Zend_Session::isStarted()) {
             Glo_Auth_Storage_Session::setId($data['session_uuid']);
             $storage = new Glo_Auth_Storage_Session('Glo_Auth');
             $sessoinData = $storage->read();
             if (!is_object($sessoinData) || !isset($data['user_uuid']) || $sessoinData->user_uuid != $data['user_uuid']) {
                 throw new Glo_Exception_InvalidSession('Your session is invalid.');
             }
         }
     }
     /*         $this->loggedInUser = App_Model_User::getLoggedIn(); */
     return parent::init();
     /*
             // load the logged in user if there is one
             $this->view->loggedInUser = User::getLoggedIn();
             
             // set the translate adapter
             $this->registerTranslator();
     */
 }
开发者ID:highhair20,项目名称:glo,代码行数:26,代码来源:Api.php

示例3: uploadAction

 /**
  *Upload File
  *
  */
 public function uploadAction()
 {
     $this->_loadParams();
     $dir = $this->_fields[$this->_request->getParam('field_id')]['params']['dir'];
     if (!Zend_Session::sessionExists() || !Zend_Session::isStarted()) {
         Zend_Session::start();
     }
     $uniqueName = Zend_Session::getId();
     $this->_genericFileHelper->createFieldDir($dir . DIRECTORY_SEPARATOR . stripcslashes($uniqueName), true);
     $destination = $dir . DIRECTORY_SEPARATOR . stripcslashes($uniqueName);
     $uploadSettings = $this->getParams($this->_request->getParam('field_id'));
     if (!isset($uploadSettings)) {
         //do something bcs there is no file types
     }
     $uploadSettings = array_merge($uploadSettings, array('dir' => $destination, 'field' => $this->_request->getParam('field_id')));
     $result = $this->_genericFileHelper->upload($uploadSettings);
     if ($result === false) {
         $result = array('success' => false, 'files' => array());
         $lastError = $this->_genericFileHelper->getLastErrorMessage();
         if ($lastError != '') {
             $result['error'] = $this->translate($lastError);
         }
         echo json_encode($result);
     } else {
         $result = array('success' => true, 'files' => array($result), 'path' => $result['path']);
         $lastError = $this->_genericFileHelper->getLastErrorMessage();
         if ($lastError != '') {
             $result['error'] = $this->translate($lastError);
         }
         echo json_encode($result);
     }
     die;
 }
开发者ID:bokultis,项目名称:kardiomedika,代码行数:37,代码来源:FileUploadController.php

示例4: read

 /**
  * Defined by Zend_Auth_Storage_Interface
  *
  * @return mixed
  */
 public function read()
 {
     if (!Zend_Session::isStarted() && !Zend_Session::sessionExists()) {
         return array();
     }
     return $this->_getSession()->{$this->_member};
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:12,代码来源:Session.php

示例5: indexAction

 /**
  * 登录页面
  */
 public function indexAction()
 {
     $err = $this->_request->getQuery('err');
     $isValid = true;
     do {
         if (Zend_Session::isStarted()) {
             if ($this->_user->isAdminLogined()) {
                 return $this->referer($this->_basePath . '/');
             }
         }
         // 没有传入登录的SessionID
         if (empty($this->_sessionId)) {
             $isValid = false;
         }
         if (empty($this->_session->auth) || empty($this->_session->auth['address'])) {
             $isValid = false;
         }
     } while (false);
     if (!$isValid) {
         $url = $this->_request->getCookie('track');
         if (!$url) {
             $url = base64_decode($url);
         }
         if (!$url || !preg_match('/^https?:\\/\\//', $url)) {
             $url = $this->_options['sites']['tudu'];
         }
         return $this->referer($url . '/?error=admin');
     }
     if ($err && isset($this->_errMessages[$err])) {
         $err = $this->_errMessages[$err];
     }
     $memcache = $this->_bootstrap->memcache;
     $orgInfo = $memcache->get('TUDU-HOST-' . $this->_session->auth['orgid'] . '.tudu.com');
     if (!$orgInfo) {
         /* @var $daoOrg Dao_Md_Org_Org */
         $daoOrg = Oray_Dao::factory('Dao_Md_Org_Org', $this->_bootstrap->getResource('multidb')->getDefaultDb());
         $orgInfo = $daoOrg->getOrgByHost($this->_session->auth['orgid'] . '.tudu.com');
         $flag = null;
         $memcache->set('TUDU-HOST-' . $this->_session->auth['orgid'] . '.tudu.com', $orgInfo, $flag, 3600);
     }
     if ($orgInfo instanceof Dao_Md_Org_Record_Org) {
         $orgInfo = $orgInfo->toArray();
     }
     $this->view->options = array('sites' => $this->_options['sites']);
     $this->view->address = $this->_session->auth['userid'] . '@' . $this->_session->auth['orgid'];
     $this->view->err = $err;
     $this->view->org = $orgInfo;
     // 选择登陆模板
     if (!empty($orgInfo) && !empty($orgInfo['loginskin'])) {
         $loginSkin = $orgInfo['loginskin'];
         if (!empty($loginSkin['selected']) && !empty($loginSkin['selected']['value']) && $loginSkin['selected']['value'] != 'SYS:default') {
             $this->view->loginskin = $orgInfo['loginskin'];
             $this->render('custom');
         }
     }
 }
开发者ID:bjtenao,项目名称:tudu-web,代码行数:59,代码来源:LoginController.php

示例6: getSession

 function getSession()
 {
     if (Zend_Session::isStarted()) {
         $session = new Zend_Session_Namespace('Acl');
         if (isset($session->acl)) {
             return $this->acl;
         }
     }
     return false;
 }
开发者ID:josmel,项目名称:DevelEntretenimientoEntel,代码行数:10,代码来源:Acl.php

示例7: sendContent

 public function sendContent($includeMaster)
 {
     $benchmarkEnabled = Kwf_Benchmark::isEnabled();
     if (Kwf_Util_Https::supportsHttps()) {
         $foundRequestHttps = Kwf_Util_Https::doesComponentRequestHttps($this->_data);
         if (isset($_SERVER['HTTPS'])) {
             //we are on https
             if (!$foundRequestHttps && isset($_COOKIE['kwcAutoHttps']) && !Zend_Session::sessionExists() && !Zend_Session::isStarted()) {
                 //we where auto-redirected to https but don't need https anymore
                 setcookie('kwcAutoHttps', '', 0, '/');
                 //delete cookie
                 Kwf_Util_Https::ensureHttp();
             }
         } else {
             //we are on http
             if ($foundRequestHttps) {
                 setcookie('kwcAutoHttps', '1', 0, '/');
                 Kwf_Util_Https::ensureHttps();
             }
         }
         if ($benchmarkEnabled) {
             Kwf_Benchmark::checkpoint('check requestHttps');
         }
     }
     if ($benchmarkEnabled) {
         $startTime = microtime(true);
     }
     $process = $this->_getProcessInputComponents($includeMaster);
     if ($benchmarkEnabled) {
         Kwf_Benchmark::subCheckpoint('getProcessInputComponents', microtime(true) - $startTime);
     }
     self::_callProcessInput($process);
     if ($benchmarkEnabled) {
         Kwf_Benchmark::checkpoint('processInput');
     }
     $hasDynamicParts = false;
     $out = $this->_render($includeMaster, $hasDynamicParts);
     if ($benchmarkEnabled) {
         Kwf_Benchmark::checkpoint('render');
     }
     header('Content-Type: text/html; charset=utf-8');
     if (!$hasDynamicParts) {
         $lifetime = 60 * 60;
         header('Cache-Control: public, max-age=' . $lifetime);
         header('Expires: ' . gmdate("D, d M Y H:i:s \\G\\M\\T", time() + $lifetime));
         header('Pragma: public');
     }
     echo $out;
     self::_callPostProcessInput($process);
     if ($benchmarkEnabled) {
         Kwf_Benchmark::checkpoint('postProcessInput');
     }
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:53,代码来源:Default.php

示例8: __construct

 public function __construct($enableSessionCheck = true)
 {
     if (!\Zend_Session::isStarted()) {
         throw new \Exception("Session not started yet");
     }
     if (null === $this->_ses) {
         $this->_initSes();
     }
     if (!$this->_ses instanceof \Zend_Session_Abstract) {
         throw new \Exception("Invalid session instance created");
     }
 }
开发者ID:raspi,项目名称:zf1-fb-auth,代码行数:12,代码来源:Zf1auth_PersistentDataHandler.php

示例9: __construct

 /**
  * recognizes a valid session by checking certain additional information stored in the session
  * often recommended as protection against session fixation/hijacking - but doesnt make much sense
  * Zend-Framework supports session validators to validate sessions
  * @return unknown_type
  */
 public function __construct()
 {
     try {
         if (!Zend_Session::isStarted()) {
             Zend_Session::start();
         }
     } catch (Zend_Session_Exception $e) {
         Zend_Session::destroy();
         Zend_Session::start();
         Zend_Session::regenerateId();
     }
     Zend_Session::registerValidator(new Zend_Session_Validator_HttpUserAgent());
 }
开发者ID:visualweber,项目名称:appzf1,代码行数:19,代码来源:Db.php

示例10: init

 /**
  * Defined by Zend_Application_Resource_Resource
  *
  * @return Zend_Translate
  */
 public function init()
 {
     $this->getBootstrap()->bootstrap('Logger')->bootstrap('View');
     $locale = getenv('APPLICATION_LOCALE');
     if (!empty($locale)) {
         $this->_locale = $locale;
     } else {
         if (!Zend_Session::isStarted()) {
             Zend_Session::start(true);
         }
         $this->_locale = isset($_SESSION['APPLICATION_LOCALE']) ? $_SESSION['APPLICATION_LOCALE'] : 'en';
     }
     return $this->getTranslate();
 }
开发者ID:cwcw,项目名称:cms,代码行数:19,代码来源:Translate.php

示例11: get

 /**
  * @param string $namespace
  * @param bool $readOnly
  * @return \Zend_Session_Namespace
  * @throws \Zend_Session_Exception
  */
 public static function get($namespace = "pimcore_admin", $readOnly = false)
 {
     $initSession = !\Zend_Session::isStarted();
     $forceStart = !$readOnly;
     // we don't force the session to start in read-only mode (default behavior)
     $sName = self::getOption("name");
     if (self::backupForeignSession()) {
         $initSession = true;
         $forceStart = true;
     }
     if ($initSession) {
         \Zend_Session::setOptions(self::$options);
     }
     try {
         try {
             if ($initSession) {
                 // only set the session id if the cookie isn't present, otherwise Set-Cookie is always in the headers
                 if (array_key_exists($sName, $_REQUEST) && !empty($_REQUEST[$sName]) && (!array_key_exists($sName, $_COOKIE) || empty($_COOKIE[$sName]))) {
                     // get zend_session work with session-id via get (since SwfUpload doesn't support cookies)
                     \Zend_Session::setId($_REQUEST[$sName]);
                 }
             }
         } catch (\Exception $e) {
             \Logger::error("Problem while starting session");
             \Logger::error($e);
         }
     } catch (\Exception $e) {
         \Logger::emergency("there is a problem with admin session");
         die;
     }
     if ($initSession) {
         \Zend_Session::start();
     }
     if ($forceStart) {
         @session_start();
         self::$sessionCookieCleanupNeeded = true;
     }
     if (!array_key_exists($namespace, self::$sessions) || !self::$sessions[$namespace] instanceof \Zend_Session_Namespace) {
         try {
             self::$sessions[$namespace] = new Session\Container($namespace);
         } catch (\Exception $e) {
             // invalid session, regenerate the session, and return a dummy object
             \Zend_Session::regenerateId();
             return new \stdClass();
         }
     }
     self::$openedSessions++;
     self::$sessions[$namespace]->unlock();
     return self::$sessions[$namespace];
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:56,代码来源:Session.php

示例12: getPanel

 /**
  * Gets content panel for the Debugbar
  *
  * @return string
  */
 public function getPanel()
 {
     $html = '<h4>Custom Timers</h4>';
     $html .= 'Controller: ' . round($this->_timer['postDispatch'] - $this->_timer['preDispatch'], 2) . ' ms<br />';
     if (isset($this->_timer['user']) && count($this->_timer['user'])) {
         foreach ($this->_timer['user'] as $name => $time) {
             $html .= '' . $name . ': ' . round($time, 2) . ' ms<br>';
         }
     }
     if (!Zend_Session::isStarted()) {
         Zend_Session::start();
     }
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $this_module = $request->getModuleName();
     $this_controller = $request->getControllerName();
     $this_action = $request->getActionName();
     $timerNamespace = new Zend_Session_Namespace('Centurion_ZFDebug_Time', false);
     $timerNamespace->data[$this_module][$this_controller][$this_action][] = $this->_timer['postDispatch'];
     $html .= '<h4>Overall Timers</h4>';
     foreach ($timerNamespace->data as $module => $controller) {
         if ($module == $this_module) {
             $module = '<strong>' . $module . '</strong>';
         }
         $html .= $module . '<br />';
         $html .= '<div class="pre">';
         foreach ($controller as $con => $action) {
             if ($con == $this_controller) {
                 $con = '<strong>' . $con . '</strong>';
             }
             $html .= '    ' . $con . '<br />';
             $html .= '<div class="pre">';
             foreach ($action as $key => $data) {
                 if ($key == $this_action) {
                     $key = '<strong>' . $key . '</strong>';
                 }
                 $html .= '        ' . $key . '<br />';
                 $html .= '<div class="pre">';
                 $html .= '            Avg: ' . $this->_calcAvg($data) . ' ms / ' . count($data) . ' requests<br />';
                 $html .= '            Min: ' . round(min($data), 2) . ' ms<br />';
                 $html .= '            Max: ' . round(max($data), 2) . ' ms<br />';
                 $html .= '</div>';
             }
             $html .= '</div>';
         }
         $html .= '</div>';
     }
     $html .= '<br />Reset timers by sending Centurion_ZFDebug_RESET as a GET/POST parameter';
     return $html;
 }
开发者ID:netconstructor,项目名称:Centurion,代码行数:54,代码来源:Time.php

示例13: init

 /**
  *
  */
 public function init()
 {
     if (Zend_Session::isStarted() && Zend_Session::namespaceIsset('SwIRS_Web')) {
         $session = Zend_Session::namespaceGet('SwIRS_Web');
         $this->getRequest()->setParam('CustomerState', $session['customerState']);
         $this->getRequest()->setParam('CustomerUserId', $session['customerUserId']);
         $this->getRequest()->setParam('CustomerAccountId', $session['customerAccountId']);
         $this->getRequest()->setParam('SecondaryCustomerAccountId', $session['secondaryCustomerAccountId']);
         $this->getRequest()->setParam('Profile', $session['profile']);
         $webservice = $this->getResource('webservice');
         $webservice->setAuth(array('user' => $session['username'], 'password' => $session['password']));
     }
     $front = $this->getResource('FrontController');
     $front->setRequest($this->getRequest());
 }
开发者ID:cwcw,项目名称:cms,代码行数:18,代码来源:Bootstrap.php

示例14: init

 /**
  * Defined by Zend_Application_Resource_Resource
  *
  * @return Zend_Acl
  */
 public function init()
 {
     $this->getBootstrap()->bootstrap('FrontController')->bootstrap('Logger')->bootstrap('Session');
     $front = $this->getBootstrap()->getResource('FrontController');
     $log = $this->getBootstrap()->getResource('Logger');
     if (!$front->hasPlugin('Streamwide_Web_Controller_Plugin_Acl')) {
         $front->registerPlugin(new Streamwide_Web_Controller_Plugin_Acl($this->_options), 2);
         //2: the very first plugin after Log
     }
     $ini = $this->_options['definition'];
     $definitions = new Zend_Config_Ini($ini, 'resource');
     $acl = $this->getAcl();
     $acl->addRole('visitor')->addRole('developer')->addResource(new Streamwide_Web_Acl_Resource_Mca('*', '*', '*'));
     $acl->deny('visitor');
     foreach ($definitions->toArray() as $definition) {
         $rules = array();
         list($module, $controller, $action, $roles) = $this->_getDef($definition, $rules);
         $mca = new Streamwide_Web_Acl_Resource_Mca($module, $controller, $action);
         if (!$acl->has($mca)) {
             $acl->addResource($mca);
         }
         foreach ($roles as $role => $allow) {
             if (!$acl->hasRole($role)) {
                 $acl->addRole($role);
             }
             if ($allow) {
                 $acl->allow($role, $mca);
             } else {
                 $acl->deny($role, $mca);
             }
         }
     }
     $acl->allow('developer');
     $role = getenv('APPLICATION_ROLE');
     if (!empty($role)) {
         $this->_role = $role;
     } else {
         if (!Zend_Session::isStarted()) {
             Zend_Session::start(true);
         }
         $this->_role = isset($_SESSION['APPLICATION_ROLE']) ? $_SESSION['APPLICATION_ROLE'] : 'visitor';
     }
     $log->setEventItem('role', $this->_role);
     return $acl;
 }
开发者ID:cwcw,项目名称:cms,代码行数:50,代码来源:Acl.php

示例15: getInstance

 /**
  * Returns an instance of Zend_Auth
  *
  * Singleton pattern implementation
  *
  * @return Zend_Auth Provides a fluent interface
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     //        self::$_instance = new self();
     try {
         if (!Zend_Session::isStarted()) {
             Zend_Session::start();
         }
     } catch (Zend_Session_Exception $e) {
         echo $e->getFile();
         echo $e->getMessage();
         echo $e->getTrace();
     }
     self::$_session_id = session_id();
     return self::$_instance;
 }
开发者ID:visualweber,项目名称:appzf1,代码行数:25,代码来源:Auth.php


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