nextcloud/apps/files_trashbin/ajax/undelete.php

15 lines
464 B
PHP
Raw Normal View History

2013-01-18 16:11:29 +04:00
<?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)));
}