本文整理汇总了PHP中Zend_Session::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session::start方法的具体用法?PHP Zend_Session::start怎么用?PHP Zend_Session::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session
的用法示例。
在下文中一共展示了Zend_Session::start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initSession
/**
* @todo expireSessionCookie()
* @todo rememberMe(xx)
* @todo forgetMe()
* @see Zend_Registry::get('session');
* @return Zend_Session_Namespace
*/
protected function _initSession()
{
$options = $this->getOption('ca_mgr');
$db = Zend_Db::factory($options['db']['session']['pdo'], $options['db']['session']);
/**
* automatically clean up expired session entries from session cache
* use the modified and lifetime stamps to calculate expire time
*/
if ($options['db']['session']['autocleanup'] == '1') {
$stmt = $db->query('delete from front_session where (modified + lifetime * 2) < unix_timestamp()');
# $stmt->execute();
}
//you can either set the Zend_Db_Table default adapter
//or you can pass the db connection straight to the save handler $config
// @see lifetimeColumn / lifetime / overrideLifetime, lifetime defaults to php.ini: session.gc_maxlifetime
Zend_Db_Table_Abstract::setDefaultAdapter($db);
$config = array('name' => 'front_session', 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime');
//create your Zend_Session_SaveHandler_DbTable and
//set the save handler for Zend_Session
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
// Zend_Session::rememberMe(7200);
//start your session!
Zend_Session::start();
$session = new Zend_Session_Namespace();
if (!isset($session->started)) {
$session->started = time();
}
if (!isset($session->authdata)) {
$session->authdata = array('authed' => false);
}
Zend_Registry::set('session', $session);
return $session;
}
示例2: _initSession
/**
* init session
*/
protected function _initSession()
{
Zend_Session::start();
$session = new Zend_Session_Namespace();
$session->lang = isset($session->lang) ? $session->lang : "pt_BR";
Zend_Registry::set('session', new Zend_Session_Namespace());
}
示例3: _initSession
protected function _initSession()
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/sessions.ini', 'development');
Zend_Session::setOptions($config->toArray());
// start session
Zend_Session::start();
}
示例4: preDispatch
function preDispatch()
{
$this->_helper->layout()->setLayout('layout-nosidebar');
$saveHandlerManager = new Kutu_Session_SaveHandler_Manager();
$saveHandlerManager->setSaveHandler();
Zend_Session::start();
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()) {
$this->view->username = $username = "";
} else {
// [TODO] else: check if user has access to admin page
$username = $auth->getIdentity()->username;
$this->view->username = $username;
}
$sMenuAboutUs = '<ul class="sf-menu">';
$tblFolder = new Kutu_Core_Orm_Table_Folder();
$rowset = $tblFolder->fetchChildren('lgs4a1bb86c12807');
foreach ($rowset as $row) {
$sMenuAboutUs .= $this->_traverseFolder($row->guid, '', 0);
}
$this->view->sMenuAboutUs = $sMenuAboutUs . '</ul>';
$sMenuPrograms = '<ul class="sf-menu">';
$rowset = $tblFolder->fetchChildren('lgs4a1c2bf0b0a6a');
foreach ($rowset as $row) {
$sMenuPrograms .= $this->_traverseFolder($row->guid, '', 0);
}
$this->view->sMenuPrograms = $sMenuPrograms . '</ul>';
$sMenuMediaRoom = '<ul class="sf-menu">';
$rowset = $tblFolder->fetchChildren('nlrp4a1c354d26b45');
foreach ($rowset as $row) {
$sMenuMediaRoom .= $this->_traverseFolder($row->guid, '', 0);
}
$this->view->sMenuMediaRoom = $sMenuMediaRoom . '</ul>';
}
示例5: preDispatch
function preDispatch()
{
$this->_helper->layout->setLayout('layout-store');
$this->_helper->layout->setLayoutPath(array('layoutPath' => ROOT_DIR . '/app/modules/hol-site/layouts'));
Zend_Session::start();
$sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$sReturn = base64_encode($sReturn);
$identity = Pandamp_Application::getResource('identity');
$loginUrl = $identity->loginUrl;
//$loginUrl = ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn;
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()) {
$this->_redirect($loginUrl . '?returnTo=' . $sReturn);
//$this->_redirect($loginUrl);
} else {
// [TODO] else: check if user has access to admin page
$username = $auth->getIdentity()->username;
$this->view->username = $username;
}
$userId = $auth->getIdentity()->guid;
$this->_userId = $userId;
$tblUserFinance = new Pandamp_Modules_Identity_UserFinance_Model_UserFinance();
$this->_userInfo = $tblUserFinance->find($userId)->current();
$storeConfig = Pandamp_Application::getOption('store');
$this->_configStore = $storeConfig;
}
示例6: start
/**
* Starts the session.
*/
function start()
{
if (!\Zend_Session::isStarted()) {
\Zend_Session::start();
}
// session started already
}
示例7: setup
/**
* Setup db
*
*/
public function setup(Zend_Config $config)
{
$sessionConfig = $config->get('config');
$configArray = $sessionConfig->toArray();
// save_path handler
$configArray = $this->_prependSavePath($configArray);
// name handler
$configArray = $this->_parseName($configArray);
// Setup config
Zend_Session::setOptions($configArray);
// Setup save handling?
$saveHandlerConfig = $config->get('save_handler');
if ($className = $saveHandlerConfig->get('class_name')) {
if ($args = $saveHandlerConfig->get('constructor_args')) {
if ($args instanceof Zend_Config) {
$args = $args->toArray();
} else {
$args = (array) $args;
}
} else {
$args = array();
}
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($className);
$saveHandler = new ReflectionClass($className);
$saveHandler = $saveHandler->newInstanceArgs($args);
Zend_Session::setSaveHandler($saveHandler);
}
// Autostart session?
if ($config->get('auto_start')) {
// Start session
Zend_Session::start();
}
}
示例8: 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;
}
示例9: init
public function init()
{
require_once MODELS_PATH . 'Categories.php';
require_once MODELS_PATH . 'Users.php';
require_once MODELS_PATH . 'UsersRights.php';
require_once MODELS_PATH . 'Sentences.php';
require_once MODELS_PATH . 'SentencesAlt.php';
require_once MODELS_PATH . 'Images.php';
require_once MODELS_PATH . 'Sounds.php';
require_once MODELS_PATH . 'Videos.php';
require_once MODELS_PATH . 'Contents.php';
require_once MODELS_PATH . 'Tasks.php';
require_once MODELS_PATH . 'Villes.php';
require_once MODELS_PATH . 'Seo.php';
require_once MODELS_PATH . 'Sites.php';
require_once MODELS_PATH . 'Sites_Seo.php';
require_once 'Custom/Referencement.php';
Zend_Session::start();
$this->session = new Zend_Session_Namespace('Authentification');
$this->checkAuthentification();
$this->view->controller = $this->getRequest()->getControllerName();
$this->view->action = $this->getRequest()->getActionName();
if (isset($this->session->id)) {
$this->view->rights = $this->session->rights;
}
$this->UPLOAD_PATH = realpath(dirname(__FILE__) . '/../../public/images/database/');
$this->UPLOAD_PATH_2 = realpath(dirname(__FILE__) . '/../../public/sounds/database/');
$this->BACKUP_PATH = realpath(dirname(__FILE__) . '/../../public/backups/');
}
示例10: _initSession
protected function _initSession()
{
Zend_Session::start();
$sessionNamespace = new Zend_Session_Namespace($this->_config->appSettings->appName);
Zend_Registry::set('sessionNamespace', $sessionNamespace);
//Zend_Session::rememberMe();
}
示例11: init
public function init()
{
try {
Zend_Session::start();
} catch (Zend_Session_Exception $e) {
session_start();
}
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$info = Zend_Auth::getInstance()->getIdentity();
$model = new Application_Model_DbTable_Usuarios();
$usser = $model->traerdatoscliente($info);
$this->view->datosuser = $usser;
$layout = Zend_Layout::getMvcInstance();
$view = $layout->getView();
foreach ($usser as $user) {
$id_user = $user->id_usuario;
$tipo_user = $user->tipo_usuario;
$permisoadmin = $user->permiso;
$view->apellido = $user->apellido;
$view->tipo_user = $user->tipo_usuario;
$view->whatever = $user->foto_perfil;
$view->name = $user->nombre;
$view->ultimo = $user->ultimo_acceso;
$view->permiso = $permisoadmin;
}
}
}
示例12: _initSession
protected function _initSession()
{
if ($this->hasPluginResource('session') && !Zend_Session::getSaveHandler()) {
Zend_Session::setSaveHandler($this->getPluginResource('session')->getSaveHandler());
}
Zend_Session::start();
}
示例13: _initSession
public function _initSession()
{
Zend_Session::start();
$defaultNameSpace = new Zend_Session_Namespace("defaultsession");
$defaultNameSpace->setExpirationSeconds(7200);
Zend_Registry::set("defaultsession", $defaultNameSpace);
}
示例14: preDispatch
function preDispatch()
{
$this->view->addHelperPath(ROOT_DIR . '/library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper');
$this->_helper->layout->setLayout('layout-membership');
$this->_helper->layout->setLayoutPath(array('layoutPath' => ROOT_DIR . '/app/modules/membership/views/layouts'));
Zend_Session::start();
}
示例15: preDispatch
function preDispatch()
{
//don't check auth from here because the verificationAction SHOULD NOT USE ANY AUTHENTICATION METHOD
/*
- Load Configuration dari tabel kutupaymentSetting
- set TestMode = True or False
*/
$tblPaymentSetting = new Kutu_Core_Orm_Table_PaymentSetting();
$this->_testMode = $tblPaymentSetting->fetchAll($tblPaymentSetting->select()->where(" settingKey= 'testMode'"));
$crc = $tblPaymentSetting->fetchAll($tblPaymentSetting->select()->where("settingKey= 'currency'"));
$this->_defaultCurrency = $crc[0]->settingValue;
$usdIdrEx = $tblPaymentSetting->fetchAll($tblPaymentSetting->select()->where(" settingKey= 'USDIDR'"));
$this->_currencyValue = $usdIdrEx[0]->settingValue;
$this->_helper->layout()->setLayout('layout-final-inside');
$saveHandlerManager = new Kutu_Session_SaveHandler_Manager();
$saveHandlerManager->setSaveHandler();
Zend_Session::start();
$sReturn = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$sReturn = urlencode($sReturn);
$this->view->returnTo = $sReturn;
$tblPaymentSetting = new Kutu_Core_Orm_Table_PaymentSetting();
$rowSet = $tblPaymentSetting->fetchAll();
//var_dump($rowSet);
for ($iRow = 0; $iRow < count($rowSet); $iRow++) {
$key = $rowSet[$iRow]->settingKey;
$this->_paymentVars[$key] = $rowSet[$iRow]->settingValue;
}
$tblSetting = new Kutu_Core_Orm_Table_PaymentSetting();
$this->_lgsMail = $tblSetting->fetchAll($tblSetting->select()->where("settingKey = 'paypalBusiness'"));
}