summaryrefslogtreecommitdiffstats
path: root/files/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'files/ajax')
-rw-r--r--files/ajax/autocomplete.php56
-rw-r--r--files/ajax/delete.php29
-rw-r--r--files/ajax/download.php37
-rw-r--r--files/ajax/list.php46
-rw-r--r--files/ajax/mimeicon.php11
-rw-r--r--files/ajax/move.php20
-rw-r--r--files/ajax/newfile.php47
-rw-r--r--files/ajax/newfolder.php22
-rw-r--r--files/ajax/rawlist.php26
-rw-r--r--files/ajax/rename.php21
-rw-r--r--files/ajax/scan.php38
-rw-r--r--files/ajax/timezone.php6
-rw-r--r--files/ajax/upload.php64
13 files changed, 0 insertions, 423 deletions
diff --git a/files/ajax/autocomplete.php b/files/ajax/autocomplete.php
deleted file mode 100644
index 8cdb6188a02..00000000000
--- a/files/ajax/autocomplete.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-//provide auto completion of paths for use with jquer ui autocomplete
-
-
-// Init owncloud
-
-
-OC_JSON::checkLoggedIn();
-
-// Get data
-$query = $_GET['term'];
-$dirOnly=(isset($_GET['dironly']))?($_GET['dironly']=='true'):false;
-
-if($query[0]!='/'){
- $query='/'.$query;
-}
-
-if(substr($query,-1,1)=='/'){
- $base=$query;
-}else{
- $base=dirname($query);
-}
-
-$query=substr($query,strlen($base));
-
-if($base!='/'){
- $query=substr($query,1);
-}
-$queryLen=strlen($query);
-$query=strtolower($query);
-
-// echo "$base - $query";
-
-$files=array();
-
-if(OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)){
- $dh = OC_Filesystem::opendir($base);
- if($dh){
- if(substr($base,-1,1)!='/'){
- $base=$base.'/';
- }
- while (($file = readdir($dh)) !== false) {
- if ($file != "." && $file != ".."){
- if(substr(strtolower($file),0,$queryLen)==$query){
- $item=$base.$file;
- if((!$dirOnly or OC_Filesystem::is_dir($item))){
- $files[]=(object)array('id'=>$item,'label'=>$item,'name'=>$item);
- }
- }
- }
- }
- }
-}
-OC_JSON::encodedPrint($files);
-
-?>
diff --git a/files/ajax/delete.php b/files/ajax/delete.php
deleted file mode 100644
index d8a01d7acf1..00000000000
--- a/files/ajax/delete.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-// Init owncloud
-
-
-OC_JSON::checkLoggedIn();
-
-// Get data
-$dir = stripslashes($_GET["dir"]);
-$files = isset($_GET["file"]) ? stripslashes($_GET["file"]) : stripslashes($_GET["files"]);
-
-$files = explode(';', $files);
-$filesWithError = '';
-$success = true;
-//Now delete
-foreach($files as $file) {
- if( !OC_Files::delete( $dir, $file )){
- $filesWithError .= $file . "\n";
- $success = false;
- }
-}
-
-if($success) {
- OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $files )));
-} else {
- OC_JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError )));
-}
-
-?>
diff --git a/files/ajax/download.php b/files/ajax/download.php
deleted file mode 100644
index 65c04c36faf..00000000000
--- a/files/ajax/download.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/**
-* ownCloud - ajax frontend
-*
-* @author Robin Appelman
-* @copyright 2010 Robin Appelman icewind1991@gmail.com
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-// only need filesystem apps
-$RUNTIME_APPTYPES=array('filesystem');
-
-// Init owncloud
-
-
-// Check if we are a user
-OC_Util::checkLoggedIn();
-
-$files = $_GET["files"];
-$dir = $_GET["dir"];
-
-OC_Files::get($dir,$files);
-?>
diff --git a/files/ajax/list.php b/files/ajax/list.php
deleted file mode 100644
index 83914332a7d..00000000000
--- a/files/ajax/list.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-// only need filesystem apps
-$RUNTIME_APPTYPES=array('filesystem');
-
-// Init owncloud
-
-
-OC_JSON::checkLoggedIn();
-
-// Load the files
-$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
-$doBreadcrumb = isset( $_GET['breadcrumb'] ) ? true : false;
-$data = array();
-
-// Make breadcrumb
-if($doBreadcrumb){
- $breadcrumb = array();
- $pathtohere = "/";
- foreach( explode( "/", $dir ) as $i ){
- if( $i != "" ){
- $pathtohere .= "$i/";
- $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
- }
- }
-
- $breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
- $breadcrumbNav->assign( "breadcrumb", $breadcrumb );
-
- $data['breadcrumb'] = $breadcrumbNav->fetchPage();
-}
-
-// make filelist
-$files = array();
-foreach( OC_Files::getdirectorycontent( $dir ) as $i ){
- $i["date"] = OC_Util::formatDate($i["mtime"] );
- $files[] = $i;
-}
-
-$list = new OC_Template( "files", "part.list", "" );
-$list->assign( "files", $files );
-$data = array('files' => $list->fetchPage());
-
-OC_JSON::success(array('data' => $data));
-
-?>
diff --git a/files/ajax/mimeicon.php b/files/ajax/mimeicon.php
deleted file mode 100644
index 57898cd82d9..00000000000
--- a/files/ajax/mimeicon.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-// no need for apps
-$RUNTIME_NOAPPS=false;
-
-// Init owncloud
-
-
-print OC_Helper::mimetypeIcon($_GET['mime']);
-
-?>
diff --git a/files/ajax/move.php b/files/ajax/move.php
deleted file mode 100644
index 0ad314f873c..00000000000
--- a/files/ajax/move.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-// Init owncloud
-
-
-OC_JSON::checkLoggedIn();
-
-// Get data
-$dir = stripslashes($_GET["dir"]);
-$file = stripslashes($_GET["file"]);
-$target = stripslashes($_GET["target"]);
-
-
-if(OC_Files::move($dir,$file,$target,$file)){
- OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
-}else{
- OC_JSON::error(array("data" => array( "message" => "Could not move $file" )));
-}
-
-?>
diff --git a/files/ajax/newfile.php b/files/ajax/newfile.php
deleted file mode 100644
index 472b577a32a..00000000000
--- a/files/ajax/newfile.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-// Init owncloud
-
-
-OC_JSON::checkLoggedIn();
-
-// Get the params
-$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
-$filename = isset( $_POST['filename'] ) ? stripslashes($_POST['filename']) : '';
-$content = isset( $_POST['content'] ) ? $_POST['content'] : '';
-$source = isset( $_POST['source'] ) ? stripslashes($_POST['source']) : '';
-
-if($filename == '') {
- OC_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" )));
- exit();
- }
- $sourceStream=fopen($source,'rb');
- $target=$dir.'/'.$filename;
- $result=OC_Filesystem::file_put_contents($target,$sourceStream);
- if($result){
- $mime=OC_Filesystem::getMimetype($target);
- OC_JSON::success(array("data" => array('mime'=>$mime)));
- exit();
- }else{
- OC_JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target )));
- exit();
- }
-}
-
-
-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)));
- exit();
-}
-
-
-OC_JSON::error(array("data" => array( "message" => "Error when creating the file" )));
diff --git a/files/ajax/newfolder.php b/files/ajax/newfolder.php
deleted file mode 100644
index 2aff95e5b35..00000000000
--- a/files/ajax/newfolder.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-// Init owncloud
-
-
-OC_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" )));
- exit();
-}
-
-if(OC_Files::newFile($dir, stripslashes($foldername), 'dir')) {
- OC_JSON::success(array("data" => array()));
- exit();
-}
-
-OC_JSON::error(array("data" => array( "message" => "Error when creating the folder" )));
diff --git a/files/ajax/rawlist.php b/files/ajax/rawlist.php
deleted file mode 100644
index 8f1990d1b8f..00000000000
--- a/files/ajax/rawlist.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-// only need filesystem apps
-$RUNTIME_APPTYPES=array('filesystem');
-
-// Init owncloud
-
-require_once('../../lib/template.php');
-
-OC_JSON::checkLoggedIn();
-
-// Load the files
-$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
-$mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : '';
-
-// make filelist
-$files = array();
-foreach( OC_Files::getdirectorycontent( $dir, $mimetype ) as $i ){
- $i["date"] = OC_Util::formatDate($i["mtime"] );
- $i['mimetype_icon'] = $i['type'] == 'dir' ? mimetype_icon('dir'): mimetype_icon($i['mimetype']);
- $files[] = $i;
-}
-
-OC_JSON::success(array('data' => $files));
-
-?>
diff --git a/files/ajax/rename.php b/files/ajax/rename.php
deleted file mode 100644
index dc5d3962abd..00000000000
--- a/files/ajax/rename.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-// Init owncloud
-
-
-OC_JSON::checkLoggedIn();
-
-// Get data
-$dir = stripslashes($_GET["dir"]);
-$file = stripslashes($_GET["file"]);
-$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 )));
-}
-else{
- OC_JSON::error(array("data" => array( "message" => "Unable to rename file" )));
-}
-
-?>
diff --git a/files/ajax/scan.php b/files/ajax/scan.php
deleted file mode 100644
index db09b7d5c64..00000000000
--- a/files/ajax/scan.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-require_once '../../lib/base.php';
-
-set_time_limit(0);//scanning can take ages
-
-$force=isset($_GET['force']) and $_GET['force']=='true';
-$checkOnly=isset($_GET['checkonly']) and $_GET['checkonly']=='true';
-
-if(!$checkOnly){
- $eventSource=new OC_EventSource();
-}
-
-
-//create the file cache if necesary
-if($force or !OC_FileCache::inCache('')){
- if(!$checkOnly){
- OC_DB::beginTransaction();
- OC_FileCache::scan('',$eventSource);
- OC_FileCache::clean();
- OC_DB::commit();
- $eventSource->send('success',true);
- }else{
- OC_JSON::success(array('data'=>array('done'=>true)));
- exit;
- }
-}else{
- if($checkOnly){
- OC_JSON::success(array('data'=>array('done'=>false)));
- exit;
- }
- if(isset($eventSource)){
- $eventSource->send('success',false);
- }else{
- exit;
- }
-}
-$eventSource->close(); \ No newline at end of file
diff --git a/files/ajax/timezone.php b/files/ajax/timezone.php
deleted file mode 100644
index 8e1d2aa1ec1..00000000000
--- a/files/ajax/timezone.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
- // FIXME: this should start a secure session if forcessl is enabled
- // see lib/base.php for an example
- session_start();
- $_SESSION['timezone'] = $_GET['time'];
-?>
diff --git a/files/ajax/upload.php b/files/ajax/upload.php
deleted file mode 100644
index c60e1a3752a..00000000000
--- a/files/ajax/upload.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-// Init owncloud
-
-
-// Firefox and Konqueror tries to download application/json for me. --Arthur
-OC_JSON::setContentTypeHeader('text/plain');
-
-OC_JSON::checkLoggedIn();
-
-if (!isset($_FILES['files'])) {
- OC_JSON::error(array("data" => array( "message" => "No file was uploaded. Unknown error" )));
- exit();
-}
-foreach ($_FILES['files']['error'] as $error) {
- if ($error != 0) {
- $l=OC_L10N::get('files');
- $errors = array(
- UPLOAD_ERR_OK=>$l->t("There is no error, the file uploaded with success"),
- UPLOAD_ERR_INI_SIZE=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'),
- UPLOAD_ERR_FORM_SIZE=>$l->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"),
- UPLOAD_ERR_PARTIAL=>$l->t("The uploaded file was only partially uploaded"),
- UPLOAD_ERR_NO_FILE=>$l->t("No file was uploaded"),
- 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] )));
- exit();
- }
-}
-$files=$_FILES['files'];
-
-$dir = $_POST['dir'];
-$dir .= '/';
-$error='';
-
-$totalSize=0;
-foreach($files['size'] as $size){
- $totalSize+=$size;
-}
-if($totalSize>OC_Filesystem::free_space('/')){
- OC_JSON::error(array("data" => array( "message" => "Not enough space available" )));
- exit();
-}
-
-$result=array();
-if(strpos($dir,'..') === false){
- $fileCount=count($files['name']);
- for($i=0;$i<$fileCount;$i++){
- $target = OC_Helper::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]);
- if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i],$target)){
- $meta=OC_FileCache::getCached($target);
- $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'],'name'=>basename($target));
- }
- }
- OC_JSON::encodedPrint($result);
- exit();
-}else{
- $error='invalid dir';
-}
-
-OC_JSON::error(array('data' => array('error' => $error, "file" => $fileName)));
-
-?>