本文整理汇总了PHP中Zend_Session::writeClose方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session::writeClose方法的具体用法?PHP Zend_Session::writeClose怎么用?PHP Zend_Session::writeClose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session
的用法示例。
在下文中一共展示了Zend_Session::writeClose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
// Trigger tasks
if (!defined('ENGINE_TASK_NOTRIGGER')) {
$tasksTable = Engine_Api::_()->getDbtable('tasks', 'core');
if ($tasksTable->getTriggerType() == 'pre') {
Engine_Api::_()->getDbtable('tasks', 'core')->trigger();
}
}
// Start main
$this->bootstrap('frontcontroller');
$front = $this->getContainer()->frontcontroller;
$default = $front->getDefaultModule();
if (null === $front->getControllerDirectory($default)) {
throw new Zend_Application_Bootstrap_Exception('No default controller directory registered with front controller');
}
// End main
// Increment page views and referrer
Engine_Api::_()->getDbtable('statistics', 'core')->increment('core.views');
Engine_Api::_()->getDbtable('referrers', 'core')->increment();
// Start main 2
$front->setParam('bootstrap', $this);
$front->dispatch();
// End main 2
// Trigger tasks
if (!defined('ENGINE_TASK_NOTRIGGER')) {
if ($tasksTable->getTriggerType() == 'post') {
Engine_Api::_()->getDbtable('tasks', 'core')->trigger();
}
}
// Close the session to prevent chicken-egg
// http://bugs.php.net/bug.php?id=33772
Zend_Session::writeClose();
}
示例2: main
static function main()
{
Zend_Registry::set('config', new Strass_Config_Php('strass', array()));
Zend_Registry::set('acl', new Strass_Installer_FakeAcl());
Strass_Cache::setup();
try {
$fc = Zend_Controller_Front::getInstance();
$fc->setRequest(new Strass_Controller_Request_Http());
$fc->setParam('useDefaultControllerAlways', true);
$fc->setParam('noViewRenderer', true);
$fc->setModuleControllerDirectoryName('Installer');
$fc->addControllerDirectory(Strass::getPrefix() . 'include/Strass/Installer/Controller', 'Strass');
$fc->setDefaultModule('Strass');
$fc->registerPlugin(new Strass_Controller_Plugin_Error());
$fc->dispatch();
Zend_Session::writeClose();
} catch (Exception $e) {
// affichage complet des exceptions non intercepté par le controlleur. À améliorer.
$msg = ":(\n\n";
$msg .= $e->getMessage() . "\n\n";
$msg .= " à " . $e->getFile() . ":" . $e->getLine() . "\n\n";
$msg .= str_replace('#', '<br/>#', $e->getTraceAsString()) . "\n";
Orror::kill(strip_tags($msg));
}
}
示例3: pageHeader
public function pageHeader()
{
// We have finished writing session data, so release the lock
Zend_Session::writeClose();
// Ajax responses are always UTF8
header('Content-Type: text/html; charset=UTF-8');
$this->page_header = true;
return $this;
}
示例4: dispatchLoopShutdown
public function dispatchLoopShutdown()
{
if (Zend_Session::sessionExists() && Zend_Auth::getInstance()->hasIdentity()) {
$ident = Zend_Auth::getInstance()->getIdentity();
$isVaporLogin = in_array($ident['authType'], array(App_Controller_Plugin_Auth::AUTH_TYPE_LOST_PASSWORD, App_Controller_Plugin_Auth::AUTH_TYPE_ASYNC, App_Controller_Plugin_Auth::AUTH_TYPE_EXTERNAL, App_Controller_Plugin_Auth::AUTH_TYPE_THIRD_PARTY, App_Controller_Plugin_Auth::AUTH_TYPE_DOWNLOAD_TOKEN));
if (!$isVaporLogin) {
Zend_Session::writeClose(true);
} else {
Zend_Session::destroy(false);
$_SESSION = array();
}
}
}
示例5: modAction
public function modAction($modAction)
{
switch ($modAction) {
case 'ajax':
Zend_Session::writeClose();
header('Content-Type: text/html; charset=UTF-8');
echo $this->getSidebarAjaxContent();
break;
default:
header('HTTP/1.0 404 Not Found');
break;
}
exit;
}
示例6: dAction
function dAction()
{
$id = $this->_request->get('id');
$this->validateSignedLink($id);
$id = intval($id);
$media = $this->getDi()->videoTable->load($id);
set_time_limit(600);
while (@ob_end_clean()) {
}
Zend_Session::writeClose();
if ($path = $media->getFullPath()) {
$this->_helper->sendFile($path, $media->getMime());
} else {
$this->redirectLocation($media->getProtectedUrl($this->getDi()->config->get('storage.s3.expire', 15) * 60));
}
}
示例7: run
public function run()
{
// Ensure frontcontroller and router are bootstrapped
$this->bootstrap('frontcontroller');
$this->bootstrap('router');
$front = $this->getContainer()->frontcontroller;
// Trigger tasks
if (!defined('ENGINE_TASK_NOTRIGGER')) {
// Get the request so we can get the params
if (null === ($request = $front->getRequest())) {
$request = new Zend_Controller_Request_Http();
$front->setRequest($request);
}
if ($request->getParam('notrigger')) {
define('ENGINE_TASK_NOTRIGGER', true);
}
// Actually trigger now
$tasksTable = Engine_Api::_()->getDbtable('tasks', 'core');
if ($tasksTable->getTriggerType() == 'pre') {
Engine_Api::_()->getDbtable('tasks', 'core')->trigger();
}
}
// Start main
$default = $front->getDefaultModule();
if (null === $front->getControllerDirectory($default)) {
throw new Zend_Application_Bootstrap_Exception('No default controller directory registered with front controller');
}
// End main
// Start main 2
$front->setParam('bootstrap', $this);
$front->dispatch();
// End main 2
// Trigger tasks
if (!defined('ENGINE_TASK_NOTRIGGER')) {
if ($tasksTable->getTriggerType() == 'post') {
Engine_Api::_()->getDbtable('tasks', 'core')->trigger();
}
}
// Close the session to prevent chicken-egg
// http://bugs.php.net/bug.php?id=33772
Zend_Session::writeClose();
}
示例8: run
public function run()
{
// Ensure frontcontroller and router are bootstrapped
$this->bootstrap('frontcontroller');
$this->bootstrap('router');
$front = $this->getContainer()->frontcontroller;
// Start main
$default = $front->getDefaultModule();
if (null === $front->getControllerDirectory($default)) {
throw new Zend_Application_Bootstrap_Exception('No default controller directory registered with front controller');
}
// End main
// Start main 2
$front->setParam('bootstrap', $this);
$front->dispatch();
// End main 2
// Close the session to prevent chicken-egg
// http://bugs.php.net/bug.php?id=33772
Zend_Session::writeClose();
}
示例9: _redirect
/**
* Redirect to another URL
*
* By default, emits a 302 HTTP status header, prepends base URL as defined
* in request object if url is relative, and halts script execution by
* calling exit().
*
* $options is an optional associative array that can be used to control
* redirect behaviour. The available option keys are:
* - exit: boolean flag indicating whether or not to halt script execution when done
* - prependBase: boolean flag indicating whether or not to prepend the base URL when a relative URL is provided
* - code: integer HTTP status code to use with redirect. Should be between 300 and 307.
*
* _redirect() sets the Location header in the response object. If you set
* the exit flag to false, you can override this header later in code
* execution.
*
* If the exit flag is true (true by default), _redirect() will write and
* close the current session, if any.
*
* @param string $url
* @param array $options Options to be used when redirecting
* @return void
*/
protected function _redirect($url, array $options = null)
{
// prevent header injections
$url = str_replace(array("\n", "\r"), '', $url);
$exit = $this->getRedirectExit();
$prependBase = $this->getRedirectPrependBase();
$code = $this->getRedirectCode();
if (null !== $options) {
if (isset($options['exit'])) {
$exit = $options['exit'] ? true : false;
}
if (isset($options['prependBase'])) {
$prependBase = $options['prependBase'] ? true : false;
}
if (isset($options['code'])) {
$this->_checkRedirectCode($options['code']);
$code = $options['code'];
}
}
// If relative URL, decide if we should prepend base URL
if ($prependBase && !preg_match('|^[a-z]+://|', $url)) {
$request = $this->getRequest();
if ($request instanceof Zend_Controller_Request_Http) {
$base = $request->getBaseUrl();
if ('/' != substr($base, -1) && '/' != substr($url, 0, 1)) {
$url = $base . '/' . $url;
} else {
$url = $base . $url;
}
}
}
// Set response redirect
$response = $this->getResponse();
$response->setRedirect($url, $code);
if ($exit) {
// Close session, if started
if (class_exists('Zend_Session', false) && Zend_Session::isStarted()) {
Zend_Session::writeClose();
} elseif (isset($_SESSION)) {
session_write_close();
}
$response->sendHeaders();
exit;
}
}
示例10: _init
protected function _init()
{
set_include_path(implode(PATH_SEPARATOR, array(SP_LIB_PATH, SP_APP_PATH . DIRECTORY_SEPARATOR . 'modules', get_include_path())));
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(false);
$autoloader->registerNamespace('SP_');
$autoloader->registerNamespace('Apache_');
//for solr
try {
Zend_Session::start();
} catch (Zend_Session_Exception $error) {
Zend_Session::writeClose();
Zend_Session::start();
Zend_Session::regenerateId();
trigger_error($error->getMessage());
}
self::_setAutoloader();
self::_setConfig();
self::_setView();
self::_setRouter();
self::_setDbAdapter();
self::_setLog();
self::_setCache();
self::_setACL();
self::_setAuthAdapter();
self::_setLayout();
self::_setTranslate();
self::_setActionHelper();
$front = Zend_Controller_Front::getInstance();
$front->setRouter(self::$_router)->addModuleDirectory(SP_APP_PATH . '/modules')->setDefaultModule('default')->setModuleControllerDirectoryName('controllers')->throwExceptions(true)->returnResponse(false)->setDefaultControllerName('Index')->setDefaultAction('index')->setParam('prefixDefaultModule', true)->setParam('noViewRenderer', true)->setParam('useDefaultControllerAlways', false);
//register some useful plugins
$front->registerPlugin(new SP_Controller_Plugin_AppPlugin());
//set default db table adapter
Zend_Db_Table::setDefaultAdapter(self::$_db);
//set default translator for Zend_Form
Zend_Form::setDefaultTranslator(self::$_translate);
}
示例11: doGetArray
/**
* @param array $args
* @return integer Always returns zero.
*/
public function doGetArray(array $args)
{
$GLOBALS['fpc'] = 'get';
session_id($args[0]);
if (isset($args[1]) && !empty($args[1])) {
$s = new Zend_Session_Namespace($args[1]);
} else {
$s = new Zend_Session_Namespace();
}
$result = '';
foreach ($s->getIterator() as $key => $val) {
$result .= "{$key} === " . str_replace(array("\n", ' '), array(';', ''), print_r($val, true)) . ';';
}
// file_put_contents('out.sesstiontest.get', print_r($s->someArray, true));
Zend_Session::writeClose();
echo $result;
return 0;
}
示例12: finish
/**
* Complete the installation writing the config file.
*
* @return void
*/
public function finish()
{
// Create config file
$databaseNamespace = new Zend_Session_Namespace('databaseData');
$config = new Setup_Models_Config();
$content = $config->getDefaultProduction($databaseNamespace->data['dbUser'], $databaseNamespace->data['dbPass'], $databaseNamespace->data['dbName'], 'Pdo_Mysql', $databaseNamespace->data['dbHost']);
$baseDir = str_replace('htdocs/setup.php', '', $_SERVER['SCRIPT_FILENAME']);
$configFile = $baseDir . "configuration.php";
file_put_contents($configFile, $content);
// Set access
$baseDir = str_replace('htdocs/setup.php', '', $_SERVER['SCRIPT_FILENAME']);
if (PHP_OS == 'WIN32' || PHP_OS == 'WINNT') {
$this->_error[] = '"' . $baseDir . '" should have the next rights: 0750 for folders, 0640 for files';
} else {
// Root
if (!$this->chmodRecursive($baseDir, 0750, 0640)) {
$this->_error[] = '"' . $baseDir . '" should have the next rights: 0750 for folders, 0640 for files';
}
}
// Delete a session if exists
$_SESSION = array();
foreach ($_COOKIE as $key => $value) {
setcookie($key, "", 1);
}
Zend_Session::writeClose();
}
示例13: initSession
public function initSession()
{
@ini_set('session.use_trans_sid', false);
@ini_set('session.cookie_httponly', true);
// lifetime must be bigger than admin and user auth timeout
$lifetime = (int) ini_get('session.gc_maxlifetime');
if ($lifetime < ($max = max($this->di->config->get('login_session_lifetime', 120) * 60, 7200))) {
@ini_set('session.gc_maxlifetime', $max);
}
$this->setSessionCookieDomain();
if ('db' == $this->getSessionStorageType()) {
Zend_Session::setSaveHandler(new Am_Session_SaveHandler($this->di->db));
}
if (defined('AM_SESSION_NAME') && AM_SESSION_NAME) {
Zend_Session::setOptions(array('name' => AM_SESSION_NAME));
}
try {
Zend_Session::start();
} catch (Zend_Session_Exception $e) {
// fix for Error #1009 - Internal error when disable shopping cart module
if (strpos($e->getMessage(), "Failed opening 'Am/ShoppingCart.php'") !== false) {
Zend_Session::destroy();
header("Location: " . $_SERVER['REQUEST_URI']);
exit;
}
// process other session issues
if (strpos($e->getMessage(), 'This session is not valid according to') === 0) {
$_SESSION = array();
Zend_Session::regenerateId();
Zend_Session::writeClose();
}
if (defined('AM_TEST') && AM_TEST) {
// just ignore error
} else {
throw $e;
}
}
// Workaround to fix bug: https://bugs.php.net/bug.php?id=68063
// Sometimes php starts session with empty session_id()
if (!defined('AM_TEST') && !Zend_Session::getId()) {
Zend_Session::destroy();
header("Location: " . $_SERVER['REQUEST_URI']);
exit;
}
//disabled as it brokes flash uploads !
//Zend_Session::registerValidator(new Zend_Session_Validator_HttpUserAgent);
$this->di->session = new Zend_Session_Namespace('amember');
}
示例14: redirectAndExit
/**
* exit(): Perform exit for redirector
*
* @return void
*/
public function redirectAndExit()
{
// Close session, if started
if (class_exists('Zend_Session', false) && Zend_Session::isStarted()) {
Zend_Session::writeClose();
} elseif (isset($_SESSION)) {
session_write_close();
}
$this->getResponse()->sendHeaders();
exit;
}
示例15: shutdown
function shutdown()
{
Zend_Session::writeClose(true);
}