From 7b8664bbe5145509a0e38b6291212165931cead9 Mon Sep 17 00:00:00 2001 From: Benjamin Diele Date: Mon, 28 May 2012 17:54:38 +0400 Subject: [PATCH 01/10] Check for valid LDAP-resource before querying. Check if we have get valid link identifier from self::getConnectionResource() before using ldap_search() and ldap_get_entries(), otherwise return an empty array. Signed-off-by: Benjamin Diele --- apps/user_ldap/lib_ldap.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php index 5cd7e0241b..6a6d744a0f 100644 --- a/apps/user_ldap/lib_ldap.php +++ b/apps/user_ldap/lib_ldap.php @@ -469,11 +469,23 @@ class OC_LDAP { if(!is_null($attr) && !is_array($attr)) { $attr = array(strtolower($attr)); } - $sr = @ldap_search(self::getConnectionResource(), $base, $filter, $attr); - $findings = @ldap_get_entries(self::getConnectionResource(), $sr ); - // if we're here, probably no connection ressource is returned. - // to make ownCloud behave nicely, we simply give back an empty array. - if(is_null($findings)) { + + // See if we have a resource, that way we can get rid of the + // error-supressing. + $link_resource = self::getConnectionResource(); + if($link_resource) + { + $sr = ldap_search($link_resource, $base, $filter, $attr); + $findings = ldap_get_entries($link_resource, $sr ); + // if we're here, probably no connection ressource is returned. + // to make ownCloud behave nicely, we simply give back an empty array. + if(is_null($findings)) { + return array(); + } + } else + { + // Seems like we didn't find any resource. + // Return an empty array just like before. return array(); } From 2e6e1544757c3ef9e12314bfc99b2f09e7b397d9 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 22 Jun 2012 22:46:09 +0200 Subject: [PATCH 02/10] Gallery: Fix opening folders with a ' in the name --- apps/gallery/js/pictures.js | 2 +- apps/gallery/lib/tiles.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/gallery/js/pictures.js b/apps/gallery/js/pictures.js index 3a79788968..91fbf5be96 100644 --- a/apps/gallery/js/pictures.js +++ b/apps/gallery/js/pictures.js @@ -60,7 +60,7 @@ function deplode(element) { } function openNewGal(album_name) { - root = root + album_name + "/"; + root = root + decodeURIComponent(album_name) + "/"; var url = window.location.toString().replace(window.location.search, ''); url = url + "?app=gallery&root="+encodeURIComponent(root); diff --git a/apps/gallery/lib/tiles.php b/apps/gallery/lib/tiles.php index 011168471f..5efe0d7a29 100644 --- a/apps/gallery/lib/tiles.php +++ b/apps/gallery/lib/tiles.php @@ -168,7 +168,7 @@ class TileStack extends TileBase { } public function getOnClickAction() { - return 'javascript:openNewGal(\''.\OCP\Util::sanitizeHTML($this->stack_name).'\');'; + return 'javascript:openNewGal(\''.rawurlencode($this->stack_name).'\');'; } private $tiles_array; From ded9ea5ad3fd46516ca9ea7849dbdfbe753a1dc5 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 22 Jun 2012 22:57:35 +0200 Subject: [PATCH 03/10] Spelling fixes --- apps/user_ldap/lib_ldap.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php index a03ca0d4cf..c88b18b10d 100644 --- a/apps/user_ldap/lib_ldap.php +++ b/apps/user_ldap/lib_ldap.php @@ -472,14 +472,13 @@ class OC_LDAP { $attr = array(strtolower($attr)); } - // See if we have a resource, that way we can get rid of the - // error-supressing. + // See if we have a resource $link_resource = self::getConnectionResource(); if($link_resource) { $sr = ldap_search($link_resource, $base, $filter, $attr); $findings = ldap_get_entries($link_resource, $sr ); - // if we're here, probably no connection ressource is returned. + // if we're here, probably no connection resource is returned. // to make ownCloud behave nicely, we simply give back an empty array. if(is_null($findings)) { return array(); From b5e3e150eb9737022d0c9080e84bac4d290c96a7 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Fri, 22 Jun 2012 20:58:28 +0000 Subject: [PATCH 04/10] Correction of path looking for apps and css --- apps/contacts/css/jquery.Jcrop.css | 2 +- lib/db.php | 2 +- lib/migrate.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/contacts/css/jquery.Jcrop.css b/apps/contacts/css/jquery.Jcrop.css index c9b24a5ebe..a9ba4746e0 100644 --- a/apps/contacts/css/jquery.Jcrop.css +++ b/apps/contacts/css/jquery.Jcrop.css @@ -14,7 +14,7 @@ } .jcrop-vline, .jcrop-hline { - background: white url('%webroot%/apps/contacts/img/Jcrop.gif') top left repeat; + background: white url('%appswebroot%/contacts/img/Jcrop.gif') top left repeat; font-size: 0px; position: absolute; } diff --git a/lib/db.php b/lib/db.php index bcc8657b4a..dc9e3392d0 100644 --- a/lib/db.php +++ b/lib/db.php @@ -526,7 +526,7 @@ class OC_DB { self::removeDBStructure( OC::$SERVERROOT . '/db_structure.xml' ); foreach($apps as $app){ - $path = OC::$SERVERROOT.'/apps/'.$app.'/appinfo/database.xml'; + $path = self::getAppPath($app).'/appinfo/database.xml'; if(file_exists($path)){ self::removeDBStructure( $path ); } diff --git a/lib/migrate.php b/lib/migrate.php index 5939ba32e5..f26b4b2567 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -64,7 +64,7 @@ class OC_Migrate{ $apps = OC_App::getAllApps(); foreach($apps as $app){ - $path = OC::$SERVERROOT . '/apps/' . $app . '/appinfo/migrate.php'; + $path = self::getAppPath($app) . '/appinfo/migrate.php'; if( file_exists( $path ) ){ include( $path ); } @@ -398,7 +398,7 @@ class OC_Migrate{ if( OC_App::isEnabled( $provider->getID() ) ){ $success = true; // Does this app use the database? - if( file_exists( OC::$SERVERROOT.'/apps/'.$provider->getID().'/appinfo/database.xml' ) ){ + if( file_exists( self::getAppPath($provider->getID()).'/appinfo/database.xml' ) ){ // Create some app tables $tables = self::createAppTables( $provider->getID() ); if( is_array( $tables ) ){ @@ -539,7 +539,7 @@ class OC_Migrate{ } // There is a database.xml file - $content = file_get_contents( OC::$SERVERROOT . '/apps/' . $appid . '/appinfo/database.xml' ); + $content = file_get_contents(self::getAppPath($appid) . '/appinfo/database.xml' ); $file2 = 'static://db_scheme'; // TODO get the relative path to migration.db from the data dir @@ -608,7 +608,7 @@ class OC_Migrate{ static public function getApps(){ $allapps = OC_App::getAllApps(); foreach($allapps as $app){ - $path = OC::$SERVERROOT . '/apps/' . $app . '/lib/migrate.php'; + $path = self::getAppPath($app) . '/lib/migrate.php'; if( file_exists( $path ) ){ $supportsmigration[] = $app; } From 33165e3915dc5d8f09583d70fca0441e17db905f Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Fri, 22 Jun 2012 21:01:12 +0000 Subject: [PATCH 05/10] Do not close php tag on config file --- lib/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/config.php b/lib/config.php index 65f9fdc06b..266d559126 100644 --- a/lib/config.php +++ b/lib/config.php @@ -157,7 +157,7 @@ class OC_Config{ // Create a php file ... $content = "\n"; + $content .= ";\n"; $filename = OC::$SERVERROOT."/config/config.php"; // Write the file From d39d7fb9ff7d071b8981e6c8caf74fffb9eb0218 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Fri, 22 Jun 2012 22:05:39 +0000 Subject: [PATCH 06/10] Remove references to /apps/ and correct inclusion of settings --- apps/files_versions/appinfo/app.php | 4 ++-- apps/gallery/appinfo/app.php | 16 ++++++++-------- apps/gallery/index.php | 2 +- apps/media/appinfo/app.php | 6 +++--- lib/app.php | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/files_versions/appinfo/app.php b/apps/files_versions/appinfo/app.php index ef2f54dd3f..bd06dc0ced 100644 --- a/apps/files_versions/appinfo/app.php +++ b/apps/files_versions/appinfo/app.php @@ -1,6 +1,6 @@ Date: Sat, 23 Jun 2012 16:17:59 +0200 Subject: [PATCH 07/10] work with non existing apps directory. thanks to Antonio for the hint --- lib/installer.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/installer.php b/lib/installer.php index c0903f93d5..b650f3eed0 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -287,16 +287,17 @@ class OC_Installer{ */ public static function installShippedApps(){ 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'); + if($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'); + } } } } From 2c1c1ba88c7eb7a4c40fc14bc1cc92287ad1c8da Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sat, 23 Jun 2012 16:21:47 +0200 Subject: [PATCH 08/10] close only if exist --- lib/installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/installer.php b/lib/installer.php index b650f3eed0..00feb6d470 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -302,8 +302,8 @@ class OC_Installer{ } } } + closedir( $dir ); } - closedir( $dir ); } } From 5323983fc715d815a3e1820a32d0e826c0f41f09 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Sat, 23 Jun 2012 14:42:37 +0000 Subject: [PATCH 09/10] Text editor: Waste less space for line numbers --- apps/files_texteditor/css/style.css | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/files_texteditor/css/style.css b/apps/files_texteditor/css/style.css index 82c57b88bb..14a1c4a9bb 100644 --- a/apps/files_texteditor/css/style.css +++ b/apps/files_texteditor/css/style.css @@ -2,13 +2,10 @@ position: fixed; display: block; top: 6.8em; - left: 13.5em; + left: 12.5em; + z-index: 20; } #editor_save{ margin-left: 7px; float: left; } -#saving_icon{ - margin-top: 3px; - float: left; -} From d450560b392f7be4ff05f31b6ffe89caf03dd2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=BClsmann?= Date: Sat, 23 Jun 2012 16:59:55 +0200 Subject: [PATCH 10/10] remove trailing slash in %appswebroot% placeholder --- lib/minimizer/css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/minimizer/css.php b/lib/minimizer/css.php index f8e84482bb..110935ea3b 100644 --- a/lib/minimizer/css.php +++ b/lib/minimizer/css.php @@ -17,7 +17,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 = $webroot.$app_root['url']; + $in_root = rtrim($webroot.$app_root['url'], '/'); break; } }