Browse Source

Merge pull request #46 from bwoodhead/6.x

Coding standards and text sanitization
pull/47/merge
Ben Woodhead 13 years ago
parent
commit
a13ca35a03
  1. 40
      BatchIngest.inc
  2. 18
      CollectionClass.inc
  3. 6
      ConnectionHelper.inc
  4. 2
      MimeClass.inc
  5. 6
      ObjectHelper.inc
  6. 2
      SearchClass.inc
  7. 2
      SecurityClass.inc
  8. 2
      api/dublin_core.inc
  9. 2
      api/fedora_export.inc
  10. 4
      api/fedora_item.inc
  11. 2
      api/fedora_utils.inc
  12. 2
      api/rels-ext.inc
  13. 4
      api/tagging.inc
  14. 44
      fedora_repository.module
  15. 2
      formClass.inc
  16. 2
      plugins/CollectionFormBuilder.inc
  17. 2
      plugins/CreateCollection.inc
  18. 2
      plugins/DarwinCore.inc
  19. 2
      plugins/DemoFormBuilder.inc
  20. 2
      plugins/Exiftool.inc
  21. 2
      plugins/FedoraObjectDetailedContent.inc
  22. 2
      plugins/Ffmpeg.inc
  23. 6
      plugins/Flv.inc
  24. 2
      plugins/FlvFormBuilder.inc
  25. 10
      plugins/FormBuilder.inc
  26. 2
      plugins/ImageManipulation.inc
  27. 6
      plugins/ModsFormBuilder.inc
  28. 6
      plugins/PersonalCollectionClass.inc
  29. 6
      plugins/Refworks.inc
  30. 2
      plugins/ShowDemoStreamsInFieldSets.inc
  31. 6
      plugins/ShowStreamsInFieldSets.inc
  32. 2
      plugins/map_viewer.inc
  33. 2
      plugins/qt_viewer.inc
  34. 2
      plugins/slide_viewer.inc
  35. 2
      plugins/tagging_form.inc

40
BatchIngest.inc

