summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/ajax/undelete.php
blob: f55629d695c3316b6617cfb12fef09b0a27f63b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php 

if(!OC_User::isLoggedIn()) {
	exit;
}

$timestamp = isset( $_REQUEST['timestamp'] ) ? $_REQUEST['timestamp'] : '';
$filename = isset( $_REQUEST['filename'] ) ? trim($_REQUEST['filename'], '/\\') : '';

if ( OCA_Trash\Trashbin::restore($filename, $timestamp) ) {
	OCP\JSON::success(array("data" => array('filename'=>$filename, 'timestamp' => $timestamp)));
} else {
	OCP\JSON::error(array("data" => array("message" => "Couldn't restore ".$filename)));	
}