Skip to content

Commit

Permalink
Add Providence fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
collectiveaccess committed Jan 29, 2021
1 parent ebab47c commit 8163a71
Show file tree
Hide file tree
Showing 6 changed files with 1,430 additions and 420 deletions.
2 changes: 1 addition & 1 deletion app/helpers/utilityHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function caMakeProperUTF8ForXML($ps_text){

$vn_length = strlen($ps_text);
for ($i=0; $i < $vn_length; $i++) {
$vn_current = ord($ps_text{$i});
$vn_current = ord($ps_text[$i]);
if (($vn_current == 0x9) ||
($vn_current == 0xA) ||
($vn_current == 0xD) ||
Expand Down
8 changes: 3 additions & 5 deletions app/lib/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -6150,8 +6150,7 @@ public function htmlFormElementForSearch($po_request, $ps_field, $pa_options=nul
if (isset($pa_options['width'])) {
if ($va_dim = caParseFormElementDimension($pa_options['width'])) {
if ($va_dim['type'] == 'pixels') {
unset($pa_options['width']);
$pa_options['maxPixelWidth'] = $va_dim['dimension'];
$pa_options['width'] = ceil($va_dim['dimension']/7); // Temporary hack to approximate width
}
}
}
Expand Down Expand Up @@ -6224,8 +6223,7 @@ public function htmlFormElementForSimpleForm($po_request, $ps_field, $pa_options
if (isset($pa_options['width'])) {
if ($va_dim = caParseFormElementDimension($pa_options['width'])) {
if ($va_dim['type'] == 'pixels') {
unset($pa_options['width']);
$pa_options['maxPixelWidth'] = $va_dim['dimension'];
$pa_options['width'] = ceil($va_dim['dimension']/7); // Temporary hack to approximate width
}
}
}
Expand Down Expand Up @@ -8870,7 +8868,7 @@ public function htmlFormElement($ps_field, $ps_format=null, $pa_options=null) {
$post_max_size = caFormatFileSize(caReturnValueInBytes(ini_get( 'post_max_size' )));
$upload_max_filesize = caFormatFileSize(caReturnValueInBytes(ini_get( 'upload_max_filesize' )));

$vs_element = '<div class="formLabelUploadSizeNote"><input type="file" name="'.$pa_options["name"].'" id="'.$pa_options["id"].'" '.$vs_js.'/>'._t("Maximum upload size is ${post_max_size}") . '</div>';
$vs_element = '<div class="formLabelUploadSizeNote"><input type="file" name="'.$pa_options["name"].'" id="'.$pa_options["id"].'" '.$vs_js.'/>'._t("Maximum upload size is %1", $post_max_size) . '</div>';

// show current media icon
if ($vs_version = (array_key_exists('displayMediaVersion', $pa_options)) ? $pa_options['displayMediaVersion'] : 'icon') {
Expand Down
13 changes: 9 additions & 4 deletions app/lib/Logging/Eventlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ public function log($pa_entry) {
if (!$pa_entry["MESSAGE"]) {
return false;
}

$purifier = new HTMLPurifier();
$this->o_db->query("
INSERT INTO ca_eventlog
(date_time, code, message, source)
VALUES
(unix_timestamp(), ?, ?, ?)
", $pa_entry["CODE"], $pa_entry["MESSAGE"], $pa_entry["SOURCE"]);
", $pa_entry["CODE"], $purifier->purify($pa_entry["MESSAGE"]), $pa_entry["SOURCE"]);

return true;
}
Expand Down Expand Up @@ -125,11 +125,16 @@ public function search($ps_datetime_expression, $ps_code=null) {
ORDER BY date_time DESC
");
}
return $qr_log->getAllRows();
$entries = $qr_log->getAllRows();
$purifier = new HTMLPurifier();
return array_map(function($e) use ($purifier) {
$e['message'] = $purifier->purify($e['message']);
return $e;
}, $entries);
}
}
return null;
}
# ----------------------------------------
}
?>
?>
12 changes: 6 additions & 6 deletions app/models/ca_bundle_displays.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@
'width' => 100, 'height' => 4,
'takesLocale' => false,
'options' => [
'Search/browse (thumbnail view)' => 'search_browse_thumbnail',
'Search/browse (full view)' => 'search_browse_full',
'Search/browse (list view)' => 'search_browse_list',
'Editor summaries' => 'editor_summary',
'Editor relationship bundles' => 'editor_relationship_bundle',
'Set items bundles' => 'set_item_bundle'
_t('Search/browse (thumbnail view)') => 'search_browse_thumbnail',
_t('Search/browse (full view)') => 'search_browse_full',
_t('Search/browse (list view)') => 'search_browse_list',
_t('Editor summaries') => 'editor_summary',
_t('Editor relationship bundles') => 'editor_relationship_bundle',
_t('Set items bundles') => 'set_item_bundle'
],
'default' => '',
'label' => _t('Show display in'),
Expand Down
2 changes: 1 addition & 1 deletion app/models/ca_data_importers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,7 @@ static public function importDataFromSource($ps_source, $ps_mapping, $pa_options
break;
case 'ca_object_representations':
if ($vn_rel_id = DataMigrationUtils::getObjectRepresentationID($vs_name, $va_element_data['_type'], $vn_locale_id, $va_data_for_rel_table, array('forceUpdate' => true, 'dontCreate' => $vb_dont_create, 'matchOn' => $va_match_on, 'log' => $o_log, 'transaction' => $o_trans, 'importEvent' => $o_event, 'importEventSource' => $vn_row, 'nonPreferredLabels' => $va_nonpreferred_labels, 'matchMediaFilesWithoutExtension' => true))) {
$t_subject->linkRepresentation($vn_rel_id, null, null, null, null, array('type_id' => trim($va_element_data['_relationship_type']), 'is_primary' => true));
$t_subject->linkRepresentation($vn_rel_id, true, ['type_id' => trim($va_element_data['_relationship_type'])]);

if ($vs_error = DataMigrationUtils::postError($t_subject, _t("[%1] Could not add related object representation with:", $vs_idno), __CA_DATA_IMPORT_ERROR__, array('dontOutputLevel' => true, 'dontPrint' => true))) {
ca_data_importers::logImportError($vs_error, $va_log_import_error_opts);
Expand Down
Loading

0 comments on commit 8163a71

Please sign in to comment.