@ -65,22 +65,22 @@ function batch_creation_form(&$form_state, $collection_pid, $content_models) {
*/ */
function batch_creation_form_validate($form, &$form_state) { function batch_creation_form_validate($form, &$form_state) {
$fieldName = 'file-location'; $field_name = 'file-location';
if (isset($_FILES['files']) && is_uploaded_file($_FILES['files']['tmp_name'][$fieldName])) { if (isset($_FILES['files']) && is_uploaded_file($_FILES['files']['tmp_name'][$field_name])) {
$file = file_save_upload($fieldName); $file = file_save_upload($field_name);
if ($file->filemime != 'application/zip') { 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; return;
} }
if (!$file) { if (!$file) {
form_set_error($fieldName, 'Error uploading file.'); form_set_error($field_name, 'Error uploading file.');
return; return;
} }
$form_state['values']['file'] = $file; $form_state['values']['file'] = $file;
} }
else { else {
// set error // set error
form_set_error($fieldName, 'Error uploading file.'); form_set_error($field_name, 'Error uploading file.');
return; return;
} }
} }
@ -100,27 +100,27 @@ function batch_creation_form_submit($form, &$form_state) {
} }
$namespace = $namespace_mappings[$content_model]; $namespace = $namespace_mappings[$content_model];
$namespace = preg_replace('/:.*/', '', $namespace); $namespace = preg_replace('/:.*/', '', $namespace);
$dirName = "temp" . $user->uid; $dir_name = "temp" . $user->uid;
$tmpDir = file_directory_path() . '/' . $dirName . '/'; $tmp_dir = file_directory_path() . '/' . $dir_name . '/';
mkdir($tmpDir); mkdir($tmp_dir);
$file = $form_state['values']['file']; $file = $form_state['values']['file'];
$fileName = $file->filepath; $fileName = $file->filepath;
$file_list = array(); $file_list = array();
$cmdString = "unzip -q -o -d $tmpDir \"$fileName\""; $cmdString = "unzip -q -o -d $tmp_dir \"$fileName\"";
system($cmdString, $retVal); system($cmdString, $retVal);
$dirs = array(); $dirs = array();
$doNotAdd = array('.', '..', '__MACOSX'); $do_not_add = array('.', '..', '__MACOSX');
array_push($dirs, $tmpDir); array_push($dirs, $tmp_dir);
$files = scandir($tmpDir); $files = scandir($tmp_dir);
foreach ($files as $file) { foreach ($files as $file) {
if (is_dir("$tmpDir/$file") & !in_array($file, $doNotAdd)) { if (is_dir("$tmp_dir/$file") & !in_array($file, $do_not_add)) {
array_push($dirs, $tmpDir . $file); array_push($dirs, $tmp_dir . $file);
} }
} }
foreach ($dirs as $directory) { foreach ($dirs as $directory) {
if ($inputs = opendir($directory)) { if ($inputs = opendir($directory)) {
while (FALSE !== ($file_name = readdir($inputs))) { 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, '.'); $ext = strrchr($file_name, '.');
$base = preg_replace("/$ext$/", '', $file_name); $base = preg_replace("/$ext$/", '', $file_name);
$ext = substr($ext, 1); $ext = substr($ext, 1);
@ -148,7 +148,7 @@ function batch_creation_form_submit($form, &$form_state) {
foreach ($file_list as $label => $object_files) { 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('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_set($batch);
batch_process(); 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'); module_load_include('inc', 'fedora_reppository', 'api/fedora_item');
$cm = ContentModel::loadFromModel($content_model, 'ISLANDORACM'); $cm = ContentModel::loadFromModel($content_model, 'ISLANDORACM');
$allowedMimeTypes = $cm->getMimetypes(); $allowed_mime_types = $cm->getMimetypes();
$mime_helper = new MimeClass(); $mime_helper = new MimeClass();
$pid = fedora_item::get_next_PID_in_namespace($namespace); $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; $use_primary = TRUE;
foreach ($object_files as $ext => $filename) { foreach ($object_files as $ext => $filename) {
$file_mimetype = $mime_helper->get_mimetype($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); $added = $cm->execIngestRules($filename, $file_mimetype);
} }
else { else {
@ -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 '';
} }
} }

6
ConnectionHelper.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file
@ -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
MimeClass.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

6
ObjectHelper.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file
* Object Helper Class * Object Helper Class
@ -386,7 +386,7 @@ class ObjectHelper {
$input = new DomDocument(); $input = new DomDocument();
$input->loadXML(trim($xmlstr)); $input->loadXML(trim($xmlstr));
} catch (exception $e) { } 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); $xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input); $newdom = $proc->transformToDoc($input);
@ -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
SearchClass.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
SecurityClass.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
api/dublin_core.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
api/fedora_export.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

4
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'); 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; return NULL;
} }
@ -904,7 +904,7 @@ class Fedora_Item {
} catch (exception $e) { } catch (exception $e) {
if (!$quiet) { 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; return NULL;
} }

2
api/fedora_utils.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
api/rels-ext.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

4
api/tagging.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file
@ -69,7 +69,7 @@ class TagSet {
$this->item->modify_datastream_by_value($tagdoc->saveXML(), $this->tagsDSID, 'Tags', 'text/xml', 'X'); $this->item->modify_datastream_by_value($tagdoc->saveXML(), $this->tagsDSID, 'Tags', 'text/xml', 'X');
} }
} catch (exception $e) { } 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 FALSE;
} }
return TRUE; return TRUE;

44
fedora_repository.module

