예제 #1
0
            $ownerNodeAssignments = $owner->attribute('assigned_nodes');
            $nodeAssignments = array_merge($nodeAssignments, $ownerNodeAssignments);
        }
    }
}
// If exists location that current user has access to and location is visible.
$canAccess = false;
$isContentDraft = $contentObject->attribute('status') == eZContentObject::STATUS_DRAFT;
foreach ($nodeAssignments as $nodeAssignment) {
    if (eZContentObjectTreeNode::showInvisibleNodes() || !$nodeAssignment->attribute('is_invisible') and $nodeAssignment->canRead()) {
        $canAccess = true;
        break;
    }
}
if (!$canAccess && !$isContentDraft) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
// If $version is not current version (published)
// we should check permission versionRead for the $version.
if ($version != $currentVersion || $isContentDraft) {
    $versionObj = eZContentObjectVersion::fetchVersion($version, $contentObjectID);
    if (is_object($versionObj) and !$versionObj->canVersionRead()) {
        return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
    }
}
$fileHandler = eZBinaryFileHandler::instance();
$result = $fileHandler->handleDownload($contentObject, $contentObjectAttribute, eZBinaryFileHandler::TYPE_FILE);
if ($result == eZBinaryFileHandler::RESULT_UNAVAILABLE) {
    eZDebug::writeError("The specified file could not be found.");
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
 function fileHandler()
 {
     return eZBinaryFileHandler::instance();
 }