diff --git a/utils/xmldump.php b/utils/xmldump.php index 38579f4c0..37bd87c46 100644 --- a/utils/xmldump.php +++ b/utils/xmldump.php @@ -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." \n"; echo chunk_split(base64_encode(file_get_contents($filename)), 76, "\n"); - echo $indent." \n"; + echo $indent." \n"; } else { echo " fileref=\"".$filename."\" />\n"; if($contentdir) { @@ -163,6 +163,25 @@ function dumplog($version, $type, $logs, $indent) { /* {{{ */ echo $indent." \n"; } /* }}} */ +function dumpNotifications($notifications, $indent) { /* {{{ */ + if($notifications) { + if($notifications['groups'] || $notifications['users']) { + echo $indent." \n"; + if($notifications['users']) { + foreach($notifications['users'] as $user) { + echo $indent." getID()."\" />\n"; + } + } + if($notifications['groups']) { + foreach($notifications['groups'] as $group) { + echo $indent." getID()."\" />\n"; + } + } + echo $indent." \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." getID()."\">".wrapWithCData($attribute->getValue())."\n"; } } - if($folder->inheritsAccess()) { - echo $indent." \n"; - } else { - echo $indent." \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." \n"; foreach($accesslist['users'] as $acl) { echo $indent." getUser(); @@ -205,6 +232,7 @@ function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */ echo "/>\n"; } echo $indent." \n"; + } } echo $indent."\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." \n"; $accesslist = $document->getAccessList(); + if($accesslist['users'] || $accesslist['groups']) { + echo $indent." \n"; foreach($accesslist['users'] as $acl) { echo $indent." getUser(); @@ -271,6 +305,7 @@ function tree($folder, $parent=null, $indent='', $skipcurrent=false) { /* {{{ */ echo "/>\n"; } echo $indent." \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." \n"; } $notifications = $document->getNotifyList(); - if($notifications) { - if($notifications['groups'] || $notifications['users']) { - echo $indent." \n"; - if($notifications['users']) { - foreach($notifications['users'] as $user) { - echo $indent." getID()."\" />\n"; - } - } - if($notifications['groups']) { - foreach($notifications['groups'] as $group) { - echo $indent." getID()."\" />\n"; - } - } - echo $indent." \n"; - } - } + dumpNotifications($notifications, $indent); echo $indent."\n"; $statistic['documents']++;