7 changed files with 258 additions and 0 deletions
-
39files/admin.php
-
27files/ajax/delete.php
-
36files/ajax/list.php
-
28files/ajax/rename.php
-
45files/download.php
-
64files/settings.php
-
19files/templates/admin.php
@ -0,0 +1,39 @@ |
|||
<?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/>. |
|||
* |
|||
*/ |
|||
|
|||
|
|||
// Init owncloud
|
|||
require_once('../lib/base.php'); |
|||
oc_require( 'template.php' ); |
|||
|
|||
// Check if we are a user
|
|||
if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){ |
|||
header( "Location: ".OC_HELPER::linkTo( "index.php" )); |
|||
exit(); |
|||
} |
|||
|
|||
// return template
|
|||
$tmpl = new OC_TEMPLATE( "files", "admin", "admin" ); |
|||
$tmpl->printPage(); |
|||
|
|||
?>
|
|||
@ -0,0 +1,27 @@ |
|||
<?php |
|||
|
|||
// 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(); |
|||
} |
|||
|
|||
// Get data
|
|||
$dir = $_GET["dir"]; |
|||
$file = $_GET["file"]; |
|||
|
|||
// Delete
|
|||
if( OC_FILES::delete( $dir, $file )){ |
|||
echo json_encode( array( "status" => "success", "data" => array( "dir" => $dir, "file" => $file ))); |
|||
} |
|||
else{ |
|||
echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to delete file" ))); |
|||
} |
|||
|
|||
?>
|
|||
@ -0,0 +1,36 @@ |
|||
<?php |
|||
|
|||
// 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(); |
|||
} |
|||
|
|||
// Load the files
|
|||
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; |
|||
|
|||
$files = array(); |
|||
foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ |
|||
$i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] ); |
|||
$files[] = $i; |
|||
} |
|||
|
|||
// Make breadcrumb
|
|||
$breadcrumb = array(); |
|||
$pathtohere = "/"; |
|||
foreach( explode( "/", $dir ) as $i ){ |
|||
if( $i != "" ){ |
|||
$pathtohere .= "$i/"; |
|||
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); |
|||
} |
|||
} |
|||
|
|||
echo json_encode( array( "status" => "success", "data" => array( "files" => $files, "breadcrumb" => $breadcrumb ))); |
|||
|
|||
?>
|
|||
@ -0,0 +1,28 @@ |
|||
<?php |
|||
|
|||
// 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" => "Authentication error" )); |
|||
exit(); |
|||
} |
|||
|
|||
// Get data
|
|||
$dir = $_GET["dir"]; |
|||
$file = $_GET["file"]; |
|||
$newname = $_GET["newname"]; |
|||
|
|||
// Delete
|
|||
if( OC_FILES::move( $dir, $file, $dir, $newname )) { |
|||
echo json_encode( array( "status" => "success", "data" => array( "dir" => $dir, "file" => $file, "newname" => $newname ))); |
|||
} |
|||
else{ |
|||
echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to rename file" ))); |
|||
} |
|||
|
|||
?>
|
|||
@ -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 Affero General Public |
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
|||
* |
|||
*/ |
|||
|
|||
// Init owncloud
|
|||
require_once('../lib/base.php'); |
|||
oc_require( 'template.php' ); |
|||
|
|||
// Check if we are a user
|
|||
if( !OC_USER::isLoggedIn()){ |
|||
header( "Location: ".OC_HELPER::linkTo( "index.php" )); |
|||
exit(); |
|||
} |
|||
|
|||
$filename = $_GET["file"]; |
|||
|
|||
$ftype=OC_FILESYSTEM::getMimeType( $filename ); |
|||
|
|||
header('Content-Type:'.$ftype); |
|||
header('Expires: 0'); |
|||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|||
header('Pragma: public'); |
|||
header('Content-Length: '.OC_FILESYSTEM::filesize($filename)); |
|||
|
|||
OC_FILESYSTEM::readfile( $filename ); |
|||
?>
|
|||
@ -0,0 +1,64 @@ |
|||
<?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/>. |
|||
* |
|||
*/ |
|||
|
|||
|
|||
// Init owncloud
|
|||
require_once('../lib/base.php'); |
|||
oc_require( 'template.php' ); |
|||
|
|||
// Check if we are a user
|
|||
if( !OC_USER::isLoggedIn()){ |
|||
header( "Location: ".OC_HELPER::linkTo( "index.php" )); |
|||
exit(); |
|||
} |
|||
|
|||
// Load the files we need
|
|||
OC_UTIL::addStyle( "files", "files" ); |
|||
OC_UTIL::addScript( "files", "files" ); |
|||
|
|||
// Load the files
|
|||
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; |
|||
|
|||
$files = array(); |
|||
foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ |
|||
$i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] ); |
|||
$files[] = $i; |
|||
} |
|||
|
|||
// Make breadcrumb
|
|||
$breadcrumb = array(); |
|||
$pathtohere = "/"; |
|||
foreach( explode( "/", $dir ) as $i ){ |
|||
if( $i != "" ){ |
|||
$pathtohere .= "$i/"; |
|||
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); |
|||
} |
|||
} |
|||
|
|||
// return template
|
|||
$tmpl = new OC_TEMPLATE( "files", "index", "user" ); |
|||
$tmpl->assign( "files", $files ); |
|||
$tmpl->assign( "breadcrumb", $breadcrumb ); |
|||
$tmpl->printPage(); |
|||
|
|||
?>
|
|||
@ -0,0 +1,19 @@ |
|||
<?php |
|||
/* |
|||
* Template for files admin page |
|||
*/ |
|||
?>
|
|||
<h1>Admin</h1> |
|||
|
|||
<form> |
|||
<input type="checkbox" /> Allow public folders<br> |
|||
|
|||
(if public is enabled)<br> |
|||
<input type="radio" name="sharingaim" checked="checked" /> separated from webdav storage<br> |
|||
<input type="radio" name="sharingaim" /> let the user decide<br> |
|||
<input type="radio" name="sharingaim" /> folder "/public" in webdav storage<br> |
|||
(endif)<br> |
|||
|
|||
<input type="checkbox" /> Allow downloading shared files<br> |
|||
<input type="checkbox" /> Allow uploading in shared directory<br> |
|||
</form> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue