Browse Source

makeObject redirects to the fedora/get URL instead of buffering through SOAP if user is not logged in (so it can be an anonymous request). The SOAP request is also done if connected over SSL.

pull/2/head
mroy 14 years ago
parent
commit
65712b26cd
  1. 10
      ObjectHelper.inc

10
ObjectHelper.inc

@ -34,11 +34,12 @@ class ObjectHelper {
/**
* Grabs a stream from fedora sets the mimetype and returns it. $dsID is the
* datastream id.
* datastream id. If $forceSoap is set, the function will always buffer the datastream from fedora. Otherwise, it will
* try and use a redirect if possible.
* @param $pid String
* @param $dsID String
*/
function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL) {
function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL, $forceSoap = FALSE) {
global $user;
module_load_include('inc','fedora_repository','ContentModel');
if ($pid == NULL || $dsID == NULL) {
@ -163,7 +164,12 @@ class ObjectHelper {
header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"');
}
if ( (isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) {
curl_exec($ch);
} else {
header('Location: '.$url);
}
}
curl_close($ch);
} else {

Loading…
Cancel
Save