Browse Source

Added check_plain to the error handling

pull/46/head
Ben Woodhead 13 years ago
parent
commit
6494fa13a3
  1. 2
      BatchIngest.inc
  2. 18
      CollectionClass.inc
  3. 4
      ConnectionHelper.inc
  4. 2
      ObjectHelper.inc
  5. 2
      plugins/DarwinCore.inc
  6. 4
      plugins/Flv.inc
  7. 8
      plugins/FormBuilder.inc
  8. 4
      plugins/ModsFormBuilder.inc
  9. 4
      plugins/PersonalCollectionClass.inc
  10. 4
      plugins/ShowStreamsInFieldSets.inc

2
BatchIngest.inc

@ -229,7 +229,7 @@ function batch_create_dc_from_mods($mods_xml) {
try { try {
$proc = new XsltProcessor(); $proc = new XsltProcessor();
} catch (Exception $e) { } 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 " "; return " ";
} }

18
CollectionClass.inc

@ -131,7 +131,7 @@ class CollectionClass {
try { try {
$xml = new SimpleXMLElement($stream); $xml = new SimpleXMLElement($stream);
} catch (Exception $e) { } 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; return;
} }
$relationship = $xml->relationship[0]; $relationship = $xml->relationship[0];
@ -172,7 +172,7 @@ class CollectionClass {
try { try {
$xml = new SimpleXMLElement($stream); $xml = new SimpleXMLElement($stream);
} catch (Exception $e) { } 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; return;
} }
foreach ($xml->contentmodels->contentmodel as $contentModel) { foreach ($xml->contentmodels->contentmodel as $contentModel) {
@ -199,7 +199,7 @@ class CollectionClass {
$xml = new SimpleXMLElement($collection_stream); $xml = new SimpleXMLElement($collection_stream);
} catch (Exception $e) { } catch (Exception $e) {
if ($showError) { 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; return NULL;
} }
@ -239,7 +239,7 @@ class CollectionClass {
try { try {
$xml = new SimpleXMLElement($stream); $xml = new SimpleXMLElement($stream);
} catch (Exception $e) { } 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; return NULL;
} }
$formHandler = $xml->ingest_form; $formHandler = $xml->ingest_form;
@ -272,7 +272,7 @@ class CollectionClass {
try { try {
$xml = new SimpleXMLElement($stream); $xml = new SimpleXMLElement($stream);
} catch (Exception $e) { } 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; return;
} }
foreach ($xml->mimetypes->type as $type) { foreach ($xml->mimetypes->type as $type) {
@ -302,7 +302,7 @@ class CollectionClass {
try { try {
$xml = new SimpleXMLElement($stream); $xml = new SimpleXMLElement($stream);
} catch (Exception $e) { } 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; return FALSE;
} }
foreach ($xml->ingest_rules->rule as $rule) { foreach ($xml->ingest_rules->rule as $rule) {
@ -365,7 +365,7 @@ class CollectionClass {
try { try {
$xml = new SimpleXMLElement($stream); $xml = new SimpleXMLElement($stream);
} catch (Exception $e) { } 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; return FALSE;
} }
$docRoot = $_SERVER['DOCUMENT_ROOT']; $docRoot = $_SERVER['DOCUMENT_ROOT'];
@ -451,7 +451,7 @@ class CollectionClass {
$params $params
)); ));
} catch (exception $e) { } 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; return FALSE;
} }
$pid = implode(get_object_vars($object)); $pid = implode(get_object_vars($object));
@ -663,7 +663,7 @@ class CollectionClass {
throw new Exception("Invalid XML."); throw new Exception("Invalid XML.");
} }
} catch (Exception $e) { } 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 ''; return '';
} }
} }

4
ConnectionHelper.inc

@ -71,7 +71,7 @@ class ConnectionHelper {
'exceptions' => $exceptions, 'exceptions' => $exceptions,
)); ));
} catch (SoapFault $e) { } 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; return NULL;
} }
} }
@ -83,7 +83,7 @@ class ConnectionHelper {
'exceptions' => TRUE, 'exceptions' => TRUE,
)); ));
} catch (SoapFault $e) { } 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; return NULL;
} }
} }

