diff options
Diffstat (limited to 'files/ajax/newfolder.php')
-rw-r--r-- | files/ajax/newfolder.php | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/files/ajax/newfolder.php b/files/ajax/newfolder.php index 8eb05280e73..43d87461fc7 100644 --- a/files/ajax/newfolder.php +++ b/files/ajax/newfolder.php @@ -3,27 +3,20 @@ // Init owncloud require_once('../../lib/base.php'); -// We send json data -header( "Content-Type: application/jsonrequest" ); - -// Check if we are a user -if( !OC_User::isLoggedIn()){ - echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); - exit(); -} +OC_JSON::checkLoggedIn(); // Get the params $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; $foldername = isset( $_GET['foldername'] ) ? $_GET['foldername'] : ''; if($foldername == '') { - echo json_encode( array( "status" => "error", "data" => array( "message" => "Empty Foldername" ))); + OC_JSON::error(array("data" => array( "message" => "Empty Foldername" ))); exit(); } if(defined("DEBUG") && DEBUG) {error_log('try to create ' . $foldername . ' in ' . $dir);} if(OC_Files::newFile($dir, $foldername, 'dir')) { - echo json_encode( array( "status" => "success", "data" => array())); + OC_JSON::success(array("data" => array())); exit(); } -echo json_encode( array( "status" => "error", "data" => array( "message" => "Error when creating the folder" )));
\ No newline at end of file +OC_JSON::error(array("data" => array( "message" => "Error when creating the folder" ))); |