Merge branch 'refactoring' of git.kde.org:owncloud into refactoring
Conflicts: admin/templates/index.php templates/layout.admin.php templates/layout.user.php All conflicts are fixed.
This commit is contained in:
commit
7faf852561
|
@ -1,12 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
OC_UTIL::addApplication( array( "id" => "admin", "name" => "Administration" ));
|
|
||||||
if( OC_USER::ingroup( $_SESSION['username'], 'admin' ))
|
|
||||||
{
|
|
||||||
OC_UTIL::addNavigationEntry( array( "app" => "admin", "file" => "index.php", "name" => "Administration" ));
|
|
||||||
}
|
|
||||||
OC_UTIL::addAdminPage( array( "app" => "admin", "file" => "system.php", "name" => "System Settings" ));
|
|
||||||
OC_UTIL::addAdminPage( array( "app" => "admin", "file" => "users.php", "name" => "Users" ));
|
|
||||||
OC_UTIL::addAdminPage( array( "app" => "admin", "file" => "plugins.php", "name" => "Plugins" ));
|
|
||||||
|
|
||||||
?>
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
OC_APP::register( array( "order" => 1, "id" => "admin", "name" => "Administration" ));
|
||||||
|
if( OC_USER::ingroup( $_SESSION['username'], 'admin' ))
|
||||||
|
{
|
||||||
|
OC_UTIL::addNavigationEntry( array( "id" => "admin_index", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "index.php" ), "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ), "name" => "Administration" ));
|
||||||
|
}
|
||||||
|
OC_UTIL::addAdminPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" => "System settings" ));
|
||||||
|
OC_UTIL::addAdminPage( array( "order" => 2, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users" ));
|
||||||
|
OC_UTIL::addAdminPage( array( "order" => 3, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins" ));
|
||||||
|
|
||||||
|
?>
|
Binary file not shown.
After Width: | Height: | Size: 874 B |
|
@ -7,6 +7,6 @@
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach($_["adminpages"] as $i): ?>
|
<?php foreach($_["adminpages"] as $i): ?>
|
||||||
<li><a href="<?php echo link_to($i["app"], $i["file"]); ?>"><?php echo $i["name"]; ?></a></li>
|
<li><a href="<?php echo $i["href"]; ?>"><?php echo $i["name"]; ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -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" )));
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
OC_UTIL::addApplication( array( "id" => "files", "name" => "Files" ));
|
|
||||||
OC_UTIL::addNavigationEntry( array( "app" => "files", "file" => "index.php", "name" => "Files" ));
|
|
||||||
|
|
||||||
?>
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
OC_APP::register( array( "order" => 2, "id" => "files", "name" => "Files" ));
|
||||||
|
|
||||||
|
OC_UTIL::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_HELPER::linkTo( "files", "index.php" ), "icon" => OC_HELPER::imagePath( "files", "navicon.png" ), "name" => "Files" ));
|
||||||
|
OC_UTIL::addAdminPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files" ));
|
||||||
|
|
||||||
|
?>
|
|
@ -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 );
|
||||||
|
?>
|
Binary file not shown.
After Width: | Height: | Size: 635 B |
|
@ -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>
|
Binary file not shown.
After Width: | Height: | Size: 525 B |
Binary file not shown.
After Width: | Height: | Size: 512 B |
Binary file not shown.
After Width: | Height: | Size: 527 B |
Binary file not shown.
After Width: | Height: | Size: 484 B |
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
class OC_APP{
|
||||||
|
static private $init = false;
|
||||||
|
static private $apps = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function loadApps(){
|
||||||
|
global $SERVERROOT;
|
||||||
|
|
||||||
|
// Get all appinfo
|
||||||
|
$dir = opendir( $SERVERROOT );
|
||||||
|
while( false !== ( $filename = readdir( $dir ))){
|
||||||
|
if( substr( $filename, 0, 1 ) != '.' ){
|
||||||
|
if( file_exists( "$SERVERROOT/$filename/appinfo/app.php" )){
|
||||||
|
oc_require( "$filename/appinfo/app.php" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir( $dir );
|
||||||
|
|
||||||
|
// return
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function register( $data = array()){
|
||||||
|
OC_APP::$apps[] = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getApps(){
|
||||||
|
return OC_APP::$apps;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
|
@ -1,16 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
class OC_APPCONFIG{
|
class OC_APPCONFIG{
|
||||||
static public $forms=array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add a form to the settings page
|
|
||||||
* @param string name
|
|
||||||
* @param string url
|
|
||||||
*/
|
|
||||||
public static function addForm($name,$url){
|
|
||||||
self::$forms[$name]=$url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the available keys for an application
|
* Get the available keys for an application
|
||||||
* @param string application
|
* @param string application
|
||||||
|
|
46
lib/base.php
46
lib/base.php
|
@ -77,6 +77,8 @@ if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){
|
||||||
}
|
}
|
||||||
|
|
||||||
// load core libs
|
// load core libs
|
||||||
|
oc_require_once('helper.php');
|
||||||
|
oc_require_once('app.php');
|
||||||
oc_require_once('files.php');
|
oc_require_once('files.php');
|
||||||
oc_require_once('filesystem.php');
|
oc_require_once('filesystem.php');
|
||||||
oc_require_once('filestorage.php');
|
oc_require_once('filestorage.php');
|
||||||
|
@ -89,7 +91,7 @@ oc_require_once('connect.php');
|
||||||
oc_require_once('remotestorage.php');
|
oc_require_once('remotestorage.php');
|
||||||
oc_require_once('plugin.php');
|
oc_require_once('plugin.php');
|
||||||
|
|
||||||
OC_PLUGIN::loadPlugins();
|
OC_PLUGIN::loadPlugins( "" );
|
||||||
|
|
||||||
if(!isset($CONFIG_BACKEND)){
|
if(!isset($CONFIG_BACKEND)){
|
||||||
$CONFIG_BACKEND='database';
|
$CONFIG_BACKEND='database';
|
||||||
|
@ -102,25 +104,15 @@ if( !$RUNTIME_NOSETUPFS ){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the stuff we need always
|
// Add the stuff we need always
|
||||||
OC_UTIL::addPersonalMenuEntry( array( "file" => "index.php?logout=1", "name" => "Logout" ));
|
OC_UTIL::addPersonalMenuEntry( array( "order" => 1000, "href" => OC_HELPER::linkTo( "", "index.php?logout=1" ), "name" => "Logout" ));
|
||||||
OC_UTIL::addScript( "jquery-1.5.min" );
|
OC_UTIL::addScript( "jquery-1.5.min" );
|
||||||
OC_UTIL::addScript( "jquery-ui-1.8.10.custom.min" );
|
OC_UTIL::addScript( "jquery-ui-1.8.10.custom.min" );
|
||||||
OC_UTIL::addScript( "js" );
|
OC_UTIL::addScript( "js" );
|
||||||
OC_UTIL::addStyle( "jquery-ui-1.8.10.custom" );
|
OC_UTIL::addStyle( "jquery-ui-1.8.10.custom" );
|
||||||
OC_UTIL::addStyle( "styles" );
|
OC_UTIL::addStyle( "styles" );
|
||||||
|
|
||||||
// Require all appinfo.php
|
// Load Apps
|
||||||
$dir = opendir( $SERVERROOT );
|
OC_APP::loadApps();
|
||||||
while( false !== ( $filename = readdir( $dir ))){
|
|
||||||
if( substr( $filename, 0, 1 ) != '.' ){
|
|
||||||
if( file_exists( "$SERVERROOT/$filename/appinfo.php" )){
|
|
||||||
oc_require( "$filename/appinfo.php" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir( $dir );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// check if the server is correctly configured for ownCloud
|
// check if the server is correctly configured for ownCloud
|
||||||
OC_UTIL::checkserver();
|
OC_UTIL::checkserver();
|
||||||
|
@ -133,13 +125,12 @@ class OC_UTIL {
|
||||||
public static $scripts=array();
|
public static $scripts=array();
|
||||||
public static $styles=array();
|
public static $styles=array();
|
||||||
public static $adminpages = array();
|
public static $adminpages = array();
|
||||||
public static $applications = array();
|
|
||||||
public static $navigation = array();
|
public static $navigation = array();
|
||||||
public static $personalmenu = array();
|
public static $personalmenu = array();
|
||||||
private static $fsSetup=false;
|
private static $fsSetup=false;
|
||||||
|
|
||||||
// Can be set up
|
// Can be set up
|
||||||
public static function setupFS( $user = "" ){// configure the initial filesystem based on the configuration
|
public static function setupFS( $user = "", $root = "files" ){// configure the initial filesystem based on the configuration
|
||||||
if(self::$fsSetup){//setting up the filesystem twice can only lead to trouble
|
if(self::$fsSetup){//setting up the filesystem twice can only lead to trouble
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -166,11 +157,9 @@ class OC_UTIL {
|
||||||
//first set up the local "root" storage and the backupstorage if needed
|
//first set up the local "root" storage and the backupstorage if needed
|
||||||
$rootStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_DATADIRECTORY));
|
$rootStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_DATADIRECTORY));
|
||||||
if($CONFIG_ENABLEBACKUP){
|
if($CONFIG_ENABLEBACKUP){
|
||||||
if(!is_dir($CONFIG_BACKUPDIRECTORY)){
|
// This creates the Directorys recursively
|
||||||
mkdir($CONFIG_BACKUPDIRECTORY);
|
if(!is_dir( "$CONFIG_BACKUPDIRECTORY/$user/$root" )){
|
||||||
}
|
mkdir( "$CONFIG_BACKUPDIRECTORY/$user/$root", 0x755, true );
|
||||||
if(!is_dir($CONFIG_BACKUPDIRECTORY.'/'.$user )){
|
|
||||||
mkdir($CONFIG_BACKUPDIRECTORY.'/'.$user );
|
|
||||||
}
|
}
|
||||||
$backupStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY));
|
$backupStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY));
|
||||||
$backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage));
|
$backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage));
|
||||||
|
@ -178,9 +167,9 @@ class OC_UTIL {
|
||||||
}
|
}
|
||||||
OC_FILESYSTEM::mount($rootStorage,'/');
|
OC_FILESYSTEM::mount($rootStorage,'/');
|
||||||
|
|
||||||
$CONFIG_DATADIRECTORY=$CONFIG_DATADIRECTORY_ROOT.'/'.$user;
|
$CONFIG_DATADIRECTORY = "$CONFIG_DATADIRECTORY_ROOT/$user/$root";
|
||||||
if( !is_dir( $CONFIG_DATADIRECTORY )){
|
if( !is_dir( $CONFIG_DATADIRECTORY )){
|
||||||
mkdir($CONFIG_DATADIRECTORY);
|
mkdir( $CONFIG_DATADIRECTORY, 0x755, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
//set up the other storages according to the system settings
|
//set up the other storages according to the system settings
|
||||||
|
@ -197,7 +186,7 @@ class OC_UTIL {
|
||||||
}
|
}
|
||||||
|
|
||||||
//jail the user into his "home" directory
|
//jail the user into his "home" directory
|
||||||
OC_FILESYSTEM::chroot('/'.$user);
|
OC_FILESYSTEM::chroot("/$user/$root");
|
||||||
self::$fsSetup=true;
|
self::$fsSetup=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,15 +243,6 @@ class OC_UTIL {
|
||||||
OC_UTIL::$adminpages[] = $entry;
|
OC_UTIL::$adminpages[] = $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* add application
|
|
||||||
*
|
|
||||||
* @param array $entry
|
|
||||||
*/
|
|
||||||
public static function addApplication( $entry){
|
|
||||||
OC_UTIL::$applications[] = $entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add an entry to the personal menu
|
* add an entry to the personal menu
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
class OC_PREFERENCES{
|
||||||
|
static public $forms=array();
|
||||||
|
/**
|
||||||
|
* Get the available keys for an application
|
||||||
|
* @param string application
|
||||||
|
*/
|
||||||
|
public static function getKeys( $user, $application ){
|
||||||
|
// OC_DB::query( $query);
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the config value
|
||||||
|
* @param string application
|
||||||
|
* @param string key
|
||||||
|
* @param string default
|
||||||
|
*/
|
||||||
|
public static function getValue( $user, $application, $key, $default ){
|
||||||
|
// OC_DB::query( $query);
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the config value
|
||||||
|
* @param string application
|
||||||
|
* @param string key
|
||||||
|
* @param string value
|
||||||
|
*/
|
||||||
|
public static function setValue( $user, $application, $name, $url ){
|
||||||
|
// OC_DB::query( $query);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
|
@ -21,8 +21,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
oc_include_once( "helper.php" );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
OC_UTIL::addApplication( array( "id" => "log", "name" => "Log" ));
|
|
||||||
OC_UTIL::addNavigationEntry( array( "app" => "log", "file" => "index.php", "name" => "Log" ));
|
|
||||||
|
|
||||||
?>
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
OC_APP::register( array( "order" => 1, "id" => "log", "name" => "Log" ));
|
||||||
|
OC_UTIL::addPersonalMenuEntry( array( "order" => 2, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log" ));
|
||||||
|
|
||||||
|
?>
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
OC_UTIL::addApplication( array( "id" => "settings", "name" => "Settings" ));
|
|
||||||
OC_UTIL::addNavigationEntry( array( "app" => "settings", "file" => "index.php", "name" => "Settings" ));
|
|
||||||
|
|
||||||
?>
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
OC_APP::register( array( "id" => "settings", "name" => "Settings" ));
|
||||||
|
OC_UTIL::addPersonalMenuEntry( array( "order" => 1, "href" => OC_HELPER::linkTo( "settings", "index.php" ), "name" => "Settings" ));
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ownCloud - Sample application
|
||||||
|
*
|
||||||
|
* @author Jakob Sack
|
||||||
|
* @copyright 2011 Jakob Sack kde@jakobsack.de
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Do not prepare the file system (for demonstration purpose)
|
||||||
|
// We HAVE TO set this var before including base.php
|
||||||
|
$RUNTIME_NOSETUPFS = true;
|
||||||
|
|
||||||
|
// Init owncloud
|
||||||
|
require_once('../lib/base.php');
|
||||||
|
|
||||||
|
// We need the file system although we said do not load it! Do it by hand now
|
||||||
|
OC_UTIL::setupFS();
|
||||||
|
|
||||||
|
// We load OC_TEMPLATE, too. This one is not loaded by base
|
||||||
|
oc_require( 'template.php' );
|
||||||
|
|
||||||
|
// The user should have admin rights. This is an admin page!
|
||||||
|
if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){
|
||||||
|
// Bad boy! Go to the very first page of owncloud
|
||||||
|
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do some crazy Stuff over here
|
||||||
|
$myvar = 2;
|
||||||
|
$myarray = array( "foo" => array( 0, 1, 2 ), "bar" => "baz" );
|
||||||
|
|
||||||
|
// Preparing for output!
|
||||||
|
$tmpl = new OC_TEMPLATE( "skeleton", "admin", "admin" ); // Programname, template, mode
|
||||||
|
// Assign the vars
|
||||||
|
$tmpl->assign( "var", $myvar );
|
||||||
|
$tmpl->assign( "array", $myarray );
|
||||||
|
// Print page
|
||||||
|
$tmpl->printPage();
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* This file is required. It makes owncloud aware of the app.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Hello, we are here
|
||||||
|
OC_APP::register( array( "id" => "skeleton", "name" => "Files", "order" => 1000 ));
|
||||||
|
|
||||||
|
// Add application to navigation
|
||||||
|
OC_UTIL::addNavigationEntry( array( "id" => "skeleton_index", "order" => 1000, "href" => OC_HELPER::linkTo( "skeleton", "index.php" ), "icon" => OC_HELPER::imagePath( "skeleton", "app.png" ), "name" => "Example app" ));
|
||||||
|
|
||||||
|
// Add an admin page
|
||||||
|
OC_UTIL::addAdminPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "skeleton", "admin.php" ), "name" => "Example app options" ));
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,4 @@
|
||||||
|
/*
|
||||||
|
* To include this css file, call "OC_UTIL::addStyle( "skeleton", "skeleton" )"
|
||||||
|
* in your app. (appname) (cssname)
|
||||||
|
*/
|
|
@ -0,0 +1,3 @@
|
||||||
|
/*
|
||||||
|
* If you want to you can use more css files ...
|
||||||
|
*/
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -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,3 @@
|
||||||
|
// Include this file whenever you need it. A simple
|
||||||
|
// "OC_UTIL::addScript( "skeleton", "app" )" will do this.
|
||||||
|
// Put your jquery-Stuff here
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Template for files admin page
|
||||||
|
*
|
||||||
|
* See index.php for details
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<h1>Admin</h1>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Template for files
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<h1>Skeleton</h1>
|
||||||
|
|
||||||
|
<? foreach( $_["array"] as $item ){ ?>
|
||||||
|
<p><? echo $item ?></p>
|
||||||
|
<? } ?>
|
||||||
|
|
||||||
|
<? echo $_["anothervar"] ?>
|
|
@ -25,7 +25,7 @@
|
||||||
<a id="user_menu_link" href="" title="">Username</a>
|
<a id="user_menu_link" href="" title="">Username</a>
|
||||||
<ul id="user_menu">
|
<ul id="user_menu">
|
||||||
<?php foreach($_["personalmenu"] as $entry): ?>
|
<?php foreach($_["personalmenu"] as $entry): ?>
|
||||||
<li><a href="<?php echo link_to($entry["app"], $entry["file"]); ?>" title=""><?php echo $entry["name"]; ?></a></li>
|
<li><a href="<?php echo $entry["href"]; ?>" title=""><?php echo $entry["name"]; ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,9 +34,8 @@
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<div id="plugins">
|
<div id="plugins">
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach($_["navigation"] as $entry): ?>
|
<li><a style="background-image:url(<?php echo image_path("admin", "navicon.png"); ?>)" href="<?php echo link_to("admin", "index.php"); ?>" title="">Administration</a></li>
|
||||||
<li><a href="<?php echo link_to($entry["app"], $entry["file"]); ?>" title=""><?php echo $entry["name"]; ?></a></li>
|
<li><a style="background-image:url(<?php echo image_path("", "actions/arrow-left.png"); ?>)" href="<?php echo link_to("", "index.php"); ?>" title="">Back</a></li>
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<a id="user_menu_link" href="" title="">Username</a>
|
<a id="user_menu_link" href="" title="">Username</a>
|
||||||
<ul id="user_menu">
|
<ul id="user_menu">
|
||||||
<?php foreach($_["personalmenu"] as $entry): ?>
|
<?php foreach($_["personalmenu"] as $entry): ?>
|
||||||
<li><a href="<?php echo link_to($entry["app"], $entry["file"]); ?>" title=""><?php echo $entry["name"]; ?></a></li>
|
<li><a href="<?php echo $entry["href"]; ?>" title=""><?php echo $entry["name"]; ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<div id="plugins">
|
<div id="plugins">
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach($_["navigation"] as $entry): ?>
|
<?php foreach($_["navigation"] as $entry): ?>
|
||||||
<li><a href="<?php echo link_to($entry["app"], $entry["file"]); ?>" title=""><?php echo $entry["name"]; ?></a></li>
|
<li><a style="background-image:url(<?php echo $entry["icon"]; ?>)" href="<?php echo $entry["href"]; ?>" title=""><?php echo $entry["name"]; ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue