diff options
author | Frank Karlitschek <frank@owncloud.org> | 2012-05-03 12:23:29 +0200 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2012-05-03 12:23:29 +0200 |
commit | 43caa3b3b9cc9dbbf73ab2f6695a801a07a1dba5 (patch) | |
tree | f4b191f0d039cb7de942554ea23df3fff9de7ad6 /apps/files | |
parent | 375ba986452b190745b9388be92737d7e5771673 (diff) | |
download | nextcloud-server-43caa3b3b9cc9dbbf73ab2f6695a801a07a1dba5.tar.gz nextcloud-server-43caa3b3b9cc9dbbf73ab2f6695a801a07a1dba5.zip |
ported oc_json
Diffstat (limited to 'apps/files')
-rwxr-xr-x[-rw-r--r--] | apps/files/ajax/autocomplete.php | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files/ajax/delete.php | 6 | ||||
-rwxr-xr-x | apps/files/ajax/list.php | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files/ajax/move.php | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files/ajax/newfile.php | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files/ajax/newfolder.php | 8 | ||||
-rwxr-xr-x | apps/files/ajax/rawlist.php | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files/ajax/rename.php | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files/ajax/scan.php | 4 | ||||
-rwxr-xr-x | apps/files/ajax/upload.php | 14 |
10 files changed, 35 insertions, 35 deletions
diff --git a/apps/files/ajax/autocomplete.php b/apps/files/ajax/autocomplete.php index 8cdb6188a02..7ff34da96b3 100644..100755 --- a/apps/files/ajax/autocomplete.php +++ b/apps/files/ajax/autocomplete.php @@ -5,7 +5,7 @@ // Init owncloud -OC_JSON::checkLoggedIn(); +OCP\JSON::checkLoggedIn(); // Get data $query = $_GET['term']; @@ -51,6 +51,6 @@ if(OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)){ } } } -OC_JSON::encodedPrint($files); +OCP\JSON::encodedPrint($files); ?> diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php index d8a01d7acf1..ed155de0dc7 100644..100755 --- a/apps/files/ajax/delete.php +++ b/apps/files/ajax/delete.php @@ -3,7 +3,7 @@ // Init owncloud -OC_JSON::checkLoggedIn(); +OCP\JSON::checkLoggedIn(); // Get data $dir = stripslashes($_GET["dir"]); @@ -21,9 +21,9 @@ foreach($files as $file) { } if($success) { - OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $files ))); + OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $files ))); } else { - OC_JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError ))); + OCP\JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError ))); } ?> diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index 0bff5742ef4..520e54e708d 100755 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -6,7 +6,7 @@ $RUNTIME_APPTYPES=array('filesystem'); // Init owncloud -OC_JSON::checkLoggedIn(); +OCP\JSON::checkLoggedIn(); // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; @@ -41,6 +41,6 @@ $list = new OC_Template( "files", "part.list", "" ); $list->assign( "files", $files ); $data = array('files' => $list->fetchPage()); -OC_JSON::success(array('data' => $data)); +OCP\JSON::success(array('data' => $data)); ?> diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php index 0ad314f873c..945fe4e7b82 100644..100755 --- a/apps/files/ajax/move.php +++ b/apps/files/ajax/move.php @@ -3,7 +3,7 @@ // Init owncloud -OC_JSON::checkLoggedIn(); +OCP\JSON::checkLoggedIn(); // Get data $dir = stripslashes($_GET["dir"]); @@ -12,9 +12,9 @@ $target = stripslashes($_GET["target"]); if(OC_Files::move($dir,$file,$target,$file)){ - OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $file ))); + OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $file ))); }else{ - OC_JSON::error(array("data" => array( "message" => "Could not move $file" ))); + OCP\JSON::error(array("data" => array( "message" => "Could not move $file" ))); } ?> diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index 472b577a32a..2712b54f063 100644..100755 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -3,7 +3,7 @@ // Init owncloud -OC_JSON::checkLoggedIn(); +OCP\JSON::checkLoggedIn(); // Get the params $dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : ''; @@ -12,13 +12,13 @@ $content = isset( $_POST['content'] ) ? $_POST['content'] : ''; $source = isset( $_POST['source'] ) ? stripslashes($_POST['source']) : ''; if($filename == '') { - OC_JSON::error(array("data" => array( "message" => "Empty Filename" ))); + OCP\JSON::error(array("data" => array( "message" => "Empty Filename" ))); exit(); } if($source){ if(substr($source,0,8)!='https://' and substr($source,0,7)!='http://'){ - OC_JSON::error(array("data" => array( "message" => "Not a valid source" ))); + OCP\JSON::error(array("data" => array( "message" => "Not a valid source" ))); exit(); } $sourceStream=fopen($source,'rb'); @@ -26,10 +26,10 @@ if($source){ $result=OC_Filesystem::file_put_contents($target,$sourceStream); if($result){ $mime=OC_Filesystem::getMimetype($target); - OC_JSON::success(array("data" => array('mime'=>$mime))); + OCP\JSON::success(array("data" => array('mime'=>$mime))); exit(); }else{ - OC_JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target ))); + OCP\JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target ))); exit(); } } @@ -39,9 +39,9 @@ if(OC_Files::newFile($dir, $filename, 'file')) { if($content){ OC_Filesystem::file_put_contents($dir.'/'.$filename,$content); } - OC_JSON::success(array("data" => array('content'=>$content))); + OCP\JSON::success(array("data" => array('content'=>$content))); exit(); } -OC_JSON::error(array("data" => array( "message" => "Error when creating the file" ))); +OCP\JSON::error(array("data" => array( "message" => "Error when creating the file" ))); diff --git a/apps/files/ajax/newfolder.php b/apps/files/ajax/newfolder.php index 2aff95e5b35..512e0e1f6d9 100644..100755 --- a/apps/files/ajax/newfolder.php +++ b/apps/files/ajax/newfolder.php @@ -3,20 +3,20 @@ // Init owncloud -OC_JSON::checkLoggedIn(); +OCP\JSON::checkLoggedIn(); // Get the params $dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : ''; $foldername = isset( $_POST['foldername'] ) ? stripslashes($_POST['foldername']) : ''; if(trim($foldername) == '') { - OC_JSON::error(array("data" => array( "message" => "Empty Foldername" ))); + OCP\JSON::error(array("data" => array( "message" => "Empty Foldername" ))); exit(); } if(OC_Files::newFile($dir, stripslashes($foldername), 'dir')) { - OC_JSON::success(array("data" => array())); + OCP\JSON::success(array("data" => array())); exit(); } -OC_JSON::error(array("data" => array( "message" => "Error when creating the folder" ))); +OCP\JSON::error(array("data" => array( "message" => "Error when creating the folder" ))); diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php index 86119de2d1b..36dd35cc73e 100755 --- a/apps/files/ajax/rawlist.php +++ b/apps/files/ajax/rawlist.php @@ -7,7 +7,7 @@ $RUNTIME_APPTYPES=array('filesystem'); require_once('lib/template.php'); -OC_JSON::checkLoggedIn(); +OCP\JSON::checkLoggedIn(); // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; @@ -21,6 +21,6 @@ foreach( OC_Files::getdirectorycontent( $dir, $mimetype ) as $i ){ $files[] = $i; } -OC_JSON::success(array('data' => $files)); +OCP\JSON::success(array('data' => $files)); ?> diff --git a/apps/files/ajax/rename.php b/apps/files/ajax/rename.php index dc5d3962abd..e2fa3d54a61 100644..100755 --- a/apps/files/ajax/rename.php +++ b/apps/files/ajax/rename.php @@ -3,7 +3,7 @@ // Init owncloud -OC_JSON::checkLoggedIn(); +OCP\JSON::checkLoggedIn(); // Get data $dir = stripslashes($_GET["dir"]); @@ -12,10 +12,10 @@ $newname = stripslashes($_GET["newname"]); // Delete if( OC_Files::move( $dir, $file, $dir, $newname )) { - OC_JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname ))); + OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname ))); } else{ - OC_JSON::error(array("data" => array( "message" => "Unable to rename file" ))); + OCP\JSON::error(array("data" => array( "message" => "Unable to rename file" ))); } ?> diff --git a/apps/files/ajax/scan.php b/apps/files/ajax/scan.php index a227dcc3ffc..d36366caf49 100644..100755 --- a/apps/files/ajax/scan.php +++ b/apps/files/ajax/scan.php @@ -20,12 +20,12 @@ if($force or !OC_FileCache::inCache('')){ OC_DB::commit(); $eventSource->send('success',true); }else{ - OC_JSON::success(array('data'=>array('done'=>true))); + OCP\JSON::success(array('data'=>array('done'=>true))); exit; } }else{ if($checkOnly){ - OC_JSON::success(array('data'=>array('done'=>false))); + OCP\JSON::success(array('data'=>array('done'=>false))); exit; } if(isset($eventSource)){ diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index ca64f58e14b..d6c799af32c 100755 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -4,12 +4,12 @@ // Firefox and Konqueror tries to download application/json for me. --Arthur -OC_JSON::setContentTypeHeader('text/plain'); +OCP\JSON::setContentTypeHeader('text/plain'); -OC_JSON::checkLoggedIn(); +OCP\JSON::checkLoggedIn(); if (!isset($_FILES['files'])) { - OC_JSON::error(array("data" => array( "message" => "No file was uploaded. Unknown error" ))); + OCP\JSON::error(array("data" => array( "message" => "No file was uploaded. Unknown error" ))); exit(); } foreach ($_FILES['files']['error'] as $error) { @@ -24,7 +24,7 @@ foreach ($_FILES['files']['error'] as $error) { UPLOAD_ERR_NO_TMP_DIR=>$l->t("Missing a temporary folder"), UPLOAD_ERR_CANT_WRITE=>$l->t('Failed to write to disk'), ); - OC_JSON::error(array("data" => array( "message" => $errors[$error] ))); + OCP\JSON::error(array("data" => array( "message" => $errors[$error] ))); exit(); } } @@ -38,7 +38,7 @@ foreach($files['size'] as $size){ $totalSize+=$size; } if($totalSize>OC_Filesystem::free_space('/')){ - OC_JSON::error(array("data" => array( "message" => "Not enough space available" ))); + OCP\JSON::error(array("data" => array( "message" => "Not enough space available" ))); exit(); } @@ -52,12 +52,12 @@ if(strpos($dir,'..') === false){ $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'],'name'=>basename($target)); } } - OC_JSON::encodedPrint($result); + OCP\JSON::encodedPrint($result); exit(); }else{ $error='invalid dir'; } -OC_JSON::error(array('data' => array('error' => $error, "file" => $fileName))); +OCP\JSON::error(array('data' => array('error' => $error, "file" => $fileName))); ?> |