Esempio n. 1
0
     $response['success'] = true;
     $response['files'] = list_nodes($_POST['path']);
     echo json_encode($response);
     break;
 case 'rename':
     $old_name = $_POST['oldname'];
     $new_name = $_POST['newname'];
     if ($server->rename($old_name, $new_name)) {
         echo '{"success":true}';
     } else {
         echo '{"success":false,"error":"Cannot rename file"}';
     }
     break;
 case 'newdir':
     $dir = $_POST['dir'];
     if ($server->mkdir($dir)) {
         echo '{"success":true}';
     } else {
         echo '{"success":false,"error":"Cannot create directory"}';
     }
     break;
 case 'newfile':
     $content = '';
     if ($server->put($_POST['file'], $content)) {
         echo '{"success":true}';
     } else {
         echo '{"success":false,"error":"Cannot create file"}';
     }
     break;
 case 'duplicate':
 case 'paste':