|
|
|
|
@ -14,8 +14,37 @@ $view = new OC_Filesystemview('/'.$user.'/files_trashbin'); |
|
|
|
|
OCP\Util::addStyle('files', 'files'); |
|
|
|
|
OCP\Util::addScript('files', 'filelist'); |
|
|
|
|
|
|
|
|
|
$query = \OC_DB::prepare('SELECT id,location,timestamp,type,mime FROM *PREFIX*files_trash WHERE user=?'); |
|
|
|
|
$result = $query->execute(array($user))->fetchAll(); |
|
|
|
|
$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : ''; |
|
|
|
|
|
|
|
|
|
if ($dir) { |
|
|
|
|
$dirlisting = true; |
|
|
|
|
$view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_trashbin'); |
|
|
|
|
$fullpath = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($dir); |
|
|
|
|
$dirContent = opendir($fullpath); |
|
|
|
|
$i = 0; |
|
|
|
|
while($entryName = readdir($dirContent)) { |
|
|
|
|
if ( $entryName != '.' && $entryName != '..' ) { |
|
|
|
|
$pos = strpos($dir.'/', '/', 1); |
|
|
|
|
$tmp = substr($dir, 0, $pos); |
|
|
|
|
$pos = strrpos($tmp, '.d'); |
|
|
|
|
$timestamp = substr($tmp,$pos+2); |
|
|
|
|
error_log("timestamp: $timestamp"); |
|
|
|
|
$result[] = array( |
|
|
|
|
'id' => $entryName, |
|
|
|
|
'timestamp' => $timestamp, |
|
|
|
|
'mime' => $view->getMimeType($dir.'/'.$entryName), |
|
|
|
|
'type' => $view->is_dir($dir.'/'.$entryName) ? 'dir' : 'file', |
|
|
|
|
'location' => $dir, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
closedir($fullpath); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
$dirlisting = false; |
|
|
|
|
$query = \OC_DB::prepare('SELECT id,location,timestamp,type,mime FROM *PREFIX*files_trash WHERE user=?'); |
|
|
|
|
$result = $query->execute(array($user))->fetchAll(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$files = array(); |
|
|
|
|
foreach ($result as $r) { |
|
|
|
|
@ -38,15 +67,26 @@ foreach ($result as $r) { |
|
|
|
|
$files[] = $i; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Make breadcrumb |
|
|
|
|
$breadcrumb = array('dir' => '', 'name' => 'Trash'); |
|
|
|
|
$pathtohere = ''; |
|
|
|
|
foreach (explode('/', $dir) as $i) { |
|
|
|
|
if ($i != '') { |
|
|
|
|
$pathtohere .= '/' . $i; |
|
|
|
|
$breadcrumb[] = array('dir' => $pathtohere, 'name' => $i); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', ''); |
|
|
|
|
$breadcrumbNav->assign('breadcrumb', array(array('dir' => '', 'name' => 'Trash')), false); |
|
|
|
|
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php') . '?dir=', false); |
|
|
|
|
|
|
|
|
|
$list = new OCP\Template('files_trashbin', 'part.list', ''); |
|
|
|
|
$list->assign('files', $files, false); |
|
|
|
|
$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir=', false); |
|
|
|
|
$list->assign('downloadURL', OCP\Util::linkTo('files_trashbin', 'download.php') . '?file=', false); |
|
|
|
|
$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir='.$dir, false); |
|
|
|
|
$list->assign('downloadURL', OCP\Util::linkTo('files_trashbin', 'download.php') . '?file='.$dir, false); |
|
|
|
|
$list->assign('disableSharing', true); |
|
|
|
|
$list->assign('dirlisting', $dirlisting); |
|
|
|
|
$list->assign('disableDownloadActions', true); |
|
|
|
|
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false); |
|
|
|
|
$tmpl->assign('fileList', $list->fetchPage(), false); |
|
|
|
|
|