summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-06-04 23:02:05 +0200
committerBart Visscher <bartv@thisnet.nl>2012-06-04 23:02:05 +0200
commit4a5973662c78eb5769e7b06d7d559572f57e663f (patch)
tree774e2f775b3789f5f40bd2459ddec05df1b73c31 /lib
parent786325a4bb976d92de54c472c2c3bd8a73cbef22 (diff)
parent3fee3a4633e5d4d65f7eabf2d387e209efedbc70 (diff)
downloadnextcloud-server-4a5973662c78eb5769e7b06d7d559572f57e663f.tar.gz
nextcloud-server-4a5973662c78eb5769e7b06d7d559572f57e663f.zip
Merge branch 'unstable'
Conflicts: apps/files_external/tests/config.php apps/files_versions/ajax/getVersions.php apps/files_versions/appinfo/app.php apps/files_versions/history.php apps/files_versions/js/versions.js apps/files_versions/templates/history.php apps/files_versions/versions.php lib/base.php
Diffstat (limited to 'lib')
-rwxr-xr-xlib/app.php8
-rw-r--r--lib/base.php32
-rw-r--r--lib/filesystem.php4
-rw-r--r--lib/group.php14
-rw-r--r--lib/group/backend.php58
-rw-r--r--lib/group/example.php7
-rw-r--r--lib/helper.php4
-rw-r--r--lib/minimizer.php40
-rw-r--r--lib/minimizer/css.php73
-rw-r--r--lib/minimizer/js.php62
-rw-r--r--lib/template.php10
-rw-r--r--lib/user.php20
-rw-r--r--lib/user/backend.php40
-rw-r--r--lib/user/example.php30
-rw-r--r--lib/util.php5
15 files changed, 298 insertions, 109 deletions
diff --git a/lib/app.php b/lib/app.php
index 17e0e479031..667633e2647 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -61,6 +61,14 @@ class OC_App{
}
ob_end_clean();
+ if (!defined('DEBUG') || !DEBUG){
+ if (is_null($types)) {
+ OC_Util::$core_scripts = OC_Util::$scripts;
+ OC_Util::$scripts = array();
+ OC_Util::$core_styles = OC_Util::$styles;
+ OC_Util::$styles = array();
+ }
+ }
// return
return true;
}
diff --git a/lib/base.php b/lib/base.php
index e6fcb9ec4de..bdfd05e8f1d 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -31,17 +31,13 @@ class OC{
*/
public static $CLASSPATH = array();
/**
- * $_SERVER['DOCUMENTROOT'] but without symlinks
- */
- public static $DOCUMENTROOT = '';
- /**
* The installation path for owncloud on the server (e.g. /srv/http/owncloud)
*/
public static $SERVERROOT = '';
/**
* the current request path relative to the owncloud root (e.g. files/index.php)
*/
- public static $SUBURI = '';
+ private static $SUBURI = '';
/**
* the owncloud root path for http requests (e.g. owncloud/)
*/
@@ -51,10 +47,6 @@ class OC{
*/
public static $CONFIG_DATADIRECTORY = '';
/**
- * the folder that stores the data for the root filesystem (e.g. /srv/http/owncloud/data)
- */
- public static $CONFIG_DATADIRECTORY_ROOT = '';
- /**
* The installation path of the 3rdparty folder on the server (e.g. /srv/http/owncloud/3rdparty)
*/
public static $THIRDPARTYROOT = '';
@@ -130,7 +122,7 @@ class OC{
public static function initPaths(){
// calculate the documentroot
- OC::$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
+ $DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13));
OC::$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen(OC::$SERVERROOT));
$scriptName=$_SERVER["SCRIPT_NAME"];
@@ -146,7 +138,7 @@ class OC{
}
OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI));
// try a new way to detect the WEBROOT which is simpler and also works with the app directory outside the owncloud folder. let´s see if this works for everybody
-// OC::$WEBROOT=substr(OC::$SERVERROOT,strlen(OC::$DOCUMENTROOT));
+// OC::$WEBROOT=substr(OC::$SERVERROOT,strlen($DOCUMENTROOT));
if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){
@@ -243,6 +235,9 @@ class OC{
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
}
+ OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
+ OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
+
OC_App::updateApps();
}
}
@@ -291,18 +286,9 @@ class OC{
public static function loadfile(){
if(file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE)){
if(substr(OC::$REQUESTEDFILE, -3) == 'css'){
- $appswebroot = (string) OC::$APPSWEBROOT;
- $webroot = (string) OC::$WEBROOT;
- $filepath = OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE;
- header('Content-Type: text/css');
- OC_Response::enableCaching();
- OC_Response::setLastModifiedHeader(filemtime($filepath));
- $cssfile = file_get_contents($filepath);
- $cssfile = str_replace('%appswebroot%', $appswebroot, $cssfile);
- $cssfile = str_replace('%webroot%', $webroot, $cssfile);
- OC_Response::setETagHeader(md5($cssfile));
- header('Content-Length: '.strlen($cssfile));
- echo $cssfile;
+ $file = 'apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE;
+ $minimizer = new OC_Minimizer_CSS();
+ $minimizer->output(array(array(OC::$APPSROOT, OC::$APPSWEBROOT, $file)));
exit;
}elseif(substr(OC::$REQUESTEDFILE, -3) == 'php'){
require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE);
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 6b3c254c5e9..84d45f5f24b 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -290,8 +290,10 @@ class OC_Filesystem{
}
/**
- * get the fake root
+ * @brief get the relative path of the root data directory for the current user
* @return string
+ *
+ * Returns path like /admin/files
*/
static public function getRoot(){
return self::$defaultInstance->getRoot();
diff --git a/lib/group.php b/lib/group.php
index 7967e1a581b..ceee5fa4edb 100644
--- a/lib/group.php
+++ b/lib/group.php
@@ -84,7 +84,7 @@ class OC_Group {
OC_Hook::emit( "OC_Group", "pre_createGroup", array( "run" => &$run, "gid" => $gid ));
if($run){
- //create the user in the first backend that supports creating users
+ //create the group in the first backend that supports creating groups
foreach(self::$_usedBackends as $backend){
if(!$backend->implementsActions(OC_GROUP_BACKEND_CREATE_GROUP))
continue;
@@ -141,9 +141,6 @@ class OC_Group {
*/
public static function inGroup( $uid, $gid ){
foreach(self::$_usedBackends as $backend){
- if(!$backend->implementsActions(OC_GROUP_BACKEND_IN_GROUP))
- continue;
-
if($backend->inGroup($uid,$gid)){
return true;
}
@@ -228,9 +225,6 @@ class OC_Group {
public static function getUserGroups( $uid ){
$groups=array();
foreach(self::$_usedBackends as $backend){
- if(!$backend->implementsActions(OC_GROUP_BACKEND_GET_USER_GROUPS))
- continue;
-
$groups=array_merge($backend->getUserGroups($uid),$groups);
}
asort($groups);
@@ -246,9 +240,6 @@ class OC_Group {
public static function getGroups(){
$groups=array();
foreach(self::$_usedBackends as $backend){
- if(!$backend->implementsActions(OC_GROUP_BACKEND_GET_GROUPS))
- continue;
-
$groups=array_merge($backend->getGroups(),$groups);
}
asort($groups);
@@ -276,9 +267,6 @@ class OC_Group {
public static function usersInGroup($gid){
$users=array();
foreach(self::$_usedBackends as $backend){
- if(!$backend->implementsActions(OC_GROUP_BACKEND_GET_USERS))
- continue;
-
$users=array_merge($backend->usersInGroup($gid),$users);
}
return $users;
diff --git a/lib/group/backend.php b/lib/group/backend.php
index 3b652599462..1b0b663f2ed 100644
--- a/lib/group/backend.php
+++ b/lib/group/backend.php
@@ -31,12 +31,8 @@ define('OC_GROUP_BACKEND_NOT_IMPLEMENTED', -501);
*/
define('OC_GROUP_BACKEND_CREATE_GROUP', 0x00000001);
define('OC_GROUP_BACKEND_DELETE_GROUP', 0x00000010);
-define('OC_GROUP_BACKEND_IN_GROUP', 0x00000100);
-define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00001000);
-define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00010000);
-define('OC_GROUP_BACKEND_GET_USER_GROUPS', 0x00100000);
-define('OC_GROUP_BACKEND_GET_USERS', 0x01000000);
-define('OC_GROUP_BACKEND_GET_GROUPS', 0x10000000);
+define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00000100);
+define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00001000);
/**
* Abstract base class for user management
@@ -45,12 +41,8 @@ abstract class OC_Group_Backend {
protected $possibleActions = array(
OC_GROUP_BACKEND_CREATE_GROUP => 'createGroup',
OC_GROUP_BACKEND_DELETE_GROUP => 'deleteGroup',
- OC_GROUP_BACKEND_IN_GROUP => 'inGroup',
OC_GROUP_BACKEND_ADD_TO_GROUP => 'addToGroup',
OC_GROUP_BACKEND_REMOVE_FROM_GOUP => 'removeFromGroup',
- OC_GROUP_BACKEND_GET_USER_GROUPS => 'getUserGroups',
- OC_GROUP_BACKEND_GET_USERS => 'usersInGroup',
- OC_GROUP_BACKEND_GET_GROUPS => 'getGroups'
);
/**
@@ -84,14 +76,54 @@ abstract class OC_Group_Backend {
}
/**
+ * @brief is user in group?
+ * @param $uid uid of the user
+ * @param $gid gid of the group
+ * @returns true/false
+ *
+ * Checks whether the user is member of a group or not.
+ */
+ public static function inGroup($uid, $gid){
+ return in_array($gid, $this->getUserGroups($uid));
+ }
+
+ /**
+ * @brief Get all groups a user belongs to
+ * @param $uid Name of the user
+ * @returns array with group names
+ *
+ * This function fetches all groups a user belongs to. It does not check
+ * if the user exists at all.
+ */
+ public static function getUserGroups($uid){
+ return array();
+ }
+
+ /**
+ * @brief get a list of all groups
+ * @returns array with group names
+ *
+ * Returns a list with all groups
+ */
+ public static function getGroups(){
+ return array();
+ }
+
+ /**
* check if a group exists
* @param string $gid
* @return bool
*/
public function groupExists($gid){
- if(!$this->implementsActions(OC_GROUP_BACKEND_GET_GROUPS)){
- return false;
- }
return in_array($gid, $this->getGroups());
}
+
+ /**
+ * @brief get a list of all users in a group
+ * @returns array with user ids
+ */
+ public static function usersInGroup($gid){
+ return array();
+ }
+
}
diff --git a/lib/group/example.php b/lib/group/example.php
index b2de119553c..c18562db7a4 100644
--- a/lib/group/example.php
+++ b/lib/group/example.php
@@ -94,6 +94,13 @@ abstract class OC_Group_Example {
public static function getGroups(){}
/**
+ * check if a group exists
+ * @param string $gid
+ * @return bool
+ */
+ public function groupExists($gid){}
+
+ /**
* @brief get a list of all users in a group
* @returns array with user ids
*/
diff --git a/lib/helper.php b/lib/helper.php
index f8f84b91ae3..aedac204058 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -131,8 +131,8 @@ class OC_Helper {
*
* Returns a absolute url to the given service.
*/
- public static function linkToRemote( $service ) {
- return self::linkToAbsolute( '', 'remote.php') . '/' . $service . '/';
+ public static function linkToRemote( $service, $add_slash = true ) {
+ return self::linkToAbsolute( '', 'remote.php') . '/' . $service . ($add_slash?'/':'');
}
/**
diff --git a/lib/minimizer.php b/lib/minimizer.php
new file mode 100644
index 00000000000..9f9ef086c4a
--- /dev/null
+++ b/lib/minimizer.php
@@ -0,0 +1,40 @@
+<?php
+
+abstract class OC_Minimizer
+{
+ protected $files = array();
+
+ protected function appendIfExist($root, $webroot, $file) {
+ if (is_file($root.'/'.$file)) {
+ $this->files[] = array($root, $webroot, $file);
+ return true;
+ }
+ return false;
+ }
+
+ public function getLastModified($files) {
+ $last_modified = 0;
+ foreach($files as $file_info) {
+ $file = $file_info[0] . '/' . $file_info[2];
+ $filemtime = filemtime($file);
+ if ($filemtime > $last_modified) {
+ $last_modified = $filemtime;
+ }
+ }
+ return $last_modified;
+ }
+
+ abstract public function minimizeFiles($files);
+
+ public function output($files) {
+ header('Content-Type: '.$this->contentType);
+ OC_Response::enableCaching();
+ $last_modified = $this->getLastModified($files);
+ OC_Response::setLastModifiedHeader($last_modified);
+
+ $out = $this->minimizeFiles($files);
+ OC_Response::setETagHeader(md5($out));
+ header('Content-Length: '.strlen($out));
+ echo $out;
+ }
+}
diff --git a/lib/minimizer/css.php b/lib/minimizer/css.php
new file mode 100644
index 00000000000..3d1196390e2
--- /dev/null
+++ b/lib/minimizer/css.php
@@ -0,0 +1,73 @@
+<?php
+
+require_once('mediawiki/CSSMin.php');
+
+class OC_Minimizer_CSS extends OC_Minimizer
+{
+ protected $contentType = 'text/css';
+
+ public function findFiles($styles) {
+ // Read the selected theme from the config file
+ $theme=OC_Config::getValue( "theme" );
+
+ // Read the detected formfactor and use the right file name.
+ $fext = OC_Template::getFormFactorExtension();
+ foreach($styles as $style){
+ // is it in 3rdparty?
+ if($this->appendIfExist(OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style.'.css')) {
+
+ // or in apps?
+ }elseif($this->appendIfExist(OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style$fext.css" )) {
+ }elseif($this->appendIfExist(OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style.css" )) {
+
+ // or in the owncloud root?
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$style$fext.css" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$style.css" )) {
+
+ // or in core ?
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$style$fext.css" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
+
+ }else{
+ echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
+ die();
+ }
+ }
+ // Add the theme css files. you can override the default values here
+ if(!empty($theme)) {
+ foreach($styles as $style){
+ if($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style$fext.css" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style.css" )) {
+
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style$fext.css" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style.css" )) {
+
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style$fext.css" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style.css" )) {
+ }
+ }
+ }
+ return $this->files;
+ }
+
+ public function minimizeFiles($files) {
+ $css_out = '';
+ $appswebroot = (string) OC::$APPSWEBROOT;
+ $webroot = (string) OC::$WEBROOT;
+ foreach($files as $file_info) {
+ $file = $file_info[0] . '/' . $file_info[2];
+ $css_out .= '/* ' . $file . ' */' . "\n";
+ $css = file_get_contents($file);
+ if (strpos($file, OC::$APPSROOT) == 0) {
+ $css = str_replace('%appswebroot%', $appswebroot, $css);
+ $css = str_replace('%webroot%', $webroot, $css);
+ }
+ $remote = $file_info[1];
+ $remote .= '../';
+ $remote .= dirname($file_info[2]);
+ $css_out .= CSSMin::remap($css, dirname($file), $remote, true);
+ }
+ $css_out = CSSMin::minify($css_out);
+ return $css_out;
+ }
+}
diff --git a/lib/minimizer/js.php b/lib/minimizer/js.php
new file mode 100644
index 00000000000..4ddaa79d81a
--- /dev/null
+++ b/lib/minimizer/js.php
@@ -0,0 +1,62 @@
+<?php
+
+require_once('mediawiki/JavaScriptMinifier.php');
+
+class OC_Minimizer_JS extends OC_Minimizer
+{
+ protected $contentType = 'application/javascript';
+
+ public function findFiles($scripts) {
+ // Read the selected theme from the config file
+ $theme=OC_Config::getValue( "theme" );
+
+ // Read the detected formfactor and use the right file name.
+ $fext = OC_Template::getFormFactorExtension();
+ // Add the core js files or the js files provided by the selected theme
+ foreach($scripts as $script){
+ // Is it in 3rd party?
+ if($this->appendIfExist(OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script.'.js')) {
+
+ // Is it in apps and overwritten by the theme?
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script$fext.js" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script.js" )) {
+
+ // Is it part of an app?
+ }elseif($this->appendIfExist(OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script$fext.js" )) {
+ }elseif($this->appendIfExist(OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script.js" )) {
+
+ // Is it in the owncloud root but overwritten by the theme?
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script$fext.js" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script.js" )) {
+
+ // Is it in the owncloud root ?
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$script$fext.js" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$script.js" )) {
+
+ // Is in core but overwritten by a theme?
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script$fext.js" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script.js" )) {
+
+ // Is it in core?
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$script$fext.js" )) {
+ }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$script.js" )) {
+
+ }else{
+ echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
+ die();
+ }
+ }
+ return $this->files;
+ }
+
+ public function minimizeFiles($files) {
+ $js_out = '';
+ foreach($files as $file_info) {
+ $file = $file_info[0] . '/' . $file_info[2];
+ $js_out .= '/* ' . $file . ' */' . "\n";
+ $js_out .= file_get_contents($file);
+ }
+ $js_out = JavaScriptMinifier::minify($js_out);
+ return $js_out;
+ }
+}
diff --git a/lib/template.php b/lib/template.php
index a15cfcc457b..14833a1e5b5 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -166,7 +166,7 @@ class OC_Template{
/**
* @brief Returns the formfactor extension for current formfactor
*/
- protected function getFormFactorExtension()
+ static public function getFormFactorExtension()
{
$formfactor=$_SESSION['formfactor'];
if($formfactor=='default') {
@@ -196,7 +196,7 @@ class OC_Template{
$theme=OC_Config::getValue( "theme" );
// Read the detected formfactor and use the right file name.
- $fext = $this->getFormFactorExtension();
+ $fext = self::getFormFactorExtension();
$app = $this->application;
// Check if it is a app template or not.
@@ -379,8 +379,9 @@ class OC_Template{
$theme=OC_Config::getValue( "theme" );
// Read the detected formfactor and use the right file name.
- $fext = $this->getFormFactorExtension();
+ $fext = self::getFormFactorExtension();
+ $page->assign('jsfiles', array());
// Add the core js files or the js files provided by the selected theme
foreach(OC_Util::$scripts as $script){
// Is it in 3rd party?
@@ -417,6 +418,7 @@ class OC_Template{
}
}
// Add the css files
+ $page->assign('cssfiles', array());
foreach(OC_Util::$styles as $style){
// is it in 3rdparty?
if($page->appendIfExist('cssfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style.'.css')) {
@@ -434,7 +436,7 @@ class OC_Template{
}elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
}else{
- echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
+ echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
die();
}
}
diff --git a/lib/user.php b/lib/user.php
index 9bfbfd8ee70..f1903093d6d 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -168,9 +168,7 @@ class OC_User {
if( $run ){
//delete the user from all backends
foreach(self::$_usedBackends as $backend){
- if($backend->implementsActions(OC_USER_BACKEND_DELETE_USER)){
- $backend->deleteUser($uid);
- }
+ $backend->deleteUser($uid);
}
// We have to delete the user from all groups
foreach( OC_Group::getUserGroups( $uid ) as $i ){
@@ -332,11 +330,9 @@ class OC_User {
public static function getUsers(){
$users=array();
foreach(self::$_usedBackends as $backend){
- if($backend->implementsActions(OC_USER_BACKEND_GET_USERS)){
- $backendUsers=$backend->getUsers();
- if(is_array($backendUsers)){
- $users=array_merge($users,$backendUsers);
- }
+ $backendUsers=$backend->getUsers();
+ if(is_array($backendUsers)){
+ $users=array_merge($users,$backendUsers);
}
}
asort($users);
@@ -350,11 +346,9 @@ class OC_User {
*/
public static function userExists($uid){
foreach(self::$_usedBackends as $backend){
- if($backend->implementsActions(OC_USER_BACKEND_USER_EXISTS)){
- $result=$backend->userExists($uid);
- if($result===true){
- return true;
- }
+ $result=$backend->userExists($uid);
+ if($result===true){
+ return true;
}
}
return false;
diff --git a/lib/user/backend.php b/lib/user/backend.php
index c31d4b5785b..be068a63ce0 100644
--- a/lib/user/backend.php
+++ b/lib/user/backend.php
@@ -32,11 +32,8 @@ define('OC_USER_BACKEND_NOT_IMPLEMENTED', -501);
* actions that user backends can define
*/
define('OC_USER_BACKEND_CREATE_USER', 0x000001);
-define('OC_USER_BACKEND_DELETE_USER', 0x000010);
-define('OC_USER_BACKEND_SET_PASSWORD', 0x000100);
-define('OC_USER_BACKEND_CHECK_PASSWORD', 0x001000);
-define('OC_USER_BACKEND_GET_USERS', 0x010000);
-define('OC_USER_BACKEND_USER_EXISTS', 0x100000);
+define('OC_USER_BACKEND_SET_PASSWORD', 0x000010);
+define('OC_USER_BACKEND_CHECK_PASSWORD', 0x000100);
/**
@@ -49,11 +46,8 @@ abstract class OC_User_Backend {
protected $possibleActions = array(
OC_USER_BACKEND_CREATE_USER => 'createUser',
- OC_USER_BACKEND_DELETE_USER => 'deleteUser',
OC_USER_BACKEND_SET_PASSWORD => 'setPassword',
OC_USER_BACKEND_CHECK_PASSWORD => 'checkPassword',
- OC_USER_BACKEND_GET_USERS => 'getUsers',
- OC_USER_BACKEND_USER_EXISTS => 'userExists'
);
/**
@@ -85,4 +79,34 @@ abstract class OC_User_Backend {
public function implementsActions($actions){
return (bool)($this->getSupportedActions() & $actions);
}
+
+ /**
+ * @brief delete a user
+ * @param $uid The username of the user to delete
+ * @returns true/false
+ *
+ * Deletes a user
+ */
+ public function deleteUser( $uid ){
+ return false;
+ }
+
+ /**
+ * @brief Get a list of all users
+ * @returns array with all uids
+ *
+ * Get a list of all users.
+ */
+ public function getUsers(){
+ return array();
+ }
+
+ /**
+ * @brief check if a user exists
+ * @param string $uid the username
+ * @return boolean
+ */
+ public function userExists($uid){
+ return false;
+ }
}
diff --git a/lib/user/example.php b/lib/user/example.php
index 18bc6bce00d..7f3fd1b8578 100644
--- a/lib/user/example.php
+++ b/lib/user/example.php
@@ -40,17 +40,6 @@ abstract class OC_User_Example extends OC_User_Backend {
}
/**
- * @brief delete a user
- * @param $uid The username of the user to delete
- * @returns true/false
- *
- * Deletes a user
- */
- public function deleteUser( $uid ){
- return OC_USER_BACKEND_NOT_IMPLEMENTED;
- }
-
- /**
* @brief Set password
* @param $uid The username
* @param $password The new password
@@ -74,23 +63,4 @@ abstract class OC_User_Example extends OC_User_Backend {
public function checkPassword($uid, $password){
return OC_USER_BACKEND_NOT_IMPLEMENTED;
}
-
- /**
- * @brief Get a list of all users
- * @returns array with all uids
- *
- * Get a list of all users.
- */
- public function getUsers(){
- return OC_USER_BACKEND_NOT_IMPLEMENTED;
- }
-
- /**
- * @brief check if a user exists
- * @param string $uid the username
- * @return boolean
- */
- public function userExists($uid){
- return OC_USER_BACKEND_NOT_IMPLEMENTED;
- }
}
diff --git a/lib/util.php b/lib/util.php
index fda60587b82..9a1fb7ac370 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -10,6 +10,8 @@ class OC_Util {
public static $headers=array();
private static $rootMounted=false;
private static $fsSetup=false;
+ public static $core_styles=array();
+ public static $core_scripts=array();
// Can be set up
public static function setupFS( $user = "", $root = "files" ){// configure the initial filesystem based on the configuration
@@ -39,7 +41,7 @@ class OC_Util {
// Create root dir.
if(!is_dir($CONFIG_DATADIRECTORY_ROOT)){
$success=@mkdir($CONFIG_DATADIRECTORY_ROOT);
- if(!$success) {
+ if(!$success) {
$tmpl = new OC_Template( '', 'error', 'guest' );
$tmpl->assign('errors',array(1=>array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY_ROOT.")",'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '".OC::$SERVERROOT."' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ")));
$tmpl->printPage();
@@ -58,7 +60,6 @@ class OC_Util {
self::$rootMounted=true;
}
if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem
-
OC::$CONFIG_DATADIRECTORY = $CONFIG_DATADIRECTORY_ROOT."/$user/$root";
if( !is_dir( OC::$CONFIG_DATADIRECTORY )){
mkdir( OC::$CONFIG_DATADIRECTORY, 0755, true );