diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 33 | ||||
-rw-r--r-- | lib/db.php | 3 | ||||
-rw-r--r-- | lib/filecache.php | 2 | ||||
-rw-r--r-- | lib/fileproxy/quota.php | 30 | ||||
-rw-r--r-- | lib/group/database.php | 2 | ||||
-rw-r--r-- | lib/template.php | 22 | ||||
-rw-r--r-- | lib/user.php | 5 | ||||
-rw-r--r-- | lib/util.php | 2 |
8 files changed, 89 insertions, 10 deletions
diff --git a/lib/base.php b/lib/base.php index 652b1f11bad..85afaa62258 100644 --- a/lib/base.php +++ b/lib/base.php @@ -54,6 +54,14 @@ class OC{ * 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 = ''; + /** + * the root path of the 3rdparty folder for http requests (e.g. owncloud/3rdparty) + */ + public static $THIRDPARTYWEBROOT = ''; /** * SPL autoload @@ -138,12 +146,35 @@ class OC{ } OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI)); + if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){ OC::$WEBROOT='/'.OC::$WEBROOT; } + // search the 3rdparty folder + if(OC_Config::getValue('3rdpartyroot', '')<>'' and OC_Config::getValue('3rdpartyurl', '')<>''){ + OC::$THIRDPARTYROOT=OC_Config::getValue('3rdpartyroot', ''); + OC::$THIRDPARTYWEBROOT=OC_Config::getValue('3rdpartyurl', ''); + }elseif(file_exists(OC::$SERVERROOT.'/3rdparty')){ + OC::$THIRDPARTYROOT=OC::$SERVERROOT; + OC::$THIRDPARTYWEBROOT=OC::$WEBROOT; + }elseif(file_exists(OC::$SERVERROOT.'/../3rdparty')){ + $url_tmp=explode('/',OC::$WEBROOT); + $length=count($url_tmp); + unset($url_tmp[$length-1]); + OC::$THIRDPARTYWEBROOT=implode('/',$url_tmp); + $root_tmp=explode('/',OC::$SERVERROOT); + $length=count($root_tmp); + unset($root_tmp[$length-1]); + OC::$THIRDPARTYROOT=implode('/',$root_tmp); + }else{ + echo("3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file."); + exit; + } + + // set the right include path - set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$SERVERROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT); + set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT); // Redirect to installer if not installed if (!OC_Config::getValue('installed', false) && OC::$SUBURI != '/index.php') { diff --git a/lib/db.php b/lib/db.php index 9d3c20e0145..4c17cd0dbd1 100644 --- a/lib/db.php +++ b/lib/db.php @@ -318,6 +318,9 @@ class OC_DB { // Make changes and save them to a temporary file $file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' ); + if($file2 == ''){ + die('could not create tempfile in get_temp_dir() - aborting'); + } $content = str_replace( '*dbname*', $CONFIG_DBNAME, $content ); $content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content ); if( $CONFIG_DBTYPE == 'pgsql' ){ //mysql support it too but sqlite doesn't diff --git a/lib/filecache.php b/lib/filecache.php index 83eaffb171a..6ccb0d90ef1 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -275,7 +275,7 @@ class OC_FileCache{ if(is_array($result)){ return $result['id']; }else{ - OC_Log::write('getFieldId(): file not found in cache ('.$path.')','core',OC_Log::DEBUG); + OC_Log::write('getFileId(): file not found in cache ('.$path.')','core',OC_Log::DEBUG); return -1; } } diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index 94a49176ee6..9e4c2d0643e 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -26,11 +26,37 @@ */ class OC_FileProxy_Quota extends OC_FileProxy{ + private $userQuota=-1; + + /** + * get the quota for the current user + * @return int + */ + private function getQuota(){ + if($this->userQuota!=-1){ + return $this->userQuota; + } + $userQuota=OC_Preferences::getValue(OC_User::getUser(),'files','quota','default'); + if($userQuota=='default'){ + $userQuota=OC_AppConfig::getValue('files','default_quota','none'); + } + if($userQuota=='none'){ + $this->userQuota=0; + }else{ + $this->userQuota=OC_Helper::computerFileSize($userQuota); + } + return $this->userQuota; + + } + + /** + * get the free space in the users home folder + * @return int + */ private function getFreeSpace(){ $rootInfo=OC_FileCache::get(''); $usedSpace=$rootInfo['size']; - $totalSpace=OC_Preferences::getValue(OC_User::getUser(),'files','quota',0); - $totalSpace=OC_Helper::computerFileSize($totalSpace); + $totalSpace=$this->getQuota(); if($totalSpace==0){ return 0; } diff --git a/lib/group/database.php b/lib/group/database.php index f35f61434f0..1afd4b5fe4c 100644 --- a/lib/group/database.php +++ b/lib/group/database.php @@ -130,7 +130,7 @@ class OC_Group_Database extends OC_Group_Backend { * removes the user from a group. */ public static function removeFromGroup( $uid, $gid ){ - $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?" ); + $query = OC_DB::prepare( "DELETE FROM *PREFIX*group_user WHERE uid = ? AND gid = ?" ); $result = $query->execute( array( $uid, $gid )); return true; diff --git a/lib/template.php b/lib/template.php index d991759fbcd..5fe2eb7d6c7 100644 --- a/lib/template.php +++ b/lib/template.php @@ -346,31 +346,41 @@ class OC_Template{ // Add the core js files or the js files provided by the selected theme foreach(OC_Util::$scripts as $script){ - if(is_file(OC::$SERVERROOT."/themes/$theme/apps/$script$fext.js" )){ + // Is it in 3rd party? + if(is_file(OC::$THIRDPARTYROOT."/$script.js" )){ + $page->append( "jsfiles", OC::$THIRDPARTYWEBROOT."/$script.js" ); + + // Is it in apps and overwritten by the theme? + }elseif(is_file(OC::$SERVERROOT."/themes/$theme/apps/$script$fext.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/apps/$script$fext.js" ); }elseif(is_file(OC::$SERVERROOT."/themes/$theme/apps/$script.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/apps/$script.js" ); + // Is it part of an app? }elseif(is_file(OC::$SERVERROOT."/apps/$script$fext.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/apps/$script$fext.js" ); }elseif(is_file(OC::$SERVERROOT."/apps/$script.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/apps/$script.js" ); + // Is it in the owncloud root but overwritten by the theme? }elseif(is_file(OC::$SERVERROOT."/themes/$theme/$script$fext.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/$script$fext.js" ); }elseif(is_file(OC::$SERVERROOT."/themes/$theme/$script.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/$script.js" ); - + + // Is it in the owncloud root ? }elseif(is_file(OC::$SERVERROOT."/$script$fext.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/$script$fext.js" ); }elseif(is_file(OC::$SERVERROOT."/$script.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/$script.js" ); + // Is in core but overwritten by a theme? }elseif(is_file(OC::$SERVERROOT."/themes/$theme/core/$script$fext.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/core/$script$fext.js" ); }elseif(is_file(OC::$SERVERROOT."/themes/$theme/core/$script.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/core/$script.js" ); + // Is it in core? }elseif(is_file(OC::$SERVERROOT."/core/$script$fext.js" )){ $page->append( "jsfiles", OC::$WEBROOT."/core/$script$fext.js" ); }else{ @@ -380,14 +390,20 @@ class OC_Template{ } // Add the css files foreach(OC_Util::$styles as $style){ - if(is_file(OC::$SERVERROOT."/apps/$style$fext.css" )){ + // is it in 3rdparty? + if(is_file(OC::$THIRDPARTYROOT."/$style.css" )){ + $page->append( "cssfiles", OC::$THIRDPARTYWEBROOT."/$style.css" ); + // or in apps? + }elseif(is_file(OC::$SERVERROOT."/apps/$style$fext.css" )){ $page->append( "cssfiles", OC::$WEBROOT."/apps/$style$fext.css" ); }elseif(is_file(OC::$SERVERROOT."/apps/$style.css" )){ $page->append( "cssfiles", OC::$WEBROOT."/apps/$style.css" ); + // or in the owncloud root? }elseif(is_file(OC::$SERVERROOT."/$style$fext.css" )){ $page->append( "cssfiles", OC::$WEBROOT."/$style$fext.css" ); }elseif(is_file(OC::$SERVERROOT."/$style.css" )){ $page->append( "cssfiles", OC::$WEBROOT."/$style.css" ); + // or in core ? }elseif(is_file(OC::$SERVERROOT."/core/$style$fext.css" )){ $page->append( "cssfiles", OC::$WEBROOT."/core/$style$fext.css" ); }else{ diff --git a/lib/user.php b/lib/user.php index 826215b2289..fda19a33154 100644 --- a/lib/user.php +++ b/lib/user.php @@ -321,7 +321,10 @@ class OC_User { $users=array(); foreach(self::$_usedBackends as $backend){ if($backend->implementsActions(OC_USER_BACKEND_GET_USERS)){ - $users=array_merge($users,$backend->getUsers()); + $backendUsers=$backend->getUsers(); + if(is_array($backendUsers)){ + $users=array_merge($users,$backendUsers); + } } } return $users; diff --git a/lib/util.php b/lib/util.php index 18a5db3e4ee..2fd1dd543d6 100644 --- a/lib/util.php +++ b/lib/util.php @@ -66,7 +66,7 @@ class OC_Util { * @return array */ public static function getVersion(){ - return array(3,00,1); + return array(3,00,2); } /** |