get() public static méthode

public static get ( string $namespace = "pimcore_admin", boolean $readOnly = false ) : Zend_Session_Namespace
$namespace string
$readOnly boolean
Résultat Zend_Session_Namespace
 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;
     }
 }
 public function init()
 {
     parent::init();
     $this->checkPermission("backup");
     @ini_set("memory_limit", "-1");
     $this->session = \Pimcore\Tool\Session::get("pimcore_backup");
 }
 /**
  * Get CoreShop Session
  *
  * @return \stdClass
  */
 public static function getSession()
 {
     return Session::get('CoreShop');
 }
 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));
 }
Exemple #5
0
 /**
  *
  */
 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));
 }
Exemple #6
0
 * 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="******"&db=" . $conf->dbname);
    exit;
}
// adminer plugin
function adminer_object()
 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));
 }
 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));
 }