本文整理汇总了PHP中Zend_Session_Namespace::isLocked方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session_Namespace::isLocked方法的具体用法?PHP Zend_Session_Namespace::isLocked怎么用?PHP Zend_Session_Namespace::isLocked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session_Namespace
的用法示例。
在下文中一共展示了Zend_Session_Namespace::isLocked方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: offsetSet
/**
* Defined by spl ArrayObject.
* Here we are redefining the action to point to the session namespace
*
* @param string $index
* @return bool
*/
public function offsetSet($index, $newval)
{
if (self::$_session->isLocked()) {
self::$_session->unLock();
}
self::getSession()->{$index} = $newval;
self::$_session->lock();
}
示例2: getSignedUserTwitterAccount
public function getSignedUserTwitterAccount()
{
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()) {
throw new Exception("Not signed in.");
}
$twitterInfo = new Zend_Session_Namespace('twitterInfo');
if (!$twitterInfo->isLocked()) {
$select = $this->_dbTable->select()->where("uid = ?", $auth->getIdentity());
$row = $this->_dbAdapter->fetchRow($select);
$twitterInfo->account = $row;
$twitterInfo->setExpirationSeconds(86400);
//we like fresh data
$twitterInfo->lock();
}
return $twitterInfo->account;
}
示例3: authAction
public function authAction()
{
$request = $this->getRequest();
$registry = Zend_Registry::getInstance();
$auth = Zend_Auth::getInstance();
$DB = $registry['DB'];
$authAdapter = new Zend_Auth_Adapter_DbTable($DB);
$authAdapter->setTableName('fitness_user_general')->setIdentityColumn('user_username')->setCredentialColumn('user_password');
if ($request->getParam('user_username') != "" && $request->getParam('user_password') != "") {
// Set the input credential values
$uname = $request->getParam('user_username');
$paswd = md5($request->getParam('user_password'));
$authAdapter->setIdentity($uname);
$authAdapter->setCredential($paswd);
$select = $authAdapter->getDbSelect();
$select->where('user_status = 1');
// Perform the authentication query, saving the result
$result = $auth->authenticate($authAdapter);
if ($result->isValid()) {
//print_r($result);
$data = $authAdapter->getResultRowObject(null, 'password');
$auth->getStorage()->write($data);
$sess = new Zend_Session_Namespace('UserSession');
if ($sess->isLocked()) {
$sess->unlock();
}
$sess->username = $uname;
//record login status
$fitnessUser = new FitnessUserGeneral();
$fitnessUser->userLogin($uname);
$loginDetails = $fitnessUser->getLastLogin($uname);
$fitnessUser->userLogin($uname);
if ($loginDetails['user_login'] == 1) {
$this->_redirect('/user/settings');
} else {
$this->_redirect('/user/listworkouts');
}
} else {
$this->_redirect('/user/loginform');
}
} else {
$this->_redirect('/user/loginform');
}
}
示例4: isLocked
/**
* 名前空間がロック状態にあるかチェック
*
* @access public
*/
public function isLocked()
{
return parent::isLocked();
}
示例5: testIsLockedNamespace
/**
* test isLocked() unary comparison operator under various situations; expect lock status remains synchronized with
* last call to unlock() or lock(); expect no exceptions
*
* @return void
*/
public function testIsLockedNamespace()
{
try {
$s = new Zend_Session_Namespace('somenamespace');
$s->a = 'apple';
$s->p = 'pear';
$this->assertFalse($s->isLocked(), 'isLocked() returned incorrect status (locked)');
$s->lock();
$s2 = new Zend_Session_Namespace('mayday');
$s2->lock();
$this->assertTrue($s->isLocked(), 'isLocked() returned incorrect status (unlocked)');
$s->unlock();
$s->o = 'orange';
$s->p = 'prune';
$this->assertFalse($s->isLocked(), 'isLocked() returned incorrect status (locked)');
$s->lock();
$s2->unlock();
$this->assertTrue($s->isLocked(), 'isLocked() returned incorrect status (unlocked)');
$s->unlock();
$this->assertFalse($s->isLocked(), 'isLocked() returned incorrect status (locked)');
$s->o = 'orange';
$s->p = 'papaya';
$s->c = 'cherry';
$this->assertFalse($s->isLocked(), 'isLocked() returned incorrect status (locked)');
} catch (Zend_Session_Exception $e) {
$this->fail('Unexpected exception when writing to named namespaces after unlocking them.');
}
}
示例6: QoolInstaller
define('IN_QOOL', true);
error_reporting(E_ERROR);
//read the directory structure
require_once "simple_fn.php";
//check if the cms is installed
if (!($dirs = readDirFile())) {
include "install/install.php";
$installer = new QoolInstaller();
$installer->start();
} else {
setIncludePath($dirs);
//d(get_include_path());
require_once "Zend/Session.php";
$namespace = new Zend_Session_Namespace('Qool');
if ($namespace->isLocked()) {
$namespace->unLock();
}
//get the folder if needed
amiInAfolder($dirs);
//if the user is not logged in we just set some typical rights
givemeGuestRights();
//set the include path
//now read configuration
require_once "Zend/Config/Xml.php";
$config = new Zend_Config_Xml('config/config.xml');
//just a simple definition to make things readable
define('DIR_SEP', $config->host->separator);
define('APPL_PATH', $config->host->absolute_path);
$_SESSION['SITE_URL'] = $config->host->http . $config->host->subdomain . $config->host->domain . $config->host->folder;
//read the database table names and prefix
示例7: setlanguageAction
function setlanguageAction()
{
$langcode = $this->_request->getParam('lang');
$sess = new Zend_Session_Namespace('UserLanguage');
if ($sess->isLocked()) {
$sess->unlock();
}
$sess->lang = $langcode;
$this->_redirect('/admin/homeuser');
}
示例8: initLanguage
/**
* http://stackoverflow.com/questions/3479336/why-is-there-no-translation-for-the-language-en-us
* http://stackoverflow.com/questions/1875851/application-wide-locales-with-gettext-and-zend-translate
* Enter description here ...
* @throws Exception
*/
public function initLanguage()
{
$config = Zend_Registry::get('config');
try {
if (!Zend_Session::isStarted()) {
Zend_Session::start();
}
$languageSession = new Zend_Session_Namespace('language');
} catch (Zend_Session_Exception $e) {
}
$lang = $this->_request->getParam('lang');
if ($lang == null) {
if (!isset($languageSession->current_lang)) {
$lang = $config['site']['language'];
if ($languageSession->isLocked()) {
$languageSession->unlock();
}
$languageSession->current_lang = $lang;
} else {
$lang = $languageSession->current_lang;
}
} else {
if ($languageSession->isLocked()) {
$languageSession->unlock();
}
$languageSession->current_lang = $lang;
}
$languageSession->setExpirationSeconds(1 * 60 * 60 * 12);
$languageSession->lock();
$this->view->lang = $lang;
Zend_Registry::set('lang', $lang);
$options = array('separator' => '=');
try {
$p_module = $this->_request->getModuleName();
// get language file
$languageDir = PATH_PROJECT . $config['site']['language_dir'] . $lang . DIRECTORY_SEPARATOR;
$languageModuleDir = $languageDir . $p_module . DIRECTORY_SEPARATOR;
$translate = new Zend_Translate('ini', $languageDir . "{$lang}.ini", "{$lang}", $options);
$translate->getAdapter()->addTranslation($languageModuleDir . "module.lang.ini", "{$lang}", $options);
//store translate object to the registry
Zend_Registry::set('Zend_Translate', $translate);
$this->view->translate = $translate;
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
}
示例9: setlanguageAction
function setlanguageAction()
{
$this->view->loginStatus = $this->isLoggedIn();
$langcode = $this->_request->getParam('lang');
$params = str_replace(",", "/", $this->_request->getParam('params'));
if ($this->_request->getParam('page') == 'playvideo') {
$redirectPage = '/' . $this->_request->getParam('contr') . '/' . $this->_request->getParam('page') . "/" . $params;
} else {
$redirectPage = '/' . $this->_request->getParam('contr') . '/' . $this->_request->getParam('page');
}
$sess = new Zend_Session_Namespace('UserLanguage');
if ($sess->isLocked()) {
$sess->unlock();
}
$sess->lang = $langcode;
$this->_redirect($redirectPage);
}