diff options
author | Robin <robin@Amaya.(none)> | 2010-03-24 16:35:24 +0100 |
---|---|---|
committer | Robin <robin@Amaya.(none)> | 2010-03-24 16:35:24 +0100 |
commit | ba9c95621bccddc8c83689906643a080e1671f22 (patch) | |
tree | 0bf3686caccf70312aaa039d50b4cd7e662d964c /files | |
parent | 3f88fb9f14d330e7454edcfecfdf6d39a589949c (diff) | |
download | nextcloud-server-ba9c95621bccddc8c83689906643a080e1671f22.tar.gz nextcloud-server-ba9c95621bccddc8c83689906643a080e1671f22.zip |
ajax interface
Diffstat (limited to 'files')
-rw-r--r-- | files/delete.php | 34 | ||||
-rw-r--r-- | files/get_files.php | 45 | ||||
-rw-r--r-- | files/index.php | 35 | ||||
-rw-r--r-- | files/rename.php | 34 | ||||
-rw-r--r-- | files/upload.php | 37 |
5 files changed, 185 insertions, 0 deletions
diff --git a/files/delete.php b/files/delete.php new file mode 100644 index 00000000000..1c660d97807 --- /dev/null +++ b/files/delete.php @@ -0,0 +1,34 @@ +<?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 Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ +require_once('../inc/lib_base.php'); + +$dir=$_GET['dir']; +$file=$_GET['file']; +if(isset($_SESSION['username']) and $_SESSION['username'] and strpos($dir,'..')===false){ + $file=$CONFIG_DATADIRECTORY.'/'.$dir.'/'.$file; + if(is_file($file)){ + unlink($file); + } +} + +?>
\ No newline at end of file diff --git a/files/get_files.php b/files/get_files.php new file mode 100644 index 00000000000..f6db75b3a4b --- /dev/null +++ b/files/get_files.php @@ -0,0 +1,45 @@ +<?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 Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ +require_once('../inc/lib_base.php'); + +// header('Content-type: text/plain'); +header('Content-type: application/xml'); + +$dir=isset($_GET['dir'])?$_GET['dir']:''; +$files=OC_FILES::getdirectorycontent($CONFIG_DATADIRECTORY.'/'.$dir); +$dirname=$files[0]['directory']; +$dirname=substr($dirname,strrpos($dirname,'/')); +ob_clean(); +echo "<?xml version='1.0' standalone='yes'?>\n"; +echo "<dir name='$dirname'>\n"; +foreach($files as $file){ + $attributes=''; + foreach($file as $name=>$data){ + $data=str_replace("'",''',$data); + if (is_string($name)) $attributes.=" $name='$data'"; + } + $attributes.=' date=\''.date($CONFIG_DATEFORMAT,$file['mtime']).'\''; + echo "<file$attributes/>\n"; +} +echo "</dir>"; +?>
\ No newline at end of file diff --git a/files/index.php b/files/index.php new file mode 100644 index 00000000000..6bd994e7616 --- /dev/null +++ b/files/index.php @@ -0,0 +1,35 @@ +<?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 Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + + +//require_once('../../config/config.php'); +require_once('../inc/lib_base.php'); + +OC_UTIL::addscript('/plugins/ajax/ajax.js'); + +OC_UTIL::showheader(); + +echo "<div id='content'></div>"; + +OC_UTIL::showfooter(); +?> diff --git a/files/rename.php b/files/rename.php new file mode 100644 index 00000000000..f0f272f018f --- /dev/null +++ b/files/rename.php @@ -0,0 +1,34 @@ +<?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 Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ +require_once('../inc/lib_base.php'); + +$dir=$_GET['dir']; +$file=$_GET['file']; +$newname=$_GET['newname']; +if($file!=$newname and $newname!='' and isset($_SESSION['username']) and $_SESSION['username'] and strpos($dir,'..')===false){ + $source=$CONFIG_DATADIRECTORY.'/'.$dir.'/'.$file; + $target=$CONFIG_DATADIRECTORY.'/'.$dir.'/'.$newname; + rename($source,$target); +} + +?>
\ No newline at end of file diff --git a/files/upload.php b/files/upload.php new file mode 100644 index 00000000000..b5fed2ed5b1 --- /dev/null +++ b/files/upload.php @@ -0,0 +1,37 @@ +<?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 Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ +require_once('../inc/lib_base.php'); + +$fileName=$_FILES['file']['name']; +$source=$_FILES['file']['tmp_name']; +$target=$CONFIG_DATADIRECTORY.'/'.$_GET['dir'].'/'.$fileName; +if(isset($_SESSION['username']) and $_SESSION['username'] and strpos($_GET['dir'],'..')===false){ + if(move_uploaded_file($source,$target)){ + echo 'true'; + }else{ + echo 'false'; + } +}else{ + echo 'false'; +} +?>
\ No newline at end of file |