@ -54,8 +54,7 @@ function fedora_repository_purge_object($pid = NULL, $name = NULL) {
drupal_set_message(t('You must specify an object pid to purge an object.'), 'error'); drupal_set_message(t('You must specify an object pid to purge an object.'), 'error');
return ''; return '';
} }
$output = t('Are you sure you wish to purge object %name %pid!<br /><b>This cannot be undone</b><br />', $output = t('Are you sure you wish to purge object %name %pid!<br /><b>This cannot be undone</b><br />', array(
array(
'%name' => $name, '%name' => $name,
'%pid' => $pid) '%pid' => $pid)
); );
@ -115,7 +114,7 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label
$collection_pid = urldecode($collection_pid); $collection_pid = urldecode($collection_pid);
} }
else { 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 ' '; return ' ';
} }
} }
@ -247,7 +246,7 @@ function fedora_repository_ingest_form_validate($form, &$form_state) {
elseif (!$cm->execIngestRules($file, $dformat)) { elseif (!$cm->execIngestRules($file, $dformat)) {
drupal_set_message(t('Error following Content Model Rules'), 'error'); drupal_set_message(t('Error following Content Model Rules'), 'error');
foreach (ContentModel::$errors as $err) { 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); file_delete($file);
} catch (exception $e) { } catch (exception $e) {
drupal_set_message(t($e->getMessage()), 'error'); drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
return; return;
} }
$form_state['rebuild'] = TRUE; $form_state['rebuild'] = TRUE;
@ -436,7 +435,7 @@ function add_stream_form_validate($form, &$form_state) {
return FALSE; return FALSE;
} }
if (!(preg_match("/^[a-zA-Z]/", $dsid))) { 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; return FALSE;
} }
if (strlen($dsLabel) > 64) { if (strlen($dsLabel) > 64) {
@ -482,8 +481,7 @@ function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL)
return ' '; return ' ';
} }
$output = t('Are you sure you wish to purge this datastream %name<br />', $output = t('Are you sure you wish to purge this datastream %name<br />', array(
array(
'%name' => $name) '%name' => $name)
); );
$output .= drupal_get_form('fedora_repository_purge_stream_form', $pid, $dsId); $output .= drupal_get_form('fedora_repository_purge_stream_form', $pid, $dsId);
@ -520,7 +518,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) {
drupal_set_message(t('Error: Insufficient permissions to purge object.'), 'error'); drupal_set_message(t('Error: Insufficient permissions to purge object.'), 'error');
} }
else { else {
drupal_set_message(t($e->getMessage()), 'error'); drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
} }
return; return;
} }
@ -578,7 +576,7 @@ function fedora_repository_purge_stream_form_submit($form, &$form_state) {
try { try {
$item->purge_datastream($dsid); $item->purge_datastream($dsid);
} catch (exception $e) { } catch (exception $e) {
drupal_set_message(t($e->getMessage()), 'error'); drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
} }
$form_state['redirect'] = $base_url . "/fedora/repository/$pid"; $form_state['redirect'] = $base_url . "/fedora/repository/$pid";
} }
@ -936,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 (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
if (user_access('access administration pages')) { 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(); drupal_access_denied();
exit; exit;
@ -995,7 +993,6 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
if (is_array($cmodel_tab)) { if (is_array($cmodel_tab)) {
$cmodel_tab['#selected'] = FALSE; $cmodel_tab['#selected'] = FALSE;
} }
} }
} }
$cmodels_tabs = array_merge($cmodels_tabs, $object_details); $cmodels_tabs = array_merge($cmodels_tabs, $object_details);
@ -1068,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_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error');
drupal_access_denied(); drupal_access_denied();
if (user_access('access administration pages')) { 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 ' '; return ' ';
} }
@ -1580,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_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') . '/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'); $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 <a href=\"" . $base_url . "/fedora/repository/islandora:ContentModelCollection\">islandora:ContentModelCollection</a>."), 'message'); drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/islandora:ContentModelCollection\">islandora:ContentModelCollection</a>.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) { } catch (exception $e) {
} }
@ -1592,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'); $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 { 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'); $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 <a href=\"" . $base_url . "/fedora/repository/islandora:root\">islandora:root</a>."), 'message'); drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/islandora:root\">islandora:root</a>.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) { } catch (exception $e) {
} }
@ -1612,7 +1609,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
$new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); $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'); $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'); $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 <a href=\"" . $base_url . "/fedora/repository/islandora:demos\">islandora:demos</a>."), 'message'); drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/islandora:demos\">islandora:demos</a>.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) { } catch (exception $e) {
} }
@ -1634,7 +1631,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
$dual_res_image_collection_cmodel = new Fedora_Item('demo:DualResImageCollection'); $dual_res_image_collection_cmodel = new Fedora_Item('demo:DualResImageCollection');
try { 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'); $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 <a href=\"" . $base_url . "/fedora/repository/demo:SmileyStuff\">demo:SmileyStuff</a> collection view."), 'message'); drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/demo:SmileyStuff\">demo:SmileyStuff</a> collection view.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) { } catch (exception $e) {
} }
@ -1653,14 +1650,14 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
try { try {
$item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'fedora_repository') . '/content_models/islandora_largeimages.xml'); $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'); $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 <a href=\"" . $base_url . "/fedora/repository/islandora:largeimages\">islandora:largeimages</a>."), 'message'); drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/islandora:largeimages\">islandora:largeimages</a>.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) { } catch (exception $e) {
$error .= " - Problem ingesting islandora:largeimages collection"; $error .= " - Problem ingesting islandora:largeimages collection";
} }
} }
if (!empty($error)) { if (!empty($error)) {
drupal_set_message(t('Some problems occurred: ' . $error)); drupal_set_message(t('Some problems occurred: @error', array('@error' => $error)));
} }
} }
} }
@ -1685,7 +1682,6 @@ function fedora_repository_required_fedora_objects() {
'dsversion' => 2, 'dsversion' => 2,
'cmodel' => 'fedora-system:ContentModel-3.0', 'cmodel' => 'fedora-system:ContentModel-3.0',
), ),
array( array(
'pid' => 'islandora:root', 'pid' => 'islandora:root',
'label' => 'Islandora Top-level Collection', 'label' => 'Islandora Top-level Collection',
@ -1956,7 +1952,7 @@ function fedora_repository_basket_form_submit($form, &$form_state) {
$foxml_dir = $export_dir . '/foxml'; $foxml_dir = $export_dir . '/foxml';
if (!file_exists($foxml_dir) && !@mkdir($foxml_dir, 0775, TRUE)) { 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; return FALSE;
} }
@ -1965,7 +1961,7 @@ function fedora_repository_basket_form_submit($form, &$form_state) {
$objects_dir = $export_dir . '/objects/' . $pid; $objects_dir = $export_dir . '/objects/' . $pid;
if (!file_exists($objects_dir) && !@mkdir($objects_dir, 0775, TRUE)) { 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; return FALSE;
} }
@ -2085,9 +2081,7 @@ function theme_add_to_basket_link($pid, $type = 'object') {
*/ */
if (!_is_added_to_basket($pid)) { if (!_is_added_to_basket($pid)) {
return l( 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))), 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)
"fedora/repository/addToBasket/" . $path,
array('html' => TRUE)
); );
} }

