From b2cbf1199ddf9802316a4508ee312490c6b88ddb Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Thu, 28 Jun 2012 19:37:29 +0000 Subject: [PATCH 01/29] Pg setup enhancement do not create a db if already existing .. and reset the user password instead of creating if the user already exists --- lib/setup.php | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index 59c3aefbf13..5387a0ef493 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -285,13 +285,23 @@ class OC_Setup { //we cant use OC_BD functions here because we need to connect as the administrative user. $e_name = pg_escape_string($name); $e_user = pg_escape_string($user); - $query = "CREATE DATABASE \"$e_name\" OWNER \"$e_user\""; + $query = "select datname from pg_database where datname = '$e_name'"; $result = pg_query($connection, $query); if(!$result) { $entry='DB Error: "'.pg_last_error($connection).'"
'; $entry.='Offending command was: '.$query.'
'; echo($entry); } + if(! pg_fetch_row($result)) { + //The database does not exists... let's create it + $query = "CREATE DATABASE \"$e_name\" OWNER \"$e_user\""; + $result = pg_query($connection, $query); + if(!$result) { + $entry='DB Error: "'.pg_last_error($connection).'"
'; + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } $query = "REVOKE ALL PRIVILEGES ON DATABASE \"$e_name\" FROM PUBLIC"; $result = pg_query($connection, $query); } @@ -299,13 +309,33 @@ class OC_Setup { private static function pg_createDBUser($name,$password,$connection) { $e_name = pg_escape_string($name); $e_password = pg_escape_string($password); - $query = "CREATE USER \"$e_name\" CREATEDB PASSWORD '$e_password';"; + $query = "select * from pg_roles where rolname='$e_name';"; $result = pg_query($connection, $query); if(!$result) { $entry='DB Error: "'.pg_last_error($connection).'"
'; $entry.='Offending command was: '.$query.'
'; echo($entry); } + + if(! pg_fetch_row($result)) { + //user does not exists let's create it :) + $query = "CREATE USER \"$e_name\" CREATEDB PASSWORD '$e_password';"; + $result = pg_query($connection, $query); + if(!$result) { + $entry='DB Error: "'.pg_last_error($connection).'"
'; + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } + else { // change password of the existing role + $query = "ALTER ROLE \"$e_name\" WITH PASSWORD '$e_password';"; + $result = pg_query($connection, $query); + if(!$result) { + $entry='DB Error: "'.pg_last_error($connection).'"
'; + $entry.='Offending command was: '.$query.'
'; + echo($entry); + } + } } /** From 19bb4e83c994a31578d35d8a43a6ab4b180858d7 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 28 Jun 2012 21:26:03 +0200 Subject: [PATCH 02/29] Remove redundant code from OC_Helper::linkTo --- lib/helper.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/helper.php b/lib/helper.php index 6ab55f27618..64378da356e 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -38,13 +38,10 @@ class OC_Helper { */ public static function linkTo( $app, $file ){ if( $app != '' ){ - $app .= '/'; + $app_path = OC_App::getAppPath($app); // Check if the app is in the app folder - if( file_exists( OC_App::getAppPath($app).'/'.$file )){ + if( $app_path && file_exists( $app_path.'/'.$file )){ if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){ - if(substr($app, -1, 1) == '/'){ - $app = substr($app, 0, strlen($app) - 1); - } $urlLinkTo = OC::$WEBROOT . '/?app=' . $app; $urlLinkTo .= ($file!='index.php')?'&getfile=' . urlencode($file):''; }else{ @@ -52,7 +49,7 @@ class OC_Helper { } } else{ - $urlLinkTo = OC::$WEBROOT . '/' . $app . $file; + $urlLinkTo = OC::$WEBROOT . '/' . $app . '/' . $file; } } else{ From bf09edcbf1775115067611b85b954fbabad74ba3 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 28 Jun 2012 21:54:33 +0200 Subject: [PATCH 03/29] Remember the app root information. --- lib/app.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/app.php b/lib/app.php index 61566ed7522..d1f12594a25 100755 --- a/lib/app.php +++ b/lib/app.php @@ -350,9 +350,13 @@ class OC_App{ protected static function findAppInDirectories($appid) { + static $app_dir = array(); + if (isset($app_dir[$appid])) { + return $app_dir[$appid]; + } foreach(OC::$APPSROOTS as $dir) { if(file_exists($dir['path'].'/'.$appid)) { - return $dir; + return $app_dir[$appid]=$dir; } } } From 02e4e0e08f39bfb59a7bd8e4a538d6715897af2b Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 28 Jun 2012 21:59:01 +0200 Subject: [PATCH 04/29] Gallery: Get all the image information for a directory at once --- apps/gallery/lib/managers.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/apps/gallery/lib/managers.php b/apps/gallery/lib/managers.php index fcce3f40e23..17eb741a660 100644 --- a/apps/gallery/lib/managers.php +++ b/apps/gallery/lib/managers.php @@ -4,6 +4,7 @@ namespace OC\Pictures; class DatabaseManager { private static $instance = null; + protected $cache = array(); const TAG = 'DatabaseManager'; public static function getInstance() { @@ -12,13 +13,27 @@ class DatabaseManager { return self::$instance; } + protected function getPathData($path) { + $stmt = \OCP\DB::prepare('SELECT * FROM *PREFIX*pictures_images_cache + WHERE uid_owner LIKE ? AND path like ? AND path not like ?'); + $path_match = $path.'/%'; + $path_notmatch = $path.'/%/%'; + $result = $stmt->execute(array(\OCP\USER::getUser(), $path_match, $path_notmatch)); + $this->cache[$path] = array(); + while (($row = $result->fetchRow()) != false) { + $this->cache[$path][$row['path']] = $row; + } + } + public function getFileData($path) { $gallery_path = \OCP\Config::getSystemValue( 'datadirectory' ).'/'.\OC_User::getUser().'/gallery'; $path = $gallery_path.$path; - $stmt = \OCP\DB::prepare('SELECT * FROM *PREFIX*pictures_images_cache WHERE uid_owner LIKE ? AND path = ?'); - $result = $stmt->execute(array(\OCP\USER::getUser(), $path)); - if (($row = $result->fetchRow()) != false) { - return $row; + $dir = dirname($path); + if (!isset($this->cache[$dir])) { + $this->getPathData($dir); + } + if (isset($this->cache[$dir][$path])) { + return $this->cache[$dir][$path]; } $image = new \OC_Image(); if (!$image->loadFromFile($path)) { @@ -28,6 +43,7 @@ class DatabaseManager { $stmt->execute(array(\OCP\USER::getUser(), $path, $image->width(), $image->height())); $ret = array('path' => $path, 'width' => $image->width(), 'height' => $image->height()); unset($image); + $this->cache[$dir][$path] = $ret; return $ret; } From 1ccbbfad530e4efdbfe301c8014ee7f31fa56220 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 28 Jun 2012 22:01:46 +0200 Subject: [PATCH 05/29] Spelling fix --- lib/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app.php b/lib/app.php index d1f12594a25..4c2c43ec26b 100755 --- a/lib/app.php +++ b/lib/app.php @@ -573,7 +573,7 @@ class OC_App{ } /** - * get the installed version of all papps + * get the installed version of all apps */ public static function getAppVersions(){ static $versions; From 31bba86e8753ce3a1d7821c195f64ebfb052e01d Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Thu, 28 Jun 2012 17:54:53 -0400 Subject: [PATCH 06/29] Fix external storage UI for Admin page --- apps/files_external/js/settings.js | 4 ++-- apps/files_external/personal.php | 2 +- apps/files_external/settings.php | 2 +- apps/files_external/templates/settings.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 57188a6a266..49b7710638e 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -27,7 +27,7 @@ OC.MountConfig={ } }); if (addMountPoint) { - if ($('#externalStorage').data('admin')) { + if ($('#externalStorage').data('admin') === true) { var isPersonal = false; var multiselect = $(tr).find('.chzn-select').val(); var oldGroups = $(tr).find('.applicable').data('applicable-groups'); @@ -117,7 +117,7 @@ $(document).ready(function() { if (mountPoint == '') { return false; } - if ($('#externalStorage').data('admin')) { + if ($('#externalStorage').data('admin') === true) { var isPersonal = false; var multiselect = $(tr).find('.chzn-select').val(); $.each(multiselect, function(index, value) { diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php index 32e08742442..b758e7e7eb0 100755 --- a/apps/files_external/personal.php +++ b/apps/files_external/personal.php @@ -26,7 +26,7 @@ $backends = OC_Mount_Config::getBackends(); // Remove local storage unset($backends['OC_Filestorage_Local']); $tmpl = new OCP\Template('files_external', 'settings'); -$tmpl->assign('isAdminPage', false); +$tmpl->assign('isAdminPage', false, false); $tmpl->assign('mounts', OC_Mount_Config::getPersonalMountPoints()); $tmpl->assign('backends', $backends); return $tmpl->fetchPage(); diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php index 983855ecdcc..acc9036b299 100644 --- a/apps/files_external/settings.php +++ b/apps/files_external/settings.php @@ -23,7 +23,7 @@ OCP\Util::addScript('files_external', 'settings'); OCP\Util::addStyle('files_external', 'settings'); $tmpl = new OCP\Template('files_external', 'settings'); -$tmpl->assign('isAdminPage', true); +$tmpl->assign('isAdminPage', true, false); $tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints()); $tmpl->assign('backends', OC_Mount_Config::getBackends()); $tmpl->assign('groups', OC_Group::getGroups()); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 6c37df8001e..7777593d74d 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -1,7 +1,7 @@
t('External Storage'); ?> - +
'> From 75af5778a4e034600edd2e891f8c70e6e807808a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 29 Jun 2012 00:49:37 +0200 Subject: [PATCH 07/29] pass progresskey the correct way during calender import --- apps/calendar/js/loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/calendar/js/loader.js b/apps/calendar/js/loader.js index 0fc5018e89c..cef95afc3aa 100644 --- a/apps/calendar/js/loader.js +++ b/apps/calendar/js/loader.js @@ -44,7 +44,7 @@ Calendar_Import={ $('#newcalendar').attr('readonly', 'readonly'); $('#calendar').attr('disabled', 'disabled'); var progresskey = $('#progresskey').val(); - $.post(OC.filePath('calendar', 'ajax/import', 'import.php') + '?progresskey='+progresskey, {method: String (method), calname: String (calname), path: String (path), file: String (filename), id: String (calid)}, function(data){ + $.post(OC.filePath('calendar', 'ajax/import', 'import.php'), {progresskey: progresskey, method: String (method), calname: String (calname), path: String (path), file: String (filename), id: String (calid)}, function(data){ if(data.status == 'success'){ $('#progressbar').progressbar('option', 'value', 100); $('#import_done').css('display', 'block'); From 6917d741931acb8d8a5dddbc6c668a5b75960a91 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Fri, 29 Jun 2012 11:07:41 +0200 Subject: [PATCH 08/29] =?UTF-8?q?move=20the=20ownCloud=20version=20to=20ad?= =?UTF-8?q?min=20which=20makes=20more=20sense.=20A=20normal=20user=20can?= =?UTF-8?q?=C2=B4t=20update=20ownCloud=20anyways.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings/templates/admin.php | 7 +++++++ settings/templates/personal.php | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/settings/templates/admin.php b/settings/templates/admin.php index a9f727d6764..033cd1a1642 100755 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -54,3 +54,10 @@ if(!$_['htaccessworking']) {
t('Mount point'); ?>
...'>
+ + +

+ ownCloud ()
+ Developed by the ownCloud community, the source code is licensed under the AGPL. +

+ diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 014996a5b20..ee40120d724 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -55,10 +55,5 @@ echo $form; };?> -

- ownCloud ()
- Developed by the ownCloud community, the source code is freely licensed under the AGPL. -

- From 60ec46f706fde158ec66b447446ed0b763e40076 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 29 Jun 2012 11:59:47 +0200 Subject: [PATCH 09/29] - remove leading http[s] to let createBaseUri() generate secure/unsecure base URI - if secure is set to true add 's' to http --- apps/files_external/lib/webdav.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index d136f04f3eb..94d9abb6a25 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -20,10 +20,14 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ private static $tempFiles=array(); public function __construct($params){ - $this->host=$params['host']; + $host = $params['host']; + //remove leading http[s], will be generated in createBaseUri() + if (substr($host,0,8) == "https://") $host = substr($host, 8); + else if (substr($host,0,7) == "http://") $host = substr($host, 7); + $this->host=$host; $this->user=$params['user']; $this->password=$params['password']; - $this->secure=isset($params['secure'])?(bool)$params['secure']:false; + $this->secure=(isset($params['secure']) && $params['secure'] == 'true')?true:false; $this->root=isset($params['root'])?$params['root']:'/'; if(!$this->root || $this->root[0]!='/'){ $this->root='/'.$this->root; @@ -46,7 +50,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ private function createBaseUri(){ $baseUri='http'; if($this->secure){ - $baseUri.'s'; + $baseUri.='s'; } $baseUri.='://'.$this->host.$this->root; return $baseUri; From b95996c02c8b94a69eba21e31e0c5a3d30756d6d Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 29 Jun 2012 15:23:04 +0200 Subject: [PATCH 10/29] - when creating a new text file or directory which name already exist use the same pattern as for file uploads in such a case (add a (N) to the name) - don't allow renaming if a file/directory with the name already exists --- apps/files/js/files.js | 13 ++++++++++--- lib/files.php | 4 +++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 3ba473e023d..86c5185bf72 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -451,7 +451,7 @@ $(document).ready(function() { $(this).append(input); input.focus(); input.change(function(){ - var name=$(this).val(); + var name=getUniqueName($(this).val()); if(type != 'web' && name.indexOf('/')!=-1){ $('#notification').text(t('files','Invalid name, \'/\' is not allowed.')); $('#notification').fadeIn(); @@ -496,6 +496,7 @@ $(document).ready(function() { }else{//or the domain localName=(localName.match(/:\/\/(.[^/]+)/)[1]).replace('www.',''); } + localName = getUniqueName(localName); $.post( OC.filePath('files','ajax','newfile.php'), {dir:$('#dir').val(),source:name,filename:localName}, @@ -737,7 +738,10 @@ getMimeIcon.cache={}; function getUniqueName(name){ if($('tr').filterAttr('data-file',name).length>0){ var parts=name.split('.'); - var extension=parts.pop(); + var extension = ""; + if (parts.length > 1) { + extension=parts.pop(); + } var base=parts.join('.'); numMatch=base.match(/\((\d+)\)/); var num=2; @@ -747,7 +751,10 @@ function getUniqueName(name){ base.pop(); base=base.join('(').trim(); } - name=base+' ('+num+').'+extension; + name=base+' ('+num+')'; + if (extension) { + name = name+'.'+extension; + } return getUniqueName(name); } return name; diff --git a/lib/files.php b/lib/files.php index 469c3a15b8e..cee273d95c9 100644 --- a/lib/files.php +++ b/lib/files.php @@ -167,10 +167,12 @@ class OC_Files { * @param file $target */ public static function move($sourceDir,$source,$targetDir,$target){ - if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared')){ + if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared') && !OC_Filesystem::file_exists($tagetDir.'/'.$target)){ $targetFile=self::normalizePath($targetDir.'/'.$target); $sourceFile=self::normalizePath($sourceDir.'/'.$source); return OC_Filesystem::rename($sourceFile,$targetFile); + } else { + return false; } } From bda0026374381d4519f1032c365db0a18989fbb7 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 29 Jun 2012 15:40:46 +0200 Subject: [PATCH 11/29] fix birthday calendar --- apps/calendar/lib/app.php | 18 +++++++++--------- apps/contacts/lib/hooks.php | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index 344c89f36b0..9cd6ad28518 100644 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -368,12 +368,14 @@ class OC_Calendar_App{ * @return (array) $output - readable output */ public static function generateEventOutput($event, $start, $end){ - if(isset($event['calendardata'])){ - $object = OC_VObject::parse($event['calendardata']); - $vevent = $object->VEVENT; - }else{ - $vevent = $event['vevent']; + if(!isset($event['calendardata']) && !isset($event['vevent'])){ + return false; + } + if(!isset($event['calendardata']) && isset($event['vevent'])){ + $event['calendardata'] = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud's Internal iCal System\n" . $event['vevent']->serialize() . "END:VCALENDAR"; } + $object = OC_VObject::parse($event['calendardata']); + $vevent = $object->VEVENT; $return = array(); $id = $event['id']; $allday = ($vevent->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE)?true:false; @@ -404,15 +406,13 @@ class OC_Calendar_App{ $return[] = array_merge($staticoutput, $dynamicoutput); } }else{ - if(OC_Calendar_Object::isrepeating($id)){ - $object->expand($start, $end); - } + $object->expand($start, $end); foreach($object->getComponents() as $singleevent){ if(!($singleevent instanceof Sabre_VObject_Component_VEvent)){ continue; } $dynamicoutput = OC_Calendar_Object::generateStartEndDate($singleevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($singleevent), $allday, self::$tz); - $return[] = array_merge($staticoutput, $dynamicoutput); + $return[] = array_merge($staticoutput, $dynamicoutput); } } return $return; diff --git a/apps/contacts/lib/hooks.php b/apps/contacts/lib/hooks.php index 9794a9c9b94..d91d3c565b5 100644 --- a/apps/contacts/lib/hooks.php +++ b/apps/contacts/lib/hooks.php @@ -90,9 +90,10 @@ class OC_Contacts_Hooks{ if ($birthday) { $date = new DateTime($birthday); $vevent = new OC_VObject('VEVENT'); - $vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV)); + //$vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV)); $vevent->setDateTime('DTSTART', $date, Sabre_VObject_Element_DateTime::DATE); $vevent->setString('DURATION', 'P1D'); + $vevent->setString('UID', substr(md5(rand().time()),0,10)); // DESCRIPTION? $vevent->setString('RRULE', 'FREQ=YEARLY'); $title = str_replace('{name}', $vcard->getAsString('FN'), OC_Contacts_App::$l10n->t('{name}\'s Birthday')); @@ -101,6 +102,7 @@ class OC_Contacts_Hooks{ 'vevent' => $vevent, 'repeating' => true, 'summary' => $title, + 'calendardata' => "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Contacts " . OCP\App::getAppVersion('contacts') . "\n" . $vevent->serialize() . "END:VCALENDAR" ); } } From 94add1c000bc40cd77362ae7a1176e2b6c8faad3 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 29 Jun 2012 16:49:22 +0200 Subject: [PATCH 12/29] typo fixed --- lib/files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/files.php b/lib/files.php index cee273d95c9..d5bebb7e549 100644 --- a/lib/files.php +++ b/lib/files.php @@ -167,7 +167,7 @@ class OC_Files { * @param file $target */ public static function move($sourceDir,$source,$targetDir,$target){ - if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared') && !OC_Filesystem::file_exists($tagetDir.'/'.$target)){ + if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared') && !OC_Filesystem::file_exists($targetDir.'/'.$target)){ $targetFile=self::normalizePath($targetDir.'/'.$target); $sourceFile=self::normalizePath($sourceDir.'/'.$source); return OC_Filesystem::rename($sourceFile,$targetFile); From f311c2a2ff0155a457097346b6b7011e0db4df64 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 29 Jun 2012 11:04:35 -0400 Subject: [PATCH 13/29] Hide the delete button on new mount point row --- apps/files_external/js/settings.js | 1 + apps/files_external/templates/settings.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 49b7710638e..23d5c2f6301 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -103,6 +103,7 @@ $(document).ready(function() { }); $('.chz-select').chosen(); $(tr).find('td').last().attr('class', 'remove'); + $(tr).find('td').last().removeAttr('style'); $(tr).removeAttr('id'); $(this).remove(); }); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 7777593d74d..069599d028f 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -74,7 +74,7 @@ - ><?php echo $l->t('Delete'); ?> + ><?php echo $l->t('Delete'); ?> From 2d49a491fb740625ef56f6791669584e5ae49927 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 29 Jun 2012 11:09:17 -0400 Subject: [PATCH 14/29] Clear the mount point value for the new mount point row --- apps/files_external/js/settings.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 23d5c2f6301..1c366a79c7a 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -73,7 +73,8 @@ $(document).ready(function() { $('#selectBackend').live('change', function() { var tr = $(this).parent().parent(); - $('#externalStorage tbody').last().append($(tr).clone()); + $('#externalStorage tbody').append($(tr).clone()); + $('#externalStorage tbody tr').last().find('.mountPoint input').val(''); var selected = $(this).find('option:selected').text(); var backendClass = $(this).val(); $(this).parent().text(selected); From 7e9455c3823d31fc12fcaee030abfc78ffedec80 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 29 Jun 2012 11:22:54 -0400 Subject: [PATCH 15/29] Allow multiple Google Drive and Dropbox external storages to be configured --- apps/files_external/js/dropbox.js | 1 - apps/files_external/js/google.js | 1 - 2 files changed, 2 deletions(-) diff --git a/apps/files_external/js/dropbox.js b/apps/files_external/js/dropbox.js index 67f3c46a6ed..08796cbbdc9 100644 --- a/apps/files_external/js/dropbox.js +++ b/apps/files_external/js/dropbox.js @@ -23,7 +23,6 @@ $(document).ready(function() { }); } } - return false; } }); diff --git a/apps/files_external/js/google.js b/apps/files_external/js/google.js index 84c74c57421..55042194c7d 100644 --- a/apps/files_external/js/google.js +++ b/apps/files_external/js/google.js @@ -24,7 +24,6 @@ $(document).ready(function() { }); } } - return false; } }); From 3bcf176a53c17f43c252673b2e3eced9d9ce94f3 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 29 Jun 2012 17:26:29 +0200 Subject: [PATCH 16/29] add some hooks to fix calendar sharing --- apps/calendar/appinfo/app.php | 5 +++++ apps/calendar/lib/share.php | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index f1f2a26d87d..c9e0f14d7a5 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -8,12 +8,17 @@ OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre OC::$CLASSPATH['OC_Calendar_Repeat'] = 'apps/calendar/lib/repeat.php'; OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php'; OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php'; +//General Hooks OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser'); +//Repeating Events Hooks OCP\Util::connectHook('OC_Calendar', 'addEvent', 'OC_Calendar_Repeat', 'generate'); OCP\Util::connectHook('OC_Calendar', 'editEvent', 'OC_Calendar_Repeat', 'update'); OCP\Util::connectHook('OC_Calendar', 'deleteEvent', 'OC_Calendar_Repeat', 'clean'); OCP\Util::connectHook('OC_Calendar', 'moveEvent', 'OC_Calendar_Repeat', 'update'); OCP\Util::connectHook('OC_Calendar', 'deleteCalendar', 'OC_Calendar_Repeat', 'cleanCalendar'); +//Sharing Hooks +OCP\Util::connectHook('OC_Calendar', 'deleteEvent', 'OC_Calendar_Share', 'post_eventdelete'); +OCP\Util::connectHook('OC_Calendar', 'deleteCalendar', 'OC_Calendar_Share', 'post_caldelete'); OCP\Util::addscript('calendar','loader'); OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min"); OCP\Util::addStyle("3rdparty", "chosen/chosen"); diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php index 54c531892f0..01502f1c6b0 100644 --- a/apps/calendar/lib/share.php +++ b/apps/calendar/lib/share.php @@ -258,7 +258,7 @@ class OC_Calendar_Share{ } /* - * @brief delete all shared calendars / events after a user was deleted + * @brief deletes all shared calendars / events after a user was deleted * @param (string) $userid * @return (bool) */ @@ -273,4 +273,26 @@ class OC_Calendar_Share{ $stmt->execute(array($userid)); return true; } + + /* + * @brief deletes all shared events of a calendar + * @param integer $calid + * @return boolean + */ + public static function post_caldelete($calid){ + $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_share_calendar WHERE calendarid = ?'); + $stmt->execute(array($calid)); + return true; + } + + /* + * @brief deletes all shares of an event + * @param integer $eventid + * @return boolean + */ + public static function post_eventdelete($eventid){ + $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_share_event WHERE eventid = ?'); + $stmt->execute(array($eventid)); + return true; + } } \ No newline at end of file From 652a874fa6ad82d1bc797898bce23c0ad52be14c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 29 Jun 2012 18:13:52 +0200 Subject: [PATCH 17/29] fix displaying of events --- apps/calendar/lib/app.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index 9cd6ad28518..ca897a36dc0 100644 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -406,7 +406,9 @@ class OC_Calendar_App{ $return[] = array_merge($staticoutput, $dynamicoutput); } }else{ - $object->expand($start, $end); + if(OC_Calendar_Object::isrepeating($id) || $event['repeating'] == 1){ + $object->expand($start, $end); + } foreach($object->getComponents() as $singleevent){ if(!($singleevent instanceof Sabre_VObject_Component_VEvent)){ continue; From 2b4ecbaba0b6696d399166a1faab79cd6f6e2d43 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 29 Jun 2012 18:36:24 +0200 Subject: [PATCH 18/29] Whitespace fixes --- apps/user_openid/appinfo/app.php | 2 -- apps/user_openid/class.openid.v3.php | 2 -- apps/user_openid/user_openid.php | 4 ---- 3 files changed, 8 deletions(-) diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php index c683254101f..a37b3237e20 100644 --- a/apps/user_openid/appinfo/app.php +++ b/apps/user_openid/appinfo/app.php @@ -50,5 +50,3 @@ if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){ OCP\Util::writeLog('user_openid','USER CANCELED REQUEST',OCP\Util::DEBUG); return false; } - -?> diff --git a/apps/user_openid/class.openid.v3.php b/apps/user_openid/class.openid.v3.php index 8afb9e5b817..eeb31986659 100644 --- a/apps/user_openid/class.openid.v3.php +++ b/apps/user_openid/class.openid.v3.php @@ -324,5 +324,3 @@ class SimpleOpenID{ } } } - -?> \ No newline at end of file diff --git a/apps/user_openid/user_openid.php b/apps/user_openid/user_openid.php index e228de95e9e..229bb10aaeb 100644 --- a/apps/user_openid/user_openid.php +++ b/apps/user_openid/user_openid.php @@ -63,7 +63,3 @@ class OC_USER_OPENID extends OC_User_Backend { } } } - - - -?> From f61793aa14ac8ebbdd7bdc69e21063d12eb08746 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 29 Jun 2012 18:36:58 +0200 Subject: [PATCH 19/29] Coding style fixes --- apps/user_openid/appinfo/app.php | 2 +- apps/user_openid/user_openid.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php index a37b3237e20..fe57b189fac 100644 --- a/apps/user_openid/appinfo/app.php +++ b/apps/user_openid/appinfo/app.php @@ -27,7 +27,7 @@ OC_User::useBackend('openid'); //check for results from openid requests if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){ OCP\Util::writeLog('user_openid','openid retured',OCP\Util::DEBUG); - $openid = new SimpleOpenID; + $openid = new SimpleOpenID(); $openid->SetIdentity($_GET['openid_identity']); $openid_validation_result = $openid->ValidateWithServer(); if ($openid_validation_result == true){ // OK HERE KEY IS VALID diff --git a/apps/user_openid/user_openid.php b/apps/user_openid/user_openid.php index 229bb10aaeb..70b193a30b1 100644 --- a/apps/user_openid/user_openid.php +++ b/apps/user_openid/user_openid.php @@ -37,7 +37,7 @@ class OC_USER_OPENID extends OC_User_Backend { */ public function checkPassword( $uid, $password ){ // Get identity from user and redirect browser to OpenID Server - $openid = new SimpleOpenID; + $openid = new SimpleOpenID(); $openid->SetIdentity($uid); $openid->SetTrustRoot('http://' . OCP\Util::getServerHost()); if ($openid->GetOpenIDServer()){ From 3ed7738d5efb7cfc86552d6992a8983d10b18310 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 29 Jun 2012 18:37:42 +0200 Subject: [PATCH 20/29] Increment user_openid version to load new app type --- apps/user_openid/appinfo/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/user_openid/appinfo/version b/apps/user_openid/appinfo/version index 6da28dde76d..d917d3e26ad 100644 --- a/apps/user_openid/appinfo/version +++ b/apps/user_openid/appinfo/version @@ -1 +1 @@ -0.1.1 \ No newline at end of file +0.1.2 From 719c7f7f6ebfe53a73eeffb07c6c23d6a788e711 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 29 Jun 2012 13:00:41 -0400 Subject: [PATCH 21/29] Fix WebDAV external storage opendir() and stat() for directories, bug fix for oc-1160 --- apps/files_external/lib/webdav.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index 94d9abb6a25..d0fe2aca854 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -73,13 +73,15 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ $stripLength=strlen($this->root)+strlen($path); $id=md5('webdav'.$this->root.$path); OC_FakeDirStream::$dirs[$id]=array(); + $skip = true; foreach($response as $file=>$data){ - //strip root and path - $file=trim(substr($file,$stripLength)); - $file=trim($file,'/'); - if($file){ - OC_FakeDirStream::$dirs[$id][]=$file; + // Skip the first file, because it is the current directory + if ($skip) { + $skip = false; + continue; } + $file = urldecode(basename($file)); + OC_FakeDirStream::$dirs[$id][]=$file; } return opendir('fakedir://'.$id); }catch(Exception $e){ @@ -244,15 +246,11 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ $path=$this->cleanPath($path); try{ $response=$this->client->propfind($path, array('{DAV:}getlastmodified','{DAV:}getcontentlength')); - if(isset($response['{DAV:}getlastmodified']) and isset($response['{DAV:}getcontentlength'])){ - return array( - 'mtime'=>strtotime($response['{DAV:}getlastmodified']), - 'size'=>(int)$response['{DAV:}getcontentlength'], - 'ctime'=>-1, - ); - }else{ - return array(); - } + return array( + 'mtime'=>strtotime($response['{DAV:}getlastmodified']), + 'size'=>(int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, + 'ctime'=>-1, + ); }catch(Exception $e){ return array(); } From 05cb94801ad9d73e50b800b6a940e4fd15518b40 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 29 Jun 2012 16:29:58 -0400 Subject: [PATCH 22/29] Add new group to other user's group select forms --- core/js/multiselect.js | 5 +++-- settings/js/users.js | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/js/multiselect.js b/core/js/multiselect.js index db5afa637c9..ba89c1bb563 100644 --- a/core/js/multiselect.js +++ b/core/js/multiselect.js @@ -35,6 +35,7 @@ } button.click(function(event){ + var button=$(this); if(button.parent().children('ul').length>0){ button.parent().children('ul').slideUp(400,function(){ @@ -136,11 +137,11 @@ var option=$(''); + }) + }; element.multiSelect({ + createCallback:addGroup, createText:'add group', checked:checked, oncheck:checkHandeler, From 8e4832bd129b91fcfe5c24b821e6daf6d9fe6edb Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 29 Jun 2012 16:44:08 -0400 Subject: [PATCH 23/29] Prevent adding a duplicate to a multiselect --- core/js/multiselect.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/js/multiselect.js b/core/js/multiselect.js index ba89c1bb563..c4fd74b0475 100644 --- a/core/js/multiselect.js +++ b/core/js/multiselect.js @@ -129,13 +129,24 @@ if(event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); + var value = $(this).val(); + var exists = false; + $.each(options,function(index, item) { + if ($(item).val() == value) { + exists = true; + return false; + } + }); + if (exists) { + return false; + } var li=$(this).parent(); $(this).remove(); li.text('+ '+settings.createText); li.before(createItem(this)); var select=button.parent().next(); var option=$('