From 5ca2bf9fe06397a1e87c7c643fb4e60e1bce2897 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 19 Apr 2023 06:41:52 +0200 Subject: [PATCH 1/2] check for openssl and openssl_cipher_iv_length --- views/bootstrap/class.Info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.Info.php b/views/bootstrap/class.Info.php index 71b9a030b..4b4bb439f 100644 --- a/views/bootstrap/class.Info.php +++ b/views/bootstrap/class.Info.php @@ -105,12 +105,12 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style { echo implode(', ', $phpextensions); $this->contentHeading(getMLText("missing_php_extensions")); - $requiredext = array('zip', 'xml', 'xsl', 'json', 'intl', 'fileinfo', 'mbstring', 'curl', 'sqlite3', 'imagick'); + $requiredext = array('zip', 'xml', 'xsl', 'json', 'intl', 'fileinfo', 'mbstring', 'curl', 'sqlite3', 'imagick', 'openssl'); echo implode(', ', array_diff($requiredext, $phpextensions)); $this->contentHeading(getMLText("missing_php_functions_and_classes")); $missingfunc = []; - foreach(array('proc_open') as $funcname) { + foreach(array('proc_open', 'openssl_cipher_iv_length') as $funcname) { if(!function_exists($funcname)) { $missingfunc[] = $funcname; //getMLText('func_'.$funcname."_missing") } From 874aecb4bb670a1203957a1fb7a6cd6e32adddee Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 19 Apr 2023 13:59:01 +0200 Subject: [PATCH 2/2] search form shows 'from' and 'to' field for integers and floats --- CHANGELOG | 1 + views/bootstrap/class.Bootstrap.php | 28 +++++++++++++------------ views/bootstrap/class.Search.php | 17 ++++++++++++--- views/bootstrap4/class.Bootstrap4.php | 30 ++++++++++++++------------- 4 files changed, 46 insertions(+), 30 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3b0cfc5c2..c19c333ca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ - fix preview for file in drop folder - fix export of search result - use openssl instead of mcrypt +- search form shows 'from' and 'to' field for integers and floats -------------------------------------------------------------------------------- Changes in version 5.1.30 diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index c737c3c05..47ea6b006 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1878,28 +1878,30 @@ $(document).ready(function() { function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */ $dms = $this->params['dms']; + $attr_id = $fieldname.'_'.$attrdef->getId().($namepostfix ? '_'.$namepostfix : ''); + $attr_name = $fieldname.'['.$attrdef->getId().']'.($namepostfix ? '['.$namepostfix.']' : ''); $content = ''; switch($attrdef->getType()) { case SeedDMS_Core_AttributeDefinition::type_boolean: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; - $content .= "getId()."]\" value=\"\" />"; - $content .= "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"1\" ".($objvalue ? 'checked' : '')." />"; + $content .= ""; + $content .= ""; break; case SeedDMS_Core_AttributeDefinition::type_date: $objvalue = $attribute ? getReadableDate((is_object($attribute) ? $attribute->getValue() : $attribute)) : ''; $dateformat = getConvertDateFormat($this->params['settings']->_dateformat); $content .= ' - + '; break; case SeedDMS_Core_AttributeDefinition::type_email: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; - $content .= "getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '').' data-rule-email="true"'." />"; + $content .= "getMinValues() > 0) ? ' required="required"' : '').' data-rule-email="true"'." />"; break; case SeedDMS_Core_AttributeDefinition::type_float: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; - $content .= "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." data-rule-number=\"true\"/>"; + $content .= "getMinValues() > 0) ? ' required="required"' : '')." data-rule-number=\"true\"/>"; break; case SeedDMS_Core_AttributeDefinition::type_folder: $objvalue = $attribute ? (is_object($attribute) ? (int) $attribute->getValue() : (int) $attribute) : 0; @@ -1907,7 +1909,7 @@ $(document).ready(function() { $target = $dms->getFolder($objvalue); else $target = null; - $content .= $this->getFolderChooserHtml("attr".$attrdef->getId(), M_READWRITE, -1, $target, $fieldname."[".$attrdef->getId()."]", false); + $content .= $this->getFolderChooserHtml("attr".$attrdef->getId(), M_READWRITE, -1, $target, $attr_name, false); break; case SeedDMS_Core_AttributeDefinition::type_document: $objvalue = $attribute ? (is_object($attribute) ? (int) $attribute->getValue() : (int) $attribute) : 0; @@ -1915,7 +1917,7 @@ $(document).ready(function() { $target = $dms->getDocument($objvalue); else $target = null; - $content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), $target, $fieldname."[".$attrdef->getId()."]"); + $content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), $target, $attr_name); break; case SeedDMS_Core_AttributeDefinition::type_user: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array(); @@ -1923,7 +1925,7 @@ $(document).ready(function() { if($users) { $allowempty = $attrdef->getMinValues() == 0; $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple; - $content .= ""; if($allowempty) $content .= ""; foreach($users as $curuser) { @@ -1943,7 +1945,7 @@ $(document).ready(function() { if($groups) { $allowempty = $attrdef->getMinValues() == 0; $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple; - $content .= ""; if($allowempty) $content .= ""; foreach($groups as $curgroup) { @@ -1959,8 +1961,8 @@ $(document).ready(function() { break; default: if($valueset = $attrdef->getValueSetAsArray()) { - $content .= "getId()."]\" value=\"\"/>"; - $content .= ""; + $content .= ""; + $content .= ""; } else { - $content .= "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '').($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int ? ' data-rule-digits="true"' : '')." />"; + $content .= "getMinValues() > 0) ? ' required="required"' : '').($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int ? ' data-rule-digits="true"' : '')." />"; } } break; diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 5fd7ded68..05b2223bc 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -577,7 +577,7 @@ function typeahead() { /* {{{ */ * even if it is empty. FIXME should be also checked. */ $hasattrs = true; - if($attrdef->getType() != SeedDMS_Core_AttributeDefinition::type_date) + if(!in_array($attrdef->getType(), [SeedDMS_Core_AttributeDefinition::type_date, SeedDMS_Core_AttributeDefinition::type_int, SeedDMS_Core_AttributeDefinition::type_float])) if(!empty($attributes[$attrdef->getID()])) $openfilterdlg = true; } @@ -591,6 +591,9 @@ function typeahead() { /* {{{ */ if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) { $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from')); $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to')); + } elseif(in_array($attrdef->getType(), [SeedDMS_Core_AttributeDefinition::type_int, SeedDMS_Core_AttributeDefinition::type_float]) && !$attrdef->getValueSet()) { + $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? $attributes[$attrdef->getID()]['from'] : '', 'attributes', true, 'from')); + $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? $attributes[$attrdef->getID()]['to'] : '', 'attributes', true, 'to')); } else $this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true)); } @@ -612,7 +615,7 @@ function typeahead() { /* {{{ */ /* Do not check dates because they always have 'from' and 'to' element * even if it is empty. FIXME should be also checked. */ - if($attrdef->getType() != SeedDMS_Core_AttributeDefinition::type_date) + if(!in_array($attrdef->getType(), [SeedDMS_Core_AttributeDefinition::type_date, SeedDMS_Core_AttributeDefinition::type_int, SeedDMS_Core_AttributeDefinition::type_float])) if(!empty($attributes[$attrdef->getID()])) $openfilterdlg = true; } @@ -694,6 +697,10 @@ function typeahead() { /* {{{ */ if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) { $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from')); $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to')); + } elseif(in_array($attrdef->getType(), [SeedDMS_Core_AttributeDefinition::type_int, SeedDMS_Core_AttributeDefinition::type_float]) && !$attrdef->getValueSet()) { + $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? $attributes[$attrdef->getID()]['from'] : '', 'attributes', true, 'from')); + $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? $attributes[$attrdef->getID()]['to'] : '', 'attributes', true, 'to')); + } else $this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true, '', true)); } @@ -714,7 +721,7 @@ function typeahead() { /* {{{ */ foreach($attrdefs as $attrdef) { if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) { $hasattrs = true; - if($attrdef->getType() != SeedDMS_Core_AttributeDefinition::type_date) + if(!in_array($attrdef->getType(), [SeedDMS_Core_AttributeDefinition::type_date, SeedDMS_Core_AttributeDefinition::type_int, SeedDMS_Core_AttributeDefinition::type_float])) if(!empty($attributes[$attrdef->getID()])) $openfilterdlg = true; } @@ -728,6 +735,10 @@ function typeahead() { /* {{{ */ if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) { $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from')); $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to')); + } elseif(in_array($attrdef->getType(), [SeedDMS_Core_AttributeDefinition::type_int, SeedDMS_Core_AttributeDefinition::type_float]) && !$attrdef->getValueSet()) { + $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? $attributes[$attrdef->getID()]['from'] : '', 'attributes', true, 'from')); + $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? $attributes[$attrdef->getID()]['to'] : '', 'attributes', true, 'to')); + } else $this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true, '', true)); } diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 8c2696669..3e838522a 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -1920,25 +1920,27 @@ $(document).ready(function() { function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */ $dms = $this->params['dms']; + $attr_id = $fieldname.'_'.$attrdef->getId().($namepostfix ? '_'.$namepostfix : ''); + $attr_name = $fieldname.'['.$attrdef->getId().']'.($namepostfix ? '['.$namepostfix.']' : ''); $content = ''; switch($attrdef->getType()) { case SeedDMS_Core_AttributeDefinition::type_boolean: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; - $content .= "getId()."]\" value=\"\" />"; - $content .= "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"1\" ".($objvalue ? 'checked' : '')." />"; + $content .= ""; + $content .= ""; break; case SeedDMS_Core_AttributeDefinition::type_date: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; $dateformat = getConvertDateFormat($this->params['settings']->_dateformat); /* $content .= ' - + '; */ $content = '
- +
@@ -1947,11 +1949,11 @@ $(document).ready(function() { break; case SeedDMS_Core_AttributeDefinition::type_email: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; - $content .= "getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '').' data-rule-email="true"'." />"; + $content .= "getMinValues() > 0) ? ' required="required"' : '').' data-rule-email="true"'." />"; break; case SeedDMS_Core_AttributeDefinition::type_float: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; - $content .= "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." data-rule-number=\"true\"/>"; + $content .= "getMinValues() > 0) ? ' required="required"' : '')." data-rule-number=\"true\"/>"; break; case SeedDMS_Core_AttributeDefinition::type_folder: $objvalue = $attribute ? (is_object($attribute) ? (int) $attribute->getValue() : (int) $attribute) : 0; @@ -1959,7 +1961,7 @@ $(document).ready(function() { $target = $dms->getFolder($objvalue); else $target = null; - $content .= $this->getFolderChooserHtml("attr".$attrdef->getId(), M_READWRITE, -1, $target, $fieldname."[".$attrdef->getId()."]", false); + $content .= $this->getFolderChooserHtml("attr".$attrdef->getId(), M_READWRITE, -1, $target, $attr_name, false); break; case SeedDMS_Core_AttributeDefinition::type_document: $objvalue = $attribute ? (is_object($attribute) ? (int) $attribute->getValue() : (int) $attribute) : 0; @@ -1967,7 +1969,7 @@ $(document).ready(function() { $target = $dms->getDocument($objvalue); else $target = null; - $content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), $target, $fieldname."[".$attrdef->getId()."]"); + $content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), $target, $attr_name); break; case SeedDMS_Core_AttributeDefinition::type_user: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array(); @@ -1975,7 +1977,7 @@ $(document).ready(function() { if($users) { $allowempty = $attrdef->getMinValues() == 0; $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple; - $content .= ""; if($allowempty) $content .= ""; foreach($users as $curuser) { @@ -1995,7 +1997,7 @@ $(document).ready(function() { if($groups) { $allowempty = $attrdef->getMinValues() == 0; $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple; - $content .= ""; if($allowempty) $content .= ""; foreach($groups as $curgroup) { @@ -2011,8 +2013,8 @@ $(document).ready(function() { break; default: if($valueset = $attrdef->getValueSetAsArray()) { - $content .= "getId()."]\" value=\"\"/>"; - $content .= ""; + $content .= ""; + $content .= ""; } else { - $content .= "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '').($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int ? ' data-rule-digits="true"' : '')." />"; + $content .= "getMinValues() > 0) ? ' required="required"' : '').($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int ? ' data-rule-digits="true"' : '')." />"; } } break;