mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 12:41:30 +00:00
better error checking when setting a custom attribute
This commit is contained in:
parent
2317c092d6
commit
63d4ee9460
|
@ -904,48 +904,34 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
} else {
|
} else {
|
||||||
$this->logger->log('PROPPATCH: set '.$prop["ns"].''.$prop["val"].' to '.$prop["val"], PEAR_LOG_INFO);
|
$this->logger->log('PROPPATCH: set '.$prop["ns"].''.$prop["val"].' to '.$prop["val"], PEAR_LOG_INFO);
|
||||||
if($prop["ns"] == "SeedDMS:") {
|
if($prop["ns"] == "SeedDMS:") {
|
||||||
if (isset($prop["val"]))
|
if(in_array($prop['name'], array('id', 'version', 'status', 'status-comment', 'status-date'))) {
|
||||||
$val = $prop["val"];
|
$options["props"][$key]['status'] = "403 Forbidden";
|
||||||
else
|
} else {
|
||||||
$val = '';
|
if (isset($prop["val"]))
|
||||||
switch($prop["name"]) {
|
$val = $prop["val"];
|
||||||
case "comment":
|
else
|
||||||
$obj->setComment($val);
|
$val = '';
|
||||||
break;
|
switch($prop["name"]) {
|
||||||
default:
|
case "comment":
|
||||||
if($attrdef = $this->dms->getAttributeDefinitionByName($prop["name"])) {
|
$obj->setComment($val);
|
||||||
$valueset = $attrdef->getValueSetAsArray();
|
break;
|
||||||
switch($attrdef->getType()) {
|
default:
|
||||||
case SeedDMS_Core_AttributeDefinition::type_string:
|
if($attrdef = $this->dms->getAttributeDefinitionByName($prop["name"])) {
|
||||||
if($valueset) {
|
$valueset = $attrdef->getValueSetAsArray();
|
||||||
if(in_array($val, $valueset)) {
|
switch($attrdef->getType()) {
|
||||||
$obj->setAttributeValue($attrdef, $val);
|
case SeedDMS_Core_AttributeDefinition::type_string:
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$obj->setAttributeValue($attrdef, $val);
|
$obj->setAttributeValue($attrdef, $val);
|
||||||
}
|
break;
|
||||||
break;
|
case SeedDMS_Core_AttributeDefinition::type_int:
|
||||||
case SeedDMS_Core_AttributeDefinition::type_int:
|
|
||||||
if($valueset) {
|
|
||||||
if(in_array($val, $valueset)) {
|
|
||||||
$obj->setAttributeValue($attrdef, (int) $val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$obj->setAttributeValue($attrdef, (int) $val);
|
$obj->setAttributeValue($attrdef, (int) $val);
|
||||||
}
|
break;
|
||||||
break;
|
case SeedDMS_Core_AttributeDefinition::type_float:
|
||||||
case SeedDMS_Core_AttributeDefinition::type_float:
|
|
||||||
if($valueset) {
|
|
||||||
if(in_array($val, $valueset)) {
|
|
||||||
$obj->setAttributeValue($attrdef, (float) $val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$obj->setAttributeValue($attrdef, (float) $val);
|
$obj->setAttributeValue($attrdef, (float) $val);
|
||||||
|
break;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_boolean:
|
||||||
|
$obj->setAttributeValue($attrdef, $val == 1 ? true : false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case SeedDMS_Core_AttributeDefinition::type_boolean:
|
|
||||||
$obj->setAttributeValue($attrdef, $val == 1 ? true : false);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user