2
formClass.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
plugins/CollectionFormBuilder.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
plugins/CreateCollection.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

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 " ";
} }

2
plugins/DemoFormBuilder.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
plugins/Exiftool.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
plugins/FedoraObjectDetailedContent.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
plugins/Ffmpeg.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

6
plugins/Flv.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file
@ -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;
} }
} }

2
plugins/FlvFormBuilder.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

10
plugins/FormBuilder.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file
@ -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;
} }
} }

2
plugins/ImageManipulation.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

6
plugins/ModsFormBuilder.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file
@ -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;
} }
} }

6
plugins/PersonalCollectionClass.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file
@ -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();

6
plugins/Refworks.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file
@ -290,7 +290,7 @@ class Refworks {
if ($client == NULL) { if ($client == NULL) {
drupal_set_message(t('Error getting SOAP client.'), 'error'); 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; return;
} }
$object = $client->__soapCall('ingest', array( $object = $client->__soapCall('ingest', array(
@ -305,7 +305,7 @@ class Refworks {
} catch (exception $e) { } catch (exception $e) {
$errors++; $errors++;
$errorMessage = 'yes'; $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++; $success++;
} }

2
plugins/ShowDemoStreamsInFieldSets.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

6
plugins/ShowStreamsInFieldSets.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file
@ -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();

2
plugins/map_viewer.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
plugins/qt_viewer.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
plugins/slide_viewer.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

2
plugins/tagging_form.inc

@ -1,6 +1,6 @@
<?php <?php
// $Id$
/** /**
* @file * @file

Loading…
Cancel
Save