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. 82
      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) {
$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 {
@ -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 " ";
}

18
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 '';
}
}

6
ConnectionHelper.inc

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

2
MimeClass.inc

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

6
ObjectHelper.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
* Object Helper Class
@ -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' => $e->getMessage())));
drupal_set_message(t('Error getting parent objects @e', array('@e' => check_plain($e->getMessage()))));
return;
}

2
SearchClass.inc

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

2
SecurityClass.inc

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

2
api/dublin_core.inc

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

2
api/fedora_export.inc

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

2
api/fedora_utils.inc

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

2
api/rels-ext.inc

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

4
api/tagging.inc

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

82
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!<br /><b>This cannot be undone</b><br />',
array(
'%name' => $name,
'%pid' => $pid)
$output = t('Are you sure you wish to purge object %name %pid!<br /><b>This cannot be undone</b><br />', 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"), '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('@message', array('@message' => check_plain($e->getMessage()))), 'error');
return;
}
$form_state['rebuild'] = TRUE;
@ -436,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) {
@ -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<br />',
array(
'%name' => $name)
$output = t('Are you sure you wish to purge this datastream %name<br />', array(
'%name' => $name)
);
$output .= drupal_get_form('fedora_repository_purge_stream_form', $pid, $dsId);
return $output;
@ -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');
}
else {
drupal_set_message(t($e->getMessage()), 'error');
drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
}
return;
}
@ -578,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', array('@message' => check_plain($e->getMessage()))), 'error');
}
$form_state['redirect'] = $base_url . "/fedora/repository/$pid";
}
@ -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');
}
@ -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 (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;
@ -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);
@ -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_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 ' ';
}
@ -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 <a href="http://sourceforge.net/projects/djatoka/">Djatoka</a> and <a href="http://www.kakadusoftware.com/index.php?option=com_content&task=view&id=26&Itemid=22">Kakadu</a>.)',
'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 <a href="http://sourceforge.net/projects/djatoka/">Djatoka</a> and <a href="http://www.kakadusoftware.com/index.php?option=com_content&task=view&id=26&Itemid=22">Kakadu</a>.)',
)
as $available_demo => $available_demo_desc) {
try {
@ -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_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 <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) {
}
@ -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');
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 <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) {
}
@ -1612,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 <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) {
}
@ -1634,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 <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) {
}
@ -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) {
@ -1653,14 +1650,14 @@ 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 <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) {
$error .= " - Problem ingesting islandora:largeimages collection";
}
}
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,
'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',
),
),
),
),
),
),
);
@ -1956,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;
}
@ -1965,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;
}
@ -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)
);
}

2
formClass.inc

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

2
plugins/CollectionFormBuilder.inc

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

2
plugins/CreateCollection.inc

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

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

2
plugins/DemoFormBuilder.inc

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

2
plugins/Exiftool.inc

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

2
plugins/FedoraObjectDetailedContent.inc

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

2
plugins/Ffmpeg.inc

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

6
plugins/Flv.inc

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

2
plugins/FlvFormBuilder.inc

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

10
plugins/FormBuilder.inc

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

2
plugins/ImageManipulation.inc

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

6
plugins/ModsFormBuilder.inc

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

6
plugins/PersonalCollectionClass.inc

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

6
plugins/Refworks.inc

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

2
plugins/ShowDemoStreamsInFieldSets.inc

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

6
plugins/ShowStreamsInFieldSets.inc

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

2
plugins/map_viewer.inc

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

2
plugins/qt_viewer.inc

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

2
plugins/slide_viewer.inc

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

2
plugins/tagging_form.inc

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

Loading…
Cancel
Save