lots of bug fixes

This commit is contained in:
Uwe Steinmann 2016-09-15 14:00:42 +02:00
parent 4ccdcac7df
commit e55047fb58

View File

@ -140,11 +140,11 @@ function dumplog($version, $type, $logs, $indent) { /* {{{ */
if(!empty($a['file'])) {
$filename = $dms->contentDir . $document->getDir().'r'.(int) $a[$type2.'LogID'];
if(file_exists($filename)) {
echo $indent." <data length=\"".filesize($filename)."\"";
echo $indent." <data length=\"".filesize($filename)."\"";
if(filesize($filename) < $maxsize) {
echo ">\n";
echo chunk_split(base64_encode(file_get_contents($filename)), 76, "\n");
echo $indent." </data>\n";
echo $indent." </data>\n";
} else {
echo " fileref=\"".$filename."\" />\n";
if($contentdir) {
@ -163,6 +163,25 @@ function dumplog($version, $type, $logs, $indent) { /* {{{ */
echo $indent." </".$type."s>\n";
} /* }}} */
function dumpNotifications($notifications, $indent) { /* {{{ */
if($notifications) {
if($notifications['groups'] || $notifications['users']) {
echo $indent." <notifications>\n";
if($notifications['users']) {
foreach($notifications['users'] as $user) {
echo $indent." <user id=\"".$user->getID()."\" />\n";
}
}
if($notifications['groups']) {
foreach($notifications['groups'] as $group) {
echo $indent." <group id=\"".$group->getID()."\" />\n";
}
}
echo $indent." </notifications>\n";
}
}
} /* }}} */
function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */
global $sections, $statistic, $index, $dms, $maxsize, $contentdir;
@ -185,11 +204,19 @@ function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */
echo $indent." <attr type=\"user\" attrdef=\"".$attrdef->getID()."\">".wrapWithCData($attribute->getValue())."</attr>\n";
}
}
if($folder->inheritsAccess()) {
echo $indent." <acls type=\"inherited\" />\n";
} else {
echo $indent." <acls>\n";
$notifications = $folder->getNotifyList();
dumpNotifications($notifications, $indent);
/* getAccessList() returns also inherited access. So first check
* if inheritsAccess is set and don't output any acls in that case.
* There could be acls of the folder, which will be visible once the
* inheritsAccess is turned off. Those entries will be lost in the
* xml output.
*/
if(!$folder->inheritsAccess()) {
$accesslist = $folder->getAccessList();
if($accesslist['users'] || $accesslist['groups']) {
echo $indent." <acls>\n";
foreach($accesslist['users'] as $acl) {
echo $indent." <acl type=\"user\"";
$user = $acl->getUser();
@ -205,6 +232,7 @@ function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */
echo "/>\n";
}
echo $indent." </acls>\n";
}
}
echo $indent."</folder>\n";
$statistic['folders']++;
@ -252,10 +280,16 @@ function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */
}
}
/* Check if acl is not inherited */
/* getAccessList() returns also inherited access. So first check
* if inheritsAccess is set and don't output any acls in that case.
* There could be acls of the folder, which will be visible once the
* inheritsAccess is turned off. Those entries will be lost in the
* xml output.
*/
if(!$document->inheritsAccess()) {
echo $indent." <acls>\n";
$accesslist = $document->getAccessList();
if($accesslist['users'] || $accesslist['groups']) {
echo $indent." <acls>\n";
foreach($accesslist['users'] as $acl) {
echo $indent." <acl type=\"user\"";
$user = $acl->getUser();
@ -271,6 +305,7 @@ function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */
echo "/>\n";
}
echo $indent." </acls>\n";
}
}
$cats = $document->getCategories();
@ -383,7 +418,7 @@ function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */
} else {
echo " fileref=\"".$document->getID()."-A-".$file->getID().$file->getFileType()."\" />\n";
if($contentdir) {
copy($dms->contentDir . $version->getPath(), $contentdir.$document->getID()."-A-".$file->getID().$file->getFileType());
copy($dms->contentDir . $file->getPath(), $contentdir.$document->getID()."-A-".$file->getID().$file->getFileType());
} else {
echo "Warning: file content (size=".filesize($dms->contentDir . $file->getPath()).") will be missing from output\n";
}
@ -410,22 +445,7 @@ function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */
echo $indent." </links>\n";
}
$notifications = $document->getNotifyList();
if($notifications) {
if($notifications['groups'] || $notifications['users']) {
echo $indent." <notifications>\n";
if($notifications['users']) {
foreach($notifications['users'] as $user) {
echo $indent." <user id=\"".$user->getID()."\" />\n";
}
}
if($notifications['groups']) {
foreach($notifications['groups'] as $group) {
echo $indent." <group id=\"".$group->getID()."\" />\n";
}
}
echo $indent." </notifications>\n";
}
}
dumpNotifications($notifications, $indent);
echo $indent."</document>\n";
$statistic['documents']++;