diff --git a/admin/appinfo.php b/admin/appinfo.php deleted file mode 100644 index 0b2e4dbf85d..00000000000 --- a/admin/appinfo.php +++ /dev/null @@ -1,12 +0,0 @@ - "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" )); - -?> diff --git a/admin/appinfo/app.php b/admin/appinfo/app.php new file mode 100644 index 00000000000..3221e276c5f --- /dev/null +++ b/admin/appinfo/app.php @@ -0,0 +1,12 @@ + 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" )); + +?> diff --git a/admin/img/navicon.png b/admin/img/navicon.png new file mode 100644 index 00000000000..f2c7c0867f6 Binary files /dev/null and b/admin/img/navicon.png differ diff --git a/admin/templates/index.php b/admin/templates/index.php index 2ca7b0b2d3b..9d0ffd84c61 100644 --- a/admin/templates/index.php +++ b/admin/templates/index.php @@ -7,6 +7,6 @@ diff --git a/files/admin.php b/files/admin.php new file mode 100644 index 00000000000..4c442c4b111 --- /dev/null +++ b/files/admin.php @@ -0,0 +1,39 @@ +. +* +*/ + + +// 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(); + +?> diff --git a/files/ajax/delete.php b/files/ajax/delete.php new file mode 100644 index 00000000000..113476f0254 --- /dev/null +++ b/files/ajax/delete.php @@ -0,0 +1,27 @@ + "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" ))); +} + +?> diff --git a/files/ajax/list.php b/files/ajax/list.php new file mode 100644 index 00000000000..4694f842832 --- /dev/null +++ b/files/ajax/list.php @@ -0,0 +1,36 @@ + "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 ))); + +?> diff --git a/files/ajax/rename.php b/files/ajax/rename.php new file mode 100644 index 00000000000..86cb7944a88 --- /dev/null +++ b/files/ajax/rename.php @@ -0,0 +1,28 @@ + "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" ))); +} + +?> diff --git a/files/appinfo.php b/files/appinfo.php deleted file mode 100644 index 44a533cf4a0..00000000000 --- a/files/appinfo.php +++ /dev/null @@ -1,6 +0,0 @@ - "files", "name" => "Files" )); -OC_UTIL::addNavigationEntry( array( "app" => "files", "file" => "index.php", "name" => "Files" )); - -?> diff --git a/files/appinfo/app.php b/files/appinfo/app.php new file mode 100644 index 00000000000..8b1a806b7be --- /dev/null +++ b/files/appinfo/app.php @@ -0,0 +1,8 @@ + 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" )); + +?> diff --git a/files/download.php b/files/download.php new file mode 100644 index 00000000000..d6d39c82126 --- /dev/null +++ b/files/download.php @@ -0,0 +1,45 @@ +. +* +*/ + +// 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 ); +?> diff --git a/files/img/navicon.png b/files/img/navicon.png new file mode 100644 index 00000000000..9ee717c8b12 Binary files /dev/null and b/files/img/navicon.png differ diff --git a/files/settings.php b/files/settings.php new file mode 100644 index 00000000000..25a9f0297dc --- /dev/null +++ b/files/settings.php @@ -0,0 +1,64 @@ +. +* +*/ + + +// 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(); + +?> diff --git a/files/templates/admin.php b/files/templates/admin.php new file mode 100644 index 00000000000..811b48af027 --- /dev/null +++ b/files/templates/admin.php @@ -0,0 +1,19 @@ + +

Admin

