From b6c5ca126b802354c44a374e72b2e0b677b2af90 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Fri, 1 Jun 2012 22:05:20 +0000 Subject: [PATCH 01/71] First almost working version --- lib/app.php | 38 ++++++++++++++------ lib/base.php | 31 ++++++++-------- lib/helper.php | 4 +-- lib/l10n.php | 4 +-- lib/template.php | 94 +++++++++++++++++++++++++++--------------------- 5 files changed, 100 insertions(+), 71 deletions(-) diff --git a/lib/app.php b/lib/app.php index 667633e264..13b6617b23 100755 --- a/lib/app.php +++ b/lib/app.php @@ -78,7 +78,7 @@ class OC_App{ * @param string app */ public static function loadApp($app){ - if(is_file(OC::$APPSROOT.'/apps/'.$app.'/appinfo/app.php')){ + if(is_file(self::getAppPath($app).'/appinfo/app.php')){ require_once( $app.'/appinfo/app.php' ); } } @@ -322,11 +322,25 @@ class OC_App{ return $list; } + /** + * Get the directory for the given app. + * If the app is defined in multiple directory, the first one is taken. (false if not found) + */ + public static function getAppPath($appid) { + foreach(OC::$APPSROOTS as $dir) { + if(file_exists($dir.'/'.$appid)) { + return $dir.'/'.$appid; + } + } +// OC_Log::write('core','Unable to find app "'.$appid.'"',OC_Log::ERROR); + return false; + } + /** * get the last version of the app, either from appinfo/version or from appinfo/info.xml */ public static function getAppVersion($appid){ - $file=OC::$APPSROOT.'/apps/'.$appid.'/appinfo/version'; + $file= self::getAppPath($appid).'/appinfo/version'; $version=@file_get_contents($file); if($version){ return $version; @@ -349,7 +363,7 @@ class OC_App{ if(isset(self::$appInfo[$appid])){ return self::$appInfo[$appid]; } - $file=OC::$APPSROOT.'/apps/'.$appid.'/appinfo/info.xml'; + $file= self::getAppPath($appid).'/appinfo/info.xml'; } $data=array(); $content=@file_get_contents($file); @@ -462,10 +476,12 @@ class OC_App{ */ public static function getAllApps(){ $apps=array(); - $dh=opendir(OC::$APPSROOT.'/apps'); - while($file=readdir($dh)){ - if(substr($file,0,1)!='.' and is_file(OC::$APPSROOT.'/apps/'.$file.'/appinfo/app.php')){ - $apps[]=$file; + foreach(OC::$APPSROOTS as $apps_dir) { + $dh=opendir($apps_dir); + while($file=readdir($dh)){ + if(substr($file,0,1)!='.' and is_file($apps_dir.'/'.$file.'/appinfo/app.php')){ + $apps[]=$file; + } } } return $apps; @@ -530,14 +546,14 @@ class OC_App{ * @param string appid */ public static function updateApp($appid){ - if(file_exists(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/database.xml')){ - OC_DB::updateDbFromStructure(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/database.xml'); + if(file_exists(self::getAppPath($appid).'/appinfo/database.xml')){ + OC_DB::updateDbFromStructure(self::getAppPath($appid).'/appinfo/database.xml'); } if(!self::isEnabled($appid)){ return; } - if(file_exists(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/update.php')){ - include OC::$APPSROOT.'/apps/'.$appid.'/appinfo/update.php'; + if(file_exists(self::getAppPath($appid).'/appinfo/update.php')){ + include self::getAppPath($appid).'/appinfo/update.php'; } //set remote/public handelers diff --git a/lib/base.php b/lib/base.php index a65a33b166..b494bbcabc 100644 --- a/lib/base.php +++ b/lib/base.php @@ -57,7 +57,7 @@ class OC{ /** * The installation path of the apps folder on the server (e.g. /srv/http/owncloud) */ - public static $APPSROOT = ''; + public static $APPSROOTS = array(); /** * the root path of the apps folder for http requests (e.g. owncloud) */ @@ -168,15 +168,17 @@ class OC{ // search the apps folder if(OC_Config::getValue('appsroot', '')<>''){ - OC::$APPSROOT=OC_Config::getValue('appsroot', ''); + OC::$APPSROOTS=explode(':',OC_Config::getValue('appsroot', '')); OC::$APPSWEBROOT=OC_Config::getValue('appsurl', ''); }elseif(file_exists(OC::$SERVERROOT.'/apps')){ - OC::$APPSROOT=OC::$SERVERROOT; - OC::$APPSWEBROOT=OC::$WEBROOT; - }elseif(file_exists(OC::$SERVERROOT.'/../apps')){ - OC::$APPSROOT=rtrim(dirname(OC::$SERVERROOT), '/'); - OC::$APPSWEBROOT=rtrim(dirname(OC::$WEBROOT), '/'); - }else{ + OC::$APPSROOTS= array(OC::$SERVERROOT.'/apps'); + OC::$APPSWEBROOT=OC::$WEBROOT; + } + if(file_exists(OC::$SERVERROOT.'/../apps')){ + OC::$APPSROOTS[] = rtrim(realpath(OC::$SERVERROOT.'/../apps'), '/'); +// OC::$APPSWEBROOT=rtrim(dirname(OC::$WEBROOT), '/'); + } + if(empty(OC::$APPSROOTS)){ echo("apps directory not found! Please put the ownCloud apps folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file."); exit; } @@ -186,8 +188,7 @@ class OC{ OC::$SERVERROOT.'/lib'.PATH_SEPARATOR. OC::$SERVERROOT.'/config'.PATH_SEPARATOR. OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR. - OC::$APPSROOT.PATH_SEPARATOR. - OC::$APPSROOT.'/apps'.PATH_SEPARATOR. + implode(OC::$APPSROOTS,PATH_SEPARATOR).PATH_SEPARATOR. get_include_path().PATH_SEPARATOR. OC::$SERVERROOT ); @@ -273,15 +274,15 @@ class OC{ } public static function loadapp(){ - if(file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/index.php')){ - require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/index.php'); + if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php')){ + require_once(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php'); }else{ trigger_error('The requested App was not found.', E_USER_ERROR);//load default app instead? } } public static function loadfile(){ - if(file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE)){ + if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/' . OC::$REQUESTEDFILE)){ if(substr(OC::$REQUESTEDFILE, -3) == 'css'){ $file = 'apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE; $minimizer = new OC_Minimizer_CSS(); @@ -453,8 +454,8 @@ class OC{ $_GET['getfile'] = $file; } if(!is_null(self::$REQUESTEDFILE)){ - $subdir = OC::$APPSROOT . '/apps/' . self::$REQUESTEDAPP . '/' . self::$REQUESTEDFILE; - $parent = OC::$APPSROOT . '/apps/' . self::$REQUESTEDAPP; + $subdir = OC_App::getAppPath(OC::$REQUESTEDAPP) . '/' . self::$REQUESTEDFILE; + $parent = OC_App::getAppPath(OC::$REQUESTEDAPP); if(!OC_Helper::issubdirectory($subdir, $parent)){ self::$REQUESTEDFILE = null; header('HTTP/1.0 404 Not Found'); diff --git a/lib/helper.php b/lib/helper.php index decc1d6133..72ae98222d 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -40,7 +40,7 @@ class OC_Helper { if( $app != '' ){ $app .= '/'; // Check if the app is in the app folder - if( file_exists( OC::$APPSROOT . '/apps/'. $app.$file )){ + if( file_exists( OC_App::getAppPath($app).$file )){ if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){ if(substr($app, -1, 1) == '/'){ $app = substr($app, 0, strlen($app) - 1); @@ -150,7 +150,7 @@ class OC_Helper { // Check if the app is in the app folder if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )){ return OC::$WEBROOT."/themes/$theme/apps/$app/img/$image"; - }elseif( file_exists( OC::$APPSROOT."/apps/$app/img/$image" )){ + }elseif( file_exists(OC_App::getAppPath($app)."/img/$image" )){ return OC::$APPSWEBROOT."/apps/$app/img/$image"; }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/themes/$theme/$app/img/$image" )){ return OC::$WEBROOT."/themes/$theme/$app/img/$image"; diff --git a/lib/l10n.php b/lib/l10n.php index 682e15f0e9..70b32b9298 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -263,8 +263,8 @@ class OC_L10N{ $i18ndir = OC::$SERVERROOT.'/core/l10n/'; if($app != ''){ // Check if the app is in the app folder - if(file_exists(OC::$APPSROOT.'/apps/'.$app.'/l10n/')){ - $i18ndir = OC::$APPSROOT.'/apps/'.$app.'/l10n/'; + if(file_exists(OC_App::getAppPath($app).'/l10n/')){ + $i18ndir = OC_App::getAppPath($app).'/l10n/'; } else{ $i18ndir = OC::$SERVERROOT.'/'.$app.'/l10n/'; diff --git a/lib/template.php b/lib/template.php index 14833a1e5b..a354d58a4b 100644 --- a/lib/template.php +++ b/lib/template.php @@ -202,10 +202,10 @@ class OC_Template{ // Check if it is a app template or not. if( $app != "" ){ // Check if the app is in the app folder or in the root - if( file_exists( OC::$APPSROOT."/apps/$app/templates/" )){ + if( file_exists(OC_App::getAppPath($app)."/templates/" )){ // Check if the template is overwritten by the selected theme if ($this->checkPathForTemplate(OC::$SERVERROOT."/themes/$theme/apps/$app/templates/", $name, $fext)) { - }elseif ($this->checkPathForTemplate(OC::$APPSROOT."/apps/$app/templates/", $name, $fext)) { + }elseif ($this->checkPathForTemplate(OC_App::getAppPath($app)."/templates/", $name, $fext)) { } }else{ // Check if the template is overwritten by the selected theme @@ -317,29 +317,32 @@ class OC_Template{ } } - /* + /** * @brief append the $file-url if exist at $root * @param $type of collection to use when appending * @param $root path to check * @param $web base for path * @param $file the filename + * @param $in_app boolean is part of an app? (default false) */ - public function appendIfExist($type, $root, $web, $file) { - if (is_file($root.'/'.$file)) { - $pathes = explode('/', $file); - if($type == 'cssfiles' && $root == OC::$APPSROOT && $pathes[0] == 'apps'){ - $app = $pathes[1]; - unset($pathes[0]); - unset($pathes[1]); - $path = implode('/', $pathes); - $this->append( $type, OC_Helper::linkTo($app, $path)); - }else{ - $this->append( $type, $web.'/'.$file); - } - return true; - } - return false; - } + public function appendIfExist($type, $root, $web, $file, $in_app = false) { + + if (is_file($root.'/'.$file)) { + $pathes = explode('/', $file); + if($type == 'cssfiles' && $root == OC::$APPSROOTS[0] && $in_app){ + $app = $pathes[0]; + unset($pathes[0]); +// unset($pathes[1]); + $path = implode('/', $pathes); + $this->append( $type, OC_Helper::linkTo($app, $path)); + }else{ + $this->append( $type, $web.'/'.$file); + } + return true; + } + return false; + } + /** * @brief Proceeds the template * @returns content @@ -385,16 +388,12 @@ class OC_Template{ // 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? - if($page->appendIfExist('jsfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script.'.js')) { + if($page->appendIfExist('jsfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script.'.js')) { // Is it in apps and overwritten by the theme? }elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script$fext.js" )) { }elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script.js" )) { - // Is it part of an app? - }elseif($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script$fext.js" )) { - }elseif($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script.js" )) { - // Is it in the owncloud root but overwritten by the theme? }elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script$fext.js" )) { }elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script.js" )) { @@ -412,20 +411,24 @@ class OC_Template{ }elseif($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/$script.js" )) { }else{ - echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); - die(); - + // Is it part of an app? + $append = false; + foreach( OC::$APPSROOTS as $apps_dir) + { + if($page->appendIfExist('jsfiles', $apps_dir, OC::$APPSWEBROOT.'/apps/', "$script$fext.js" , true)) { $append =true; break; } + elseif($page->appendIfExist('jsfiles', $apps_dir, OC::$APPSWEBROOT.'/apps/', "$script.js", true )) { $append =true; break; } + } + if(! $append) { + echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); + die(); + } } } // 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')) { - - // or in apps? - }elseif($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style$fext.css" )) { - }elseif($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style.css" )) { + if($page->appendIfExist('cssfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style.'.css')) { // or in the owncloud root? }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "$style$fext.css" )) { @@ -436,22 +439,31 @@ class OC_Template{ }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) { }else{ - echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); - die(); + // or in apps? + $append = false; + foreach( OC::$APPSROOTS as $apps_dir) + { + if($page->appendIfExist('cssfiles', $apps_dir, OC::$APPSWEBROOT, "$style$fext.css", true)) { $append =true; break; } + elseif($page->appendIfExist('cssfiles', $apps_dir, OC::$APPSWEBROOT, "$style.css", true )) { $append =true; break; } + } + if(! $append) { + echo('css file not found: style:'.$script.' 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(OC_Util::$styles as $style){ - if($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style$fext.css" )) { - }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style.css" )) { + if($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style$fext.css" )) { + }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style.css" )) { - }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style$fext.css" )) { - }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style.css" )) { + }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style$fext.css" )) { + }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style.css" )) { - }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style$fext.css" )) { - }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style.css" )) { - } + }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style$fext.css" )) { + }elseif($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style.css" )) { + } } } From 6832aec60fcdcc7e8b6433d8f9103cdf347f32ed Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Fri, 1 Jun 2012 22:11:03 +0000 Subject: [PATCH 02/71] Correct installer --- lib/installer.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/installer.php b/lib/installer.php index 5c030d2917..afe0b9e1bb 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -126,7 +126,7 @@ class OC_Installer{ return false; } $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml',true); - $basedir=OC::$APPSROOT.'/apps/'.$info['id']; + $basedir=OC_App::getAppPath($info['id']); // check the code for not allowed calls if(!OC_Installer::checkCode($info['id'],$extractDir)){ @@ -312,13 +312,13 @@ class OC_Installer{ */ public static function installShippedApp($app){ //install the database - if(is_file(OC::$APPSROOT."/apps/$app/appinfo/database.xml")){ - OC_DB::createDbFromStructure(OC::$APPSROOT."/apps/$app/appinfo/database.xml"); + if(is_file(OC_App::getAppPath($app)."/appinfo/database.xml")){ + OC_DB::createDbFromStructure(OC_App::getAppPath($app)."/appinfo/database.xml"); } //run appinfo/install.php - if(is_file(OC::$APPSROOT."/apps/$app/appinfo/install.php")){ - include(OC::$APPSROOT."/apps/$app/appinfo/install.php"); + if(is_file(OC_App::getAppPath($app)."/appinfo/install.php")){ + include(OC_App::getAppPath($app)."/appinfo/install.php"); } $info=OC_App::getAppInfo($app); OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app)); From cc494259d3e1fc60e82452dfdc1d0e0e0cd848e9 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 3 Jun 2012 21:13:30 +0000 Subject: [PATCH 03/71] Unit path and webpath, correct some more --- apps/bookmarks/templates/list.php | 2 +- core/templates/layout.user.php | 3 ++- lib/app.php | 22 +++++++++++++++++----- lib/base.php | 31 ++++++++++++++++--------------- lib/helper.php | 4 ++-- lib/template.php | 8 ++++---- 6 files changed, 42 insertions(+), 28 deletions(-) diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php index fdd2b19f79..84436ae740 100644 --- a/apps/bookmarks/templates/list.php +++ b/apps/bookmarks/templates/list.php @@ -20,7 +20,7 @@ diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 8f6c029007..5f00a884a0 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -12,7 +12,8 @@ diff --git a/lib/app.php b/lib/app.php index 13b6617b23..5883a29bb0 100755 --- a/lib/app.php +++ b/lib/app.php @@ -328,11 +328,23 @@ class OC_App{ */ public static function getAppPath($appid) { foreach(OC::$APPSROOTS as $dir) { - if(file_exists($dir.'/'.$appid)) { - return $dir.'/'.$appid; + if(file_exists($dir['path'].'/'.$appid)) { + return $dir['path'].'/'.$appid; + } + } + return false; + } + + /** + * Get the path for the given app on the access + * If the app is defined in multiple directory, the first one is taken. (false if not found) + */ + public static function getAppWebPath($appid) { + foreach(OC::$APPSROOTS as $dir) { + if(file_exists($dir['path'].'/'.$appid)) { + return $dir['web'].'/'.$appid; } } -// OC_Log::write('core','Unable to find app "'.$appid.'"',OC_Log::ERROR); return false; } @@ -477,9 +489,9 @@ class OC_App{ public static function getAllApps(){ $apps=array(); foreach(OC::$APPSROOTS as $apps_dir) { - $dh=opendir($apps_dir); + $dh=opendir($apps_dir['path']); while($file=readdir($dh)){ - if(substr($file,0,1)!='.' and is_file($apps_dir.'/'.$file.'/appinfo/app.php')){ + if(substr($file,0,1)!='.' and is_file($apps_dir['path'].'/'.$file.'/appinfo/app.php')){ $apps[]=$file; } } diff --git a/lib/base.php b/lib/base.php index b494bbcabc..131485961a 100644 --- a/lib/base.php +++ b/lib/base.php @@ -55,13 +55,9 @@ class OC{ */ public static $THIRDPARTYWEBROOT = ''; /** - * The installation path of the apps folder on the server (e.g. /srv/http/owncloud) + * The installation path array of the apps folder on the server (e.g. /srv/http/owncloud) 'real' and web path in 'web' */ public static $APPSROOTS = array(); - /** - * the root path of the apps folder for http requests (e.g. owncloud) - */ - public static $APPSWEBROOT = ''; /* * requested app */ @@ -168,27 +164,31 @@ class OC{ // search the apps folder if(OC_Config::getValue('appsroot', '')<>''){ - OC::$APPSROOTS=explode(':',OC_Config::getValue('appsroot', '')); - OC::$APPSWEBROOT=OC_Config::getValue('appsurl', ''); - }elseif(file_exists(OC::$SERVERROOT.'/apps')){ - OC::$APPSROOTS= array(OC::$SERVERROOT.'/apps'); - OC::$APPSWEBROOT=OC::$WEBROOT; - } - if(file_exists(OC::$SERVERROOT.'/../apps')){ - OC::$APPSROOTS[] = rtrim(realpath(OC::$SERVERROOT.'/../apps'), '/'); -// OC::$APPSWEBROOT=rtrim(dirname(OC::$WEBROOT), '/'); + $real_a = explode(':',OC_Config::getValue('appsroot', '')); + $web_a = explode(':',OC_Config::getValue('appsurl', '')); + foreach($real_a as $k => $path) { + if(!isset($web_a[$k])){ + echo("Apps root and appsurl not mathing. You need to have the same number of paths"); + exit; + } + OC::$APPSROOTS[] = array('path'=> $path, 'web' => $web_a[$k]); + } } + if(empty(OC::$APPSROOTS)){ echo("apps directory not found! Please put the ownCloud apps folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file."); exit; } + $paths = array(); + foreach( OC::$APPSROOTS as $path) + $paths[] = $path['path']; // set the right include path set_include_path( OC::$SERVERROOT.'/lib'.PATH_SEPARATOR. OC::$SERVERROOT.'/config'.PATH_SEPARATOR. OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR. - implode(OC::$APPSROOTS,PATH_SEPARATOR).PATH_SEPARATOR. + implode($paths,PATH_SEPARATOR).PATH_SEPARATOR. get_include_path().PATH_SEPARATOR. OC::$SERVERROOT ); @@ -292,6 +292,7 @@ class OC{ require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE); } }else{ + die(); header('HTTP/1.0 404 Not Found'); exit; } diff --git a/lib/helper.php b/lib/helper.php index 72ae98222d..550bf9771e 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -48,7 +48,7 @@ class OC_Helper { $urlLinkTo = OC::$WEBROOT . '/?app=' . $app; $urlLinkTo .= ($file!='index.php')?'&getfile=' . urlencode($file):''; }else{ - $urlLinkTo = OC::$APPSWEBROOT . '/apps/' . $app . $file; + $urlLinkTo = OC_App::getAppWebPath($app) . $file; } } else{ @@ -151,7 +151,7 @@ class OC_Helper { if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )){ return OC::$WEBROOT."/themes/$theme/apps/$app/img/$image"; }elseif( file_exists(OC_App::getAppPath($app)."/img/$image" )){ - return OC::$APPSWEBROOT."/apps/$app/img/$image"; + return OC_App::getAppWebPath($app)."/img/$image"; }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/themes/$theme/$app/img/$image" )){ return OC::$WEBROOT."/themes/$theme/$app/img/$image"; }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/$app/img/$image" )){ diff --git a/lib/template.php b/lib/template.php index a354d58a4b..e6525ec633 100644 --- a/lib/template.php +++ b/lib/template.php @@ -415,8 +415,8 @@ class OC_Template{ $append = false; foreach( OC::$APPSROOTS as $apps_dir) { - if($page->appendIfExist('jsfiles', $apps_dir, OC::$APPSWEBROOT.'/apps/', "$script$fext.js" , true)) { $append =true; break; } - elseif($page->appendIfExist('jsfiles', $apps_dir, OC::$APPSWEBROOT.'/apps/', "$script.js", true )) { $append =true; break; } + if($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script$fext.js" , true)) { $append =true; break; } + elseif($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script.js", true )) { $append =true; break; } } if(! $append) { echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); @@ -443,8 +443,8 @@ class OC_Template{ $append = false; foreach( OC::$APPSROOTS as $apps_dir) { - if($page->appendIfExist('cssfiles', $apps_dir, OC::$APPSWEBROOT, "$style$fext.css", true)) { $append =true; break; } - elseif($page->appendIfExist('cssfiles', $apps_dir, OC::$APPSWEBROOT, "$style.css", true )) { $append =true; break; } + if($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style$fext.css", true)) { $append =true; break; } + elseif($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style.css", true )) { $append =true; break; } } if(! $append) { echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); From 6a250d0d20c92513a883a7103885712127b51cc8 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Mon, 4 Jun 2012 19:52:44 +0000 Subject: [PATCH 04/71] Correct css file inclusion --- lib/template.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/template.php b/lib/template.php index e6525ec633..fdd608fdc7 100644 --- a/lib/template.php +++ b/lib/template.php @@ -329,10 +329,16 @@ class OC_Template{ if (is_file($root.'/'.$file)) { $pathes = explode('/', $file); - if($type == 'cssfiles' && $root == OC::$APPSROOTS[0] && $in_app){ + $in_root = false; + foreach(OC::$APPSROOTS as $app_root) { + if($root == $app_root['path']) { + $in_root = true; + break; + } + } + if($type == 'cssfiles' && $in_root && $in_app){ $app = $pathes[0]; unset($pathes[0]); -// unset($pathes[1]); $path = implode('/', $pathes); $this->append( $type, OC_Helper::linkTo($app, $path)); }else{ From 6a812644e4d0f6eed8dca4e20c6f7135d881012a Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Mon, 4 Jun 2012 20:37:00 +0000 Subject: [PATCH 05/71] Correct remote and public, and last occurence of OC:: --- apps/bookmarks/ajax/addBookmark.php | 2 +- apps/calendar/appinfo/remote.php | 4 ++-- apps/media/remote.php | 4 ++-- apps/media/server/xml.server.php | 4 ++-- apps/user_webfinger/webfinger.php | 2 +- lib/app.php | 4 ++-- lib/helper.php | 2 +- lib/installer.php | 32 +++++++++++++++-------------- public.php | 6 +++--- remote.php | 6 +++--- 10 files changed, 34 insertions(+), 32 deletions(-) diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php index 9241dc8ddf..d66aab5896 100644 --- a/apps/bookmarks/ajax/addBookmark.php +++ b/apps/bookmarks/ajax/addBookmark.php @@ -30,6 +30,6 @@ $RUNTIME_NOSETUPFS=true; OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('bookmarks'); -require_once(OC::$APPSROOT . '/apps/bookmarks/bookmarksHelper.php'); +require_once(OC_App::getAppPath('bookmarks').'/bookmarksHelper.php'); $id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']); OCP\JSON::success(array('data' => $id)); \ No newline at end of file diff --git a/apps/calendar/appinfo/remote.php b/apps/calendar/appinfo/remote.php index 3bd8737ee9..7ab546245f 100644 --- a/apps/calendar/appinfo/remote.php +++ b/apps/calendar/appinfo/remote.php @@ -7,8 +7,8 @@ */ OCP\App::checkAppEnabled('calendar'); -if(substr($_SERVER["REQUEST_URI"],0,strlen(OC::$APPSWEBROOT . '/apps/calendar/caldav.php')) == OC::$APPSWEBROOT . '/apps/calendar/caldav.php'){ - $baseuri = OC::$APPSWEBROOT . '/apps/calendar/caldav.php'; +if(substr($_SERVER["REQUEST_URI"],0,strlen(OC_App::getAppWebPath('calendar').'/caldav.php')) == OC_App::getAppWebPath('calendar'). '/caldav.php'){ + $baseuri = OC_App::getAppWebPath('calendar').'/caldav.php'; } // only need authentication apps diff --git a/apps/media/remote.php b/apps/media/remote.php index 01add42b31..0535077cef 100644 --- a/apps/media/remote.php +++ b/apps/media/remote.php @@ -5,7 +5,7 @@ $RUNTIME_APPTYPES=array('filesystem','authentication'); OC_App::loadApps($RUNTIME_APPTYPES); if($path_info == '/ampache' || $path_info == '/ampache/'){ - require_once(OC::$APPSROOT . '/apps/media/index.php'); + require_once(OC_App::getAppPath('media').'/index.php'); }else{ - require_once(OC::$APPSROOT . '/apps/media/server/xml.server.php'); + require_once(OC_App::getAppPath('media').'/server/xml.server.php'); } diff --git a/apps/media/server/xml.server.php b/apps/media/server/xml.server.php index 6cb6c91ca0..796da130a4 100644 --- a/apps/media/server/xml.server.php +++ b/apps/media/server/xml.server.php @@ -22,8 +22,8 @@ */ OCP\App::checkAppEnabled('media'); - require_once(OC::$APPSROOT . '/apps/media/lib_collection.php'); - require_once(OC::$APPSROOT . '/apps/media/lib_ampache.php'); + require_once(OC_App::getAppPath('media').'/lib_collection.php'); + require_once(OC_App::getAppPath('media').'/lib_ampache.php'); $arguments=$_POST; if(!isset($_POST['action']) and isset($_GET['action'])){ diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php index e75c546c2c..67cbba54a4 100644 --- a/apps/user_webfinger/webfinger.php +++ b/apps/user_webfinger/webfinger.php @@ -59,7 +59,7 @@ echo "{\"links\":["; $apps = OC_Appconfig::getApps(); foreach($apps as $app) { if(OCP\App::isEnabled($app)) { - if(is_file(OC::$APPSROOT . '/apps/' . $app . '/appinfo/webfinger.php')) { + if(is_file(OC_App::getAppPath($app). '/appinfo/webfinger.php')) { require($app . '/appinfo/webfinger.php'); } } diff --git a/lib/app.php b/lib/app.php index 5883a29bb0..43d60f3a68 100755 --- a/lib/app.php +++ b/lib/app.php @@ -571,10 +571,10 @@ class OC_App{ //set remote/public handelers $appData=self::getAppInfo($appid); foreach($appData['remote'] as $name=>$path){ - OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$appid.'/'.$path); + OCP\CONFIG::setAppValue('core', 'remote_'.$name, $path); } foreach($appData['public'] as $name=>$path){ - OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$appid.'/'.$path); + OCP\CONFIG::setAppValue('core', 'public_'.$name, $appid.'/'.$path); } self::setAppTypes($appid); diff --git a/lib/helper.php b/lib/helper.php index 550bf9771e..3cf5107eea 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -40,7 +40,7 @@ class OC_Helper { if( $app != '' ){ $app .= '/'; // Check if the app is in the app folder - if( file_exists( OC_App::getAppPath($app).$file )){ + if( file_exists( OC_App::getAppPath($app).'/'.$file )){ if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){ if(substr($app, -1, 1) == '/'){ $app = substr($app, 0, strlen($app) - 1); diff --git a/lib/installer.php b/lib/installer.php index afe0b9e1bb..bfa34de2a7 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -197,10 +197,10 @@ class OC_Installer{ //set remote/public handelers foreach($info['remote'] as $name=>$path){ - OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$info['id'].'/'.$path); + OCP\CONFIG::setAppValue('core', 'remote_'.$name, $app.'/'.$path); } foreach($info['public'] as $name=>$path){ - OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$info['id'].'/'.$path); + OCP\CONFIG::setAppValue('core', 'public_'.$name, $app.'/'.$path); } OC_App::setAppTypes($info['id']); @@ -287,22 +287,24 @@ class OC_Installer{ * This function installs all apps found in the 'apps' directory that should be enabled by default; */ public static function installShippedApps(){ - $dir = opendir( OC::$APPSROOT."/apps" ); - while( false !== ( $filename = readdir( $dir ))){ - if( substr( $filename, 0, 1 ) != '.' and is_dir(OC::$APPSROOT."/apps/$filename") ){ - if( file_exists( OC::$APPSROOT."/apps/$filename/appinfo/app.php" )){ - if(!OC_Installer::isInstalled($filename)){ - $info=OC_App::getAppInfo($filename); - $enabled = isset($info['default_enable']); - if( $enabled ){ - OC_Installer::installShippedApp($filename); - OC_Appconfig::setValue($filename,'enabled','yes'); + foreach(OC::$APPSROOTS as $app_dir) { + $dir = opendir( $app_dir['path'] ); + while( false !== ( $filename = readdir( $dir ))){ + if( substr( $filename, 0, 1 ) != '.' and is_dir($app_dir['path']."/$filename") ){ + if( file_exists( $app_dir['path']."/$filename/appinfo/app.php" )){ + if(!OC_Installer::isInstalled($filename)){ + $info=OC_App::getAppInfo($filename); + $enabled = isset($info['default_enable']); + if( $enabled ){ + OC_Installer::installShippedApp($filename); + OC_Appconfig::setValue($filename,'enabled','yes'); + } } } } } + closedir( $dir ); } - closedir( $dir ); } /** @@ -325,10 +327,10 @@ class OC_Installer{ //set remote/public handelers foreach($info['remote'] as $name=>$path){ - OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$app.'/'.$path); + OCP\CONFIG::setAppValue('core', 'remote_'.$name, $app.'/'.$path); } foreach($info['public'] as $name=>$path){ - OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$app.'/'.$path); + OCP\CONFIG::setAppValue('core', 'public_'.$name, $app.'/'.$path); } OC_App::setAppTypes($info['id']); diff --git a/public.php b/public.php index f974e1c50d..19c02a7a02 100644 --- a/public.php +++ b/public.php @@ -8,8 +8,8 @@ if(is_null($file)){ exit; } -$parts=explode('/',$file); -$app=$parts[2]; +$parts=explode('/',$file,2); +$app=$parts[0]; OC_App::loadApp($app); -require_once(OC::$APPSROOT . $file); +require_once(OC_App::getAppPath($app) .'/'. $parts[1]); diff --git a/remote.php b/remote.php index 7131dfc940..55b088d775 100644 --- a/remote.php +++ b/remote.php @@ -17,9 +17,9 @@ if(is_null($file)){ exit; } -$parts=explode('/',$file); -$app=$parts[2]; +$parts=explode('/', $file, 2); +$app=$parts[0]; OC_App::loadApp($app); $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; -require_once(OC::$APPSROOT . $file); \ No newline at end of file +require_once(OC_App::getAppPath($app) .'/'. $parts[1]); \ No newline at end of file From 5c2b2fc8425e7fa52945b53058ac67f67d228409 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Wed, 6 Jun 2012 19:54:57 +0000 Subject: [PATCH 06/71] Change app path logic in templates --- apps/contacts/appinfo/remote.php | 4 ++-- core/js/js.js | 8 +++----- core/templates/layout.guest.php | 2 +- core/templates/layout.user.php | 3 +-- lib/template.php | 5 +++++ 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/contacts/appinfo/remote.php b/apps/contacts/appinfo/remote.php index ef50e4ad39..5add3bc688 100644 --- a/apps/contacts/appinfo/remote.php +++ b/apps/contacts/appinfo/remote.php @@ -22,8 +22,8 @@ OCP\App::checkAppEnabled('contacts'); -if(substr($_SERVER["REQUEST_URI"],0,strlen(OC::$APPSWEBROOT . '/apps/contacts/carddav.php')) == OC::$APPSWEBROOT . '/apps/contacts/carddav.php'){ - $baseuri = OC::$APPSWEBROOT . '/apps/contacts/carddav.php'; +if(substr($_SERVER["REQUEST_URI"],0,strlen(OC_App::getAppWebPath('contacts').'/carddav.php')) == OC_App::getAppWebPath('contacts').'/carddav.php'){ + $baseuri = OC_App::getAppWebPath('contacts').'/carddav.php'; } // only need authentication apps diff --git a/core/js/js.js b/core/js/js.js index 89a20a529f..a1ad0c7718 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -31,7 +31,7 @@ t.cache={}; OC={ webroot:oc_webroot, - appswebroot:oc_appswebroot, + appswebroots:oc_appswebroots, currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false, coreApps:['', 'admin','log','search','settings','core','3rdparty'], /** @@ -63,10 +63,8 @@ OC={ link+= file; } }else if(file.substring(file.length-3) != 'php' && !isCore){ - link=OC.appswebroot; - link+='/'; - link+='apps/'; - link+=app+'/'; + link=OC.appswebroots[app]; + link+='/'+app+'/'; if(type){ link+=type+'/'; } diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 7f5a4d50fc..7a96891771 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -12,7 +12,7 @@ diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 5f00a884a0..91cfa1a87a 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -12,8 +12,7 @@ diff --git a/lib/template.php b/lib/template.php index fdd608fdc7..6fe0710203 100644 --- a/lib/template.php +++ b/lib/template.php @@ -383,6 +383,11 @@ class OC_Template{ }else{ $page = new OC_Template( "core", "layout.guest" ); } + $apps_paths = array(); + foreach(OC_App::getEnabledApps() as $app){ + $apps_paths[$app] = OC_App::getAppWebPath($app); + } + $page->assign( 'apps_paths', str_replace('\\/', '/',json_encode($apps_paths)) ); // Ugly unescape slashes waiting for better solution // Read the selected theme from the config file $theme=OC_Config::getValue( "theme" ); From e8447e0bda25744c4836a8fdf009a98174264eda Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Wed, 6 Jun 2012 21:11:15 +0000 Subject: [PATCH 07/71] Rework to fit with minizer --- lib/base.php | 6 +++--- lib/minimizer/css.php | 29 ++++++++++++++++++++--------- lib/minimizer/js.php | 17 +++++++++++------ remote.php | 18 +++++++++++++----- 4 files changed, 47 insertions(+), 23 deletions(-) diff --git a/lib/base.php b/lib/base.php index 131485961a..0d205c8f78 100644 --- a/lib/base.php +++ b/lib/base.php @@ -284,12 +284,12 @@ class OC{ public static function loadfile(){ if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/' . OC::$REQUESTEDFILE)){ if(substr(OC::$REQUESTEDFILE, -3) == 'css'){ - $file = 'apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE; + $file = OC_App::getAppWebPath(OC::$REQUESTEDAPP). '/' . OC::$REQUESTEDFILE; $minimizer = new OC_Minimizer_CSS(); - $minimizer->output(array(array(OC::$APPSROOT, OC::$APPSWEBROOT, $file))); + $minimizer->output(array(array(OC_App::getAppPath(OC::$REQUESTEDAPP), OC_App::getAppWebPath(OC::$REQUESTEDAPP), OC::$REQUESTEDFILE))); exit; }elseif(substr(OC::$REQUESTEDFILE, -3) == 'php'){ - require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE); + require_once(OC_App::getAppPath(OC::$REQUESTEDAPP). '/' . OC::$REQUESTEDFILE); } }else{ die(); diff --git a/lib/minimizer/css.php b/lib/minimizer/css.php index 4637417579..76dc99b335 100644 --- a/lib/minimizer/css.php +++ b/lib/minimizer/css.php @@ -16,10 +16,6 @@ class OC_Minimizer_CSS extends OC_Minimizer // 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" )) { @@ -29,8 +25,16 @@ class OC_Minimizer_CSS extends OC_Minimizer }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(); + $append = false; + foreach( OC::$APPSROOTS as $apps_dir) + { + if($this->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style$fext.css", true)) { $append =true; break; } + elseif($this->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style.css", true )) { $append =true; break; } + } + if(! $append) { + echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); + die(); + } } } // Add the theme css files. you can override the default values here @@ -52,14 +56,21 @@ class OC_Minimizer_CSS extends OC_Minimizer 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); + + $in_root = false; + foreach(OC::$APPSROOTS as $app_root) { + if(strpos($file, $app_root['path']) == 0) { + $in_root = $app_root['web']; + break; + } + } + if ($in_root !== false) { + $css = str_replace('%appswebroot%', $in_root, $css); $css = str_replace('%webroot%', $webroot, $css); } $remote = $file_info[1]; diff --git a/lib/minimizer/js.php b/lib/minimizer/js.php index 4ddaa79d81..aea8b66f91 100644 --- a/lib/minimizer/js.php +++ b/lib/minimizer/js.php @@ -21,10 +21,6 @@ class OC_Minimizer_JS extends OC_Minimizer }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" )) { @@ -42,8 +38,17 @@ class OC_Minimizer_JS extends OC_Minimizer }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(); + // Is it part of an app? + $append = false; + foreach( OC::$APPSROOTS as $apps_dir) + { + if($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script$fext.js" , true)) { $append =true; break; } + elseif($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script.js", true )) { $append =true; break; } + } + if(! $append) { + echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); + die(); + } } } return $this->files; diff --git a/remote.php b/remote.php index 55b088d775..e1e11c5773 100644 --- a/remote.php +++ b/remote.php @@ -17,9 +17,17 @@ if(is_null($file)){ exit; } -$parts=explode('/', $file, 2); -$app=$parts[0]; -OC_App::loadApp($app); +if(count(explode('/',$file)) == 3) { + $parts=explode('/',$file); + $app=$parts[2]; + OC_App::loadApp($app); + $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; + require_once( OC::$SERVERROOT.$file); -$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; -require_once(OC_App::getAppPath($app) .'/'. $parts[1]); \ No newline at end of file +} else { + $parts=explode('/', $file, 2); + $app=$parts[0]; + OC_App::loadApp($app); + $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; + require_once(OC_App::getAppPath($app) .'/'. $parts[1]); +} From 0f7fdd414896ddfd1a5cd600d982f38c2b926ed8 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Thu, 7 Jun 2012 19:15:31 +0000 Subject: [PATCH 08/71] ReAdd possibility to load existing app folders --- lib/base.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/base.php b/lib/base.php index 0d205c8f78..9f2925fa31 100644 --- a/lib/base.php +++ b/lib/base.php @@ -173,6 +173,11 @@ class OC{ } OC::$APPSROOTS[] = array('path'=> $path, 'web' => $web_a[$k]); } + }elseif(file_exists(OC::$SERVERROOT.'/apps')){ + OC::$APPSROOTS[] = array('path'=> OC::$SERVERROOT.'/apps', 'web' => OC::$WEBROOT.'/apps/'); + }elseif(file_exists(OC::$SERVERROOT.'/../apps')){ + OC::$APPSROOTS[] = array('path'=> rtrim(dirname(OC::$SERVERROOT), '/').'/apps', 'web' => rtrim(dirname(OC::$WEBROOT), '/').'/apps/'); + OC::$APPSROOT=rtrim(dirname(OC::$SERVERROOT), '/'); } if(empty(OC::$APPSROOTS)){ From 9f1c46b6f6faebaebf555e0d26bcdef9e49daccc Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Thu, 7 Jun 2012 19:22:43 +0000 Subject: [PATCH 09/71] Correct Minizer inclusions --- lib/minimizer/css.php | 4 ++-- lib/minimizer/js.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/minimizer/css.php b/lib/minimizer/css.php index 76dc99b335..5ba557c4cd 100644 --- a/lib/minimizer/css.php +++ b/lib/minimizer/css.php @@ -28,8 +28,8 @@ class OC_Minimizer_CSS extends OC_Minimizer $append = false; foreach( OC::$APPSROOTS as $apps_dir) { - if($this->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style$fext.css", true)) { $append =true; break; } - elseif($this->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style.css", true )) { $append =true; break; } + if($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$style$fext.css", true)) { $append =true; break; } + elseif($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$style.css", true )) { $append =true; break; } } if(! $append) { echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); diff --git a/lib/minimizer/js.php b/lib/minimizer/js.php index aea8b66f91..4002b11538 100644 --- a/lib/minimizer/js.php +++ b/lib/minimizer/js.php @@ -42,8 +42,8 @@ class OC_Minimizer_JS extends OC_Minimizer $append = false; foreach( OC::$APPSROOTS as $apps_dir) { - if($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script$fext.js" , true)) { $append =true; break; } - elseif($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script.js", true )) { $append =true; break; } + if($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$script$fext.js" , true)) { $append =true; break; } + elseif($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$script.js", true )) { $append =true; break; } } if(! $append) { echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); From 9ec68c819bf409905e3e3ab17cb4b2dd925cbde7 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Thu, 7 Jun 2012 20:36:55 +0000 Subject: [PATCH 10/71] Change parameter 'web' to 'url' and take array of array in config instead of : separated values --- lib/app.php | 2 +- lib/base.php | 21 ++++++++------------- lib/minimizer/css.php | 6 +++--- lib/minimizer/js.php | 4 ++-- lib/template.php | 8 ++++---- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/lib/app.php b/lib/app.php index 43d60f3a68..79a0a2e053 100755 --- a/lib/app.php +++ b/lib/app.php @@ -342,7 +342,7 @@ class OC_App{ public static function getAppWebPath($appid) { foreach(OC::$APPSROOTS as $dir) { if(file_exists($dir['path'].'/'.$appid)) { - return $dir['web'].'/'.$appid; + return $dir['url'].'/'.$appid; } } return false; diff --git a/lib/base.php b/lib/base.php index 9f2925fa31..6e85f1a734 100644 --- a/lib/base.php +++ b/lib/base.php @@ -55,7 +55,7 @@ class OC{ */ public static $THIRDPARTYWEBROOT = ''; /** - * The installation path array of the apps folder on the server (e.g. /srv/http/owncloud) 'real' and web path in 'web' + * The installation path array of the apps folder on the server (e.g. /srv/http/owncloud) 'path' and web path in 'url' */ public static $APPSROOTS = array(); /* @@ -161,22 +161,17 @@ class OC{ 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; } - // search the apps folder - if(OC_Config::getValue('appsroot', '')<>''){ - $real_a = explode(':',OC_Config::getValue('appsroot', '')); - $web_a = explode(':',OC_Config::getValue('appsurl', '')); - foreach($real_a as $k => $path) { - if(!isset($web_a[$k])){ - echo("Apps root and appsurl not mathing. You need to have the same number of paths"); - exit; - } - OC::$APPSROOTS[] = array('path'=> $path, 'web' => $web_a[$k]); + $config_paths = OC_Config::getValue('apps_paths', array()); + if(! empty($config_paths)){ + foreach($config_paths as $paths) { + if( isset($paths['url']) && isset($paths['path'])) + OC::$APPSROOTS[] = $paths; } }elseif(file_exists(OC::$SERVERROOT.'/apps')){ - OC::$APPSROOTS[] = array('path'=> OC::$SERVERROOT.'/apps', 'web' => OC::$WEBROOT.'/apps/'); + OC::$APPSROOTS[] = array('path'=> OC::$SERVERROOT.'/apps', 'url' => OC::$WEBROOT.'/apps/'); }elseif(file_exists(OC::$SERVERROOT.'/../apps')){ - OC::$APPSROOTS[] = array('path'=> rtrim(dirname(OC::$SERVERROOT), '/').'/apps', 'web' => rtrim(dirname(OC::$WEBROOT), '/').'/apps/'); + OC::$APPSROOTS[] = array('path'=> rtrim(dirname(OC::$SERVERROOT), '/').'/apps', 'url' => rtrim(dirname(OC::$WEBROOT), '/').'/apps/'); OC::$APPSROOT=rtrim(dirname(OC::$SERVERROOT), '/'); } diff --git a/lib/minimizer/css.php b/lib/minimizer/css.php index 5ba557c4cd..c7e5d96e06 100644 --- a/lib/minimizer/css.php +++ b/lib/minimizer/css.php @@ -28,8 +28,8 @@ class OC_Minimizer_CSS extends OC_Minimizer $append = false; foreach( OC::$APPSROOTS as $apps_dir) { - if($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$style$fext.css", true)) { $append =true; break; } - elseif($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$style.css", true )) { $append =true; break; } + if($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$style$fext.css", true)) { $append =true; break; } + elseif($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$style.css", true )) { $append =true; break; } } if(! $append) { echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); @@ -65,7 +65,7 @@ class OC_Minimizer_CSS extends OC_Minimizer $in_root = false; foreach(OC::$APPSROOTS as $app_root) { if(strpos($file, $app_root['path']) == 0) { - $in_root = $app_root['web']; + $in_root = $app_root['url']; break; } } diff --git a/lib/minimizer/js.php b/lib/minimizer/js.php index 4002b11538..dd7d15de06 100644 --- a/lib/minimizer/js.php +++ b/lib/minimizer/js.php @@ -42,8 +42,8 @@ class OC_Minimizer_JS extends OC_Minimizer $append = false; foreach( OC::$APPSROOTS as $apps_dir) { - if($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$script$fext.js" , true)) { $append =true; break; } - elseif($this->appendIfExist($apps_dir['path'], $apps_dir['web'], "$script.js", true )) { $append =true; break; } + if($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$script$fext.js" , true)) { $append =true; break; } + elseif($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$script.js", true )) { $append =true; break; } } if(! $append) { echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); diff --git a/lib/template.php b/lib/template.php index 6fe0710203..b99d492a53 100644 --- a/lib/template.php +++ b/lib/template.php @@ -426,8 +426,8 @@ class OC_Template{ $append = false; foreach( OC::$APPSROOTS as $apps_dir) { - if($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script$fext.js" , true)) { $append =true; break; } - elseif($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['web'], "$script.js", true )) { $append =true; break; } + if($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['url'], "$script$fext.js" , true)) { $append =true; break; } + elseif($page->appendIfExist('jsfiles', $apps_dir['path'], $apps_dir['url'], "$script.js", true )) { $append =true; break; } } if(! $append) { echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); @@ -454,8 +454,8 @@ class OC_Template{ $append = false; foreach( OC::$APPSROOTS as $apps_dir) { - if($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style$fext.css", true)) { $append =true; break; } - elseif($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['web'], "$style.css", true )) { $append =true; break; } + if($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['url'], "$style$fext.css", true)) { $append =true; break; } + elseif($page->appendIfExist('cssfiles', $apps_dir['path'], $apps_dir['url'], "$style.css", true )) { $append =true; break; } } if(! $append) { echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); From dd98afc56c4356a06fb5afef39da916a97bae90b Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Thu, 7 Jun 2012 20:56:21 +0000 Subject: [PATCH 11/71] Add doc about multi app dir in sample config --- config/config.sample.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index 7ab327e2bc..bc66e9ebc0 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -34,6 +34,17 @@ $CONFIG = array( * in the admin apps menu. */ "writable_appsdir" => true, -// "datadirectory" => "" +// "datadirectory" => "", +"apps_paths" => array( + +/* Set an array of path for your apps directories + key 'path' is for the fs path an the key url is for the http path to your + applications paths +*/ + array( + 'path'=> '/var/www/owncloud/apps', + 'url' => '/apps', + ), + ), ); ?> From 6da5a2fdd4e8a19ab993b4a1f7de7e45b8922a16 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Thu, 14 Jun 2012 21:00:02 +0000 Subject: [PATCH 12/71] Add possibility to choose the installation folder --- config/config.sample.php | 12 ++++++------ lib/app.php | 39 +++++++++++++++++++++++++++++---------- lib/base.php | 4 ++-- lib/installer.php | 3 +-- lib/util.php | 16 +++++++++------- 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/config/config.sample.php b/config/config.sample.php index bc66e9ebc0..afc04f8ec1 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -33,17 +33,17 @@ $CONFIG = array( * If the apps dir is not writable, you can't download&install extra apps * in the admin apps menu. */ -"writable_appsdir" => true, // "datadirectory" => "", "apps_paths" => array( /* Set an array of path for your apps directories - key 'path' is for the fs path an the key url is for the http path to your - applications paths + key 'path' is for the fs path an the key 'url' is for the http path to your + applications paths. 'writable' indicate if the user can install apps in this folder. */ - array( - 'path'=> '/var/www/owncloud/apps', - 'url' => '/apps', + array( + 'path'=> '/var/www/owncloud/apps', + 'url' => '/apps', + 'writable' => true, ), ), ); diff --git a/lib/app.php b/lib/app.php index 79a0a2e053..ca7a022f89 100755 --- a/lib/app.php +++ b/lib/app.php @@ -322,17 +322,39 @@ class OC_App{ return $list; } + /** + * Get the path where to install apps + */ + public static function getInstallPath() { + if(OC_Config::getValue('appstoreenabled', true)==false) { + return false; + } + + foreach(OC::$APPSROOTS as $dir) { + if(isset($dir['writable']) && $dir['writable']===true) + return $dir['path']; + } + + OC_Log::write('core','No application directories are marked as writable.',OC_Log::ERROR); + return null; + } + + + protected static function findAppInDirectories($appid) { + foreach(OC::$APPSROOTS as $dir) { + if(file_exists($dir['path'].'/'.$appid)) { + return $dir; + } + } + } /** * Get the directory for the given app. * If the app is defined in multiple directory, the first one is taken. (false if not found) */ public static function getAppPath($appid) { - foreach(OC::$APPSROOTS as $dir) { - if(file_exists($dir['path'].'/'.$appid)) { - return $dir['path'].'/'.$appid; - } + if( ($dir = self::findAppInDirectories($appid)) != false) { + return $dir['path'].'/'.$appid; } - return false; } /** @@ -340,12 +362,9 @@ class OC_App{ * If the app is defined in multiple directory, the first one is taken. (false if not found) */ public static function getAppWebPath($appid) { - foreach(OC::$APPSROOTS as $dir) { - if(file_exists($dir['path'].'/'.$appid)) { - return $dir['url'].'/'.$appid; - } + if( ($dir = self::findAppInDirectories($appid)) != false) { + return $dir['url'].'/'.$appid; } - return false; } /** diff --git a/lib/base.php b/lib/base.php index 6e85f1a734..ca4052e5a1 100644 --- a/lib/base.php +++ b/lib/base.php @@ -169,9 +169,9 @@ class OC{ OC::$APPSROOTS[] = $paths; } }elseif(file_exists(OC::$SERVERROOT.'/apps')){ - OC::$APPSROOTS[] = array('path'=> OC::$SERVERROOT.'/apps', 'url' => OC::$WEBROOT.'/apps/'); + OC::$APPSROOTS[] = array('path'=> OC::$SERVERROOT.'/apps', 'url' => OC::$WEBROOT.'/apps/', 'writable' => true); }elseif(file_exists(OC::$SERVERROOT.'/../apps')){ - OC::$APPSROOTS[] = array('path'=> rtrim(dirname(OC::$SERVERROOT), '/').'/apps', 'url' => rtrim(dirname(OC::$WEBROOT), '/').'/apps/'); + OC::$APPSROOTS[] = array('path'=> rtrim(dirname(OC::$SERVERROOT), '/').'/apps', 'url' => rtrim(dirname(OC::$WEBROOT), '/').'/apps/', 'writable' => true); OC::$APPSROOT=rtrim(dirname(OC::$SERVERROOT), '/'); } diff --git a/lib/installer.php b/lib/installer.php index bfa34de2a7..299674b29e 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -126,8 +126,6 @@ class OC_Installer{ return false; } $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml',true); - $basedir=OC_App::getAppPath($info['id']); - // check the code for not allowed calls if(!OC_Installer::checkCode($info['id'],$extractDir)){ OC_Log::write('core','App can\'t be installed because of not allowed code in the App',OC_Log::ERROR); @@ -153,6 +151,7 @@ class OC_Installer{ return false; } + $basedir=OC_App::getInstallPath().'/'.$info['id']; //check if the destination directory already exists if(is_dir($basedir)){ OC_Log::write('core','App directory already exists',OC_Log::WARN); diff --git a/lib/util.php b/lib/util.php index 20888fa71f..b344d576eb 100644 --- a/lib/util.php +++ b/lib/util.php @@ -29,13 +29,15 @@ class OC_Util { $tmpl->printPage(); exit; } - - // Check if apps folder is writable. - if(OC_Config::getValue('writable_appsdir', true) && !is_writable(OC::$SERVERROOT."/apps/")) { - $tmpl = new OC_Template( '', 'error', 'guest' ); - $tmpl->assign('errors',array(1=>array('error'=>"Can't write into apps directory 'apps'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud"))); - $tmpl->printPage(); - exit; + + // Check if there is a writable install folder. + if(OC_Config::getValue('appstoreenabled', true)) { + if( OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath())) { + $tmpl = new OC_Template( '', 'error', 'guest' ); + $tmpl->assign('errors',array(1=>array('error'=>"Can't write into apps directory 'apps'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud"))); + $tmpl->printPage(); + exit; + } } // Create root dir. From df83df5263db57056d0bd70edfa3b28e7b5e6b6b Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Thu, 14 Jun 2012 21:19:11 +0000 Subject: [PATCH 13/71] Correct sample config --- config/config.sample.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/config/config.sample.php b/config/config.sample.php index 5af5a6efc0..c7c811345b 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -86,11 +86,11 @@ $CONFIG = array( /* Loglevel to start logging at. 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default is WARN) */ "loglevel" => "", -/* Set this to false to disable the check for writable apps dir. - * If the apps dir is not writable, you can't download&install extra apps - * in the admin apps menu. +/* The directory where the user data is stored, default to data in the owncloud + * directory. The sqlite database is also stored here, when sqlite is used. */ // "datadirectory" => "", + "apps_paths" => array( /* Set an array of path for your apps directories @@ -103,9 +103,5 @@ $CONFIG = array( 'writable' => true, ), ), - -/* The directory where the user data is stored, default to data in the owncloud - * directory. The sqlite database is also stored here, when sqlite is used. - */ ); -?> + From f8ec280b6eb072a687be5e55021eb4d76dec02cf Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 21 Jun 2012 09:44:20 +0200 Subject: [PATCH 14/71] correct presentation of HTML encoded characters --- apps/media/js/player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/media/js/player.js b/apps/media/js/player.js index ad40683083..867ea80236 100644 --- a/apps/media/js/player.js +++ b/apps/media/js/player.js @@ -40,7 +40,7 @@ var PlayList={ PlayList.init(items[index].type,null); // init calls load that calls play }else{ PlayList.player.jPlayer("setMedia", items[PlayList.current]); - $(".jp-current-song").text(items[PlayList.current].name); + $(".jp-current-song").html(items[PlayList.current].name); items[index].playcount++; PlayList.player.jPlayer("play",time); if(index>0){ From 96d0b9834afda9d717631789210ede1dddebc86c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 21 Jun 2012 09:58:04 +0200 Subject: [PATCH 15/71] fix mimetype for cdr files - bugfix for oc 559 --- lib/mimetypes.fixlist.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/mimetypes.fixlist.php b/lib/mimetypes.fixlist.php index a40fbd9e22..13e3f16b36 100644 --- a/lib/mimetypes.fixlist.php +++ b/lib/mimetypes.fixlist.php @@ -17,5 +17,6 @@ return array( 'xlsx'=>'application/msexcel', 'ppt'=>'application/mspowerpoint', 'pptx'=>'application/mspowerpoint', - 'sgf' => 'application/sgf' + 'sgf' => 'application/sgf', + 'cdr' => 'application/coreldraw' ); From cd005e6c62976eabb38112138415c1c0e19069ee Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 21 Jun 2012 10:28:43 +0200 Subject: [PATCH 16/71] use new sanitizeHTML() function --- apps/files/templates/part.breadcrumb.php | 2 +- apps/files_texteditor/js/editor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/templates/part.breadcrumb.php b/apps/files/templates/part.breadcrumb.php index 43fe2d1fa9..22d9bb4490 100644 --- a/apps/files/templates/part.breadcrumb.php +++ b/apps/files/templates/part.breadcrumb.php @@ -1,6 +1,6 @@
svg" data-dir='' style='background-image:url("")'> - "> + ">
diff --git a/apps/files_texteditor/js/editor.js b/apps/files_texteditor/js/editor.js index 70bb74a910..9d168c1c4f 100644 --- a/apps/files_texteditor/js/editor.js +++ b/apps/files_texteditor/js/editor.js @@ -67,7 +67,7 @@ function setSyntaxMode(ext){ function showControls(filename,writeperms){ // Loads the control bar at the top. // Load the new toolbar. - var editorbarhtml = '