本文整理汇总了PHP中Pimcore\Tool\Session::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::get方法的具体用法?PHP Session::get怎么用?PHP Session::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Tool\Session
的用法示例。
在下文中一共展示了Session::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
// PHP 7.0 compatibility of adminer (throws some warnings)
ini_set("display_errors", 0);
// only for admins
$this->checkPermission("adminer");
// call this to keep the session 'open' so that Adminer can write to it
$session = \Pimcore\Tool\Session::get();
$this->adminerHome = PIMCORE_DOCUMENT_ROOT . '/vendor/vrana/adminer/';
// proxy for resources
$path = $this->getRequest()->getPathInfo();
$path = str_replace("/admin/external_adminer/", "", $path);
if (preg_match("@\\.(css|js|ico|png|jpg|gif)\$@", $path)) {
$filePath = $this->adminerHome . "/" . $path;
// it seems that css files need the right content-type (Chrome)
if (preg_match("@.css\$@", $path)) {
header("Content-Type: text/css");
} elseif (preg_match("@.js\$@", $path)) {
header("Content-Type: text/javascript");
}
if (file_exists($filePath)) {
echo file_get_contents($filePath);
if (preg_match("@default.css\$@", $path)) {
// append custom styles, because in Adminer everything is hardcoded
echo file_get_contents($this->adminerHome . "designs/konya/adminer.css");
echo file_get_contents(PIMCORE_DOCUMENT_ROOT . "/pimcore/static6/css/adminer-modifications.css");
}
}
exit;
}
}
示例2: init
public function init()
{
parent::init();
$this->checkPermission("backup");
@ini_set("memory_limit", "-1");
$this->session = \Pimcore\Tool\Session::get("pimcore_backup");
}
示例3: getSession
/**
* Get CoreShop Session
*
* @return \stdClass
*/
public static function getSession()
{
return Session::get('CoreShop');
}
示例4: copyAction
public function copyAction()
{
$success = false;
$message = "";
$sourceId = intval($this->getParam("sourceId"));
$source = Object::getById($sourceId);
$session = Tool\Session::get("pimcore_copy");
$targetId = intval($this->getParam("targetId"));
if ($this->getParam("targetParentId")) {
$sourceParent = Object::getById($this->getParam("sourceParentId"));
// this is because the key can get the prefix "_copy" if the target does already exists
if ($session->{$this->getParam("transactionId")}["parentId"]) {
$targetParent = Object::getById($session->{$this->getParam("transactionId")}["parentId"]);
} else {
$targetParent = Object::getById($this->getParam("targetParentId"));
}
$targetPath = preg_replace("@^" . $sourceParent->getFullPath() . "@", $targetParent . "/", $source->getPath());
$target = Object::getByPath($targetPath);
} else {
$target = Object::getById($targetId);
}
if ($target->isAllowed("create")) {
$source = Object::getById($sourceId);
if ($source != null) {
try {
if ($this->getParam("type") == "child") {
$newObject = $this->_objectService->copyAsChild($target, $source);
$session->{$this->getParam("transactionId")}["idMapping"][(int) $source->getId()] = (int) $newObject->getId();
// this is because the key can get the prefix "_copy" if the target does already exists
if ($this->getParam("saveParentId")) {
$session->{$this->getParam("transactionId")}["parentId"] = $newObject->getId();
Tool\Session::writeClose();
}
} elseif ($this->getParam("type") == "replace") {
$this->_objectService->copyContents($target, $source);
}
$success = true;
} catch (\Exception $e) {
\Logger::err($e);
$success = false;
$message = $e->getMessage() . " in object " . $source->getFullPath() . " [id: " . $source->getId() . "]";
}
} else {
\Logger::error("could not execute copy/paste, source object with id [ {$sourceId} ] not found");
$this->_helper->json(array("success" => false, "message" => "source object not found"));
}
} else {
\Logger::error("could not execute copy/paste because of missing permissions on target [ " . $targetId . " ]");
$this->_helper->json(array("error" => false, "message" => "missing_permission"));
}
$this->_helper->json(array("success" => $success, "message" => $message));
}
示例5: saveToSessionAction
/**
*
*/
public function saveToSessionAction()
{
if ($this->getParam("id")) {
$key = "document_" . $this->getParam("id");
$session = Session::get("pimcore_documents");
if (!($document = $session->{$key})) {
$document = Model\Document::getById($this->getParam("id"));
$document = $this->getLatestVersion($document);
}
// set _fulldump otherwise the properties will be removed because of the session-serialize
$document->_fulldump = true;
$this->setValuesToDocument($document);
$session->{$key} = $document;
Session::writeClose();
}
$this->_helper->json(array("success" => true));
}
示例6: error_reporting
* Pimcore
*
* This source file is subject to the GNU General Public License version 3 (GPLv3)
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code. dsf sdaf asdf asdf
*
* @copyright Copyright (c) 2009-2015 pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GNU General Public License version 3 (GPLv3)
*/
// adminer isn'T fully php 5.4 compatible
error_reporting(E_ERROR);
$workingDirectory = getcwd();
include "../../../cli/startup.php";
chdir($workingDirectory);
// start global session an keep it open (this is needed for the CSRF protections from adminer)
\Pimcore\Tool\Session::get();
// only for logged in users
$user = \Pimcore\Tool\Authentication::authenticateSession();
if (!$user instanceof User) {
die("Authentication failed!");
}
if (!$user->isAllowed("database")) {
die("Permission denied!");
}
$conf = \Pimcore\Config::getSystemConfig()->database->params;
if (empty($_SERVER["QUERY_STRING"])) {
header("Location: /pimcore/modules/3rdparty/adminer/index.php?username=" . $conf->username . "&db=" . $conf->dbname);
exit;
}
// adminer plugin
function adminer_object()
示例7: copyAction
public function copyAction()
{
$success = false;
$sourceId = intval($this->getParam("sourceId"));
$source = Asset::getById($sourceId);
$session = Tool\Session::get("pimcore_copy");
$targetId = intval($this->getParam("targetId"));
if ($this->getParam("targetParentId")) {
$sourceParent = Asset::getById($this->getParam("sourceParentId"));
// this is because the key can get the prefix "_copy" if the target does already exists
if ($session->{$this->getParam("transactionId")}["parentId"]) {
$targetParent = Asset::getById($session->{$this->getParam("transactionId")}["parentId"]);
} else {
$targetParent = Asset::getById($this->getParam("targetParentId"));
}
$targetPath = preg_replace("@^" . $sourceParent->getFullPath() . "@", $targetParent . "/", $source->getPath());
$target = Asset::getByPath($targetPath);
} else {
$target = Asset::getById($targetId);
}
if ($target->isAllowed("create")) {
$source = Asset::getById($sourceId);
if ($source != null) {
if ($this->getParam("type") == "child") {
$newAsset = $this->_assetService->copyAsChild($target, $source);
// this is because the key can get the prefix "_copy" if the target does already exists
if ($this->getParam("saveParentId")) {
$session->{$this->getParam("transactionId")}["parentId"] = $newAsset->getId();
}
} else {
if ($this->getParam("type") == "replace") {
$this->_assetService->copyContents($target, $source);
}
}
$success = true;
} else {
\Logger::debug("prevended copy/paste because asset with same path+key already exists in this location");
}
} else {
\Logger::error("could not execute copy/paste because of missing permissions on target [ " . $targetId . " ]");
$this->_helper->json(array("error" => false, "message" => "missing_permission"));
}
Tool\Session::writeClose();
$this->_helper->json(array("success" => $success));
}
示例8: copyAction
public function copyAction()
{
$success = false;
$sourceId = intval($this->getParam("sourceId"));
$source = Document::getById($sourceId);
$session = Session::get("pimcore_copy");
$targetId = intval($this->getParam("targetId"));
if ($this->getParam("targetParentId")) {
$sourceParent = Document::getById($this->getParam("sourceParentId"));
// this is because the key can get the prefix "_copy" if the target does already exists
if ($session->{$this->getParam("transactionId")}["parentId"]) {
$targetParent = Document::getById($session->{$this->getParam("transactionId")}["parentId"]);
} else {
$targetParent = Document::getById($this->getParam("targetParentId"));
}
$targetPath = preg_replace("@^" . $sourceParent->getFullPath() . "@", $targetParent . "/", $source->getPath());
$target = Document::getByPath($targetPath);
} else {
$target = Document::getById($targetId);
}
if ($target instanceof Document) {
if ($target->isAllowed("create")) {
if ($source != null) {
if ($this->getParam("type") == "child") {
$enableInheritance = $this->getParam("enableInheritance") == "true" ? true : false;
$resetIndex = $this->getParam("resetIndex") == "true" ? true : false;
$newDocument = $this->_documentService->copyAsChild($target, $source, $enableInheritance, $resetIndex);
$session->{$this->getParam("transactionId")}["idMapping"][(int) $source->getId()] = (int) $newDocument->getId();
// this is because the key can get the prefix "_copy" if the target does already exists
if ($this->getParam("saveParentId")) {
$session->{$this->getParam("transactionId")}["parentId"] = $newDocument->getId();
}
Session::writeClose();
} elseif ($this->getParam("type") == "replace") {
$this->_documentService->copyContents($target, $source);
}
$success = true;
} else {
\Logger::error("prevended copy/paste because document with same path+key already exists in this location");
}
} else {
\Logger::error("could not execute copy/paste because of missing permissions on target [ " . $targetId . " ]");
$this->_helper->json(array("success" => false, "message" => "missing_permission"));
}
}
$this->_helper->json(array("success" => $success));
}