public function getDataByIdAction()
 {
     // check for lock
     if (Element_Editlock::isLocked($this->_getParam("id"), "document")) {
         $this->_helper->json(array("editlock" => Element_Editlock::getByElement($this->_getParam("id"), "document")));
     }
     Element_Editlock::lock($this->_getParam("id"), "document");
     $page = Document_Page::getById($this->_getParam("id"));
     $page = $this->getLatestVersion($page);
     $page->getVersions();
     $page->getScheduledTasks();
     $page->idPath = Pimcore_Tool::getIdPathForElement($page);
     $page->userPermissions = $page->getUserPermissions();
     $page->setLocked($page->isLocked());
     // get depending redirects
     $redirectList = new Redirect_List();
     $redirectList->setCondition("target = ?", $page->getId());
     $page->redirects = $redirectList->load();
     // unset useless data
     $page->setElements(null);
     $page->childs = null;
     // cleanup properties
     $this->minimizeProperties($page);
     if ($page->isAllowed("view")) {
         $this->_helper->json($page);
     }
     $this->_helper->json(false);
 }
 public function getDataByIdAction()
 {
     // check for lock
     if (Element_Editlock::isLocked($this->_getParam("id"), "asset")) {
         $this->_helper->json(array("editlock" => Element_Editlock::getByElement($this->_getParam("id"), "asset")));
     }
     Element_Editlock::lock($this->_getParam("id"), "asset");
     $asset = Asset::getById(intval($this->_getParam("id")));
     if (!$asset instanceof Asset) {
         $this->_helper->json(array("success" => false, "message" => "asset doesn't exist"));
     }
     $asset->setProperties(Element_Service::minimizePropertiesForEditmode($asset->getProperties()));
     $asset->getVersions();
     $asset->getScheduledTasks();
     $asset->idPath = Pimcore_Tool::getIdPathForElement($asset);
     $asset->userPermissions = $asset->getUserPermissions();
     $asset->setLocked($asset->isLocked());
     if ($asset instanceof Asset_Text) {
         $asset->getData();
     }
     if ($asset instanceof Asset_Image) {
         $imageInfo = array();
         if ($asset->getWidth() && $asset->getHeight()) {
             $imageInfo["dimensions"] = array();
             $imageInfo["dimensions"]["width"] = $asset->getWidth();
             $imageInfo["dimensions"]["height"] = $asset->getHeight();
         }
         if (function_exists("exif_read_data") && is_file($asset->getFileSystemPath())) {
             $supportedTypes = array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM);
             if (in_array(exif_imagetype($asset->getFileSystemPath()), $supportedTypes)) {
                 $exif = @exif_read_data($asset->getFileSystemPath());
                 if (is_array($exif)) {
                     $imageInfo["exif"] = array();
                     foreach ($exif as $name => $value) {
                         if (is_string($value) && strlen($value) < 50 || is_numeric($value)) {
                             $imageInfo["exif"][$name] = $value;
                         }
                     }
                 }
             }
         }
         $asset->imageInfo = $imageInfo;
     }
     if ($asset->isAllowed("view")) {
         $this->_helper->json($asset);
     }
     $this->_helper->json(array("success" => false, "message" => "missing_permission"));
 }
