/** * Writes the block data into persistence (destroys previous and insert new) * * @param integer $pageID The page which contains the client space, DB ID * @param integer $clientSpaceID The client space which contains the row, DB ID * @param integer $rowID The row which contains the block, DB ID * @param integer $location The location we want to completly remove the block from * @param boolean $public The precision needed for USERSPACE location * @param array(mixed=>mixed) $data The data indexed by data type (value, file, alt_tag, ...), * @return boolean true on success, false on failure * @access public */ function writeToPersistence($pageID, $clientSpaceID, $rowID, $location, $public, $data) { if (!SensitiveIO::isInSet($location, CMS_resourceStatus::getAllLocations())) { $this->raiseError("writeToPersistence was given a bad location"); return false; } }
/** * Deletes the block from a location (public, archived, deleted, edited) * * @param integer $pageID The page which contains the client space, DB ID * @param integer $clientSpaceID The client space which contains the row, DB ID * @param integer $rowID The row which contains the block, DB ID * @param integer $location The location we want to completly remove the block from * @param boolean $public The precision needed for USERSPACE location * @return boolean true on success, false on failure * @access public */ function delFromLocation($pageID, $clientSpaceID, $rowID, $location, $public = false) { if (!SensitiveIO::isInSet($location, CMS_resourceStatus::getAllLocations())) { $this->raiseError("DelFromLocation was given a bad location"); return false; } $table = $this->_getDataTableName($location, $public); $sql = "\n\t\t\tdelete from\n\t\t\t\t" . $table . "\n\t\t\twhere\n\t\t\t\tpage='" . $pageID . "'\n\t\t\t\tand clientSpaceID='" . $clientSpaceID . "'\n\t\t\t\tand rowID='" . $rowID . "'\n\t\t\t\tand blockID='" . $this->_tagID . "'\n\t\t"; $q = new CMS_query($sql); return true; }
/** * Deletes the block from a location (public, archived, deleted, edited) * * @param integer $pageID The page which contains the client space, DB ID * @param integer $clientSpaceID The client space which contains the row, DB ID * @param integer $rowID The row which contains the block, DB ID * @param integer $location The location we want to completly remove the block from * @param boolean $public The precision needed for USERSPACE location * @param boolean $withfile : delete the attached file if any (default : false) * @return boolean true on success, false on failure * @access public */ function delFromLocation($pageID, $clientSpaceID, $rowID, $location, $public = false, $withfile = false) { if (!SensitiveIO::isInSet($location, CMS_resourceStatus::getAllLocations())) { $this->raiseError("DelFromLocation was given a bad location"); return false; } if ($withfile) { $data = $this->getRawData($pageID, $clientSpaceID, $rowID, $location, $public); $folder = $this->_getFolderName($location, $public); if ($data['file']) { //get folder for files if (file_exists(PATH_MODULES_FILES_STANDARD_FS . '/' . $folder . '/' . $data['file'])) { @unlink(PATH_MODULES_FILES_STANDARD_FS . '/' . $folder . '/' . $data['file']); } } if ($data['enlargedFile']) { //get folder for files if (file_exists(PATH_MODULES_FILES_STANDARD_FS . '/' . $folder . '/' . $data['enlargedFile'])) { @unlink(PATH_MODULES_FILES_STANDARD_FS . '/' . $folder . '/' . $data['enlargedFile']); } } if ($data['externalLink']) { $link = new CMS_href($data["externalLink"]); $file = $link->getFileLink(true, MOD_STANDARD_CODENAME, $folder, PATH_RELATIVETO_FILESYSTEM); if (file_exists($file)) { @unlink($file); } } } $table = $this->_getDataTableName($location, $public); $sql = "\n\t\t\tdelete from\n\t\t\t\t" . $table . "\n\t\t\twhere\n\t\t\t\tpage='" . $pageID . "'\n\t\t\t\tand clientSpaceID='" . $clientSpaceID . "'\n\t\t\t\tand rowID='" . $rowID . "'\n\t\t\t\tand blockID='" . $this->_tagID . "'\n\t\t"; $q = new CMS_query($sql); return true; }
/** * Deletes the block from a location (public, archived, deleted, edited) * * @param integer $pageID The page which contains the client space, DB ID * @param integer $clientSpaceID The client space which contains the row, DB ID * @param integer $rowID The row which contains the block, DB ID * @param integer $location The location we want to completly remove the block from * @param boolean $public The precision needed for USERSPACE location * @param boolean $withfile : delete the attached file if any (default : false) * @return boolean true on success, false on failure * @access public */ function delFromLocation($pageID, $clientSpaceID, $rowID, $location, $public = false, $withfile = false) { if (!SensitiveIO::isInSet($location, CMS_resourceStatus::getAllLocations())) { $this->raiseError("DelFromLocation was given a bad location"); return false; } if ($withfile) { $data = $this->getRawData($pageID, $clientSpaceID, $rowID, $location, $public); $link = new CMS_href($data["value"]); if ($link->getLinkType() == RESOURCE_LINK_TYPE_FILE) { //get file path $file = $link->getFileLink(true, MOD_STANDARD_CODENAME, $location, PATH_RELATIVETO_FILESYSTEM, true); if (file_exists($file)) { @unlink($file); } } } $table = $this->_getDataTableName($location, $public); $sql = "\n\t\t\tdelete from\n\t\t\t\t" . $table . "\n\t\t\twhere\n\t\t\t\tpage='" . $pageID . "'\n\t\t\t\tand clientSpaceID='" . $clientSpaceID . "'\n\t\t\t\tand rowID='" . $rowID . "'\n\t\t\t\tand blockID='" . $this->_tagID . "'\n\t\t"; $q = new CMS_query($sql); return true; }