+ +
+ Allow public folders
+ + (if public is enabled)
+ separated from webdav storage
+ let the user decide
+ folder "/public" in webdav storage
+ (endif)
+ + Allow downloading shared files
+ Allow uploading in shared directory
+
diff --git a/img/actions/arrow-down.png b/img/actions/arrow-down.png new file mode 100644 index 00000000000..03f201428ad Binary files /dev/null and b/img/actions/arrow-down.png differ diff --git a/img/actions/arrow-left.png b/img/actions/arrow-left.png new file mode 100644 index 00000000000..b56cfee03df Binary files /dev/null and b/img/actions/arrow-left.png differ diff --git a/img/actions/arrow-right.png b/img/actions/arrow-right.png new file mode 100644 index 00000000000..0acee70bcdd Binary files /dev/null and b/img/actions/arrow-right.png differ diff --git a/img/actions/arrow-up.png b/img/actions/arrow-up.png new file mode 100644 index 00000000000..5e423213fbd Binary files /dev/null and b/img/actions/arrow-up.png differ diff --git a/lib/app.php b/lib/app.php new file mode 100644 index 00000000000..0bef7381262 --- /dev/null +++ b/lib/app.php @@ -0,0 +1,42 @@ + diff --git a/lib/appconfig.php b/lib/appconfig.php index f1bccc0a250..844d4cf54e8 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -1,16 +1,5 @@ "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-ui-1.8.10.custom.min" ); OC_UTIL::addScript( "js" ); OC_UTIL::addStyle( "jquery-ui-1.8.10.custom" ); OC_UTIL::addStyle( "styles" ); -// Require all appinfo.php -$dir = opendir( $SERVERROOT ); -while( false !== ( $filename = readdir( $dir ))){ - if( substr( $filename, 0, 1 ) != '.' ){ - if( file_exists( "$SERVERROOT/$filename/appinfo.php" )){ - oc_require( "$filename/appinfo.php" ); - } - } -} -closedir( $dir ); - - +// Load Apps +OC_APP::loadApps(); // check if the server is correctly configured for ownCloud OC_UTIL::checkserver(); @@ -133,13 +125,12 @@ class OC_UTIL { public static $scripts=array(); public static $styles=array(); public static $adminpages = array(); - public static $applications = array(); public static $navigation = array(); public static $personalmenu = array(); private static $fsSetup=false; // 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 return false; } @@ -166,11 +157,9 @@ class OC_UTIL { //first set up the local "root" storage and the backupstorage if needed $rootStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_DATADIRECTORY)); if($CONFIG_ENABLEBACKUP){ - if(!is_dir($CONFIG_BACKUPDIRECTORY)){ - mkdir($CONFIG_BACKUPDIRECTORY); - } - if(!is_dir($CONFIG_BACKUPDIRECTORY.'/'.$user )){ - mkdir($CONFIG_BACKUPDIRECTORY.'/'.$user ); + // This creates the Directorys recursively + if(!is_dir( "$CONFIG_BACKUPDIRECTORY/$user/$root" )){ + mkdir( "$CONFIG_BACKUPDIRECTORY/$user/$root", 0x755, true ); } $backupStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY)); $backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage)); @@ -178,9 +167,9 @@ class OC_UTIL { } OC_FILESYSTEM::mount($rootStorage,'/'); - $CONFIG_DATADIRECTORY=$CONFIG_DATADIRECTORY_ROOT.'/'.$user; - if(!is_dir($CONFIG_DATADIRECTORY)){ - mkdir($CONFIG_DATADIRECTORY); + $CONFIG_DATADIRECTORY = "$CONFIG_DATADIRECTORY_ROOT/$user/$root"; + if( !is_dir( $CONFIG_DATADIRECTORY )){ + mkdir( $CONFIG_DATADIRECTORY, 0x755, true ); } //set up the other storages according to the system settings @@ -197,7 +186,7 @@ class OC_UTIL { } //jail the user into his "home" directory - OC_FILESYSTEM::chroot('/'.$user); + OC_FILESYSTEM::chroot("/$user/$root"); self::$fsSetup=true; } } @@ -250,19 +239,10 @@ class OC_UTIL { * * @param array $entry */ - public static function addAdminPage( $entry){ + public static function addAdminPage( $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 * diff --git a/lib/preferences.php b/lib/preferences.php new file mode 100644 index 00000000000..bd4ff55cc5c --- /dev/null +++ b/lib/preferences.php @@ -0,0 +1,35 @@ + diff --git a/lib/template.php b/lib/template.php index 79899efee49..cd576a89f94 100644 --- a/lib/template.php +++ b/lib/template.php @@ -21,8 +21,6 @@ * */ -oc_include_once( "helper.php" ); - /** * */ diff --git a/log/appinfo.php b/log/appinfo.php deleted file mode 100644 index e4ffa79efe1..00000000000 --- a/log/appinfo.php +++ /dev/null @@ -1,6 +0,0 @@ - "log", "name" => "Log" )); -OC_UTIL::addNavigationEntry( array( "app" => "log", "file" => "index.php", "name" => "Log" )); - -?> diff --git a/log/appinfo/app.php b/log/appinfo/app.php new file mode 100644 index 00000000000..e639982a89c --- /dev/null +++ b/log/appinfo/app.php @@ -0,0 +1,6 @@ + 1, "id" => "log", "name" => "Log" )); +OC_UTIL::addPersonalMenuEntry( array( "order" => 2, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log" )); + +?> diff --git a/settings/appinfo.php b/settings/appinfo.php deleted file mode 100644 index 232aaa0f0e7..00000000000 --- a/settings/appinfo.php +++ /dev/null @@ -1,6 +0,0 @@ - "settings", "name" => "Settings" )); -OC_UTIL::addNavigationEntry( array( "app" => "settings", "file" => "index.php", "name" => "Settings" )); - -?> diff --git a/settings/appinfo/app.php b/settings/appinfo/app.php new file mode 100644 index 00000000000..c43d47f0dd6 --- /dev/null +++ b/settings/appinfo/app.php @@ -0,0 +1,6 @@ + "settings", "name" => "Settings" )); +OC_UTIL::addPersonalMenuEntry( array( "order" => 1, "href" => OC_HELPER::linkTo( "settings", "index.php" ), "name" => "Settings" )); + +?> diff --git a/skeleton/admin.php b/skeleton/admin.php new file mode 100644 index 00000000000..f237e84d852 --- /dev/null +++ b/skeleton/admin.php @@ -0,0 +1,56 @@ +. +* +*/ + +// 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(); + +?> diff --git a/skeleton/appinfo/app.sample.php b/skeleton/appinfo/app.sample.php new file mode 100644 index 00000000000..12db7154c2b --- /dev/null +++ b/skeleton/appinfo/app.sample.php @@ -0,0 +1,15 @@ + "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" )); + +?> diff --git a/skeleton/css/skeleton.css b/skeleton/css/skeleton.css new file mode 100644 index 00000000000..aa68a8be867 --- /dev/null +++ b/skeleton/css/skeleton.css @@ -0,0 +1,4 @@ +/* + * To include this css file, call "OC_UTIL::addStyle( "skeleton", "skeleton" )" + * in your app. (appname) (cssname) + */ \ No newline at end of file diff --git a/skeleton/css/special.css b/skeleton/css/special.css new file mode 100644 index 00000000000..8fd75917bf2 --- /dev/null +++ b/skeleton/css/special.css @@ -0,0 +1,3 @@ +/* + * If you want to you can use more css files ... + */ diff --git a/skeleton/img/put_images_here.txt b/skeleton/img/put_images_here.txt new file mode 100644 index 00000000000..8d1c8b69c3f --- /dev/null +++ b/skeleton/img/put_images_here.txt @@ -0,0 +1 @@ + diff --git a/skeleton/index.php b/skeleton/index.php new file mode 100644 index 00000000000..25a9f0297dc --- /dev/null +++ b/skeleton/index.php @@ -0,0 +1,64 @@ +. +* +*/ + + +// 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(); + +?> diff --git a/skeleton/js/app.js b/skeleton/js/app.js new file mode 100644 index 00000000000..5d5b668eeb5 --- /dev/null +++ b/skeleton/js/app.js @@ -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 diff --git a/skeleton/templates/admin.php b/skeleton/templates/admin.php new file mode 100644 index 00000000000..63fcd5cd39f --- /dev/null +++ b/skeleton/templates/admin.php @@ -0,0 +1,8 @@ + +

Admin

diff --git a/skeleton/templates/index.php b/skeleton/templates/index.php new file mode 100644 index 00000000000..f8d8440817f --- /dev/null +++ b/skeleton/templates/index.php @@ -0,0 +1,12 @@ + +

Skeleton

+ + +

+ + + diff --git a/templates/layout.admin.php b/templates/layout.admin.php index ebf0a1f048a..22de64335fd 100644 --- a/templates/layout.admin.php +++ b/templates/layout.admin.php @@ -24,8 +24,8 @@
Username
@@ -34,9 +34,8 @@
diff --git a/templates/layout.user.php b/templates/layout.user.php index 20fb3f88cd6..7529f2c720a 100644 --- a/templates/layout.user.php +++ b/templates/layout.user.php @@ -25,7 +25,7 @@ Username
@@ -35,7 +35,7 @@