Example #3
0
 public function getDataByIdAction()
 {
     // check for lock
     if (Element_Editlock::isLocked($this->_getParam("id"), "document")) {
         $this->_helper->json(array("editlock" => Element_Editlock::getByElement($this->_getParam("id"), "document")));
     }
     Element_Editlock::lock($this->_getParam("id"), "document");
     $link = Document_Link::getById($this->_getParam("id"));
     $link->getPermissionsForUser($this->getUser());
     $link->setObject(null);
     $link->idPath = Pimcore_Tool::getIdPathForElement($link);
     $this->minimizeProperties($link);
     if ($link->isAllowed("view")) {
         $this->_helper->json($link);
     }
     $this->_helper->json(false);
 }
 public function getDataByIdAction()
 {
     // check for lock
     if (Element_Editlock::isLocked($this->_getParam("id"), "document")) {
         $this->_helper->json(array("editlock" => Element_Editlock::getByElement($this->_getParam("id"), "document")));
     }
     Element_Editlock::lock($this->_getParam("id"), "document");
     $folder = Document_Folder::getById($this->_getParam("id"));
     $folder->idPath = Pimcore_Tool::getIdPathForElement($folder);
     $folder->userPermissions = $folder->getUserPermissions();
     $folder->setLocked($folder->isLocked());
     $this->minimizeProperties($folder);
     if ($folder->isAllowed("view")) {
         $this->_helper->json($folder);
     }
     $this->_helper->json(false);
 }
 public function getDataByIdAction()
 {
     // check for lock
     if (Element_Editlock::isLocked($this->_getParam("id"), "document")) {
         $this->_helper->json(array("editlock" => Element_Editlock::getByElement($this->_getParam("id"), "document")));
     }
     Element_Editlock::lock($this->_getParam("id"), "document");
     $snippet = Document_Snippet::getById($this->_getParam("id"));
     $modificationDate = $snippet->getModificationDate();
     $snippet = $this->getLatestVersion($snippet);
     $snippet->getVersions();
     $snippet->getScheduledTasks();
     $snippet->idPath = Pimcore_Tool::getIdPathForElement($snippet);
     $snippet->userPermissions = $snippet->getUserPermissions();
     $snippet->setLocked($snippet->isLocked());
     $this->minimizeProperties($snippet);
     // unset useless data
     $snippet->setElements(null);
     if ($snippet->isAllowed("view")) {
         $this->_helper->json($snippet);
     }
     $this->_helper->json(false);
 }
 public function getDataByIdAction()
 {
     // check for lock
     if (Element_Editlock::isLocked($this->_getParam("id"), "document")) {
         $this->_helper->json(array("editlock" => Element_Editlock::getByElement($this->_getParam("id"), "document")));
     }
     Element_Editlock::lock($this->_getParam("id"), "document");
     $email = Document_Email::getById($this->_getParam("id"));
     $email = $this->getLatestVersion($email);
     $email->getVersions();
     $email->idPath = Pimcore_Tool::getIdPathForElement($email);
     $email->userPermissions = $email->getUserPermissions();
     $email->setLocked($email->isLocked());
     // unset useless data
     $email->setElements(null);
     $email->childs = null;
     // cleanup properties
     $this->minimizeProperties($email);
     if ($email->isAllowed("view")) {
         $this->_helper->json($email);
     }
     $this->_helper->json(false);
 }
 public function getFolderAction()
 {
     // check for lock
     if (Element_Editlock::isLocked($this->_getParam("id"), "object")) {
         $this->_helper->json(array("editlock" => Element_Editlock::getByElement($this->_getParam("id"), "object")));
     }
     Element_Editlock::lock($this->_getParam("id"), "object");
     $object = Object_Abstract::getById(intval($this->_getParam("id")));
     if ($object->isAllowed("view")) {
         $objectData = array();
         $objectData["general"] = array();
         $objectData["idPath"] = Pimcore_Tool::getIdPathForElement($object);
         $allowedKeys = array("o_published", "o_key", "o_id", "o_type");
         foreach (get_object_vars($object) as $key => $value) {
             if (strstr($key, "o_") && in_array($key, $allowedKeys)) {
                 $objectData["general"][$key] = $value;
             }
         }
         $objectData["general"]["o_locked"] = $object->isLocked();
         $objectData["properties"] = Element_Service::minimizePropertiesForEditmode($object->getProperties());
         $objectData["userPermissions"] = $object->getUserPermissions();
         $objectData["classes"] = $object->getResource()->getClasses();
         $this->_helper->json($objectData);
     } else {
         Logger::debug("prevented getting folder id [ " . $object->getId() . " ] because of missing permissions");
         $this->_helper->json(array("success" => false, "message" => "missing_permission"));
     }
 }
Example #8
0
 public function lockElementAction()
 {
     Element_Editlock::lock($this->_getParam("id"), $this->_getParam("type"));
     exit;
 }