From e8a450e3469e49d61cf82ceb53b4a47ce1d95153 Mon Sep 17 00:00:00 2001 From: Kris Bulman Date: Thu, 13 Dec 2012 10:53:37 -0400 Subject: [PATCH 1/5] catch bad dc.. or qdc --- includes/DublinCore.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/DublinCore.inc b/includes/DublinCore.inc index 7c2b094c..7dc8d973 100644 --- a/includes/DublinCore.inc +++ b/includes/DublinCore.inc @@ -39,7 +39,7 @@ class DublinCore { * @param string $dc_xml */ function DublinCore($dc_xml = NULL) { - if (!empty($dc_string)) { + if (!empty($dc_xml)) { $this->dc = self::import_from_xml_string($dc_xml); } } @@ -145,8 +145,11 @@ class DublinCore { if ($dc_doc->loadXML($dc_xml)) { $oai_dc = $dc_doc->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/', '*'); $new_dc = new DublinCore(); + foreach ($oai_dc as $child) { - array_push($new_dc->dc[$child->nodeName], $child->nodeValue); + if(isset($new_dc->dc[$child->nodeName])) { + array_push($new_dc->dc[$child->nodeName], $child->nodeValue); + } } return $new_dc; } From c3519035bfe091d8cd5756fae4c993e9620ecd12 Mon Sep 17 00:00:00 2001 From: David Wilcox Date: Mon, 17 Dec 2012 13:35:33 -0400 Subject: [PATCH 2/5] Changed object management permissions Changed 'FEDORA_MODIFY_STATE' to 'FEDORA_MANAGE_PROPERTIES' and fixed 'View object management tabs' permission to correctly depend on 'FEDORA_MANAGE'. --- islandora.module | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/islandora.module b/islandora.module index 5e6fd7cf..f8673546 100644 --- a/islandora.module +++ b/islandora.module @@ -31,7 +31,7 @@ define('FEDORA_METADATA_EDIT', 'edit fedora metadata'); define('FEDORA_ADD_DS', 'add fedora datastreams'); define('FEDORA_INGEST', 'ingest fedora objects'); define('FEDORA_PURGE', 'delete fedora objects and datastreams'); -define('FEDORA_MODIFY_STATE', 'modify fedora state'); +define('FEDORA_MANAGE_PROPERTIES', 'manage object properties'); define('FEDORA_MANAGE', 'manage fedora items'); // Hooks @@ -108,7 +108,7 @@ function islandora_menu() { 'page arguments' => array(2), 'type' => MENU_LOCAL_TASK, 'access callback' => 'islandora_object_access_callback', - 'access arguments' => array(FEDORA_MODIFY_STATE, 2), + 'access arguments' => array(FEDORA_MANAGE, 2), ); $items['islandora/object/%islandora_object/manage/datastreams'] = array( 'title' => 'Datastreams', @@ -122,7 +122,7 @@ function islandora_menu() { 'page arguments' => array('islandora_object_properties_form', 2), 'type' => MENU_LOCAL_TASK, 'access callback' => 'islandora_object_access_callback', - 'access arguments' => array(FEDORA_MODIFY_STATE, 2), + 'access arguments' => array(FEDORA_MANAGE_PROPERTIES, 2), 'weight' => -5, ); $items['islandora/object/%islandora_object/delete'] = array( @@ -268,9 +268,9 @@ function islandora_permission() { 'title' => t('Permanently remove objects from the repository'), 'description' => t('Permanently remove objects from the repository.') ), - FEDORA_MODIFY_STATE => array( - 'title' => t('Change repository object states'), - 'description' => t('Change the state of objects in the repository (e.g. from Active to Inactive).') + FEDORA_MANAGE_PROPERTIES => array( + 'title' => t('Manage object properties'), + 'description' => t('Modify object labels, owner IDs, and states.') ), FEDORA_MANAGE => array( 'title' => t('View object management tabs'), From cf63033f796c947c21d2553e6e95ac6d5e1b3785 Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Thu, 20 Dec 2012 13:28:49 -0400 Subject: [PATCH 3/5] Avoid creating a temp file --- includes/datastream.inc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/includes/datastream.inc b/includes/datastream.inc index c6cb2780..74517d7c 100644 --- a/includes/datastream.inc +++ b/includes/datastream.inc @@ -41,10 +41,7 @@ function islandora_view_datastream(FedoraDatastream $datastream, $download = FAL } drupal_page_is_cacheable(FALSE); // Try not to load the file into PHP memory! - $file = drupal_tempnam(file_directory_temp(), 'islandora'); - $datastream->getContent($file); - readfile($file); - drupal_unlink($file); + $datastream->getContent('php://output'); exit(); } From 252cc44a72b6be8b293cdbd62d7ffdabe1ed9176 Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Thu, 20 Dec 2012 17:50:14 +0000 Subject: [PATCH 4/5] Removed instantiation of NewFedoraObject. --- includes/utilities.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/utilities.inc b/includes/utilities.inc index 55ef7562..066946e9 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -382,7 +382,7 @@ function islandora_get_datastreams_requirements_from_content_model(FedoraObject function islandora_prepare_new_object($namespace = NULL, $label = NULL, $datastreams = array(), $content_models = array(), $relationships = array()) { global $user; $tuque = islandora_get_tuque_connection(); - $object = isset($namespace) ? $tuque->repository->constructObject($namespace) : new NewFedoraObject(NULL, $tuque->repository); + $object = $tuque->repository->constructObject($namespace); $object->owner = isset($user->name) ? $user->name : $object->owner; $object->label = isset($label) ? $label : $object->label; foreach ($content_models as $content_model) { From 8680f911c9442e35b91eaecff9127badefc06aa5 Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Thu, 20 Dec 2012 19:30:04 +0000 Subject: [PATCH 5/5] Fixed namespace problem caused by previous commit --- includes/utilities.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/utilities.inc b/includes/utilities.inc index 066946e9..b2006722 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -382,7 +382,7 @@ function islandora_get_datastreams_requirements_from_content_model(FedoraObject function islandora_prepare_new_object($namespace = NULL, $label = NULL, $datastreams = array(), $content_models = array(), $relationships = array()) { global $user; $tuque = islandora_get_tuque_connection(); - $object = $tuque->repository->constructObject($namespace); + $object = isset($namespace) ? $tuque->repository->constructObject($namespace) : new IslandoraNewFedoraObject(NULL, $tuque->repository); $object->owner = isset($user->name) ? $user->name : $object->owner; $object->label = isset($label) ? $label : $object->label; foreach ($content_models as $content_model) {