, 2013
*/
// Prepare
global $conf;
if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__).'/../../../../');
define('DOKU_DISABLE_GZIP_OUTPUT', 1);
// $conf and classpathes
require_once(DOKU_INC.'inc/init.php');
// db access
$helper = new helper_plugin_owncloud();
if(isset($_POST['fileid']) && $_POST['fileid'] > 0){
$dir = $helper->getFilenameForID($_POST['fileid']);
}else{
$dir = urldecode($_POST['dir']);
$dir = $helper->wikiIDToPath($dir);
}
$dir = trim($dir,'/');
$fullpath = $conf['mediadir'].'/'.$dir;
$metapath = $conf['mediametadir'].'/'.$dir;
$level = 'level0';
if(isset($_POST['level'])){
$levelInt = (intval(str_replace('level','',$_POST['level'])));
if($levelInt != 0){
$level = "";
for($i = 0; $i <= $levelInt; $i++) $level .= "level$i ";
$padding = 'style="padding-left:'.($levelInt*($helper->getConf('marginFilelist'))).'px;"';
}
}
if(file_exists($fullpath)){
$dircontent = scandir($fullpath);
natcasesort($dircontent); // sort by name
$files = array();
$folders = array();
foreach($dircontent as $file ){
if($file == '.' || $file == '..') continue;
if(is_dir($fullpath.'/'.$file)){
array_push($folders, $file);
}else{
array_push($files, $file);
}
}
if(empty($folders) && empty($files)) echo '
'.($helper->getLang('emptyFolder')).' |
';
$nr = 1;
foreach($folders as $folder){
$link = $helper->internalmedia(0,$helper->pathToWikiID($dir.'/'.$folder));
$mtime = strftime($conf['dformat'],filemtime($fullpath.'/'.$folder));
$title = $helper->_media($helper->getLastfileid(), $helper->pathToWikiID($dir.'/'.$folder), NULL, NULL, NULL, NULL, NULL, false);
$url = $helper->ml($helper->pathToWikiID($dir.'/'.$file), array('fileid'=>($helper->getLastfileid())),false);
$download = $helper->_formatLink(array('title'=>$title,'url'=>$url, 'class'=>"media mediafile detail"));
echo '';
echo ' '.$link.' | | '.$mtime.' | -- | '.$download.' | ';
echo '
';
$nr++;
}
foreach($files as $file){
$filesize = filesize_h(filesize($fullpath.'/'.$file));
$mtime = strftime($conf['dformat'],filemtime($fullpath.'/'.$file));
$detail = $helper->internalmedia(0,$helper->pathToWikiID($dir.'/'.$file),NULL,NULL,16,NULL,NULL,'linkonly');
$title = $helper->_media($helper->getLastfileid(), $helper->pathToWikiID($dir.'/'.$file), NULL, NULL, NULL, NULL, NULL, false);
$url = $helper->ml($helper->pathToWikiID($dir.'/'.$file), array('fileid'=>($helper->getLastfileid())),true);
$download = $helper->_formatLink(array('title'=>'download: '.$title,'url'=>$url, 'class'=>"media mediafile download"));
/*if(file_exists($metapath.'/'.$file.'.changes')){
$meta = file($metapath.'/'.$file.'.changes');
$authors = array();
foreach($meta as $onemeta){
$line = explode("\t", $onemeta);
if($line[4] != "" && !in_array($line[4],$authors)) array_push($authors,$line[4]);
}
$authorsString = implode(", ", $authors);
}*/
list($authorsString,$desc,$count) =$helper->getAuthorsAndDescOfMediafile($dir.'/'.$file);
echo '';
echo ' '.$detail.' | '.$authorsString.' | '.$mtime.' | '.$filesize.' | '.$download.' | ';
echo '
';
$nr++;
}
//echo '';
/*if(file_exists($conf['mediametadir']."/"."vwiki/graph.png.changes")) $a = file($conf['mediametadir']."/"."vwiki/graph.png.changes");
foreach($a as $aa){
$array = explode("\t", $aa);
echo $array[4]."
";
}*/
}
?>