From d8728516b978875d6d8e87f6a062679d7d515833 Mon Sep 17 00:00:00 2001 From: Ben Woodhead Date: Thu, 13 Oct 2011 14:11:35 -0300 Subject: [PATCH 1/9] checking to see if I need an array to sanitize text --- fedora_repository.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fedora_repository.module b/fedora_repository.module index e2153355..90354d44 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -115,7 +115,7 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label $collection_pid = urldecode($collection_pid); } else { - drupal_set_message(t("This collection PID $collection_pid is not valid"), 'error'); + drupal_set_message(t("This collection PID @collection_pid is not valid", check_plain($collection_pid )), 'error'); return ' '; } } From bba29d761a032823098c61f8fc9e3a715e9d0483 Mon Sep 17 00:00:00 2001 From: Ben Woodhead Date: Thu, 13 Oct 2011 14:16:41 -0300 Subject: [PATCH 2/9] Does this actually work --- fedora_repository.module | 56 ++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/fedora_repository.module b/fedora_repository.module index 90354d44..67dc0494 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -54,10 +54,9 @@ function fedora_repository_purge_object($pid = NULL, $name = NULL) { drupal_set_message(t('You must specify an object pid to purge an object.'), 'error'); return ''; } - $output = t('Are you sure you wish to purge object %name %pid!
This cannot be undone
', - array( - '%name' => $name, - '%pid' => $pid) + $output = t('Are you sure you wish to purge object %name %pid!
This cannot be undone
', array( + '%name' => $name, + '%pid' => $pid) ); $output .= drupal_get_form('fedora_repository_purge_object_form', $pid); @@ -115,7 +114,7 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label $collection_pid = urldecode($collection_pid); } else { - drupal_set_message(t("This collection PID @collection_pid is not valid", check_plain($collection_pid )), 'error'); + drupal_set_message(t("This collection PID @collection_pid is not valid", check_plain($collection_pid)), 'error'); return ' '; } } @@ -150,7 +149,7 @@ function fedora_repository_ingest_form_submit(array $form, array &$form_state) { $xml_form->submit($form, $form_state); } } - else if ($form_state['clicked_button']['#id'] == 'edit-submit') { + elseif ($form_state['clicked_button']['#id'] == 'edit-submit') { global $base_url; module_load_include('inc', 'fedora_repository', 'CollectionClass'); module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); @@ -240,14 +239,14 @@ function fedora_repository_ingest_form_validate($form, &$form_state) { if (!empty($file)) { if (!in_array($dformat, $allowedMimeTypes)) { form_set_error('ingest-file-location', t('The uploaded file\'s mimetype (' . $dformat . ') is not associated with this Content Model. The allowed types are ' . - implode(' ', $allowedMimeTypes))); + implode(' ', $allowedMimeTypes))); file_delete($file); return; } elseif (!$cm->execIngestRules($file, $dformat)) { drupal_set_message(t('Error following Content Model Rules'), 'error'); foreach (ContentModel::$errors as $err) { - drupal_set_message($err, 'error'); + drupal_set_message(check_plain($err), 'error'); } } } @@ -400,7 +399,7 @@ function add_stream_form_submit($form, &$form_state) { file_delete($file); } catch (exception $e) { - drupal_set_message(t($e->getMessage()), 'error'); + drupal_set_message(t(check_plain($e->getMessage())), 'error'); return; } $form_state['rebuild'] = TRUE; @@ -448,9 +447,9 @@ function add_stream_form_validate($form, &$form_state) { return FALSE; } $validators = array( - // 'file_validate_is_image' => array(), - // 'file_validate_image_resolution' => array('85x85'), - // 'file_validate_size' => array(30 * 1024), + // 'file_validate_is_image' => array(), + // 'file_validate_image_resolution' => array('85x85'), + // 'file_validate_size' => array(30 * 1024), ); $fileObject = file_save_upload('add-stream-file-location', $validators); @@ -482,9 +481,8 @@ function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL) return ' '; } - $output = t('Are you sure you wish to purge this datastream %name
', - array( - '%name' => $name) + $output = t('Are you sure you wish to purge this datastream %name
', array( + '%name' => $name) ); $output .= drupal_get_form('fedora_repository_purge_stream_form', $pid, $dsId); return $output; @@ -909,12 +907,12 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU drupal_set_message(t('The Fedora repository server is currently unavailable. Please contact the site administrator.'), 'warning', FALSE); return ''; } - + if (!risearch_available()) { drupal_set_message(t('The Fedora resource index search is currently unavailable. Please contact the site administrator.'), 'warning', FALSE); return ''; } - + if ($pid == NULL) { $pid = variable_get('fedora_repository_pid', 'islandora:root'); } @@ -990,12 +988,11 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU // Add a 'manage object' tab for all objects, where detailed list of content is shown. $obj = new FedoraObjectDetailedContent($pid); $object_details = $obj->showFieldSets(); - if ($object_details['fedora_object_details']['#selected'] == TRUE){ - foreach($cmodels_tabs as $cmodel_tab){ - if (is_array($cmodel_tab)){ + if ($object_details['fedora_object_details']['#selected'] == TRUE) { + foreach ($cmodels_tabs as $cmodel_tab) { + if (is_array($cmodel_tab)) { $cmodel_tab['#selected'] = FALSE; } - } } $cmodels_tabs = array_merge($cmodels_tabs, $object_details); @@ -1468,10 +1465,10 @@ function fedora_repository_demo_objects_form() { ); foreach (array( - 'islandora:collectionCModel' => 'Islandora default content models', - 'islandora:root' => 'Islandora top-level collection', - 'islandora:demos' => 'Islandora demos collection', - 'islandora:largeimages' => 'Sample large image content model (requires Djatoka and Kakadu.)', +'islandora:collectionCModel' => 'Islandora default content models', + 'islandora:root' => 'Islandora top-level collection', + 'islandora:demos' => 'Islandora demos collection', + 'islandora:largeimages' => 'Sample large image content model (requires Djatoka and Kakadu.)', ) as $available_demo => $available_demo_desc) { try { @@ -1643,7 +1640,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { if (!empty($form_state['values']['demo_collections']['islandora:largeimages'])) { $error = ''; foreach (array('islandora_jp2Sdep-slideCModel.xml', 'islandora_mods2htmlSdef.xml', 'islandora_mods2htmlSdep.xml', - 'islandora_slideCModel.xml', 'islandora_viewerSdep-slideCModel.xml', 'ilives_jp2Sdef.xml', 'ilives_viewerSdef.xml') as $foxml_file) { + 'islandora_slideCModel.xml', 'islandora_viewerSdep-slideCModel.xml', 'ilives_jp2Sdef.xml', 'ilives_viewerSdef.xml') as $foxml_file) { try { $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'fedora_repository') . '/content_models/' . $foxml_file); } catch (exception $e) { @@ -1685,7 +1682,6 @@ function fedora_repository_required_fedora_objects() { 'dsversion' => 2, 'cmodel' => 'fedora-system:ContentModel-3.0', ), - array( 'pid' => 'islandora:root', 'label' => 'Islandora Top-level Collection', @@ -1701,7 +1697,7 @@ function fedora_repository_required_fedora_objects() { 'mimetype' => 'image/png', ), ), - ), + ), ), ), ); @@ -2085,9 +2081,7 @@ function theme_add_to_basket_link($pid, $type = 'object') { */ if (!_is_added_to_basket($pid)) { return l( - theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $save, t("Add to basket"), t("Add this @object to my basket", array('@object' => $object))), - "fedora/repository/addToBasket/" . $path, - array('html' => TRUE) + theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $save, t("Add to basket"), t("Add this @object to my basket", array('@object' => $object))), "fedora/repository/addToBasket/" . $path, array('html' => TRUE) ); } From e542a6d4b52b9ca9d67e708334255064ce0ed768 Mon Sep 17 00:00:00 2001 From: Ben Woodhead Date: Thu, 13 Oct 2011 14:19:28 -0300 Subject: [PATCH 3/9] Sanitizing text --- fedora_repository.module | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fedora_repository.module b/fedora_repository.module index 67dc0494..1d761d8f 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -399,7 +399,7 @@ function add_stream_form_submit($form, &$form_state) { file_delete($file); } catch (exception $e) { - drupal_set_message(t(check_plain($e->getMessage())), 'error'); + drupal_set_message(t('@message', check_plain($e->getMessage())), 'error'); return; } $form_state['rebuild'] = TRUE; @@ -518,7 +518,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) { drupal_set_message(t('Error: Insufficient permissions to purge object.'), 'error'); } else { - drupal_set_message(t($e->getMessage()), 'error'); + drupal_set_message(t('@message', check_plain($e->getMessage())), 'error'); } return; } @@ -576,7 +576,7 @@ function fedora_repository_purge_stream_form_submit($form, &$form_state) { try { $item->purge_datastream($dsid); } catch (exception $e) { - drupal_set_message(t($e->getMessage()), 'error'); + drupal_set_message(t('@message', check_plain($e->getMessage())), 'error'); } $form_state['redirect'] = $base_url . "/fedora/repository/$pid"; } @@ -934,7 +934,7 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU } if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { if (user_access('access administration pages')) { - drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'warning'); + drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed @here", array('@here' => l('here', 'admin/settings/fedora_repository'))), 'warning'); } drupal_access_denied(); exit; From bc69572d6413d58c02d9b5d354a96b9bcb5062cf Mon Sep 17 00:00:00 2001 From: Ben Woodhead Date: Thu, 13 Oct 2011 14:29:21 -0300 Subject: [PATCH 4/9] Sanitized more text --- fedora_repository.module | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fedora_repository.module b/fedora_repository.module index 1d761d8f..2a7e5498 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -399,7 +399,7 @@ function add_stream_form_submit($form, &$form_state) { file_delete($file); } catch (exception $e) { - drupal_set_message(t('@message', check_plain($e->getMessage())), 'error'); + drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error'); return; } $form_state['rebuild'] = TRUE; @@ -435,7 +435,7 @@ function add_stream_form_validate($form, &$form_state) { return FALSE; } if (!(preg_match("/^[a-zA-Z]/", $dsid))) { - form_set_error('', t("Data stream ID ($dsid) has to start with a letter.")); + form_set_error('', t("Data stream ID (@dsid) has to start with a letter.", array( '@dsid' => check_plain($dsid)))); return FALSE; } if (strlen($dsLabel) > 64) { @@ -518,7 +518,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) { drupal_set_message(t('Error: Insufficient permissions to purge object.'), 'error'); } else { - drupal_set_message(t('@message', check_plain($e->getMessage())), 'error'); + drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error'); } return; } @@ -576,7 +576,7 @@ function fedora_repository_purge_stream_form_submit($form, &$form_state) { try { $item->purge_datastream($dsid); } catch (exception $e) { - drupal_set_message(t('@message', check_plain($e->getMessage())), 'error'); + drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error'); } $form_state['redirect'] = $base_url . "/fedora/repository/$pid"; } @@ -1065,7 +1065,7 @@ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NU //drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error'); drupal_access_denied(); if (user_access('access administration pages')) { - drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'error'); + drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed @here", array('@here' => l('here', 'admin/settings/fedora_repository'))), 'error'); } return ' '; } @@ -1577,7 +1577,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { $cmodel_collection->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_views/simple_list_view.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/contentModel.jpg', 'TN', 'Thumbnail', 'image/jpg', 'M'); - drupal_set_message(t("Successfully installed islandora:ContentModelCollection."), 'message'); + drupal_set_message(t("Successfully installed islandora:ContentModelCollection.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { } @@ -1589,7 +1589,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); try { $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - drupal_set_message(t("Successfully installed islandora:root."), 'message'); + drupal_set_message(t("Successfully installed islandora:root.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { } @@ -1609,7 +1609,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_mimetype_pdf.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - drupal_set_message(t("Successfully installed islandora:demos."), 'message'); + drupal_set_message(t("Successfully installed islandora:demos.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { } @@ -1631,7 +1631,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { $dual_res_image_collection_cmodel = new Fedora_Item('demo:DualResImageCollection'); try { $cmstream = $dual_res_image_collection_cmodel->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); - drupal_set_message(t("Successfully installed demo:SmileyStuff collection view."), 'message'); + drupal_set_message(t("Successfully installed demo:SmileyStuff collection view.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { } @@ -1650,7 +1650,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { try { $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'fedora_repository') . '/content_models/islandora_largeimages.xml'); $tn = $item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - drupal_set_message(t("Successfully installed islandora:largeimages."), 'message'); + drupal_set_message(t("Successfully installed islandora:largeimages.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { $error .= " - Problem ingesting islandora:largeimages collection"; } @@ -1952,7 +1952,7 @@ function fedora_repository_basket_form_submit($form, &$form_state) { $foxml_dir = $export_dir . '/foxml'; if (!file_exists($foxml_dir) && !@mkdir($foxml_dir, 0775, TRUE)) { - drupal_set_message(t("Failed to create foxml dir %dir. Check that export dir exsits and has correct permissions", array('%dir' => $foxml_dir)), 'error'); + drupal_set_message(t("Failed to create foxml dir @dir. Check that export dir exsits and has correct permissions", array('@dir' => $foxml_dir)), 'error'); return FALSE; } @@ -1961,7 +1961,7 @@ function fedora_repository_basket_form_submit($form, &$form_state) { $objects_dir = $export_dir . '/objects/' . $pid; if (!file_exists($objects_dir) && !@mkdir($objects_dir, 0775, TRUE)) { - drupal_set_message(t("Failed to create objects dir %dir. Check that export dir exsits and has correct permissions", array('%dir' => $objects_dir)), 'error'); + drupal_set_message(t("Failed to create objects dir @dir. Check that export dir exsits and has correct permissions", array('@dir' => $objects_dir)), 'error'); return FALSE; } From cc4f8903635ea880b98f121b53fb3c92046497cd Mon Sep 17 00:00:00 2001 From: Ben Woodhead Date: Thu, 13 Oct 2011 14:30:27 -0300 Subject: [PATCH 5/9] Fixed last string error in fedora_repository.module --- fedora_repository.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fedora_repository.module b/fedora_repository.module index 2a7e5498..56859edb 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -1657,7 +1657,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { } if (!empty($error)) { - drupal_set_message(t('Some problems occurred: ' . $error)); + drupal_set_message(t('Some problems occurred: @error', array('@error' => $error))); } } } From d705d897cb2012a0aec39070ec179d91eccd1abc Mon Sep 17 00:00:00 2001 From: Ben Woodhead Date: Thu, 13 Oct 2011 14:32:04 -0300 Subject: [PATCH 6/9] Removed CVS id tags --- ConnectionHelper.inc | 2 +- MimeClass.inc | 2 +- ObjectHelper.inc | 2 +- SearchClass.inc | 2 +- SecurityClass.inc | 2 +- api/dublin_core.inc | 2 +- api/fedora_export.inc | 2 +- api/fedora_utils.inc | 2 +- api/rels-ext.inc | 2 +- api/tagging.inc | 2 +- formClass.inc | 2 +- plugins/CollectionFormBuilder.inc | 2 +- plugins/CreateCollection.inc | 2 +- plugins/DemoFormBuilder.inc | 2 +- plugins/Exiftool.inc | 2 +- plugins/FedoraObjectDetailedContent.inc | 2 +- plugins/Ffmpeg.inc | 2 +- plugins/Flv.inc | 2 +- plugins/FlvFormBuilder.inc | 2 +- plugins/FormBuilder.inc | 2 +- plugins/ImageManipulation.inc | 2 +- plugins/ModsFormBuilder.inc | 2 +- plugins/PersonalCollectionClass.inc | 2 +- plugins/Refworks.inc | 2 +- plugins/ShowDemoStreamsInFieldSets.inc | 2 +- plugins/ShowStreamsInFieldSets.inc | 2 +- plugins/map_viewer.inc | 2 +- plugins/qt_viewer.inc | 2 +- plugins/slide_viewer.inc | 2 +- plugins/tagging_form.inc | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/ConnectionHelper.inc b/ConnectionHelper.inc index 8225f0fc..255ebfac 100644 --- a/ConnectionHelper.inc +++ b/ConnectionHelper.inc @@ -1,6 +1,6 @@ Date: Thu, 13 Oct 2011 14:37:52 -0300 Subject: [PATCH 7/9] Added check_plain to the error handling --- BatchIngest.inc | 2 +- CollectionClass.inc | 18 +++++++++--------- ConnectionHelper.inc | 4 ++-- ObjectHelper.inc | 2 +- plugins/DarwinCore.inc | 2 +- plugins/Flv.inc | 4 ++-- plugins/FormBuilder.inc | 8 ++++---- plugins/ModsFormBuilder.inc | 4 ++-- plugins/PersonalCollectionClass.inc | 4 ++-- plugins/ShowStreamsInFieldSets.inc | 4 ++-- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/BatchIngest.inc b/BatchIngest.inc index 621a674a..f4d987e0 100644 --- a/BatchIngest.inc +++ b/BatchIngest.inc @@ -229,7 +229,7 @@ function batch_create_dc_from_mods($mods_xml) { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); return " "; } diff --git a/CollectionClass.inc b/CollectionClass.inc index ae68e2de..3d2c9f5b 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -131,7 +131,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting relationship element from policy stream !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Error getting relationship element from policy stream !e', array('!e' => check_plain($e->getMessage()))), 'error'); return; } $relationship = $xml->relationship[0]; @@ -172,7 +172,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting PID namespace !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Error getting PID namespace !e', array('!e' => check_plain($e->getMessage()))), 'error'); return; } foreach ($xml->contentmodels->contentmodel as $contentModel) { @@ -199,7 +199,7 @@ class CollectionClass { $xml = new SimpleXMLElement($collection_stream); } catch (Exception $e) { if ($showError) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); } return NULL; } @@ -239,7 +239,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error Getting FormHandler: !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Error Getting FormHandler: !e', array('!e' => check_plain($e->getMessage()))), 'error'); return NULL; } $formHandler = $xml->ingest_form; @@ -272,7 +272,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting content model stream for mime types !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Error getting content model stream for mime types !e', array('!e' => check_plain($e->getMessage()))), 'error'); return; } foreach ($xml->mimetypes->type as $type) { @@ -302,7 +302,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting content model stream !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Error getting content model stream !e', array('!e' => check_plain($e->getMessage()))), 'error'); return FALSE; } foreach ($xml->ingest_rules->rule as $rule) { @@ -365,7 +365,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting ingest form stream !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Error getting ingest form stream !e', array('!e' => check_plain($e->getMessage()))), 'error'); return FALSE; } $docRoot = $_SERVER['DOCUMENT_ROOT']; @@ -451,7 +451,7 @@ class CollectionClass { $params )); } catch (exception $e) { - drupal_set_message(t('Error getting Next PID: !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Error getting Next PID: !e', array('!e' => check_plain($e->getMessage()))), 'error'); return FALSE; } $pid = implode(get_object_vars($object)); @@ -663,7 +663,7 @@ class CollectionClass { throw new Exception("Invalid XML."); } } catch (Exception $e) { - drupal_set_message(t('!e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('!e', array('!e' => check_plain($e->getMessage()))), 'error'); return ''; } } diff --git a/ConnectionHelper.inc b/ConnectionHelper.inc index 255ebfac..71cca98d 100644 --- a/ConnectionHelper.inc +++ b/ConnectionHelper.inc @@ -71,7 +71,7 @@ class ConnectionHelper { 'exceptions' => $exceptions, )); } catch (SoapFault $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage()))); + drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage())))); return NULL; } } @@ -83,7 +83,7 @@ class ConnectionHelper { 'exceptions' => TRUE, )); } catch (SoapFault $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage()))); + drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage())))); return NULL; } } diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 98160292..ed3aec38 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -750,7 +750,7 @@ class ObjectHelper { try { $parent_collections = new SimpleXMLElement($parent_collections); } catch (exception $e) { - drupal_set_message(t('Error getting parent objects !e', array('!e' => $e->getMessage()))); + drupal_set_message(t('Error getting parent objects !e', array('!e' => check_plain($e->getMessage())))); return; } diff --git a/plugins/DarwinCore.inc b/plugins/DarwinCore.inc index 5ab525b6..1071c5e0 100644 --- a/plugins/DarwinCore.inc +++ b/plugins/DarwinCore.inc @@ -261,7 +261,7 @@ class DarwinCore { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); return " "; } diff --git a/plugins/Flv.inc b/plugins/Flv.inc index f51e2194..0e248b71 100644 --- a/plugins/Flv.inc +++ b/plugins/Flv.inc @@ -69,7 +69,7 @@ class FormBuilder { $oai->appendChild($previousElement); } } catch (exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); continue; } } @@ -126,7 +126,7 @@ class FormBuilder { unlink($form_values['fullpath']); } } catch (exception $e) { - drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Error ingesting object: !e', array('!e' => check_plain($e->getMessage()))), 'error'); return; } } diff --git a/plugins/FormBuilder.inc b/plugins/FormBuilder.inc index 6da718fa..d44e1f9b 100644 --- a/plugins/FormBuilder.inc +++ b/plugins/FormBuilder.inc @@ -68,7 +68,7 @@ class FormBuilder { $oai->appendChild($previousElement); } } catch (exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); continue; } } @@ -96,7 +96,7 @@ class FormBuilder { $xml = new SimpleXMLElement($policyStreamDoc); } catch (Exception $e) { watchdog(t("Fedora_Repository"), t("Problem getting security policy."), NULL, WATCHDOG_ERROR); - drupal_set_message(t('Problem getting security policy: !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Problem getting security policy: !e', array('!e' => check_plain($e->getMessage()))), 'error'); return FALSE; } $policyElement = $dom->createDocumentFragment(); @@ -182,8 +182,8 @@ class FormBuilder { } file_delete($form_values['ingest-file-location']); } catch (exception $e) { - drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error'); - watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => $e->getMessage()), NULL, WATCHDOG_ERROR); + drupal_set_message(t('Error ingesting object: !e', array('!e' => check_plain($e->getMessage()))), 'error'); + watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR); return; } } diff --git a/plugins/ModsFormBuilder.inc b/plugins/ModsFormBuilder.inc index b9ace70b..05ae0a99 100644 --- a/plugins/ModsFormBuilder.inc +++ b/plugins/ModsFormBuilder.inc @@ -316,8 +316,8 @@ class ModsFormBuilder extends FormBuilder { } file_delete($form_values['ingest-file-location']); } catch (exception $e) { - drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error'); - watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => $e->getMessage()), NULL, WATCHDOG_ERROR); + drupal_set_message(t('Error ingesting object: !e', array('!e' => check_plain($e->getMessage()))), 'error'); + watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR); return; } } diff --git a/plugins/PersonalCollectionClass.inc b/plugins/PersonalCollectionClass.inc index 39dc68d0..6d5b0946 100644 --- a/plugins/PersonalCollectionClass.inc +++ b/plugins/PersonalCollectionClass.inc @@ -57,7 +57,7 @@ class PersonalCollectionClass { $params )); } catch (exception $e) { - drupal_set_message(t('Error ingesting personal collection object: !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Error ingesting personal collection object: !e', array('!e' => check_plain($e->getMessage()))), 'error'); return FALSE; } return TRUE; @@ -76,7 +76,7 @@ class PersonalCollectionClass { $xml = new SimpleXMLElement($collectionTemplate); } catch (Exception $e) { watchdog(t("Fedora_Repository"), t("Problem creating personal collection policy, could not parse collection policy stream."), NULL, WATCHDOG_ERROR); - drupal_set_message(t('Problem creating personal collection policy, could not parse collection policy stream: !e', array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t('Problem creating personal collection policy, could not parse collection policy stream: !e', array('!e' => check_plain($e->getMessage()))), 'error'); return FALSE; } $policyElement = $dom->createDocumentFragment(); diff --git a/plugins/ShowStreamsInFieldSets.inc b/plugins/ShowStreamsInFieldSets.inc index e13dce33..23d5a4dc 100644 --- a/plugins/ShowStreamsInFieldSets.inc +++ b/plugins/ShowStreamsInFieldSets.inc @@ -183,7 +183,7 @@ class ShowStreamsInFieldSets { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); return " "; } $xsl = new DomDocument(); @@ -237,7 +237,7 @@ class ShowStreamsInFieldSets { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); return; } $xsl = new DomDocument(); From 9c43f2dce7cdab33c9a590566c55b5f5c6529e64 Mon Sep 17 00:00:00 2001 From: Ben Woodhead Date: Thu, 13 Oct 2011 14:52:10 -0300 Subject: [PATCH 8/9] Added a check_plain to getMessage and changed !e to @e --- BatchIngest.inc | 2 +- CollectionClass.inc | 18 +++++++++--------- ConnectionHelper.inc | 4 ++-- ObjectHelper.inc | 4 ++-- api/fedora_item.inc | 4 ++-- api/tagging.inc | 2 +- plugins/DarwinCore.inc | 2 +- plugins/Flv.inc | 4 ++-- plugins/FormBuilder.inc | 8 ++++---- plugins/ModsFormBuilder.inc | 4 ++-- plugins/PersonalCollectionClass.inc | 4 ++-- plugins/Refworks.inc | 4 ++-- plugins/ShowStreamsInFieldSets.inc | 4 ++-- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/BatchIngest.inc b/BatchIngest.inc index f4d987e0..efc235a6 100644 --- a/BatchIngest.inc +++ b/BatchIngest.inc @@ -229,7 +229,7 @@ function batch_create_dc_from_mods($mods_xml) { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); return " "; } diff --git a/CollectionClass.inc b/CollectionClass.inc index 3d2c9f5b..82e4739e 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -131,7 +131,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting relationship element from policy stream !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Error getting relationship element from policy stream @e', array('@e' => check_plain($e->getMessage()))), 'error'); return; } $relationship = $xml->relationship[0]; @@ -172,7 +172,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting PID namespace !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Error getting PID namespace @e', array('@e' => check_plain($e->getMessage()))), 'error'); return; } foreach ($xml->contentmodels->contentmodel as $contentModel) { @@ -199,7 +199,7 @@ class CollectionClass { $xml = new SimpleXMLElement($collection_stream); } catch (Exception $e) { if ($showError) { - drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); } return NULL; } @@ -239,7 +239,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error Getting FormHandler: !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Error Getting FormHandler: @e', array('@e' => check_plain($e->getMessage()))), 'error'); return NULL; } $formHandler = $xml->ingest_form; @@ -272,7 +272,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting content model stream for mime types !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Error getting content model stream for mime types @e', array('@e' => check_plain($e->getMessage()))), 'error'); return; } foreach ($xml->mimetypes->type as $type) { @@ -302,7 +302,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting content model stream !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Error getting content model stream @e', array('@e' => check_plain($e->getMessage()))), 'error'); return FALSE; } foreach ($xml->ingest_rules->rule as $rule) { @@ -365,7 +365,7 @@ class CollectionClass { try { $xml = new SimpleXMLElement($stream); } catch (Exception $e) { - drupal_set_message(t('Error getting ingest form stream !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Error getting ingest form stream @e', array('@e' => check_plain($e->getMessage()))), 'error'); return FALSE; } $docRoot = $_SERVER['DOCUMENT_ROOT']; @@ -451,7 +451,7 @@ class CollectionClass { $params )); } catch (exception $e) { - drupal_set_message(t('Error getting Next PID: !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Error getting Next PID: @e', array('@e' => check_plain($e->getMessage()))), 'error'); return FALSE; } $pid = implode(get_object_vars($object)); @@ -663,7 +663,7 @@ class CollectionClass { throw new Exception("Invalid XML."); } } catch (Exception $e) { - drupal_set_message(t('!e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); return ''; } } diff --git a/ConnectionHelper.inc b/ConnectionHelper.inc index 71cca98d..59f811e2 100644 --- a/ConnectionHelper.inc +++ b/ConnectionHelper.inc @@ -71,7 +71,7 @@ class ConnectionHelper { 'exceptions' => $exceptions, )); } catch (SoapFault $e) { - drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage())))); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); return NULL; } } @@ -83,7 +83,7 @@ class ConnectionHelper { 'exceptions' => TRUE, )); } catch (SoapFault $e) { - drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage())))); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); return NULL; } } diff --git a/ObjectHelper.inc b/ObjectHelper.inc index ed3aec38..70f73d4b 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -386,7 +386,7 @@ class ObjectHelper { $input = new DomDocument(); $input->loadXML(trim($xmlstr)); } catch (exception $e) { - watchdog(t("Fedora_Repository"), "Problem loading XSL file: !e", array('!e' => $e), NULL, WATCHDOG_ERROR); + watchdog(t("Fedora_Repository"), "Problem loading XSL file: @e", array('@e' => $e), NULL, WATCHDOG_ERROR); } $xsl = $proc->importStylesheet($xsl); $newdom = $proc->transformToDoc($input); @@ -750,7 +750,7 @@ class ObjectHelper { try { $parent_collections = new SimpleXMLElement($parent_collections); } catch (exception $e) { - drupal_set_message(t('Error getting parent objects !e', array('!e' => check_plain($e->getMessage())))); + drupal_set_message(t('Error getting parent objects @e', array('@e' => check_plain($e->getMessage())))); return; } diff --git a/api/fedora_item.inc b/api/fedora_item.inc index a4ee923b..54a9158b 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -885,7 +885,7 @@ class Fedora_Item { drupal_set_message(t("Error trying to call SOAP function $function_name. Check watchdog logs for more information."), 'error'); } - watchdog(t("FEDORA_REPOSITORY"), "Error Trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e), NULL, WATCHDOG_ERROR); + watchdog(t("FEDORA_REPOSITORY"), "Error Trying to call SOAP function @fn: @e", array('@fn' => $function_name, '@e' => $e), NULL, WATCHDOG_ERROR); } return NULL; } @@ -904,7 +904,7 @@ class Fedora_Item { } catch (exception $e) { if (!$quiet) { - watchdog(t("FEDORA_REPOSITORY"), "Error trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e), NULL, WATCHDOG_ERROR); + watchdog(t("FEDORA_REPOSITORY"), "Error trying to call SOAP function @fn: @e", array('@fn' => $function_name, '@e' => $e), NULL, WATCHDOG_ERROR); } return NULL; } diff --git a/api/tagging.inc b/api/tagging.inc index bfe4b844..418193fa 100644 --- a/api/tagging.inc +++ b/api/tagging.inc @@ -69,7 +69,7 @@ class TagSet { $this->item->modify_datastream_by_value($tagdoc->saveXML(), $this->tagsDSID, 'Tags', 'text/xml', 'X'); } } catch (exception $e) { - drupal_set_message(t('There was an error saving the tags datastream: !e'), array('!e' => $e), 'error'); + drupal_set_message(t('There was an error saving the tags datastream: @e'), array('@e' => $e), 'error'); return FALSE; } return TRUE; diff --git a/plugins/DarwinCore.inc b/plugins/DarwinCore.inc index 1071c5e0..2d66d60a 100644 --- a/plugins/DarwinCore.inc +++ b/plugins/DarwinCore.inc @@ -261,7 +261,7 @@ class DarwinCore { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); return " "; } diff --git a/plugins/Flv.inc b/plugins/Flv.inc index 0e248b71..b5f159b2 100644 --- a/plugins/Flv.inc +++ b/plugins/Flv.inc @@ -69,7 +69,7 @@ class FormBuilder { $oai->appendChild($previousElement); } } catch (exception $e) { - drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); continue; } } @@ -126,7 +126,7 @@ class FormBuilder { unlink($form_values['fullpath']); } } catch (exception $e) { - drupal_set_message(t('Error ingesting object: !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error'); return; } } diff --git a/plugins/FormBuilder.inc b/plugins/FormBuilder.inc index d44e1f9b..cd9dc4a9 100644 --- a/plugins/FormBuilder.inc +++ b/plugins/FormBuilder.inc @@ -68,7 +68,7 @@ class FormBuilder { $oai->appendChild($previousElement); } } catch (exception $e) { - drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); continue; } } @@ -96,7 +96,7 @@ class FormBuilder { $xml = new SimpleXMLElement($policyStreamDoc); } catch (Exception $e) { watchdog(t("Fedora_Repository"), t("Problem getting security policy."), NULL, WATCHDOG_ERROR); - drupal_set_message(t('Problem getting security policy: !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Problem getting security policy: @e', array('@e' => check_plain($e->getMessage()))), 'error'); return FALSE; } $policyElement = $dom->createDocumentFragment(); @@ -182,8 +182,8 @@ class FormBuilder { } file_delete($form_values['ingest-file-location']); } catch (exception $e) { - drupal_set_message(t('Error ingesting object: !e', array('!e' => check_plain($e->getMessage()))), 'error'); - watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR); + drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + watchdog(t("Fedora_Repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR); return; } } diff --git a/plugins/ModsFormBuilder.inc b/plugins/ModsFormBuilder.inc index 05ae0a99..aa0f6f92 100644 --- a/plugins/ModsFormBuilder.inc +++ b/plugins/ModsFormBuilder.inc @@ -316,8 +316,8 @@ class ModsFormBuilder extends FormBuilder { } file_delete($form_values['ingest-file-location']); } catch (exception $e) { - drupal_set_message(t('Error ingesting object: !e', array('!e' => check_plain($e->getMessage()))), 'error'); - watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR); + drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + watchdog(t("Fedora_Repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR); return; } } diff --git a/plugins/PersonalCollectionClass.inc b/plugins/PersonalCollectionClass.inc index 6d5b0946..29c76cfa 100644 --- a/plugins/PersonalCollectionClass.inc +++ b/plugins/PersonalCollectionClass.inc @@ -57,7 +57,7 @@ class PersonalCollectionClass { $params )); } catch (exception $e) { - drupal_set_message(t('Error ingesting personal collection object: !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Error ingesting personal collection object: @e', array('@e' => check_plain($e->getMessage()))), 'error'); return FALSE; } return TRUE; @@ -76,7 +76,7 @@ class PersonalCollectionClass { $xml = new SimpleXMLElement($collectionTemplate); } catch (Exception $e) { watchdog(t("Fedora_Repository"), t("Problem creating personal collection policy, could not parse collection policy stream."), NULL, WATCHDOG_ERROR); - drupal_set_message(t('Problem creating personal collection policy, could not parse collection policy stream: !e', array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('Problem creating personal collection policy, could not parse collection policy stream: @e', array('@e' => check_plain($e->getMessage()))), 'error'); return FALSE; } $policyElement = $dom->createDocumentFragment(); diff --git a/plugins/Refworks.inc b/plugins/Refworks.inc index 0f3e908c..5e39b3c2 100644 --- a/plugins/Refworks.inc +++ b/plugins/Refworks.inc @@ -290,7 +290,7 @@ class Refworks { if ($client == NULL) { drupal_set_message(t('Error getting SOAP client.'), 'error'); - watchdog(t("FEDORA_REPOSITORY"), "Error getting SOAP client: !e", array('!e' => $e), NULL, WATCHDOG_ERROR); + watchdog(t("FEDORA_REPOSITORY"), "Error getting SOAP client: @e", array('@e' => $e), NULL, WATCHDOG_ERROR); return; } $object = $client->__soapCall('ingest', array( @@ -305,7 +305,7 @@ class Refworks { } catch (exception $e) { $errors++; $errorMessage = 'yes'; - watchdog(t("FEDORA_REPOSITORY"), t("Error during ingest !it !e", array('!it' => $item_title, '!e' => $e)), NULL, WATCHDOG_ERROR); + watchdog(t("FEDORA_REPOSITORY"), t("Error during ingest !it @e", array('!it' => $item_title, '@e' => $e)), NULL, WATCHDOG_ERROR); } $success++; } diff --git a/plugins/ShowStreamsInFieldSets.inc b/plugins/ShowStreamsInFieldSets.inc index 23d5a4dc..a6e7eaad 100644 --- a/plugins/ShowStreamsInFieldSets.inc +++ b/plugins/ShowStreamsInFieldSets.inc @@ -183,7 +183,7 @@ class ShowStreamsInFieldSets { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); return " "; } $xsl = new DomDocument(); @@ -237,7 +237,7 @@ class ShowStreamsInFieldSets { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => check_plain($e->getMessage()))), 'error'); + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); return; } $xsl = new DomDocument(); From 759c5204497fb27e60a108f28fb85b070e1a9589 Mon Sep 17 00:00:00 2001 From: Ben Woodhead Date: Thu, 13 Oct 2011 14:56:38 -0300 Subject: [PATCH 9/9] Removed camel case --- BatchIngest.inc | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/BatchIngest.inc b/BatchIngest.inc index efc235a6..c78be313 100644 --- a/BatchIngest.inc +++ b/BatchIngest.inc @@ -65,22 +65,22 @@ function batch_creation_form(&$form_state, $collection_pid, $content_models) { */ function batch_creation_form_validate($form, &$form_state) { - $fieldName = 'file-location'; - if (isset($_FILES['files']) && is_uploaded_file($_FILES['files']['tmp_name'][$fieldName])) { - $file = file_save_upload($fieldName); + $field_name = 'file-location'; + if (isset($_FILES['files']) && is_uploaded_file($_FILES['files']['tmp_name'][$field_name])) { + $file = file_save_upload($field_name); if ($file->filemime != 'application/zip') { - form_set_error($fieldName, 'Input file must be a .zip file'); + form_set_error($field_name, 'Input file must be a .zip file'); return; } if (!$file) { - form_set_error($fieldName, 'Error uploading file.'); + form_set_error($field_name, 'Error uploading file.'); return; } $form_state['values']['file'] = $file; } else { // set error - form_set_error($fieldName, 'Error uploading file.'); + form_set_error($field_name, 'Error uploading file.'); return; } } @@ -100,27 +100,27 @@ function batch_creation_form_submit($form, &$form_state) { } $namespace = $namespace_mappings[$content_model]; $namespace = preg_replace('/:.*/', '', $namespace); - $dirName = "temp" . $user->uid; - $tmpDir = file_directory_path() . '/' . $dirName . '/'; - mkdir($tmpDir); + $dir_name = "temp" . $user->uid; + $tmp_dir = file_directory_path() . '/' . $dir_name . '/'; + mkdir($tmp_dir); $file = $form_state['values']['file']; $fileName = $file->filepath; $file_list = array(); - $cmdString = "unzip -q -o -d $tmpDir \"$fileName\""; + $cmdString = "unzip -q -o -d $tmp_dir \"$fileName\""; system($cmdString, $retVal); $dirs = array(); - $doNotAdd = array('.', '..', '__MACOSX'); - array_push($dirs, $tmpDir); - $files = scandir($tmpDir); + $do_not_add = array('.', '..', '__MACOSX'); + array_push($dirs, $tmp_dir); + $files = scandir($tmp_dir); foreach ($files as $file) { - if (is_dir("$tmpDir/$file") & !in_array($file, $doNotAdd)) { - array_push($dirs, $tmpDir . $file); + if (is_dir("$tmp_dir/$file") & !in_array($file, $do_not_add)) { + array_push($dirs, $tmp_dir . $file); } } foreach ($dirs as $directory) { if ($inputs = opendir($directory)) { while (FALSE !== ($file_name = readdir($inputs))) { - if (!in_array($file_name, $doNotAdd) && is_dir($file_name) == FALSE) { + if (!in_array($file_name, $do_not_add) && is_dir($file_name) == FALSE) { $ext = strrchr($file_name, '.'); $base = preg_replace("/$ext$/", '', $file_name); $ext = substr($ext, 1); @@ -148,7 +148,7 @@ function batch_creation_form_submit($form, &$form_state) { foreach ($file_list as $label => $object_files) { $batch['operations'][] = array('create_batch_objects', array($label, $content_model, $object_files, $collection_pid, $namespace, $metadata)); } - $batch['operations'][] = array('recursive_directory_delete', array($tmpDir)); + $batch['operations'][] = array('recursive_directory_delete', array($tmp_dir)); batch_set($batch); batch_process(); } @@ -168,7 +168,7 @@ function create_batch_objects($label, $content_model, $object_files, $collection module_load_include('inc', 'fedora_reppository', 'api/fedora_item'); $cm = ContentModel::loadFromModel($content_model, 'ISLANDORACM'); - $allowedMimeTypes = $cm->getMimetypes(); + $allowed_mime_types = $cm->getMimetypes(); $mime_helper = new MimeClass(); $pid = fedora_item::get_next_PID_in_namespace($namespace); @@ -193,7 +193,7 @@ function create_batch_objects($label, $content_model, $object_files, $collection $use_primary = TRUE; foreach ($object_files as $ext => $filename) { $file_mimetype = $mime_helper->get_mimetype($filename); - if (in_array($file_mimetype, $allowedMimeTypes)) { + if (in_array($file_mimetype, $allowed_mime_types)) { $added = $cm->execIngestRules($filename, $file_mimetype); } else {