本文整理汇总了PHP中Zend_Session::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session::getId方法的具体用法?PHP Zend_Session::getId怎么用?PHP Zend_Session::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session
的用法示例。
在下文中一共展示了Zend_Session::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processSubmit
/**
* Store submitted files to storeFolder
*/
function processSubmit($fieldName, $is_admin = true)
{
if (empty($_FILES[$fieldName])) {
return false;
}
if (is_array($_FILES[$fieldName]['tmp_name'])) {
$keys = array_keys($_FILES[$fieldName]['tmp_name']);
} else {
$keys = array(null);
}
foreach ($keys as $k) {
$upload[$k] = $this->getDi()->uploadRecord;
$upload[$k]->prefix = $this->prefix;
$upload[$k]->admin_id = $is_admin ? Am_Di::getInstance()->authAdmin->getUserId() : null;
$upload[$k]->user_id = $is_admin ? null : Am_Di::getInstance()->auth->getUserId();
$upload[$k]->session_id = !$is_admin && !Am_Di::getInstance()->auth->getUserId() ? Zend_Session::getId() : null;
$upload[$k]->setFrom_FILES($_FILES[$fieldName], $k);
}
foreach ($upload as $k => $file) {
if ($f = $this->checkFileAndMove($file)) {
$this->files[] = $f;
if (!$is_admin && !Am_Di::getInstance()->auth->getUserId()) {
if (!isset($this->getDi()->session->uploadNeedBind)) {
$this->getDi()->session->uploadNeedBind = array();
}
$this->getDi()->session->uploadNeedBind[] = $f->pk();
}
}
}
return $this;
}
示例2: _getMainSection
protected function _getMainSection()
{
try {
$args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
$query = array(Sitengine_Env::PARAM_SESSIONID => Zend_Session::getId());
$route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS_POSTS_FILES_UPLOAD);
$submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
$submitUri .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
require_once $this->_controller->getEnv()->getContribDir() . '/FlexUpload/class.flexupload.inc.php';
$flex = new FlexUpload($submitUri);
$flex->setWidth('100%');
#$flex->setHeight('100%');
$flex->setMaxFiles(20);
$flex->setMaxFileSize(15 * 1024 * 1024);
$type = $this->_controller->getEntity()->getAncestorType();
if ($type == Sitengine_Blog_Posts_Table::TYPE_GALLERY) {
$types = '*.gif;*.jpg;*.jpeg';
} else {
$types = '*.zip;*.mp3;*.wav;*.gif;*.jpg;*.jpeg;*.pdf;*.doc;*.xls';
}
$flex->setFileExtensions($types);
$flex->setPathToSWF($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/');
$flex->setPathToSWFObject($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/js/');
$flex->setLocale($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/locale/en.xml');
return array('flex' => $flex->getHTML());
} catch (Exception $exception) {
require_once 'Sitengine/Blog/Frontend/Blogs/Posts/Files/Exception.php';
throw new Sitengine_Blog_Frontend_Blogs_Posts_Files_Exception('form page error', $exception);
}
}
示例3: log
public function log($entityId, $entityTable, $message = null, $preChangedData)
{
/*
fields in mst_user_log table
----------------------------
id
user_id
entity_table
entity_id
module_name
controller_name
action_name
timestamp
message
variables
session_id
ip
*/
$auth = Zend_Auth::getInstance();
$userid = 0;
//System user
if ($auth->hasIdentity()) {
$authArray = $auth->getIdentity();
$userid = $authArray['user_id'];
}
$module_name = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
$controller_name = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
$action_name = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
$session_id = Zend_Session::getId();
$ip = Zend_Controller_Front::getInstance()->getRequest()->getServer('REMOTE_ADDR');
$table = new Application_Model_DbTable_MstUserLog();
$data = array('user_id' => $userid, 'entity_table' => $entityTable, 'entity_id' => $entityId, 'module_name' => $module_name, 'controller_name' => $controller_name, 'action_name' => $action_name, 'timestamp' => date('Y-m-d H:i:s'), 'message' => $message, 'variables' => $preChangedData, 'session_id' => $session_id, 'ip' => $ip);
$table->insert($data);
}
示例4: 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;
}
示例5: _getMainSection
protected function _getMainSection()
{
try {
$args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
$query = array(Sitengine_Env::PARAM_SESSIONID => Zend_Session::getId());
$route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS_UPLOAD);
$submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
$submitUri .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
#print $submitUri;
require_once $this->_controller->getEnv()->getContribDir() . '/FlexUpload/class.flexupload.inc.php';
$flex = new FlexUpload($submitUri);
$flex->setWidth('100%');
#$flex->setHeight('100%');
$flex->setMaxFiles(20);
$flex->setMaxFileSize(100 * 1024 * 1024);
$flex->setFileExtensions('*.zip;*.mp3;*.wav;*.gif;*.jpg;*.jpeg;*.pdf;*.doc;*.xls');
$flex->setPathToSWF($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/');
$flex->setPathToSWFObject($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/js/');
$flex->setLocale($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/locale/en.xml');
return array('flex' => $flex->getHTML());
} catch (Exception $exception) {
require_once 'Sitengine/Newsletter/Backend/Campaigns/Attachments/Exception.php';
throw new Sitengine_Newsletter_Backend_Campaigns_Attachments_Exception('form page error', $exception);
}
}
示例6: dispatchLoopStartup
/**
* Route shutdown hook -- Check for router exceptions
*
* @param Zend_Controller_Request_Abstract $request
*/
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
try {
// Avoid error override! :S
if (count($this->getResponse()->getException())) {
return;
}
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()) {
$this->_forceLogout($request, "No session");
return;
}
$sessionId = Zend_Session::getId();
$sessMapper = Application\Model\Mapper\SessionMapper::getInstance();
$session = $sessMapper->findOneById($sessionId);
if (!$session) {
return;
}
if (isset($session['logout'])) {
$this->_forceLogout($request, isset($session['logout']['message']) ? $session['logout']['message'] : "External logout", isset($session['logout']['code']) ? $session['logout']['code'] : PermissionCodes::AUTH_ANOTHER_SESSION_STARTED);
return;
}
} catch (Exception $exc) {
\App::log()->err("MESSAGE BROADCAST: " . $exc->getMessage());
$this->_forceLogout($request, "Unexpected fatal error: " . $exc->getMessage(), 500);
return;
}
}
示例7: init
public function init()
{
$this->bootstrap = $this->getInvokeArg('bootstrap');
$this->options = $this->bootstrap->getOptions();
$this->_host = $this->_request->getServer('HTTP_HOST');
if (Zend_Session::sessionExists()) {
if (!$this->session) {
$singleton = !empty($this->options['unittest']) ? false : true;
$this->session = new Zend_Session_Namespace(self::SESSION_NAMESPACE, $singleton);
}
$this->_sessionId = Zend_Session::getId();
do {
// 登陆信息验证
$names = $this->options['cookies'];
if (!isset($this->session->auth) || !$this->_request->getCookie($names['username'])) {
break;
}
//var_dump($this->_request->getCookie($names['email']));exit();
if ($this->session->auth['username'] != $this->_request->getCookie($names['username'])) {
break;
}
$this->session->auth['lasttime'] = time();
$this->_user = Tudu_User::getInstance();
$this->_user->init($this->session->auth);
} while (false);
} else {
$authId = $this->_request->getCookie($this->options['cookies']['auth']);
if (!empty($authId)) {
$referer = PROTOCOL . '//' . $this->_request->getServer('HTTP_HOST') . '/frame';
return $this->_redirect($this->options['sites']['www'] . '/login/auto?referer=' . urlencode($referer));
}
}
}
示例8: calculationSettingsChangeAction
public function calculationSettingsChangeAction()
{
$this->getHelper('viewRenderer')->setNoRender();
$request = $this->getRequest();
if ($request->isPost()) {
$post = $request->getPost();
if (!isset($post['changeSet']) || empty($post['changeSet'])) {
$this->ajaxException("Nieprawidłowa wartość parametrów");
return;
} else {
$data = Zend_Json::decode($post['changeSet']);
for ($i = 0; $i < $data['formsCount']; $i++) {
$form = $data[$i];
if (count($form['changes']) == 0) {
Logic_FormsTracker::invalidate(Zend_Session::getId() . '_' . $form['trackingName'], Zend_Auth::getInstance()->getIdentity()->id);
} else {
Logic_FormsTracker::store(Zend_Session::getId(), $form['trackingName'], $form['changes']);
}
}
echo Zend_Json::encode(array('result' => 'success', 'message' => 'ok'));
}
} else {
$this->ajaxException("Bad request");
return;
}
}
示例9: loginAction
public function loginAction()
{
//$this->_helper->layout->disableLayout();
$this->_helper->layout()->setLayout('layout-front');
$r = $this->getRequest();
//$returnTo = $r->getParam('returnTo');
//$this->view->returnTo = urlencode($returnTo);
if ($r->isPost()) {
$returnTo = $r->getParam('returnTo');
$this->view->returnTo = $returnTo;
Zend_Session::start();
$username = $r->getParam('username');
$password = $r->getParam('password');
$authAdapterFactory = new Kutu_Auth_Adapter_Factory();
$authAdapter = $authAdapterFactory->getAdapter();
$authAdapter->setIdentity($username)->setCredential($password);
$auth = Zend_Auth::getInstance();
$authResult = $auth->authenticate($authAdapter);
if ($authResult->isValid()) {
Zend_Session::regenerateId();
// success : store database row to auth's storage
$data = $authAdapter->getResultRowObject();
$auth->getStorage()->write($data);
if (strpos($returnTo, '?')) {
$sAddition = '&';
} else {
$sAddition = '?';
}
header("location: " . $returnTo . $sAddition . "PHPSESSID=" . Zend_Session::getId());
} else {
if ($authResult->getCode() != -51) {
// failure : clear database row from session
Zend_Auth::getInstance()->clearIdentity();
}
$this->view->errorMessage = "Login GAGAL";
}
} else {
Zend_Session::start();
$returnTo = $r->getParam('returnTo');
if (!empty($returnTo)) {
$returnTo = urldecode($returnTo);
$this->view->returnTo = $returnTo;
} else {
$returnTo = KUTU_ROOT_URL . '/identity/account';
$this->view->returnTo = $returnTo;
}
//check sudah login belum
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
//echo "punya identitas";
if (strpos($returnTo, '?')) {
$sAddition = '&';
} else {
$sAddition = '?';
}
header("location: " . $returnTo . $sAddition . "PHPSESSID=" . Zend_Session::getId());
}
}
}
示例10: indexAction
public function indexAction()
{
$registry = Zend_Registry::getInstance();
$auth = Zend_Auth::getInstance();
$config = $registry->get("config");
$sessionConfig = $config['resources']['session'];
Ml_Model_AntiAttack::loadRules();
$credential = Ml_Model_Credential::getInstance();
$logger = Ml_Model_Logger::getInstance();
if ($auth->hasIdentity()) {
return $this->_forward("goback");
}
$request = $this->getRequest();
$form = $credential->loginForm();
if (Ml_Model_AntiAttack::ensureHuman()) {
$ensureHuman = true;
} else {
$ensureHuman = false;
}
if ($request->isPost()) {
ignore_user_abort(true);
//A way to sign in only if captcha is right. This is a workaround to
//signout if the captcha is wrong.
//
//I've decided to put the sign in code in the validator itself,
//but couldn't find a way to make the password validator
//load after the captcha one (but to let it come first in code,
//and that's ugly on the screen) and get a result if the
//validation worked. Notice that it is only useful when
//the captcha is required.
if ($form->isValid($request->getPost())) {
//@see below
$session = Ml_Model_Session::getInstance();
//rememberMe and ForgetMe already regenerates the ID
if ($form->getElement("remember_me")->isChecked()) {
Zend_Session::rememberMe($sessionConfig['cookie_lifetime']);
} else {
Zend_Session::ForgetMe();
}
$session->associate($auth->getIdentity(), Zend_Session::getId());
$logger->log(array("action" => "login", "username" => $form->getValue("username")));
$this->_forward("goback");
} else {
//@see above
if ($auth->hasIdentity()) {
$auth->clearIdentity();
}
$logger->log(array("action" => "login_denied", "username" => $form->getValue("username")));
$this->view->errorlogin = true;
}
//@end of workaround
}
$challenge = $form->getElement("challenge");
//don't show missing value in the first time that asks for the captcha
if (!$ensureHuman && is_object($challenge)) {
$challenge->setErrorMessages(array("missingValue" => ''));
}
$this->view->loginform = $form;
}
示例11: indexAction
public function indexAction()
{
if ($this->_user->initPassword) {
$this->jump('/frame/initpwd');
}
if (!isset($this->session->tips)) {
$this->session->tips = $this->_loadTips();
}
$labels = $this->getLabels(null);
if (!count($labels)) {
// 防止新用户点入左导航为空
$daoLabel = $this->getDao('Dao_Td_Tudu_Label');
foreach ($this->options['tudu']['label'] as $alias => $id) {
if (!isset($labels[$alias])) {
$daoLabel->createLabel(array('uniqueid' => $this->_user->uniqueId, 'labelalias' => $alias, 'labelid' => $id, 'isshow' => isset($this->_labelDefaultSetting[$alias]['isshow']) ? $this->_labelDefaultSetting[$alias]['isshow'] : 1, 'issystem' => true, 'ordernum' => $this->_labelDefaultSetting[$alias]['ordernum']));
$daoLabel->calculateLabel($this->_user->uniqueId, $id);
$reLoad = true;
}
}
$labels = $this->getLabels(null);
}
$mailboxes = array();
$access = array('skin' => $this->_user->getAccess()->isAllowed(Tudu_Access::PERM_CUSTOM_SKIN), 'flow' => $this->_user->getAccess()->isAllowed(Tudu_Access::PERM_CREATE_FLOW));
// 有权限创建工作流,但仍需判断是否为版主
if ($access['flow']) {
$boards = $this->getBoards(true, true);
// 若用户均不是某一板块的负责人或分区负责人,则无权限新建工作流
if (empty($boards)) {
$access['flow'] = false;
}
}
// 没有权限创建工作流,则读取该用户是否有使用的工作流
if (!$access['flow']) {
$flows = $this->_getFlows();
if (!empty($flows)) {
$access['flow'] = true;
}
}
$daoBoard = $this->getDao('Dao_Td_Board_Board');
$boards = $daoBoard->getAttentionBoards($this->_user->orgId, $this->_user->uniqueId);
$daoEmail = $this->getMdDao('Dao_Md_User_Email');
$mailBoxes = $daoEmail->getEmails(array('orgid' => $this->_user->orgId, 'userid' => $this->_user->userId), null, array('ordernum' => 'DESC'));
$upload = $this->options['upload'];
$upload['cgi']['upload'] .= '?' . session_name() . '=' . Zend_Session::getId() . '&email=' . $this->_user->address;
$daoOrg = $this->getMdDao('Dao_Md_Org_Org');
$org = $daoOrg->getOrg(array('orgid' => $this->_user->orgId));
$this->view->mailboxes = $mailBoxes->toArray();
$this->view->upload = $upload;
$this->view->im = $this->options['im'];
$this->view->access = $access;
$this->view->boards = $boards;
$this->view->labels = $labels;
$this->view->user = $this->_user->toArray();
$this->view->sid = Zend_Session::getId();
$this->view->LANG = $this->lang;
$this->view->org = $org->toArray();
$this->view->checklog = !empty($this->session->auth['loginlogid']);
$this->view->registFunction('format_label', array($this, 'formatLabels'));
}
示例12: kloginAction
/**
* Login user
*
*/
public function kloginAction()
{
$this->_helper->getHelper('viewRenderer')->setNoRender();
$this->_helper->getHelper('layout')->disableLayout();
$response = array();
$request = $this->getRequest();
/**
* Redirect to dashboard if user has logged in already
*/
if ($request->isPost()) {
$username = $request->getPost('u');
$password = $request->getPost('p');
$remember = $request->getPost('s');
$authMan = new Pandamp_Auth_Manager($username, $password);
$authResult = $authMan->authenticate();
$zendAuth = Zend_Auth::getInstance();
if ($zendAuth->hasIdentity()) {
if ($authResult->isValid()) {
$returnUrl = base64_decode($request->getPost('r'));
if (!empty($returnUrl)) {
if (strpos($returnUrl, '?')) {
$sAddition = '&';
} else {
$sAddition = '?';
}
$data = array('success' => true, 'msg' => 'Logging in', 'message' => "{$returnUrl}" . $sAddition . "PHPSESSID=" . Zend_Session::getId());
Pandamp_Lib_Formater::writeLog();
// to help thwart session fixation/hijacking
// @modifiedDate 2014-09-15 17:01
if (isset($remember) && $remember == 'yes') {
/*$hol = new Pandamp_Core_Hol_Auth();
$hol->user = $username;
$hol->user_pw = $password;
$hol->save_login = $remember;
$hol->login_saver();*/
// remember the session for 604800s = 7 days
Zend_Session::rememberMe(604800);
} else {
// do not remember the session
// Zend_Session::forgetMe();
}
$this->_helper->FlashMessenger('Successful authentication');
}
} else {
if ($authResult->getCode() != -51) {
Zend_Auth::getInstance()->clearIdentity();
}
$messages = $authResult->getMessages();
$data = array('error' => $messages[0], 'success' => false);
}
} else {
$messages = $authResult->getMessages();
$data = array('error' => $messages[0], 'failure' => true);
}
}
$this->getResponse()->setBody(Zend_Json::encode($data));
}
示例13: __construct
public function __construct()
{
$this->front = Zend_Controller_Front::getInstance();
$this->view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
$this->limit = (int) Zend_Registry::get('config')->get('sidebar_max_users');
$this->model = new LobbyModel();
$this->translator = Zend_Registry::get('Zend_Translate');
$this->uid = Zend_Auth::getInstance()->hasIdentity() ? Zend_Session::getId() : md5('APPLICATION_PATH');
}
示例14: start
/**
* Inicía o log de Relatório
*
* @param string $mapperView
* @param string $title
* @return \Log_Context_Relatorio
*/
public function start($mapperView, $title)
{
$this->_session = Zend_Session::getId();
if ($this->_session) {
$idUsuario = Zend_Auth::getInstance()->getStorage()->read()->getId();
$this->setArquivo($mapperView)->setTitulo($title)->setSessao($this->_session)->setIdUsuario($idUsuario)->setDhIniExec(ZendT_Type_Date::nowDateTime())->setImpresso('N')->insert();
}
return $this;
}
示例15: getVisitor
/**
* Return visitor row
*
* @return Zend_Db_Table_Row_Abstract
*/
public function getVisitor()
{
if (!isset(Axis::session()->visitorId) || !($row = $this->find(Axis::session()->visitorId)->current())) {
$row = $this->createRow(array('session_id' => Zend_Session::getId(), 'customer_id' => Axis::getCustomerId() ? Axis::getCustomerId() : new Zend_Db_Expr('NULL')));
$row->save();
Axis::session()->visitorId = $row->id;
//unset only on logout
}
return $row;
}