2
ObjectHelper.inc

@ -750,7 +750,7 @@ class ObjectHelper {
try { try {
$parent_collections = new SimpleXMLElement($parent_collections); $parent_collections = new SimpleXMLElement($parent_collections);
} catch (exception $e) { } 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; return;
} }

2
plugins/DarwinCore.inc

@ -261,7 +261,7 @@ class DarwinCore {
try { try {
$proc = new XsltProcessor(); $proc = new XsltProcessor();
} catch (Exception $e) { } 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 " "; return " ";
} }

4
plugins/Flv.inc

@ -69,7 +69,7 @@ class FormBuilder {
$oai->appendChild($previousElement); $oai->appendChild($previousElement);
} }
} catch (exception $e) { } 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; continue;
} }
} }
@ -126,7 +126,7 @@ class FormBuilder {
unlink($form_values['fullpath']); unlink($form_values['fullpath']);
} }
} catch (exception $e) { } 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; return;
} }
} }

8
plugins/FormBuilder.inc

@ -68,7 +68,7 @@ class FormBuilder {
$oai->appendChild($previousElement); $oai->appendChild($previousElement);
} }
} catch (exception $e) { } 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; continue;
} }
} }
@ -96,7 +96,7 @@ class FormBuilder {
$xml = new SimpleXMLElement($policyStreamDoc); $xml = new SimpleXMLElement($policyStreamDoc);
} catch (Exception $e) { } catch (Exception $e) {
watchdog(t("Fedora_Repository"), t("Problem getting security policy."), NULL, WATCHDOG_ERROR); 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; return FALSE;
} }
$policyElement = $dom->createDocumentFragment(); $policyElement = $dom->createDocumentFragment();
@ -182,8 +182,8 @@ class FormBuilder {
} }
file_delete($form_values['ingest-file-location']); file_delete($form_values['ingest-file-location']);
} catch (exception $e) { } 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');
watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => $e->getMessage()), NULL, WATCHDOG_ERROR); watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
return; return;
} }
} }

4
plugins/ModsFormBuilder.inc

@ -316,8 +316,8 @@ class ModsFormBuilder extends FormBuilder {
} }
file_delete($form_values['ingest-file-location']); file_delete($form_values['ingest-file-location']);
} catch (exception $e) { } 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');
watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => $e->getMessage()), NULL, WATCHDOG_ERROR); watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
return; return;
} }
} }

4
plugins/PersonalCollectionClass.inc

@ -57,7 +57,7 @@ class PersonalCollectionClass {
$params $params
)); ));
} catch (exception $e) { } 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 FALSE;
} }
return TRUE; return TRUE;
@ -76,7 +76,7 @@ class PersonalCollectionClass {
$xml = new SimpleXMLElement($collectionTemplate); $xml = new SimpleXMLElement($collectionTemplate);
} catch (Exception $e) { } catch (Exception $e) {
watchdog(t("Fedora_Repository"), t("Problem creating personal collection policy, could not parse collection policy stream."), NULL, WATCHDOG_ERROR); 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; return FALSE;
} }
$policyElement = $dom->createDocumentFragment(); $policyElement = $dom->createDocumentFragment();

4
plugins/ShowStreamsInFieldSets.inc

@ -183,7 +183,7 @@ class ShowStreamsInFieldSets {
try { try {
$proc = new XsltProcessor(); $proc = new XsltProcessor();
} catch (Exception $e) { } 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 " "; return " ";
} }
$xsl = new DomDocument(); $xsl = new DomDocument();
@ -237,7 +237,7 @@ class ShowStreamsInFieldSets {
try { try {
$proc = new XsltProcessor(); $proc = new XsltProcessor();
} catch (Exception $e) { } 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; return;
} }
$xsl = new DomDocument(); $xsl = new DomDocument();

Loading…
Cancel
Save