summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre.includes.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Backend/Abstract.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Backend/PDO.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Calendar.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/CalendarObject.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/CalendarQueryParser.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/CalendarQueryValidator.php28
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/CalendarRootNode.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/ICSExportPlugin.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/ICalendar.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/ICalendarObject.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Plugin.php36
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Principal/Collection.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Principal/ProxyRead.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Principal/ProxyWrite.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Principal/User.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Property/SupportedCalendarData.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Property/SupportedCollationSet.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Schedule/IMip.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Schedule/IOutbox.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Schedule/Outbox.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Server.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/UserCalendars.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/Version.php2
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CalDAV/includes.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/AddressBook.php4
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/AddressBookQueryParser.php18
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/AddressBookRoot.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/Backend/Abstract.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/Backend/PDO.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/Card.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/IAddressBook.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/ICard.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/IDirectory.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/Plugin.php79
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/UserAddressBooks.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/Version.php2
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/CardDAV/includes.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/Apache.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/File.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Backend/PDO.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/IBackend.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Auth/Plugin.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/GuessContentType.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/Plugin.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/assets/favicon.icobin4286 -> 4286 bytes
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.pngbin7232 -> 7232 bytes
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/assets/icons/calendar.pngbin4388 -> 4388 bytes
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/assets/icons/card.pngbin5695 -> 5695 bytes
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/assets/icons/collection.pngbin3474 -> 3474 bytes
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/assets/icons/file.pngbin2837 -> 2837 bytes
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/assets/icons/parent.pngbin3474 -> 3474 bytes
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Browser/assets/icons/principal.pngbin5480 -> 5480 bytes
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Client.php49
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Collection.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Directory.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/BadRequest.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/Conflict.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/ConflictingLock.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/FileNotFound.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/Forbidden.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/InsufficientStorage.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/InvalidResourceType.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/Locked.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/NotAuthenticated.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/NotFound.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/NotImplemented.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/PaymentRequired.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/PreconditionFailed.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FS/Directory.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FS/File.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FS/Node.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FSExt/Directory.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FSExt/File.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/FSExt/Node.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/File.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/ICollection.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/IExtendedCollection.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/IFile.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/INode.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/IProperties.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/IQuota.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Backend/Abstract.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Backend/FS.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Backend/File.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Backend/PDO.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/LockInfo.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Locks/Plugin.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Mount/Plugin.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Node.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/ObjectTree.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/GetLastModified.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/Href.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/HrefList.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/IHref.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/LockDiscovery.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/ResourceType.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/Response.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/ResponseList.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/SupportedLock.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Property/SupportedReportSet.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Server.php9
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/ServerPlugin.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/SimpleCollection.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/SimpleDirectory.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/SimpleFile.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/StringUtil.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Tree.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Tree/Filesystem.php4
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/URLUtil.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/UUIDUtil.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/Version.php2
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/XMLUtil.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAV/includes.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Exception/AceConflict.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Exception/NoAbstract.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/IACL.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/IPrincipal.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/IPrincipalBackend.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Plugin.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Principal.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/PrincipalBackend/PDO.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/PrincipalCollection.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Property/Acl.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Property/AclRestrictions.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Property/Principal.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Property/SupportedPrivilegeSet.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/Version.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/DAVACL/includes.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/AWSAuth.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/AbstractAuth.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/BasicAuth.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/DigestAuth.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/Request.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/Response.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/Util.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/Version.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/includes.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Component.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Component/VAlarm.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Component/VCalendar.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Component/VEvent.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Component/VJournal.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Component/VTodo.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/DateTimeParser.php4
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Element.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Element/DateTime.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Element/MultiDateTime.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/ElementList.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/FreeBusyGenerator.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Node.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Parameter.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/ParseException.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Property.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Property/DateTime.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Property/MultiDateTime.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Reader.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/RecurrenceIterator.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/Version.php2
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/WindowsTimezoneMap.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/VObject/includes.php0
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/autoload.php0
-rw-r--r--apps/calendar/ajax/calendar/activation.php2
-rw-r--r--apps/calendar/ajax/calendar/delete.php1
-rw-r--r--apps/calendar/ajax/calendar/new.php3
-rw-r--r--apps/calendar/ajax/calendar/update.php1
-rw-r--r--apps/calendar/ajax/categories/rescan.php1
-rw-r--r--apps/calendar/ajax/event/delete.php1
-rw-r--r--apps/calendar/ajax/event/edit.php1
-rw-r--r--apps/calendar/ajax/event/move.php1
-rw-r--r--apps/calendar/ajax/event/new.form.php2
-rw-r--r--apps/calendar/ajax/event/new.php1
-rw-r--r--apps/calendar/ajax/event/resize.php1
-rw-r--r--apps/calendar/ajax/import/import.php3
-rw-r--r--apps/calendar/ajax/settings/setfirstday.php1
-rw-r--r--apps/calendar/ajax/settings/settimeformat.php1
-rw-r--r--apps/calendar/ajax/settings/settimezone.php1
-rw-r--r--apps/calendar/ajax/share/changepermission.php4
-rw-r--r--apps/calendar/ajax/share/share.php2
-rw-r--r--apps/calendar/ajax/share/unshare.php4
-rw-r--r--apps/calendar/appinfo/app.php1
-rw-r--r--apps/calendar/js/settings.js4
-rw-r--r--apps/calendar/lib/app.php14
-rw-r--r--apps/calendar/lib/hooks.php13
-rw-r--r--apps/calendar/lib/object.php2
-rw-r--r--apps/calendar/lib/search.php2
-rw-r--r--apps/calendar/templates/calendar.php8
-rw-r--r--apps/contacts/ajax/activation.php8
-rw-r--r--apps/contacts/ajax/addaddressbook.php6
-rw-r--r--apps/contacts/ajax/addcontact.php10
-rw-r--r--apps/contacts/ajax/addproperty.php42
-rw-r--r--apps/contacts/ajax/categories/categoriesfor.php15
-rw-r--r--apps/contacts/ajax/categories/delete.php3
-rw-r--r--apps/contacts/ajax/categories/rescan.php1
-rw-r--r--apps/contacts/ajax/contactdetails.php5
-rw-r--r--apps/contacts/ajax/createaddressbook.php2
-rw-r--r--apps/contacts/ajax/currentphoto.php2
-rw-r--r--apps/contacts/ajax/deletecard.php12
-rw-r--r--apps/contacts/ajax/deleteproperty.php11
-rw-r--r--apps/contacts/ajax/editaddress.php4
-rw-r--r--apps/contacts/ajax/editname.php6
-rw-r--r--apps/contacts/ajax/loadcard.php14
-rw-r--r--apps/contacts/ajax/loadintro.php2
-rw-r--r--apps/contacts/ajax/loadphoto.php2
-rw-r--r--apps/contacts/ajax/loghandler.php10
-rw-r--r--apps/contacts/ajax/oc_photo.php6
-rw-r--r--apps/contacts/ajax/savecrop.php22
-rw-r--r--apps/contacts/ajax/saveproperty.php21
-rw-r--r--apps/contacts/ajax/updateaddressbook.php2
-rw-r--r--apps/contacts/ajax/uploadimport.php28
-rw-r--r--apps/contacts/ajax/uploadphoto.php46
-rw-r--r--apps/contacts/appinfo/app.php2
-rw-r--r--apps/contacts/appinfo/database.xml4
-rw-r--r--apps/contacts/appinfo/migrate.php15
-rw-r--r--apps/contacts/appinfo/remote.php4
-rw-r--r--apps/contacts/appinfo/update.php2
-rw-r--r--apps/contacts/appinfo/version2
-rw-r--r--apps/contacts/carddav.php6
-rw-r--r--apps/contacts/css/contacts.css8
-rw-r--r--apps/contacts/export.php18
-rw-r--r--apps/contacts/import.php61
-rw-r--r--apps/contacts/index.php45
-rw-r--r--apps/contacts/js/contacts.js398
-rw-r--r--apps/contacts/lib/VCFExportPlugin.php8
-rw-r--r--apps/contacts/lib/addressbook.php80
-rw-r--r--apps/contacts/lib/app.php10
-rw-r--r--apps/contacts/lib/connector_sabre.php6
-rw-r--r--apps/contacts/lib/hooks.php24
-rw-r--r--apps/contacts/lib/search.php6
-rw-r--r--apps/contacts/lib/vcard.php130
-rw-r--r--apps/contacts/photo.php23
-rw-r--r--apps/contacts/templates/index.php2
-rw-r--r--apps/contacts/templates/part.cropphoto.php1
-rw-r--r--apps/contacts/templates/part.edit_categories_dialog.php16
-rw-r--r--apps/contacts/thumbnail.php27
-rw-r--r--apps/contacts/tmpphoto.php2
-rw-r--r--apps/files_encryption/lib/cryptstream.php3
-rwxr-xr-xapps/files_external/lib/dropbox.php2
-rw-r--r--apps/files_external/lib/google.php9
-rw-r--r--apps/files_external/lib/smb.php2
-rw-r--r--apps/files_external/lib/webdav.php15
-rw-r--r--apps/files_external/tests/ftp.php1
-rw-r--r--apps/files_external/tests/google.php1
-rw-r--r--apps/files_external/tests/smb.php1
-rw-r--r--apps/files_external/tests/swift.php1
-rw-r--r--apps/files_external/tests/webdav.php1
-rw-r--r--apps/files_sharing/sharedstorage.php66
-rw-r--r--apps/files_sharing_log/appinfo/database.xml2
-rw-r--r--apps/files_versions/ajax/expireAll.php1
-rw-r--r--apps/files_versions/ajax/rollbackVersion.php1
-rw-r--r--apps/files_versions/ajax/togglesettings.php1
-rw-r--r--apps/files_versions/lib/versions.php6
-rw-r--r--apps/gallery/lib/album.php2
-rw-r--r--apps/gallery/lib/managers.php1
-rw-r--r--apps/gallery/lib/tiles.php2
-rw-r--r--apps/media/lib_ampache.php1
-rw-r--r--apps/media/lib_collection.php3
-rw-r--r--apps/media/lib_media.php6
-rw-r--r--apps/remoteStorage/appinfo/info.xml3
-rw-r--r--apps/remoteStorage/appinfo/version2
-rw-r--r--apps/remoteStorage/appinfo/webfinger.php6
-rw-r--r--apps/remoteStorage/lib_remoteStorage.php13
-rw-r--r--apps/remoteStorage/oauth_ro_auth.php20
-rw-r--r--apps/remoteStorage/webdav.php (renamed from apps/remoteStorage/WebDAV.php)36
-rw-r--r--apps/tasks/ajax/addtask.php3
-rw-r--r--apps/tasks/ajax/addtaskform.php20
-rw-r--r--apps/tasks/ajax/delete.php1
-rw-r--r--apps/tasks/ajax/edittask.php31
-rw-r--r--apps/tasks/ajax/edittaskform.php24
-rw-r--r--apps/tasks/ajax/getdetails.php24
-rw-r--r--apps/tasks/ajax/gettasks.php2
-rw-r--r--apps/tasks/ajax/update_property.php5
-rw-r--r--apps/tasks/index.php4
-rw-r--r--apps/tasks/js/tasks.js62
-rw-r--r--apps/tasks/lib/app.php18
-rw-r--r--apps/tasks/templates/part.addtaskform.php15
-rw-r--r--apps/tasks/templates/part.details.php42
-rw-r--r--apps/tasks/templates/part.edittaskform.php5
-rw-r--r--apps/tasks/templates/part.property.php22
-rw-r--r--apps/tasks/templates/part.taskform.php36
-rw-r--r--apps/tasks/templates/part.tasks.php3
-rw-r--r--apps/user_external/appinfo/app.php4
-rw-r--r--apps/user_external/appinfo/info.xml13
-rw-r--r--apps/user_external/appinfo/version1
-rw-r--r--apps/user_external/lib/ftp.php45
-rw-r--r--apps/user_external/lib/imap.php40
-rw-r--r--apps/user_external/lib/smb.php43
-rw-r--r--apps/user_external/tests/config.php28
-rw-r--r--apps/user_external/tests/ftp.php34
-rw-r--r--apps/user_external/tests/imap.php34
-rw-r--r--apps/user_external/tests/smb.php34
-rw-r--r--apps/user_webfinger/.htaccess5
-rw-r--r--apps/user_webfinger/host-meta.php19
-rwxr-xr-xautotest.sh116
-rw-r--r--core/templates/login.php2
-rw-r--r--lib/MDB2/Driver/sqlite3.php2
-rwxr-xr-xlib/app.php1
-rw-r--r--lib/archive/zip.php4
-rw-r--r--lib/base.php2
-rw-r--r--lib/connector/sabre/auth.php17
-rw-r--r--lib/connector/sabre/client.php22
-rw-r--r--lib/connector/sabre/directory.php24
-rw-r--r--lib/connector/sabre/file.php27
-rw-r--r--lib/connector/sabre/locks.php2
-rw-r--r--lib/connector/sabre/node.php28
-rw-r--r--lib/db.php9
-rw-r--r--lib/eventsource.php2
-rw-r--r--lib/filecache.php4
-rw-r--r--lib/filecache/update.php1
-rw-r--r--lib/filestorage.php2
-rw-r--r--lib/filestorage/common.php2
-rw-r--r--lib/filestorage/local.php14
-rw-r--r--lib/filesystem.php39
-rw-r--r--lib/filesystemview.php2
-rw-r--r--lib/group/database.php5
-rw-r--r--lib/group/dummy.php3
-rw-r--r--lib/group/example.php18
-rw-r--r--lib/helper.php6
-rw-r--r--lib/image.php9
-rw-r--r--lib/l10n.php7
-rw-r--r--lib/migrate.php2
-rw-r--r--lib/ocs.php6
-rw-r--r--lib/ocsclient.php2
-rw-r--r--lib/preferences.php8
-rw-r--r--lib/public/app.php22
-rw-r--r--lib/public/json.php105
-rw-r--r--lib/search/provider.php10
-rw-r--r--lib/setup.php1
-rw-r--r--lib/streamwrappers.php5
-rw-r--r--lib/template.php1
-rw-r--r--lib/templatelayout.php2
-rw-r--r--lib/user.php40
-rw-r--r--lib/user/database.php8
-rw-r--r--lib/user/example.php12
-rwxr-xr-xlib/util.php2
-rw-r--r--tests/index.php19
-rw-r--r--tests/lib/cache/file.php6
-rw-r--r--tests/lib/user/database.php1
356 files changed, 1714 insertions, 1227 deletions
diff --git a/3rdparty/Sabre.includes.php b/3rdparty/Sabre.includes.php
index c1334373663..c1334373663 100644..100755
--- a/3rdparty/Sabre.includes.php
+++ b/3rdparty/Sabre.includes.php
diff --git a/3rdparty/Sabre/CalDAV/Backend/Abstract.php b/3rdparty/Sabre/CalDAV/Backend/Abstract.php
index 7aba1d69ffe..7aba1d69ffe 100644..100755
--- a/3rdparty/Sabre/CalDAV/Backend/Abstract.php
+++ b/3rdparty/Sabre/CalDAV/Backend/Abstract.php
diff --git a/3rdparty/Sabre/CalDAV/Backend/PDO.php b/3rdparty/Sabre/CalDAV/Backend/PDO.php
index ddacf940c74..ddacf940c74 100644..100755
--- a/3rdparty/Sabre/CalDAV/Backend/PDO.php
+++ b/3rdparty/Sabre/CalDAV/Backend/PDO.php
diff --git a/3rdparty/Sabre/CalDAV/Calendar.php b/3rdparty/Sabre/CalDAV/Calendar.php
index 623df2dd1b8..623df2dd1b8 100644..100755
--- a/3rdparty/Sabre/CalDAV/Calendar.php
+++ b/3rdparty/Sabre/CalDAV/Calendar.php
diff --git a/3rdparty/Sabre/CalDAV/CalendarObject.php b/3rdparty/Sabre/CalDAV/CalendarObject.php
index 72f0a578d16..72f0a578d16 100644..100755
--- a/3rdparty/Sabre/CalDAV/CalendarObject.php
+++ b/3rdparty/Sabre/CalDAV/CalendarObject.php
diff --git a/3rdparty/Sabre/CalDAV/CalendarQueryParser.php b/3rdparty/Sabre/CalDAV/CalendarQueryParser.php
index bd0d343382f..bd0d343382f 100644..100755
--- a/3rdparty/Sabre/CalDAV/CalendarQueryParser.php
+++ b/3rdparty/Sabre/CalDAV/CalendarQueryParser.php
diff --git a/3rdparty/Sabre/CalDAV/CalendarQueryValidator.php b/3rdparty/Sabre/CalDAV/CalendarQueryValidator.php
index 1bb6b5d53fa..4bcd32cdf88 100644..100755
--- a/3rdparty/Sabre/CalDAV/CalendarQueryValidator.php
+++ b/3rdparty/Sabre/CalDAV/CalendarQueryValidator.php
@@ -294,6 +294,7 @@ class Sabre_CalDAV_CalendarQueryValidator {
// in the VALARM component code, so this is a hack, and an
// expensive one too.
if ($component->parent->name === 'VEVENT' && $component->parent->RRULE) {
+
// Fire up the iterator!
$it = new Sabre_VObject_RecurrenceIterator($component->parent->parent, (string)$component->parent->UID);
while($it->valid()) {
@@ -304,14 +305,35 @@ class Sabre_CalDAV_CalendarQueryValidator {
// determine if we can 'give up' expanding events.
$firstAlarm = null;
foreach($expandedEvent->VALARM as $expandedAlarm) {
+
$effectiveTrigger = $expandedAlarm->getEffectiveTriggerTime();
- if (!$firstAlarm || $effectiveTrigger < $firstAlarm) {
- $firstAlarm = $effectiveTrigger;
- }
if ($expandedAlarm->isInTimeRange($start, $end)) {
return true;
}
+ if ((string)$expandedAlarm->TRIGGER['VALUE'] === 'DATE-TIME') {
+ // This is an alarm with a non-relative trigger
+ // time, likely created by a buggy client. The
+ // implication is that every alarm in this
+ // recurring event trigger at the exact same
+ // time. It doesn't make sense to traverse
+ // further.
+ } else {
+ // We store the first alarm as a means to
+ // figure out when we can stop traversing.
+ if (!$firstAlarm || $effectiveTrigger < $firstAlarm) {
+ $firstAlarm = $effectiveTrigger;
+ }
+ }
+
+ }
+ if (is_null($firstAlarm)) {
+ // No alarm was found.
+ //
+ // Or technically: No alarm that will change for
+ // every instance of the recurrence was found,
+ // which means we can assume there was no match.
+ return false;
}
if ($firstAlarm > $end) {
return false;
diff --git a/3rdparty/Sabre/CalDAV/CalendarRootNode.php b/3rdparty/Sabre/CalDAV/CalendarRootNode.php
index 3907913cc78..3907913cc78 100644..100755
--- a/3rdparty/Sabre/CalDAV/CalendarRootNode.php
+++ b/3rdparty/Sabre/CalDAV/CalendarRootNode.php
diff --git a/3rdparty/Sabre/CalDAV/ICSExportPlugin.php b/3rdparty/Sabre/CalDAV/ICSExportPlugin.php
index ec42b406b2f..ec42b406b2f 100644..100755
--- a/3rdparty/Sabre/CalDAV/ICSExportPlugin.php
+++ b/3rdparty/Sabre/CalDAV/ICSExportPlugin.php
diff --git a/3rdparty/Sabre/CalDAV/ICalendar.php b/3rdparty/Sabre/CalDAV/ICalendar.php
index 15d51ebcf79..15d51ebcf79 100644..100755
--- a/3rdparty/Sabre/CalDAV/ICalendar.php
+++ b/3rdparty/Sabre/CalDAV/ICalendar.php
diff --git a/3rdparty/Sabre/CalDAV/ICalendarObject.php b/3rdparty/Sabre/CalDAV/ICalendarObject.php
index 280f982a310..280f982a310 100644..100755
--- a/3rdparty/Sabre/CalDAV/ICalendarObject.php
+++ b/3rdparty/Sabre/CalDAV/ICalendarObject.php
diff --git a/3rdparty/Sabre/CalDAV/Plugin.php b/3rdparty/Sabre/CalDAV/Plugin.php
index d7d1d970518..5903968c003 100644..100755
--- a/3rdparty/Sabre/CalDAV/Plugin.php
+++ b/3rdparty/Sabre/CalDAV/Plugin.php
@@ -672,6 +672,42 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
}
+ if ($vobj->name !== 'VCALENDAR') {
+ throw new Sabre_DAV_Exception_UnsupportedMediaType('This collection can only support iCalendar objects.');
+ }
+
+ $foundType = null;
+ $foundUID = null;
+ foreach($vobj->getComponents() as $component) {
+ switch($component->name) {
+ case 'VTIMEZONE' :
+ continue 2;
+ case 'VEVENT' :
+ case 'VTODO' :
+ case 'VJOURNAL' :
+ if (is_null($foundType)) {
+ $foundType = $component->name;
+ if (!isset($component->UID)) {
+ throw new Sabre_DAV_Exception_BadRequest('Every ' . $component->name . ' component must have an UID');
+ }
+ $foundUID = (string)$component->UID;
+ } else {
+ if ($foundType !== $component->name) {
+ throw new Sabre_DAV_Exception_BadRequest('A calendar object must only contain 1 component. We found a ' . $component->name . ' as well as a ' . $foundType);
+ }
+ if ($foundUID !== (string)$component->UID) {
+ throw new Sabre_DAV_Exception_BadRequest('Every ' . $component->name . ' in this object must have identical UIDs');
+ }
+ }
+ break;
+ default :
+ throw new Sabre_DAV_Exception_BadRequest('You are not allowed to create components of type: ' . $component->name . ' here');
+
+ }
+ }
+ if (!$foundType)
+ throw new Sabre_DAV_Exception_BadRequest('iCalendar object must contain at least 1 of VEVENT, VTODO or VJOURNAL');
+
}
/**
diff --git a/3rdparty/Sabre/CalDAV/Principal/Collection.php b/3rdparty/Sabre/CalDAV/Principal/Collection.php
index abbefa5567a..abbefa5567a 100644..100755
--- a/3rdparty/Sabre/CalDAV/Principal/Collection.php
+++ b/3rdparty/Sabre/CalDAV/Principal/Collection.php
diff --git a/3rdparty/Sabre/CalDAV/Principal/ProxyRead.php b/3rdparty/Sabre/CalDAV/Principal/ProxyRead.php
index 4b3f035634a..4b3f035634a 100644..100755
--- a/3rdparty/Sabre/CalDAV/Principal/ProxyRead.php
+++ b/3rdparty/Sabre/CalDAV/Principal/ProxyRead.php
diff --git a/3rdparty/Sabre/CalDAV/Principal/ProxyWrite.php b/3rdparty/Sabre/CalDAV/Principal/ProxyWrite.php
index dd0c2e86edd..dd0c2e86edd 100644..100755
--- a/3rdparty/Sabre/CalDAV/Principal/ProxyWrite.php
+++ b/3rdparty/Sabre/CalDAV/Principal/ProxyWrite.php
diff --git a/3rdparty/Sabre/CalDAV/Principal/User.php b/3rdparty/Sabre/CalDAV/Principal/User.php
index 8453b877a73..8453b877a73 100644..100755
--- a/3rdparty/Sabre/CalDAV/Principal/User.php
+++ b/3rdparty/Sabre/CalDAV/Principal/User.php
diff --git a/3rdparty/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php b/3rdparty/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php
index 2ea078d7dac..2ea078d7dac 100644..100755
--- a/3rdparty/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php
+++ b/3rdparty/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php
diff --git a/3rdparty/Sabre/CalDAV/Property/SupportedCalendarData.php b/3rdparty/Sabre/CalDAV/Property/SupportedCalendarData.php
index 1d848dd5cf6..1d848dd5cf6 100644..100755
--- a/3rdparty/Sabre/CalDAV/Property/SupportedCalendarData.php
+++ b/3rdparty/Sabre/CalDAV/Property/SupportedCalendarData.php
diff --git a/3rdparty/Sabre/CalDAV/Property/SupportedCollationSet.php b/3rdparty/Sabre/CalDAV/Property/SupportedCollationSet.php
index 24e84d4c17d..24e84d4c17d 100644..100755
--- a/3rdparty/Sabre/CalDAV/Property/SupportedCollationSet.php
+++ b/3rdparty/Sabre/CalDAV/Property/SupportedCollationSet.php
diff --git a/3rdparty/Sabre/CalDAV/Schedule/IMip.php b/3rdparty/Sabre/CalDAV/Schedule/IMip.php
index 37e75fcc4a7..37e75fcc4a7 100644..100755
--- a/3rdparty/Sabre/CalDAV/Schedule/IMip.php
+++ b/3rdparty/Sabre/CalDAV/Schedule/IMip.php
diff --git a/3rdparty/Sabre/CalDAV/Schedule/IOutbox.php b/3rdparty/Sabre/CalDAV/Schedule/IOutbox.php
index 46d77514bc0..46d77514bc0 100644..100755
--- a/3rdparty/Sabre/CalDAV/Schedule/IOutbox.php
+++ b/3rdparty/Sabre/CalDAV/Schedule/IOutbox.php
diff --git a/3rdparty/Sabre/CalDAV/Schedule/Outbox.php b/3rdparty/Sabre/CalDAV/Schedule/Outbox.php
index 014c37230d1..014c37230d1 100644..100755
--- a/3rdparty/Sabre/CalDAV/Schedule/Outbox.php
+++ b/3rdparty/Sabre/CalDAV/Schedule/Outbox.php
diff --git a/3rdparty/Sabre/CalDAV/Server.php b/3rdparty/Sabre/CalDAV/Server.php
index 325e3d80a7f..325e3d80a7f 100644..100755
--- a/3rdparty/Sabre/CalDAV/Server.php
+++ b/3rdparty/Sabre/CalDAV/Server.php
diff --git a/3rdparty/Sabre/CalDAV/UserCalendars.php b/3rdparty/Sabre/CalDAV/UserCalendars.php
index b8d3f0573fa..b8d3f0573fa 100644..100755
--- a/3rdparty/Sabre/CalDAV/UserCalendars.php
+++ b/3rdparty/Sabre/CalDAV/UserCalendars.php
diff --git a/3rdparty/Sabre/CalDAV/Version.php b/3rdparty/Sabre/CalDAV/Version.php
index 939e903c89f..289a0c83a34 100644..100755
--- a/3rdparty/Sabre/CalDAV/Version.php
+++ b/3rdparty/Sabre/CalDAV/Version.php
@@ -14,7 +14,7 @@ class Sabre_CalDAV_Version {
/**
* Full version number
*/
- const VERSION = '1.6.2';
+ const VERSION = '1.6.3';
/**
* Stability : alpha, beta, stable
diff --git a/3rdparty/Sabre/CalDAV/includes.php b/3rdparty/Sabre/CalDAV/includes.php
index 1ecb870a0e1..1ecb870a0e1 100644..100755
--- a/3rdparty/Sabre/CalDAV/includes.php
+++ b/3rdparty/Sabre/CalDAV/includes.php
diff --git a/3rdparty/Sabre/CardDAV/AddressBook.php b/3rdparty/Sabre/CardDAV/AddressBook.php
index 3b381e1eea3..12297175a85 100644..100755
--- a/3rdparty/Sabre/CardDAV/AddressBook.php
+++ b/3rdparty/Sabre/CardDAV/AddressBook.php
@@ -108,7 +108,9 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca
*/
public function createFile($name,$vcardData = null) {
- $vcardData = stream_get_contents($vcardData);
+ if (is_resource($vcardData)) {
+ $vcardData = stream_get_contents($vcardData);
+ }
// Converting to UTF-8, if needed
$vcardData = Sabre_DAV_StringUtil::ensureUTF8($vcardData);
diff --git a/3rdparty/Sabre/CardDAV/AddressBookQueryParser.php b/3rdparty/Sabre/CardDAV/AddressBookQueryParser.php
index 85a4963127b..46bb8ff18dd 100644..100755
--- a/3rdparty/Sabre/CardDAV/AddressBookQueryParser.php
+++ b/3rdparty/Sabre/CardDAV/AddressBookQueryParser.php
@@ -9,7 +9,7 @@
* @package Sabre
* @subpackage CardDAV
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_CardDAV_AddressBookQueryParser {
@@ -88,12 +88,22 @@ class Sabre_CardDAV_AddressBookQueryParser {
if (is_nan($limit)) $limit = null;
$filter = $this->xpath->query('/card:addressbook-query/card:filter');
- if ($filter->length !== 1) {
+
+ // According to the CardDAV spec there needs to be exactly 1 filter
+ // element. However, KDE 4.8.2 contains a bug that will encode 0 filter
+ // elements, so this is a workaround for that.
+ //
+ // See: https://bugs.kde.org/show_bug.cgi?id=300047
+ if ($filter->length === 0) {
+ $test = null;
+ $filter = null;
+ } elseif ($filter->length === 1) {
+ $filter = $filter->item(0);
+ $test = $this->xpath->evaluate('string(@test)', $filter);
+ } else {
throw new Sabre_DAV_Exception_BadRequest('Only one filter element is allowed');
}
- $filter = $filter->item(0);
- $test = $this->xpath->evaluate('string(@test)', $filter);
if (!$test) $test = self::TEST_ANYOF;
if ($test !== self::TEST_ANYOF && $test !== self::TEST_ALLOF) {
throw new Sabre_DAV_Exception_BadRequest('The test attribute must either hold "anyof" or "allof"');
diff --git a/3rdparty/Sabre/CardDAV/AddressBookRoot.php b/3rdparty/Sabre/CardDAV/AddressBookRoot.php
index 9d37b15f08e..9d37b15f08e 100644..100755
--- a/3rdparty/Sabre/CardDAV/AddressBookRoot.php
+++ b/3rdparty/Sabre/CardDAV/AddressBookRoot.php
diff --git a/3rdparty/Sabre/CardDAV/Backend/Abstract.php b/3rdparty/Sabre/CardDAV/Backend/Abstract.php
index e4806b7161f..e4806b7161f 100644..100755
--- a/3rdparty/Sabre/CardDAV/Backend/Abstract.php
+++ b/3rdparty/Sabre/CardDAV/Backend/Abstract.php
diff --git a/3rdparty/Sabre/CardDAV/Backend/PDO.php b/3rdparty/Sabre/CardDAV/Backend/PDO.php
index 413a77f3bcc..413a77f3bcc 100644..100755
--- a/3rdparty/Sabre/CardDAV/Backend/PDO.php
+++ b/3rdparty/Sabre/CardDAV/Backend/PDO.php
diff --git a/3rdparty/Sabre/CardDAV/Card.php b/3rdparty/Sabre/CardDAV/Card.php
index d7c66333837..d7c66333837 100644..100755
--- a/3rdparty/Sabre/CardDAV/Card.php
+++ b/3rdparty/Sabre/CardDAV/Card.php
diff --git a/3rdparty/Sabre/CardDAV/IAddressBook.php b/3rdparty/Sabre/CardDAV/IAddressBook.php
index 2bc275bcf74..2bc275bcf74 100644..100755
--- a/3rdparty/Sabre/CardDAV/IAddressBook.php
+++ b/3rdparty/Sabre/CardDAV/IAddressBook.php
diff --git a/3rdparty/Sabre/CardDAV/ICard.php b/3rdparty/Sabre/CardDAV/ICard.php
index a17299316c1..a17299316c1 100644..100755
--- a/3rdparty/Sabre/CardDAV/ICard.php
+++ b/3rdparty/Sabre/CardDAV/ICard.php
diff --git a/3rdparty/Sabre/CardDAV/IDirectory.php b/3rdparty/Sabre/CardDAV/IDirectory.php
index 22d4afeb24a..22d4afeb24a 100644..100755
--- a/3rdparty/Sabre/CardDAV/IDirectory.php
+++ b/3rdparty/Sabre/CardDAV/IDirectory.php
diff --git a/3rdparty/Sabre/CardDAV/Plugin.php b/3rdparty/Sabre/CardDAV/Plugin.php
index 9ebec243eb0..ca20e468497 100644..100755
--- a/3rdparty/Sabre/CardDAV/Plugin.php
+++ b/3rdparty/Sabre/CardDAV/Plugin.php
@@ -52,6 +52,8 @@ class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
$server->subscribeEvent('report', array($this,'report'));
$server->subscribeEvent('onHTMLActionsPanel', array($this,'htmlActionsPanel'));
$server->subscribeEvent('onBrowserPostAction', array($this,'browserPostAction'));
+ $server->subscribeEvent('beforeWriteContent', array($this, 'beforeWriteContent'));
+ $server->subscribeEvent('beforeCreateFile', array($this, 'beforeCreateFile'));
/* Namespaces */
$server->xmlNamespaces[self::NS_CARDDAV] = 'card';
@@ -284,6 +286,81 @@ class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
}
/**
+ * This method is triggered before a file gets updated with new content.
+ *
+ * This plugin uses this method to ensure that Card nodes receive valid
+ * vcard data.
+ *
+ * @param string $path
+ * @param Sabre_DAV_IFile $node
+ * @param resource $data
+ * @return void
+ */
+ public function beforeWriteContent($path, Sabre_DAV_IFile $node, &$data) {
+
+ if (!$node instanceof Sabre_CardDAV_ICard)
+ return;
+
+ $this->validateVCard($data);
+
+ }
+
+ /**
+ * This method is triggered before a new file is created.
+ *
+ * This plugin uses this method to ensure that Card nodes receive valid
+ * vcard data.
+ *
+ * @param string $path
+ * @param resource $data
+ * @param Sabre_DAV_ICollection $parentNode
+ * @return void
+ */
+ public function beforeCreateFile($path, &$data, Sabre_DAV_ICollection $parentNode) {
+
+ if (!$parentNode instanceof Sabre_CardDAV_IAddressBook)
+ return;
+
+ $this->validateVCard($data);
+
+ }
+
+ /**
+ * Checks if the submitted iCalendar data is in fact, valid.
+ *
+ * An exception is thrown if it's not.
+ *
+ * @param resource|string $data
+ * @return void
+ */
+ protected function validateVCard(&$data) {
+
+ // If it's a stream, we convert it to a string first.
+ if (is_resource($data)) {
+ $data = stream_get_contents($data);
+ }
+
+ // Converting the data to unicode, if needed.
+ $data = Sabre_DAV_StringUtil::ensureUTF8($data);
+
+ try {
+
+ $vobj = Sabre_VObject_Reader::read($data);
+
+ } catch (Sabre_VObject_ParseException $e) {
+
+ throw new Sabre_DAV_Exception_UnsupportedMediaType('This resource only supports valid vcard data. Parse error: ' . $e->getMessage());
+
+ }
+
+ if ($vobj->name !== 'VCARD') {
+ throw new Sabre_DAV_Exception_UnsupportedMediaType('This collection can only support vcard objects.');
+ }
+
+ }
+
+
+ /**
* This function handles the addressbook-query REPORT
*
* This report is used by the client to filter an addressbook based on a
@@ -362,6 +439,8 @@ class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
$vcard = Sabre_VObject_Reader::read($vcardData);
+ if (!$filters) return true;
+
foreach($filters as $filter) {
$isDefined = isset($vcard->{$filter['name']});
diff --git a/3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php b/3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php
index 36d9306e7aa..36d9306e7aa 100644..100755
--- a/3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php
+++ b/3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php
diff --git a/3rdparty/Sabre/CardDAV/UserAddressBooks.php b/3rdparty/Sabre/CardDAV/UserAddressBooks.php
index 3f11fb11238..3f11fb11238 100644..100755
--- a/3rdparty/Sabre/CardDAV/UserAddressBooks.php
+++ b/3rdparty/Sabre/CardDAV/UserAddressBooks.php
diff --git a/3rdparty/Sabre/CardDAV/Version.php b/3rdparty/Sabre/CardDAV/Version.php
index 811b929e397..d0623f0d3e8 100644..100755
--- a/3rdparty/Sabre/CardDAV/Version.php
+++ b/3rdparty/Sabre/CardDAV/Version.php
@@ -16,7 +16,7 @@ class Sabre_CardDAV_Version {
/**
* Full version number
*/
- const VERSION = '1.6.1';
+ const VERSION = '1.6.3';
/**
* Stability : alpha, beta, stable
diff --git a/3rdparty/Sabre/CardDAV/includes.php b/3rdparty/Sabre/CardDAV/includes.php
index c3b8c04b077..c3b8c04b077 100644..100755
--- a/3rdparty/Sabre/CardDAV/includes.php
+++ b/3rdparty/Sabre/CardDAV/includes.php
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php b/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php
index 1e89b84f9a1..1e89b84f9a1 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php b/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php
index 9833928b976..9833928b976 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/Apache.php b/3rdparty/Sabre/DAV/Auth/Backend/Apache.php
index d4294ea4d86..d4294ea4d86 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/Apache.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/Apache.php
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/File.php b/3rdparty/Sabre/DAV/Auth/Backend/File.php
index de308d64a67..de308d64a67 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/File.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/File.php
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/PDO.php b/3rdparty/Sabre/DAV/Auth/Backend/PDO.php
index eac18a23fbb..eac18a23fbb 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Backend/PDO.php
+++ b/3rdparty/Sabre/DAV/Auth/Backend/PDO.php
diff --git a/3rdparty/Sabre/DAV/Auth/IBackend.php b/3rdparty/Sabre/DAV/Auth/IBackend.php
index 5be5d1bc93d..5be5d1bc93d 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/IBackend.php
+++ b/3rdparty/Sabre/DAV/Auth/IBackend.php
diff --git a/3rdparty/Sabre/DAV/Auth/Plugin.php b/3rdparty/Sabre/DAV/Auth/Plugin.php
index 55a4e391674..55a4e391674 100644..100755
--- a/3rdparty/Sabre/DAV/Auth/Plugin.php
+++ b/3rdparty/Sabre/DAV/Auth/Plugin.php
diff --git a/3rdparty/Sabre/DAV/Browser/GuessContentType.php b/3rdparty/Sabre/DAV/Browser/GuessContentType.php
index b6c00d461cb..b6c00d461cb 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/GuessContentType.php
+++ b/3rdparty/Sabre/DAV/Browser/GuessContentType.php
diff --git a/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php b/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php
index 15884887641..15884887641 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php
+++ b/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php
diff --git a/3rdparty/Sabre/DAV/Browser/Plugin.php b/3rdparty/Sabre/DAV/Browser/Plugin.php
index 09bbdd2ae02..09bbdd2ae02 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/Plugin.php
+++ b/3rdparty/Sabre/DAV/Browser/Plugin.php
diff --git a/3rdparty/Sabre/DAV/Browser/assets/favicon.ico b/3rdparty/Sabre/DAV/Browser/assets/favicon.ico
index 2b2c10a22cc..2b2c10a22cc 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/assets/favicon.ico
+++ b/3rdparty/Sabre/DAV/Browser/assets/favicon.ico
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png b/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png
index c9acc84172d..c9acc84172d 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png b/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png
index 3ecd6a800a0..3ecd6a800a0 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/card.png b/3rdparty/Sabre/DAV/Browser/assets/icons/card.png
index 2ce954866d8..2ce954866d8 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/card.png
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/card.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png b/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png
index 156fa64fd50..156fa64fd50 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/file.png b/3rdparty/Sabre/DAV/Browser/assets/icons/file.png
index 3b98551cec3..3b98551cec3 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/file.png
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/file.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png b/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png
index 156fa64fd50..156fa64fd50 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png b/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png
index f8988f828e6..f8988f828e6 100644..100755
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png
+++ b/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Client.php b/3rdparty/Sabre/DAV/Client.php
index 075e84caa1d..9a428765e90 100644..100755
--- a/3rdparty/Sabre/DAV/Client.php
+++ b/3rdparty/Sabre/DAV/Client.php
@@ -11,7 +11,7 @@
* @package Sabre
* @subpackage DAVClient
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_Client {
@@ -24,6 +24,28 @@ class Sabre_DAV_Client {
protected $proxy;
/**
+ * Basic authentication
+ */
+ const AUTH_BASIC = 1;
+
+ /**
+ * Digest authentication
+ */
+ const AUTH_DIGEST = 2;
+
+ /**
+ * The authentication type we're using.
+ *
+ * This is a bitmask of AUTH_BASIC and AUTH_DIGEST.
+ *
+ * If DIGEST is used, the client makes 1 extra request per request, to get
+ * the authentication tokens.
+ *
+ * @var int
+ */
+ protected $authType;
+
+ /**
* Constructor
*
* Settings are provided through the 'settings' argument. The following
@@ -46,16 +68,21 @@ class Sabre_DAV_Client {
'baseUri',
'userName',
'password',
- 'proxy'
+ 'proxy',
);
-
foreach($validSettings as $validSetting) {
if (isset($settings[$validSetting])) {
$this->$validSetting = $settings[$validSetting];
}
}
+ if (isset($settings['authType'])) {
+ $this->authType = $settings['authType'];
+ } else {
+ $this->authType = self::AUTH_BASIC | self::AUTH_DIGEST;
+ }
+
$this->propertyMap['{DAV:}resourcetype'] = 'Sabre_DAV_Property_ResourceType';
}
@@ -250,14 +277,9 @@ class Sabre_DAV_Client {
// Automatically follow redirects
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 5,
- CURLOPT_SSL_VERIFYPEER => true,
- //CURLOPT_SSL_VERIFYPEER => false,
);
switch ($method) {
- case 'PUT':
- $curlSettings[CURLOPT_PUT] = true;
- break;
case 'HEAD' :
// do not read body with HEAD requests (this is neccessary because cURL does not ignore the body with HEAD
@@ -288,8 +310,15 @@ class Sabre_DAV_Client {
$curlSettings[CURLOPT_PROXY] = $this->proxy;
}
- if ($this->userName) {
- $curlSettings[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC | CURLAUTH_DIGEST;
+ if ($this->userName && $this->authType) {
+ $curlType = 0;
+ if ($this->authType & self::AUTH_BASIC) {
+ $curlType |= CURLAUTH_BASIC;
+ }
+ if ($this->authType & self::AUTH_DIGEST) {
+ $curlType |= CURLAUTH_DIGEST;
+ }
+ $curlSettings[CURLOPT_HTTPAUTH] = $curlType;
$curlSettings[CURLOPT_USERPWD] = $this->userName . ':' . $this->password;
}
diff --git a/3rdparty/Sabre/DAV/Collection.php b/3rdparty/Sabre/DAV/Collection.php
index 776c22531b2..776c22531b2 100644..100755
--- a/3rdparty/Sabre/DAV/Collection.php
+++ b/3rdparty/Sabre/DAV/Collection.php
diff --git a/3rdparty/Sabre/DAV/Directory.php b/3rdparty/Sabre/DAV/Directory.php
index 6db8febc02e..6db8febc02e 100644..100755
--- a/3rdparty/Sabre/DAV/Directory.php
+++ b/3rdparty/Sabre/DAV/Directory.php
diff --git a/3rdparty/Sabre/DAV/Exception.php b/3rdparty/Sabre/DAV/Exception.php
index a2cd6cf5820..a2cd6cf5820 100644..100755
--- a/3rdparty/Sabre/DAV/Exception.php
+++ b/3rdparty/Sabre/DAV/Exception.php
diff --git a/3rdparty/Sabre/DAV/Exception/BadRequest.php b/3rdparty/Sabre/DAV/Exception/BadRequest.php
index b198648a754..b198648a754 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/BadRequest.php
+++ b/3rdparty/Sabre/DAV/Exception/BadRequest.php
diff --git a/3rdparty/Sabre/DAV/Exception/Conflict.php b/3rdparty/Sabre/DAV/Exception/Conflict.php
index 6b0bd1fad73..6b0bd1fad73 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/Conflict.php
+++ b/3rdparty/Sabre/DAV/Exception/Conflict.php
diff --git a/3rdparty/Sabre/DAV/Exception/ConflictingLock.php b/3rdparty/Sabre/DAV/Exception/ConflictingLock.php
index 6121868e69e..6121868e69e 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/ConflictingLock.php
+++ b/3rdparty/Sabre/DAV/Exception/ConflictingLock.php
diff --git a/3rdparty/Sabre/DAV/Exception/FileNotFound.php b/3rdparty/Sabre/DAV/Exception/FileNotFound.php
index d76e400c93b..d76e400c93b 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/FileNotFound.php
+++ b/3rdparty/Sabre/DAV/Exception/FileNotFound.php
diff --git a/3rdparty/Sabre/DAV/Exception/Forbidden.php b/3rdparty/Sabre/DAV/Exception/Forbidden.php
index 20b1056e31b..20b1056e31b 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/Forbidden.php
+++ b/3rdparty/Sabre/DAV/Exception/Forbidden.php
diff --git a/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php b/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php
index 1a15089b0a3..1a15089b0a3 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php
+++ b/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php
diff --git a/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php b/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php
index 2230f1d0811..2230f1d0811 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php
+++ b/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php
diff --git a/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php b/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php
index 80ab7aff65a..80ab7aff65a 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php
+++ b/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php
diff --git a/3rdparty/Sabre/DAV/Exception/Locked.php b/3rdparty/Sabre/DAV/Exception/Locked.php
index 976365ac1f8..976365ac1f8 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/Locked.php
+++ b/3rdparty/Sabre/DAV/Exception/Locked.php
diff --git a/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php b/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php
index 31875751505..31875751505 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php
+++ b/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php
diff --git a/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php b/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php
index 87ca624429f..87ca624429f 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php
+++ b/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php
diff --git a/3rdparty/Sabre/DAV/Exception/NotFound.php b/3rdparty/Sabre/DAV/Exception/NotFound.php
index 2b9da560d23..2b9da560d23 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/NotFound.php
+++ b/3rdparty/Sabre/DAV/Exception/NotFound.php
diff --git a/3rdparty/Sabre/DAV/Exception/NotImplemented.php b/3rdparty/Sabre/DAV/Exception/NotImplemented.php
index d017a19f559..d017a19f559 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/NotImplemented.php
+++ b/3rdparty/Sabre/DAV/Exception/NotImplemented.php
diff --git a/3rdparty/Sabre/DAV/Exception/PaymentRequired.php b/3rdparty/Sabre/DAV/Exception/PaymentRequired.php
index 4982f45a4b5..4982f45a4b5 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/PaymentRequired.php
+++ b/3rdparty/Sabre/DAV/Exception/PaymentRequired.php
diff --git a/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php b/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php
index 213e9c52317..213e9c52317 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php
+++ b/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php
diff --git a/3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php b/3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php
index e86800f3038..e86800f3038 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php
+++ b/3rdparty/Sabre/DAV/Exception/ReportNotImplemented.php
diff --git a/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php b/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php
index 29ee3654a7e..29ee3654a7e 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php
+++ b/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php
diff --git a/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php b/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php
index 9a4693b21a8..9a4693b21a8 100644..100755
--- a/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php
+++ b/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php
diff --git a/3rdparty/Sabre/DAV/FS/Directory.php b/3rdparty/Sabre/DAV/FS/Directory.php
index 3af2d755583..3af2d755583 100644..100755
--- a/3rdparty/Sabre/DAV/FS/Directory.php
+++ b/3rdparty/Sabre/DAV/FS/Directory.php
diff --git a/3rdparty/Sabre/DAV/FS/File.php b/3rdparty/Sabre/DAV/FS/File.php
index 6a8039fe303..6a8039fe303 100644..100755
--- a/3rdparty/Sabre/DAV/FS/File.php
+++ b/3rdparty/Sabre/DAV/FS/File.php
diff --git a/3rdparty/Sabre/DAV/FS/Node.php b/3rdparty/Sabre/DAV/FS/Node.php
index 1283e9d0fdc..1283e9d0fdc 100644..100755
--- a/3rdparty/Sabre/DAV/FS/Node.php
+++ b/3rdparty/Sabre/DAV/FS/Node.php
diff --git a/3rdparty/Sabre/DAV/FSExt/Directory.php b/3rdparty/Sabre/DAV/FSExt/Directory.php
index 540057183b3..540057183b3 100644..100755
--- a/3rdparty/Sabre/DAV/FSExt/Directory.php
+++ b/3rdparty/Sabre/DAV/FSExt/Directory.php
diff --git a/3rdparty/Sabre/DAV/FSExt/File.php b/3rdparty/Sabre/DAV/FSExt/File.php
index b93ce5aee21..b93ce5aee21 100644..100755
--- a/3rdparty/Sabre/DAV/FSExt/File.php
+++ b/3rdparty/Sabre/DAV/FSExt/File.php
diff --git a/3rdparty/Sabre/DAV/FSExt/Node.php b/3rdparty/Sabre/DAV/FSExt/Node.php
index 68ca06beb7e..68ca06beb7e 100644..100755
--- a/3rdparty/Sabre/DAV/FSExt/Node.php
+++ b/3rdparty/Sabre/DAV/FSExt/Node.php
diff --git a/3rdparty/Sabre/DAV/File.php b/3rdparty/Sabre/DAV/File.php
index 3126bd8d364..3126bd8d364 100644..100755
--- a/3rdparty/Sabre/DAV/File.php
+++ b/3rdparty/Sabre/DAV/File.php
diff --git a/3rdparty/Sabre/DAV/ICollection.php b/3rdparty/Sabre/DAV/ICollection.php
index 4626038a66e..4626038a66e 100644..100755
--- a/3rdparty/Sabre/DAV/ICollection.php
+++ b/3rdparty/Sabre/DAV/ICollection.php
diff --git a/3rdparty/Sabre/DAV/IExtendedCollection.php b/3rdparty/Sabre/DAV/IExtendedCollection.php
index 6ec345f9a62..6ec345f9a62 100644..100755
--- a/3rdparty/Sabre/DAV/IExtendedCollection.php
+++ b/3rdparty/Sabre/DAV/IExtendedCollection.php
diff --git a/3rdparty/Sabre/DAV/IFile.php b/3rdparty/Sabre/DAV/IFile.php
index 478f822ae71..478f822ae71 100644..100755
--- a/3rdparty/Sabre/DAV/IFile.php
+++ b/3rdparty/Sabre/DAV/IFile.php
diff --git a/3rdparty/Sabre/DAV/INode.php b/3rdparty/Sabre/DAV/INode.php
index c57d3923105..c57d3923105 100644..100755
--- a/3rdparty/Sabre/DAV/INode.php
+++ b/3rdparty/Sabre/DAV/INode.php
diff --git a/3rdparty/Sabre/DAV/IProperties.php b/3rdparty/Sabre/DAV/IProperties.php
index 38eaab16dad..38eaab16dad 100644..100755
--- a/3rdparty/Sabre/DAV/IProperties.php
+++ b/3rdparty/Sabre/DAV/IProperties.php
diff --git a/3rdparty/Sabre/DAV/IQuota.php b/3rdparty/Sabre/DAV/IQuota.php
index 3fe4c4eced4..3fe4c4eced4 100644..100755
--- a/3rdparty/Sabre/DAV/IQuota.php
+++ b/3rdparty/Sabre/DAV/IQuota.php
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php b/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php
index 127e643a2b9..127e643a2b9 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php
+++ b/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/FS.php b/3rdparty/Sabre/DAV/Locks/Backend/FS.php
index 02cab87fc82..02cab87fc82 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Backend/FS.php
+++ b/3rdparty/Sabre/DAV/Locks/Backend/FS.php
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/File.php b/3rdparty/Sabre/DAV/Locks/Backend/File.php
index c33f963514b..c33f963514b 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Backend/File.php
+++ b/3rdparty/Sabre/DAV/Locks/Backend/File.php
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/PDO.php b/3rdparty/Sabre/DAV/Locks/Backend/PDO.php
index acce80638ec..acce80638ec 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Backend/PDO.php
+++ b/3rdparty/Sabre/DAV/Locks/Backend/PDO.php
diff --git a/3rdparty/Sabre/DAV/Locks/LockInfo.php b/3rdparty/Sabre/DAV/Locks/LockInfo.php
index 9df014a4281..9df014a4281 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/LockInfo.php
+++ b/3rdparty/Sabre/DAV/Locks/LockInfo.php
diff --git a/3rdparty/Sabre/DAV/Locks/Plugin.php b/3rdparty/Sabre/DAV/Locks/Plugin.php
index fd956950b8a..fd956950b8a 100644..100755
--- a/3rdparty/Sabre/DAV/Locks/Plugin.php
+++ b/3rdparty/Sabre/DAV/Locks/Plugin.php
diff --git a/3rdparty/Sabre/DAV/Mount/Plugin.php b/3rdparty/Sabre/DAV/Mount/Plugin.php
index b37a90ae993..b37a90ae993 100644..100755
--- a/3rdparty/Sabre/DAV/Mount/Plugin.php
+++ b/3rdparty/Sabre/DAV/Mount/Plugin.php
diff --git a/3rdparty/Sabre/DAV/Node.php b/3rdparty/Sabre/DAV/Node.php
index 070b7176afd..070b7176afd 100644..100755
--- a/3rdparty/Sabre/DAV/Node.php
+++ b/3rdparty/Sabre/DAV/Node.php
diff --git a/3rdparty/Sabre/DAV/ObjectTree.php b/3rdparty/Sabre/DAV/ObjectTree.php
index bce51463900..bce51463900 100644..100755
--- a/3rdparty/Sabre/DAV/ObjectTree.php
+++ b/3rdparty/Sabre/DAV/ObjectTree.php
diff --git a/3rdparty/Sabre/DAV/Property.php b/3rdparty/Sabre/DAV/Property.php
index 1cfada3236c..1cfada3236c 100644..100755
--- a/3rdparty/Sabre/DAV/Property.php
+++ b/3rdparty/Sabre/DAV/Property.php
diff --git a/3rdparty/Sabre/DAV/Property/GetLastModified.php b/3rdparty/Sabre/DAV/Property/GetLastModified.php
index bd63f573140..bd63f573140 100644..100755
--- a/3rdparty/Sabre/DAV/Property/GetLastModified.php
+++ b/3rdparty/Sabre/DAV/Property/GetLastModified.php
diff --git a/3rdparty/Sabre/DAV/Property/Href.php b/3rdparty/Sabre/DAV/Property/Href.php
index dac564f24d7..dac564f24d7 100644..100755
--- a/3rdparty/Sabre/DAV/Property/Href.php
+++ b/3rdparty/Sabre/DAV/Property/Href.php
diff --git a/3rdparty/Sabre/DAV/Property/HrefList.php b/3rdparty/Sabre/DAV/Property/HrefList.php
index 7a52272e885..7a52272e885 100644..100755
--- a/3rdparty/Sabre/DAV/Property/HrefList.php
+++ b/3rdparty/Sabre/DAV/Property/HrefList.php
diff --git a/3rdparty/Sabre/DAV/Property/IHref.php b/3rdparty/Sabre/DAV/Property/IHref.php
index 5c0409064cb..5c0409064cb 100644..100755
--- a/3rdparty/Sabre/DAV/Property/IHref.php
+++ b/3rdparty/Sabre/DAV/Property/IHref.php
diff --git a/3rdparty/Sabre/DAV/Property/LockDiscovery.php b/3rdparty/Sabre/DAV/Property/LockDiscovery.php
index 2ded5649a44..2ded5649a44 100644..100755
--- a/3rdparty/Sabre/DAV/Property/LockDiscovery.php
+++ b/3rdparty/Sabre/DAV/Property/LockDiscovery.php
diff --git a/3rdparty/Sabre/DAV/Property/ResourceType.php b/3rdparty/Sabre/DAV/Property/ResourceType.php
index f6269611e54..f6269611e54 100644..100755
--- a/3rdparty/Sabre/DAV/Property/ResourceType.php
+++ b/3rdparty/Sabre/DAV/Property/ResourceType.php
diff --git a/3rdparty/Sabre/DAV/Property/Response.php b/3rdparty/Sabre/DAV/Property/Response.php
index 88afbcfb26d..88afbcfb26d 100644..100755
--- a/3rdparty/Sabre/DAV/Property/Response.php
+++ b/3rdparty/Sabre/DAV/Property/Response.php
diff --git a/3rdparty/Sabre/DAV/Property/ResponseList.php b/3rdparty/Sabre/DAV/Property/ResponseList.php
index cae923afbf9..cae923afbf9 100644..100755
--- a/3rdparty/Sabre/DAV/Property/ResponseList.php
+++ b/3rdparty/Sabre/DAV/Property/ResponseList.php
diff --git a/3rdparty/Sabre/DAV/Property/SupportedLock.php b/3rdparty/Sabre/DAV/Property/SupportedLock.php
index 4e3aaf23a1a..4e3aaf23a1a 100644..100755
--- a/3rdparty/Sabre/DAV/Property/SupportedLock.php
+++ b/3rdparty/Sabre/DAV/Property/SupportedLock.php
diff --git a/3rdparty/Sabre/DAV/Property/SupportedReportSet.php b/3rdparty/Sabre/DAV/Property/SupportedReportSet.php
index e62699f3b5a..e62699f3b5a 100644..100755
--- a/3rdparty/Sabre/DAV/Property/SupportedReportSet.php
+++ b/3rdparty/Sabre/DAV/Property/SupportedReportSet.php
diff --git a/3rdparty/Sabre/DAV/Server.php b/3rdparty/Sabre/DAV/Server.php
index 50b190e8fab..0dfac8b0c71 100644..100755
--- a/3rdparty/Sabre/DAV/Server.php
+++ b/3rdparty/Sabre/DAV/Server.php
@@ -215,7 +215,7 @@ class Sabre_DAV_Server {
$DOM->appendChild($error);
$error->appendChild($DOM->createElement('s:exception',get_class($e)));
- $error->appendChild($DOM->createElement('s:message',htmlentities($e->getMessage())));
+ $error->appendChild($DOM->createElement('s:message',$e->getMessage()));
if ($this->debugExceptions) {
$error->appendChild($DOM->createElement('s:file',$e->getFile()));
$error->appendChild($DOM->createElement('s:line',$e->getLine()));
@@ -1784,7 +1784,14 @@ class Sabre_DAV_Server {
$etag = $node->getETag();
if ($etag===$ifMatchItem) {
$haveMatch = true;
+ } else {
+ // Evolution has a bug where it sometimes prepends the "
+ // with a \. This is our workaround.
+ if (str_replace('\\"','"', $ifMatchItem) === $etag) {
+ $haveMatch = true;
+ }
}
+
}
if (!$haveMatch) {
throw new Sabre_DAV_Exception_PreconditionFailed('An If-Match header was specified, but none of the specified the ETags matched.','If-Match');
diff --git a/3rdparty/Sabre/DAV/ServerPlugin.php b/3rdparty/Sabre/DAV/ServerPlugin.php
index 131863d13fb..131863d13fb 100644..100755
--- a/3rdparty/Sabre/DAV/ServerPlugin.php
+++ b/3rdparty/Sabre/DAV/ServerPlugin.php
diff --git a/3rdparty/Sabre/DAV/SimpleCollection.php b/3rdparty/Sabre/DAV/SimpleCollection.php
index 4acf971caa5..4acf971caa5 100644..100755
--- a/3rdparty/Sabre/DAV/SimpleCollection.php
+++ b/3rdparty/Sabre/DAV/SimpleCollection.php
diff --git a/3rdparty/Sabre/DAV/SimpleDirectory.php b/3rdparty/Sabre/DAV/SimpleDirectory.php
index 621222ebc53..621222ebc53 100644..100755
--- a/3rdparty/Sabre/DAV/SimpleDirectory.php
+++ b/3rdparty/Sabre/DAV/SimpleDirectory.php
diff --git a/3rdparty/Sabre/DAV/SimpleFile.php b/3rdparty/Sabre/DAV/SimpleFile.php
index 58330d6861d..58330d6861d 100644..100755
--- a/3rdparty/Sabre/DAV/SimpleFile.php
+++ b/3rdparty/Sabre/DAV/SimpleFile.php
diff --git a/3rdparty/Sabre/DAV/StringUtil.php b/3rdparty/Sabre/DAV/StringUtil.php
index b126a94c825..b126a94c825 100644..100755
--- a/3rdparty/Sabre/DAV/StringUtil.php
+++ b/3rdparty/Sabre/DAV/StringUtil.php
diff --git a/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php b/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php
index 36096e67775..36096e67775 100644..100755
--- a/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php
+++ b/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php
diff --git a/3rdparty/Sabre/DAV/Tree.php b/3rdparty/Sabre/DAV/Tree.php
index 50216394155..50216394155 100644..100755
--- a/3rdparty/Sabre/DAV/Tree.php
+++ b/3rdparty/Sabre/DAV/Tree.php
diff --git a/3rdparty/Sabre/DAV/Tree/Filesystem.php b/3rdparty/Sabre/DAV/Tree/Filesystem.php
index 85a9ee317be..40580ae366f 100644..100755
--- a/3rdparty/Sabre/DAV/Tree/Filesystem.php
+++ b/3rdparty/Sabre/DAV/Tree/Filesystem.php
@@ -42,9 +42,9 @@ class Sabre_DAV_Tree_Filesystem extends Sabre_DAV_Tree {
$realPath = $this->getRealPath($path);
if (!file_exists($realPath)) throw new Sabre_DAV_Exception_NotFound('File at location ' . $realPath . ' not found');
if (is_dir($realPath)) {
- return new Sabre_DAV_FS_Directory($path);
+ return new Sabre_DAV_FS_Directory($realPath);
} else {
- return new Sabre_DAV_FS_File($path);
+ return new Sabre_DAV_FS_File($realPath);
}
}
diff --git a/3rdparty/Sabre/DAV/URLUtil.php b/3rdparty/Sabre/DAV/URLUtil.php
index 794665a44f6..794665a44f6 100644..100755
--- a/3rdparty/Sabre/DAV/URLUtil.php
+++ b/3rdparty/Sabre/DAV/URLUtil.php
diff --git a/3rdparty/Sabre/DAV/UUIDUtil.php b/3rdparty/Sabre/DAV/UUIDUtil.php
index f0eebe598e5..f0eebe598e5 100644..100755
--- a/3rdparty/Sabre/DAV/UUIDUtil.php
+++ b/3rdparty/Sabre/DAV/UUIDUtil.php
diff --git a/3rdparty/Sabre/DAV/Version.php b/3rdparty/Sabre/DAV/Version.php
index 5e5d15e4039..40cfe81b34f 100644..100755
--- a/3rdparty/Sabre/DAV/Version.php
+++ b/3rdparty/Sabre/DAV/Version.php
@@ -14,7 +14,7 @@ class Sabre_DAV_Version {
/**
* Full version number
*/
- const VERSION = '1.6.2';
+ const VERSION = '1.6.3';
/**
* Stability : alpha, beta, stable
diff --git a/3rdparty/Sabre/DAV/XMLUtil.php b/3rdparty/Sabre/DAV/XMLUtil.php
index 60eff3b159a..60eff3b159a 100644..100755
--- a/3rdparty/Sabre/DAV/XMLUtil.php
+++ b/3rdparty/Sabre/DAV/XMLUtil.php
diff --git a/3rdparty/Sabre/DAV/includes.php b/3rdparty/Sabre/DAV/includes.php
index 6a4890677ea..6a4890677ea 100644..100755
--- a/3rdparty/Sabre/DAV/includes.php
+++ b/3rdparty/Sabre/DAV/includes.php
diff --git a/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php b/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php
index e05b7749805..e05b7749805 100644..100755
--- a/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php
+++ b/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php
diff --git a/3rdparty/Sabre/DAVACL/Exception/AceConflict.php b/3rdparty/Sabre/DAVACL/Exception/AceConflict.php
index 4b9f93b0036..4b9f93b0036 100644..100755
--- a/3rdparty/Sabre/DAVACL/Exception/AceConflict.php
+++ b/3rdparty/Sabre/DAVACL/Exception/AceConflict.php
diff --git a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php b/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php
index 9b055dd9709..9b055dd9709 100644..100755
--- a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php
+++ b/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php
diff --git a/3rdparty/Sabre/DAVACL/Exception/NoAbstract.php b/3rdparty/Sabre/DAVACL/Exception/NoAbstract.php
index f44e3e32281..f44e3e32281 100644..100755
--- a/3rdparty/Sabre/DAVACL/Exception/NoAbstract.php
+++ b/3rdparty/Sabre/DAVACL/Exception/NoAbstract.php
diff --git a/3rdparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php b/3rdparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php
index 8d1e38ca1b4..8d1e38ca1b4 100644..100755
--- a/3rdparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php
+++ b/3rdparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php
diff --git a/3rdparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php b/3rdparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php
index 3b5d012d7fa..3b5d012d7fa 100644..100755
--- a/3rdparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php
+++ b/3rdparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php
diff --git a/3rdparty/Sabre/DAVACL/IACL.php b/3rdparty/Sabre/DAVACL/IACL.php
index 003e6993483..003e6993483 100644..100755
--- a/3rdparty/Sabre/DAVACL/IACL.php
+++ b/3rdparty/Sabre/DAVACL/IACL.php
diff --git a/3rdparty/Sabre/DAVACL/IPrincipal.php b/3rdparty/Sabre/DAVACL/IPrincipal.php
index fc7605bf625..fc7605bf625 100644..100755
--- a/3rdparty/Sabre/DAVACL/IPrincipal.php
+++ b/3rdparty/Sabre/DAVACL/IPrincipal.php
diff --git a/3rdparty/Sabre/DAVACL/IPrincipalBackend.php b/3rdparty/Sabre/DAVACL/IPrincipalBackend.php
index e798bf890c0..e798bf890c0 100644..100755
--- a/3rdparty/Sabre/DAVACL/IPrincipalBackend.php
+++ b/3rdparty/Sabre/DAVACL/IPrincipalBackend.php
diff --git a/3rdparty/Sabre/DAVACL/Plugin.php b/3rdparty/Sabre/DAVACL/Plugin.php
index 5c828c6d97b..5c828c6d97b 100644..100755
--- a/3rdparty/Sabre/DAVACL/Plugin.php
+++ b/3rdparty/Sabre/DAVACL/Plugin.php
diff --git a/3rdparty/Sabre/DAVACL/Principal.php b/3rdparty/Sabre/DAVACL/Principal.php
index 51c6658afd6..51c6658afd6 100644..100755
--- a/3rdparty/Sabre/DAVACL/Principal.php
+++ b/3rdparty/Sabre/DAVACL/Principal.php
diff --git a/3rdparty/Sabre/DAVACL/PrincipalBackend/PDO.php b/3rdparty/Sabre/DAVACL/PrincipalBackend/PDO.php
index a76b4a9d727..a76b4a9d727 100644..100755
--- a/3rdparty/Sabre/DAVACL/PrincipalBackend/PDO.php
+++ b/3rdparty/Sabre/DAVACL/PrincipalBackend/PDO.php
diff --git a/3rdparty/Sabre/DAVACL/PrincipalCollection.php b/3rdparty/Sabre/DAVACL/PrincipalCollection.php
index c3e4cb83f23..c3e4cb83f23 100644..100755
--- a/3rdparty/Sabre/DAVACL/PrincipalCollection.php
+++ b/3rdparty/Sabre/DAVACL/PrincipalCollection.php
diff --git a/3rdparty/Sabre/DAVACL/Property/Acl.php b/3rdparty/Sabre/DAVACL/Property/Acl.php
index 05e1a690b3c..05e1a690b3c 100644..100755
--- a/3rdparty/Sabre/DAVACL/Property/Acl.php
+++ b/3rdparty/Sabre/DAVACL/Property/Acl.php
diff --git a/3rdparty/Sabre/DAVACL/Property/AclRestrictions.php b/3rdparty/Sabre/DAVACL/Property/AclRestrictions.php
index a8b054956dd..a8b054956dd 100644..100755
--- a/3rdparty/Sabre/DAVACL/Property/AclRestrictions.php
+++ b/3rdparty/Sabre/DAVACL/Property/AclRestrictions.php
diff --git a/3rdparty/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php b/3rdparty/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php
index 94a29640615..94a29640615 100644..100755
--- a/3rdparty/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php
+++ b/3rdparty/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php
diff --git a/3rdparty/Sabre/DAVACL/Property/Principal.php b/3rdparty/Sabre/DAVACL/Property/Principal.php
index c36328a58e0..c36328a58e0 100644..100755
--- a/3rdparty/Sabre/DAVACL/Property/Principal.php
+++ b/3rdparty/Sabre/DAVACL/Property/Principal.php
diff --git a/3rdparty/Sabre/DAVACL/Property/SupportedPrivilegeSet.php b/3rdparty/Sabre/DAVACL/Property/SupportedPrivilegeSet.php
index 276d57ae093..276d57ae093 100644..100755
--- a/3rdparty/Sabre/DAVACL/Property/SupportedPrivilegeSet.php
+++ b/3rdparty/Sabre/DAVACL/Property/SupportedPrivilegeSet.php
diff --git a/3rdparty/Sabre/DAVACL/Version.php b/3rdparty/Sabre/DAVACL/Version.php
index 9950f748741..9950f748741 100644..100755
--- a/3rdparty/Sabre/DAVACL/Version.php
+++ b/3rdparty/Sabre/DAVACL/Version.php
diff --git a/3rdparty/Sabre/DAVACL/includes.php b/3rdparty/Sabre/DAVACL/includes.php
index 28fa3eed225..28fa3eed225 100644..100755
--- a/3rdparty/Sabre/DAVACL/includes.php
+++ b/3rdparty/Sabre/DAVACL/includes.php
diff --git a/3rdparty/Sabre/HTTP/AWSAuth.php b/3rdparty/Sabre/HTTP/AWSAuth.php
index fb8245c8cbf..fb8245c8cbf 100644..100755
--- a/3rdparty/Sabre/HTTP/AWSAuth.php
+++ b/3rdparty/Sabre/HTTP/AWSAuth.php
diff --git a/3rdparty/Sabre/HTTP/AbstractAuth.php b/3rdparty/Sabre/HTTP/AbstractAuth.php
index 3bccabcd1c1..3bccabcd1c1 100644..100755
--- a/3rdparty/Sabre/HTTP/AbstractAuth.php
+++ b/3rdparty/Sabre/HTTP/AbstractAuth.php
diff --git a/3rdparty/Sabre/HTTP/BasicAuth.php b/3rdparty/Sabre/HTTP/BasicAuth.php
index a747cc6a31b..a747cc6a31b 100644..100755
--- a/3rdparty/Sabre/HTTP/BasicAuth.php
+++ b/3rdparty/Sabre/HTTP/BasicAuth.php
diff --git a/3rdparty/Sabre/HTTP/DigestAuth.php b/3rdparty/Sabre/HTTP/DigestAuth.php
index ee7f05c08ed..ee7f05c08ed 100644..100755
--- a/3rdparty/Sabre/HTTP/DigestAuth.php
+++ b/3rdparty/Sabre/HTTP/DigestAuth.php
diff --git a/3rdparty/Sabre/HTTP/Request.php b/3rdparty/Sabre/HTTP/Request.php
index 4746ef77704..4746ef77704 100644..100755
--- a/3rdparty/Sabre/HTTP/Request.php
+++ b/3rdparty/Sabre/HTTP/Request.php
diff --git a/3rdparty/Sabre/HTTP/Response.php b/3rdparty/Sabre/HTTP/Response.php
index ffe9bda2082..ffe9bda2082 100644..100755
--- a/3rdparty/Sabre/HTTP/Response.php
+++ b/3rdparty/Sabre/HTTP/Response.php
diff --git a/3rdparty/Sabre/HTTP/Util.php b/3rdparty/Sabre/HTTP/Util.php
index 67bdd489e1e..67bdd489e1e 100644..100755
--- a/3rdparty/Sabre/HTTP/Util.php
+++ b/3rdparty/Sabre/HTTP/Util.php
diff --git a/3rdparty/Sabre/HTTP/Version.php b/3rdparty/Sabre/HTTP/Version.php
index 23dc7f8a7a1..23dc7f8a7a1 100644..100755
--- a/3rdparty/Sabre/HTTP/Version.php
+++ b/3rdparty/Sabre/HTTP/Version.php
diff --git a/3rdparty/Sabre/HTTP/includes.php b/3rdparty/Sabre/HTTP/includes.php
index 9d34bf3a8be..9d34bf3a8be 100644..100755
--- a/3rdparty/Sabre/HTTP/includes.php
+++ b/3rdparty/Sabre/HTTP/includes.php
diff --git a/3rdparty/Sabre/VObject/Component.php b/3rdparty/Sabre/VObject/Component.php
index b78a26133fa..b78a26133fa 100644..100755
--- a/3rdparty/Sabre/VObject/Component.php
+++ b/3rdparty/Sabre/VObject/Component.php
diff --git a/3rdparty/Sabre/VObject/Component/VAlarm.php b/3rdparty/Sabre/VObject/Component/VAlarm.php
index ebb4a9b18f6..ebb4a9b18f6 100644..100755
--- a/3rdparty/Sabre/VObject/Component/VAlarm.php
+++ b/3rdparty/Sabre/VObject/Component/VAlarm.php
diff --git a/3rdparty/Sabre/VObject/Component/VCalendar.php b/3rdparty/Sabre/VObject/Component/VCalendar.php
index f3be29afdbb..f3be29afdbb 100644..100755
--- a/3rdparty/Sabre/VObject/Component/VCalendar.php
+++ b/3rdparty/Sabre/VObject/Component/VCalendar.php
diff --git a/3rdparty/Sabre/VObject/Component/VEvent.php b/3rdparty/Sabre/VObject/Component/VEvent.php
index 4cc1e36d7d6..4cc1e36d7d6 100644..100755
--- a/3rdparty/Sabre/VObject/Component/VEvent.php
+++ b/3rdparty/Sabre/VObject/Component/VEvent.php
diff --git a/3rdparty/Sabre/VObject/Component/VJournal.php b/3rdparty/Sabre/VObject/Component/VJournal.php
index 22b3ec921e5..22b3ec921e5 100644..100755
--- a/3rdparty/Sabre/VObject/Component/VJournal.php
+++ b/3rdparty/Sabre/VObject/Component/VJournal.php
diff --git a/3rdparty/Sabre/VObject/Component/VTodo.php b/3rdparty/Sabre/VObject/Component/VTodo.php
index 79d06298d7f..79d06298d7f 100644..100755
--- a/3rdparty/Sabre/VObject/Component/VTodo.php
+++ b/3rdparty/Sabre/VObject/Component/VTodo.php
diff --git a/3rdparty/Sabre/VObject/DateTimeParser.php b/3rdparty/Sabre/VObject/DateTimeParser.php
index 1e2d54ef3a9..23a4bb69916 100644..100755
--- a/3rdparty/Sabre/VObject/DateTimeParser.php
+++ b/3rdparty/Sabre/VObject/DateTimeParser.php
@@ -125,6 +125,9 @@ class Sabre_VObject_DateTimeParser {
}
+ if ($duration==='P') {
+ $duration = 'PT0S';
+ }
$iv = new DateInterval($duration);
if ($invert) $iv->invert = true;
@@ -150,6 +153,7 @@ class Sabre_VObject_DateTimeParser {
}
$newDur = ($matches['plusminus']==='-'?'-':'+') . trim($newDur);
+ if ($newDur === '+') { $newDur = '+0 seconds'; };
return $newDur;
}
diff --git a/3rdparty/Sabre/VObject/Element.php b/3rdparty/Sabre/VObject/Element.php
index e20ff0b353c..e20ff0b353c 100644..100755
--- a/3rdparty/Sabre/VObject/Element.php
+++ b/3rdparty/Sabre/VObject/Element.php
diff --git a/3rdparty/Sabre/VObject/Element/DateTime.php b/3rdparty/Sabre/VObject/Element/DateTime.php
index 5e5eb7ab6f2..5e5eb7ab6f2 100644..100755
--- a/3rdparty/Sabre/VObject/Element/DateTime.php
+++ b/3rdparty/Sabre/VObject/Element/DateTime.php
diff --git a/3rdparty/Sabre/VObject/Element/MultiDateTime.php b/3rdparty/Sabre/VObject/Element/MultiDateTime.php
index 8a12ced94a8..8a12ced94a8 100644..100755
--- a/3rdparty/Sabre/VObject/Element/MultiDateTime.php
+++ b/3rdparty/Sabre/VObject/Element/MultiDateTime.php
diff --git a/3rdparty/Sabre/VObject/ElementList.php b/3rdparty/Sabre/VObject/ElementList.php
index 7e508db20f0..7e508db20f0 100644..100755
--- a/3rdparty/Sabre/VObject/ElementList.php
+++ b/3rdparty/Sabre/VObject/ElementList.php
diff --git a/3rdparty/Sabre/VObject/FreeBusyGenerator.php b/3rdparty/Sabre/VObject/FreeBusyGenerator.php
index 1c96a64a004..1c96a64a004 100644..100755
--- a/3rdparty/Sabre/VObject/FreeBusyGenerator.php
+++ b/3rdparty/Sabre/VObject/FreeBusyGenerator.php
diff --git a/3rdparty/Sabre/VObject/Node.php b/3rdparty/Sabre/VObject/Node.php
index d89e01b56c6..d89e01b56c6 100644..100755
--- a/3rdparty/Sabre/VObject/Node.php
+++ b/3rdparty/Sabre/VObject/Node.php
diff --git a/3rdparty/Sabre/VObject/Parameter.php b/3rdparty/Sabre/VObject/Parameter.php
index 2e39af5f78a..2e39af5f78a 100644..100755
--- a/3rdparty/Sabre/VObject/Parameter.php
+++ b/3rdparty/Sabre/VObject/Parameter.php
diff --git a/3rdparty/Sabre/VObject/ParseException.php b/3rdparty/Sabre/VObject/ParseException.php
index 1b5e95bf16e..1b5e95bf16e 100644..100755
--- a/3rdparty/Sabre/VObject/ParseException.php
+++ b/3rdparty/Sabre/VObject/ParseException.php
diff --git a/3rdparty/Sabre/VObject/Property.php b/3rdparty/Sabre/VObject/Property.php
index ce74fe3865b..ce74fe3865b 100644..100755
--- a/3rdparty/Sabre/VObject/Property.php
+++ b/3rdparty/Sabre/VObject/Property.php
diff --git a/3rdparty/Sabre/VObject/Property/DateTime.php b/3rdparty/Sabre/VObject/Property/DateTime.php
index fe2372caa81..fe2372caa81 100644..100755
--- a/3rdparty/Sabre/VObject/Property/DateTime.php
+++ b/3rdparty/Sabre/VObject/Property/DateTime.php
diff --git a/3rdparty/Sabre/VObject/Property/MultiDateTime.php b/3rdparty/Sabre/VObject/Property/MultiDateTime.php
index ae53ab6a617..ae53ab6a617 100644..100755
--- a/3rdparty/Sabre/VObject/Property/MultiDateTime.php
+++ b/3rdparty/Sabre/VObject/Property/MultiDateTime.php
diff --git a/3rdparty/Sabre/VObject/Reader.php b/3rdparty/Sabre/VObject/Reader.php
index eea73fa3dce..eea73fa3dce 100644..100755
--- a/3rdparty/Sabre/VObject/Reader.php
+++ b/3rdparty/Sabre/VObject/Reader.php
diff --git a/3rdparty/Sabre/VObject/RecurrenceIterator.php b/3rdparty/Sabre/VObject/RecurrenceIterator.php
index 833aa091ab7..833aa091ab7 100644..100755
--- a/3rdparty/Sabre/VObject/RecurrenceIterator.php
+++ b/3rdparty/Sabre/VObject/RecurrenceIterator.php
diff --git a/3rdparty/Sabre/VObject/Version.php b/3rdparty/Sabre/VObject/Version.php
index 00110febc07..2617c7b129d 100644..100755
--- a/3rdparty/Sabre/VObject/Version.php
+++ b/3rdparty/Sabre/VObject/Version.php
@@ -14,7 +14,7 @@ class Sabre_VObject_Version {
/**
* Full version number
*/
- const VERSION = '1.3.2';
+ const VERSION = '1.3.3';
/**
* Stability : alpha, beta, stable
diff --git a/3rdparty/Sabre/VObject/WindowsTimezoneMap.php b/3rdparty/Sabre/VObject/WindowsTimezoneMap.php
index 5e1cc5d479b..5e1cc5d479b 100644..100755
--- a/3rdparty/Sabre/VObject/WindowsTimezoneMap.php
+++ b/3rdparty/Sabre/VObject/WindowsTimezoneMap.php
diff --git a/3rdparty/Sabre/VObject/includes.php b/3rdparty/Sabre/VObject/includes.php
index 0177a8f1ba6..0177a8f1ba6 100644..100755
--- a/3rdparty/Sabre/VObject/includes.php
+++ b/3rdparty/Sabre/VObject/includes.php
diff --git a/3rdparty/Sabre/autoload.php b/3rdparty/Sabre/autoload.php
index c7b537d83d3..c7b537d83d3 100644..100755
--- a/3rdparty/Sabre/autoload.php
+++ b/3rdparty/Sabre/autoload.php
diff --git a/apps/calendar/ajax/calendar/activation.php b/apps/calendar/ajax/calendar/activation.php
index e31908beb14..f4aadc5b017 100644
--- a/apps/calendar/ajax/calendar/activation.php
+++ b/apps/calendar/ajax/calendar/activation.php
@@ -9,6 +9,8 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
+
$calendarid = $_POST['calendarid'];
$calendar = OC_Calendar_App::getCalendar($calendarid, true);
if(!$calendar){
diff --git a/apps/calendar/ajax/calendar/delete.php b/apps/calendar/ajax/calendar/delete.php
index 4d6706f6002..089255cae39 100644
--- a/apps/calendar/ajax/calendar/delete.php
+++ b/apps/calendar/ajax/calendar/delete.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
$cal = $_POST["calendarid"];
$calendar = OC_Calendar_App::getCalendar($cal, true);
diff --git a/apps/calendar/ajax/calendar/new.php b/apps/calendar/ajax/calendar/new.php
index e77d4ebff03..67d12822378 100644
--- a/apps/calendar/ajax/calendar/new.php
+++ b/apps/calendar/ajax/calendar/new.php
@@ -6,11 +6,10 @@
* See the COPYING-README file.
*/
-
-
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
if(trim($_POST['name']) == ''){
OCP\JSON::error(array('message'=>'empty'));
diff --git a/apps/calendar/ajax/calendar/update.php b/apps/calendar/ajax/calendar/update.php
index a2c898c8075..c09b1008c9c 100644
--- a/apps/calendar/ajax/calendar/update.php
+++ b/apps/calendar/ajax/calendar/update.php
@@ -11,6 +11,7 @@
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
if(trim($_POST['name']) == ''){
OCP\JSON::error(array('message'=>'empty'));
diff --git a/apps/calendar/ajax/categories/rescan.php b/apps/calendar/ajax/categories/rescan.php
index f0060cb23b2..08c32865b6f 100644
--- a/apps/calendar/ajax/categories/rescan.php
+++ b/apps/calendar/ajax/categories/rescan.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
foreach ($_POST as $key=>$element) {
debug('_POST: '.$key.'=>'.print_r($element, true));
diff --git a/apps/calendar/ajax/event/delete.php b/apps/calendar/ajax/event/delete.php
index f183d431afa..17e45c001e8 100644
--- a/apps/calendar/ajax/event/delete.php
+++ b/apps/calendar/ajax/event/delete.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
diff --git a/apps/calendar/ajax/event/edit.php b/apps/calendar/ajax/event/edit.php
index 1c3babc3d90..db78bf6e5e0 100644
--- a/apps/calendar/ajax/event/edit.php
+++ b/apps/calendar/ajax/event/edit.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
$id = $_POST['id'];
diff --git a/apps/calendar/ajax/event/move.php b/apps/calendar/ajax/event/move.php
index 04cf2fb0513..f4e2b36376d 100644
--- a/apps/calendar/ajax/event/move.php
+++ b/apps/calendar/ajax/event/move.php
@@ -7,6 +7,7 @@
*/
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
diff --git a/apps/calendar/ajax/event/new.form.php b/apps/calendar/ajax/event/new.form.php
index 0b19e7e92f9..db04cdf2d49 100644
--- a/apps/calendar/ajax/event/new.form.php
+++ b/apps/calendar/ajax/event/new.form.php
@@ -27,7 +27,7 @@ if (!$end){
}
$start = new DateTime('@'.$start);
$end = new DateTime('@'.$end);
-$timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$timezone = OC_Calendar_App::getTimezone();
$start->setTimezone(new DateTimeZone($timezone));
$end->setTimezone(new DateTimeZone($timezone));
diff --git a/apps/calendar/ajax/event/new.php b/apps/calendar/ajax/event/new.php
index 30e2b0cae36..bc0439cc315 100644
--- a/apps/calendar/ajax/event/new.php
+++ b/apps/calendar/ajax/event/new.php
@@ -10,6 +10,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
$errarr = OC_Calendar_Object::validateRequest($_POST);
if($errarr){
diff --git a/apps/calendar/ajax/event/resize.php b/apps/calendar/ajax/event/resize.php
index 56b83205e85..15b687b55da 100644
--- a/apps/calendar/ajax/event/resize.php
+++ b/apps/calendar/ajax/event/resize.php
@@ -7,6 +7,7 @@
*/
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
$id = $_POST['id'];
diff --git a/apps/calendar/ajax/import/import.php b/apps/calendar/ajax/import/import.php
index cbb4b550569..b1dfc464d00 100644
--- a/apps/calendar/ajax/import/import.php
+++ b/apps/calendar/ajax/import/import.php
@@ -7,6 +7,7 @@
*/
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
session_write_close();
if (isset($_POST['progresskey']) && isset($_POST['getprogress'])) {
echo OCP\JSON::success(array('percent'=>OC_Cache::get($_POST['progresskey'])));
@@ -147,4 +148,4 @@ foreach($uids as $uid) {
writeProgress('100');
sleep(3);
OC_Cache::remove($progresskey);
-OCP\JSON::success();*/ \ No newline at end of file
+OCP\JSON::success();*/
diff --git a/apps/calendar/ajax/settings/setfirstday.php b/apps/calendar/ajax/settings/setfirstday.php
index 056a6037524..73cf0c19b78 100644
--- a/apps/calendar/ajax/settings/setfirstday.php
+++ b/apps/calendar/ajax/settings/setfirstday.php
@@ -7,6 +7,7 @@
*/
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
if(isset($_POST["firstday"])){
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
OCP\JSON::success();
diff --git a/apps/calendar/ajax/settings/settimeformat.php b/apps/calendar/ajax/settings/settimeformat.php
index 8e95f6f3bf5..6136857e2fe 100644
--- a/apps/calendar/ajax/settings/settimeformat.php
+++ b/apps/calendar/ajax/settings/settimeformat.php
@@ -7,6 +7,7 @@
*/
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
if(isset($_POST["timeformat"])){
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
OCP\JSON::success();
diff --git a/apps/calendar/ajax/settings/settimezone.php b/apps/calendar/ajax/settings/settimezone.php
index 6d029a6643a..06db66d578e 100644
--- a/apps/calendar/ajax/settings/settimezone.php
+++ b/apps/calendar/ajax/settings/settimezone.php
@@ -14,6 +14,7 @@ $l=OC_L10N::get('calendar');
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::callCheck();
// Get data
if( isset( $_POST['timezone'] ) ){
diff --git a/apps/calendar/ajax/share/changepermission.php b/apps/calendar/ajax/share/changepermission.php
index e807c164a23..5aff7666f79 100644
--- a/apps/calendar/ajax/share/changepermission.php
+++ b/apps/calendar/ajax/share/changepermission.php
@@ -5,7 +5,9 @@
* later.
* See the COPYING-README file.
*/
-
+
+OCP\JSON::callCheck();
+
$id = strip_tags($_POST['id']);
$idtype = strip_tags($_POST['idtype']);
$permission = (int) strip_tags($_POST['permission']);
diff --git a/apps/calendar/ajax/share/share.php b/apps/calendar/ajax/share/share.php
index 838db619f62..77e1ab9d657 100644
--- a/apps/calendar/ajax/share/share.php
+++ b/apps/calendar/ajax/share/share.php
@@ -6,6 +6,8 @@
* See the COPYING-README file.
*/
+OCP\JSON::callCheck();
+
$id = strip_tags($_POST['id']);
$idtype = strip_tags($_POST['idtype']);
switch($idtype){
diff --git a/apps/calendar/ajax/share/unshare.php b/apps/calendar/ajax/share/unshare.php
index 1ce04677fb1..c7c06113189 100644
--- a/apps/calendar/ajax/share/unshare.php
+++ b/apps/calendar/ajax/share/unshare.php
@@ -5,7 +5,9 @@
* later.
* See the COPYING-README file.
*/
-
+
+OCP\JSON::callCheck();
+
$id = strip_tags($_POST['id']);
$idtype = strip_tags($_POST['idtype']);
switch($idtype){
diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php
index 09b18ed397b..4fdba291262 100644
--- a/apps/calendar/appinfo/app.php
+++ b/apps/calendar/appinfo/app.php
@@ -11,6 +11,7 @@ OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php';
OC::$CLASSPATH['OC_Calendar_Export'] = 'apps/calendar/lib/export.php';
OC::$CLASSPATH['OC_Calendar_Import'] = 'apps/calendar/lib/import.php';
//General Hooks
+OCP\Util::connectHook('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'createUser');
OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser');
//Repeating Events Hooks
OCP\Util::connectHook('OC_Calendar', 'addEvent', 'OC_Calendar_Repeat', 'generate');
diff --git a/apps/calendar/js/settings.js b/apps/calendar/js/settings.js
index 03e4217573d..60741f2b6fc 100644
--- a/apps/calendar/js/settings.js
+++ b/apps/calendar/js/settings.js
@@ -34,6 +34,7 @@ $(document).ready(function(){
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'timeformat.php'), function(jsondata, status) {
$('#' + jsondata.timeformat).attr('selected',true);
$('#timeformat').chosen();
+ $('#timeformat_chzn').css('width', '100px');
});
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'gettimezonedetection.php'), function(jsondata, status){
if(jsondata.detection == 'true'){
@@ -43,6 +44,7 @@ $(document).ready(function(){
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'getfirstday.php'), function(jsondata, status) {
$('#' + jsondata.firstday).attr('selected',true);
$('#firstday').chosen();
+ $('#firstday_chzn').css('width', '100px');
});
$('#cleancalendarcache').click(function(){
$.getJSON(OC.filePath('calendar', 'ajax/cache', 'rescan.php'), function(){
@@ -55,7 +57,7 @@ function calendarcachecheck(){
$.getJSON(OC.filePath('calendar', 'ajax/cache', 'status.php'), function(jsondata, status) {
$('#cleancalendarcache').attr('title', jsondata.l10n.text);
if(jsondata.status == 'success'){
- $('#cleancalendarcache').css('background', '#90EE90');
+ $('#cleancalendarcache').css('background', '#F8F8F8');
$('#cleancalendarcache').css('color', '#333');
$('#cleancalendarcache').css('text-shadow', '#fff 0 1px 0');
}else{
diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php
index 1a13f2958c0..29e5ab5b0c8 100644
--- a/apps/calendar/lib/app.php
+++ b/apps/calendar/lib/app.php
@@ -9,7 +9,7 @@
* This class manages our app actions
*/
OC_Calendar_App::$l10n = new OC_L10N('calendar');
-OC_Calendar_App::$tz = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+OC_Calendar_App::$tz = OC_Calendar_App::getTimezone();
class OC_Calendar_App{
const CALENDAR = 'calendar';
const EVENT = 'event';
@@ -282,7 +282,17 @@ class OC_Calendar_App{
public static function getWeekofMonth(){
return OC_Calendar_Object::getWeekofMonth(self::$l10n);
}
-
+
+ /**
+ * @return (string) $timezone as set by user or the default timezone
+ */
+ public static function getTimezone() {
+ return OCP\Config::getUserValue(OCP\User::getUser(),
+ 'calendar',
+ 'timezone',
+ date_default_timezone_get());
+ }
+
/**
* @brief checks the access for a calendar / an event
* @param (int) $id - id of the calendar / event
diff --git a/apps/calendar/lib/hooks.php b/apps/calendar/lib/hooks.php
index 328d2951d23..bc0b02c62b8 100644
--- a/apps/calendar/lib/hooks.php
+++ b/apps/calendar/lib/hooks.php
@@ -11,7 +11,18 @@
*/
class OC_Calendar_Hooks{
/**
- * @brief Deletes all Addressbooks of a certain user
+ * @brief Creates default calendar for a user
+ * @param paramters parameters from postCreateUser-Hook
+ * @return array
+ */
+ public static function createUser($parameters) {
+ OC_Calendar_Calendar::addCalendar($parameters['uid'],'Default calendar');
+
+ return true;
+ }
+
+ /**
+ * @brief Deletes all calendars of a certain user
* @param paramters parameters from postDeleteUser-Hook
* @return array
*/
diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php
index 140542bf4fb..34676830205 100644
--- a/apps/calendar/lib/object.php
+++ b/apps/calendar/lib/object.php
@@ -856,7 +856,7 @@ class OC_Calendar_Object{
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::DATE);
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::DATE);
}else{
- $timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $timezone = OC_Calendar_App::getTimezone();
$timezone = new DateTimeZone($timezone);
$start = new DateTime($from.' '.$fromtime, $timezone);
$end = new DateTime($to.' '.$totime, $timezone);
diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php
index 560330f65e9..551489672b9 100644
--- a/apps/calendar/lib/search.php
+++ b/apps/calendar/lib/search.php
@@ -12,7 +12,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
}else{
$searchquery[] = $query;
}
- $user_timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $user_timezone = OC_Calendar_App::getTimezone();
$l = new OC_l10n('calendar');
foreach($calendars as $calendar){
$objects = OC_Calendar_Object::all($calendar['id']);
diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php
index 2246a0178e3..29b9bf6bc54 100644
--- a/apps/calendar/templates/calendar.php
+++ b/apps/calendar/templates/calendar.php
@@ -2,10 +2,10 @@
var defaultView = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') ?>';
var eventSources = <?php echo json_encode($_['eventSources']) ?>;
var categories = <?php echo json_encode($_['categories']); ?>;
- var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>;
- var dayNamesShort = <?php echo json_encode($l->tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>;
- var monthNames = <?php echo json_encode($l->tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>;
- var monthNamesShort = <?php echo json_encode($l->tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>;
+ var dayNames = new Array("<?php echo $l -> t("Sunday");?>", "<?php echo $l -> t("Monday");?>", "<?php echo $l -> t("Tuesday");?>", "<?php echo $l -> t("Wednesday");?>", "<?php echo $l -> t("Thursday");?>", "<?php echo $l -> t("Friday");?>", "<?php echo $l -> t("Saturday");?>");
+ var dayNamesShort = new Array("<?php echo $l -> t("Sun.");?>", "<?php echo $l -> t("Mon.");?>", "<?php echo $l -> t("Tue.");?>", "<?php echo $l -> t("Wed.");?>", "<?php echo $l -> t("Thu.");?>", "<?php echo $l -> t("Fri.");?>", "<?php echo $l -> t("Sat.");?>");
+ var monthNames = new Array("<?php echo $l -> t("January");?>", "<?php echo $l -> t("February");?>", "<?php echo $l -> t("March");?>", "<?php echo $l -> t("April");?>", "<?php echo $l -> t("May");?>", "<?php echo $l -> t("June");?>", "<?php echo $l -> t("July");?>", "<?php echo $l -> t("August");?>", "<?php echo $l -> t("September");?>", "<?php echo $l -> t("October");?>", "<?php echo $l -> t("November");?>", "<?php echo $l -> t("December");?>");
+ var monthNamesShort = new Array("<?php echo $l -> t("Jan.");?>", "<?php echo $l -> t("Feb.");?>", "<?php echo $l -> t("Mar.");?>", "<?php echo $l -> t("Apr.");?>", "<?php echo $l -> t("May.");?>", "<?php echo $l -> t("Jun.");?>", "<?php echo $l -> t("Jul.");?>", "<?php echo $l -> t("Aug.");?>", "<?php echo $l -> t("Sep.");?>", "<?php echo $l -> t("Oct.");?>", "<?php echo $l -> t("Nov.");?>", "<?php echo $l -> t("Dec.");?>");
var agendatime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}';
var defaulttime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>';
var allDayText = '<?php echo addslashes($l->t('All day')) ?>';
diff --git a/apps/contacts/ajax/activation.php b/apps/contacts/ajax/activation.php
index 74cb738ab8f..69173c54c44 100644
--- a/apps/contacts/ajax/activation.php
+++ b/apps/contacts/ajax/activation.php
@@ -16,8 +16,12 @@ $bookid = $_POST['bookid'];
$book = OC_Contacts_App::getAddressbook($bookid);// is owner access check
if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
- OCP\Util::writeLog('contacts','ajax/activation.php: Error activating addressbook: '.$bookid, OCP\Util::ERROR);
- OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
+ OCP\Util::writeLog('contacts',
+ 'ajax/activation.php: Error activating addressbook: '. $bookid,
+ OCP\Util::ERROR);
+ OCP\JSON::error(array(
+ 'data' => array(
+ 'message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
exit();
}
diff --git a/apps/contacts/ajax/addaddressbook.php b/apps/contacts/ajax/addaddressbook.php
index 3d7885fe468..40773704bb4 100644
--- a/apps/contacts/ajax/addaddressbook.php
+++ b/apps/contacts/ajax/addaddressbook.php
@@ -12,13 +12,15 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
-require_once('loghandler.php');
+require_once 'loghandler.php';
debug('name: '.$_POST['name']);
$userid = OCP\USER::getUser();
$name = isset($_POST['name'])?trim(strip_tags($_POST['name'])):null;
-$description = isset($_POST['description'])?trim(strip_tags($_POST['description'])):null;
+$description = isset($_POST['description'])
+ ? trim(strip_tags($_POST['description']))
+ : null;
if(is_null($name)) {
bailOut('Cannot add addressbook with an empty name.');
diff --git a/apps/contacts/ajax/addcontact.php b/apps/contacts/ajax/addcontact.php
index 12f7bb9db96..6aaf5a9df35 100644
--- a/apps/contacts/ajax/addcontact.php
+++ b/apps/contacts/ajax/addcontact.php
@@ -37,13 +37,15 @@ $n = trim($_POST['n']);
$vcard = new OC_VObject('VCARD');
$vcard->setUID();
-$vcard->setString('FN',$fn);
-$vcard->setString('N',$n);
+$vcard->setString('FN', $fn);
+$vcard->setString('N', $n);
$id = OC_Contacts_VCard::add($aid, $vcard, null, $isnew);
if(!$id) {
- OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.'))));
- OCP\Util::writeLog('contacts','ajax/addcontact.php: Recieved non-positive ID on adding card: '.$id, OCP\Util::ERROR);
+ OCP\JSON::error(array(
+ 'data' => array(
+ 'message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.'))));
+ OCP\Util::writeLog('contacts', 'ajax/addcontact.php: Recieved non-positive ID on adding card: '.$id, OCP\Util::ERROR);
exit();
}
diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php
index 1b6db0c8f81..58b857547fb 100644
--- a/apps/contacts/ajax/addproperty.php
+++ b/apps/contacts/ajax/addproperty.php
@@ -25,7 +25,7 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
-require_once('loghandler.php');
+require_once 'loghandler.php';
$id = isset($_POST['id'])?$_POST['id']:null;
$name = isset($_POST['name'])?$_POST['name']:null;
@@ -33,22 +33,27 @@ $value = isset($_POST['value'])?$_POST['value']:null;
$parameters = isset($_POST['parameters'])?$_POST['parameters']:array();
$vcard = OC_Contacts_App::getContactVCard($id);
+$l10n = OC_Contacts_App::$l10n;
if(!$name) {
- bailOut(OC_Contacts_App::$l10n->t('element name is not set.'));
+ bailOut($l10n->t('element name is not set.'));
}
if(!$id) {
- bailOut(OC_Contacts_App::$l10n->t('id is not set.'));
+ bailOut($l10n->t('id is not set.'));
}
if(!$vcard) {
- bailOut(OC_Contacts_App::$l10n->t('Could not parse contact: ').$id);
+ bailOut($l10n->t('Could not parse contact: ').$id);
}
-if(!is_array($value)){
+if(!is_array($value)) {
$value = trim($value);
- if(!$value && in_array($name, array('TEL', 'EMAIL', 'ORG', 'BDAY', 'URL', 'NICKNAME', 'NOTE'))) {
- bailOut(OC_Contacts_App::$l10n->t('Cannot add empty property.'));
+ if(!$value
+ && in_array(
+ $name,
+ array('TEL', 'EMAIL', 'ORG', 'BDAY', 'URL', 'NICKNAME', 'NOTE'))
+ ) {
+ bailOut($l10n->t('Cannot add empty property.'));
}
} elseif($name === 'ADR') { // only add if non-empty elements.
$empty = true;
@@ -59,7 +64,7 @@ if(!is_array($value)){
}
}
if($empty) {
- bailOut(OC_Contacts_App::$l10n->t('At least one of the address fields has to be filled out.'));
+ bailOut($l10n->t('At least one of the address fields has to be filled out.'));
}
}
@@ -68,12 +73,14 @@ $current = $vcard->select($name);
foreach($current as $item) {
$tmpvalue = (is_array($value)?implode(';', $value):$value);
if($tmpvalue == $item->value) {
- bailOut(OC_Contacts_App::$l10n->t('Trying to add duplicate property: '.$name.': '.$tmpvalue));
+ bailOut($l10n->t('Trying to add duplicate property: '.$name.': '.$tmpvalue));
}
}
if(is_array($value)) {
- ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
+ // NOTE: Important, otherwise the compound value will
+ // be set in the order the fields appear in the form!
+ ksort($value);
$value = array_map('strip_tags', $value);
} else {
$value = strip_tags($value);
@@ -116,24 +123,25 @@ switch($name) {
$line = count($vcard->children) - 1;
-// Apparently Sabre_VObject_Parameter doesn't do well with multiple values or I don't know how to do it. Tanghus.
+// Apparently Sabre_VObject_Parameter doesn't do well with
+// multiple values or I don't know how to do it. Tanghus.
foreach ($parameters as $key=>$element) {
if(is_array($element) && strtoupper($key) == 'TYPE') {
// NOTE: Maybe this doesn't only apply for TYPE?
// And it probably shouldn't be done here anyways :-/
- foreach($element as $e){
- if($e != '' && !is_null($e)){
- $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key,$e);
+ foreach($element as $e) {
+ if($e != '' && !is_null($e)) {
+ $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $e);
}
}
} else {
- $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key,$element);
+ $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $element);
}
}
$checksum = md5($vcard->children[$line]->serialize());
-if(!OC_Contacts_VCard::edit($id,$vcard)) {
- bailOut(OC_Contacts_App::$l10n->t('Error adding contact property: '.$name));
+if(!OC_Contacts_VCard::edit($id, $vcard)) {
+ bailOut($l10n->t('Error adding contact property: '.$name));
}
OCP\JSON::success(array('data' => array( 'checksum' => $checksum )));
diff --git a/apps/contacts/ajax/categories/categoriesfor.php b/apps/contacts/ajax/categories/categoriesfor.php
index 6b6fcad0ebb..8391b14b545 100644
--- a/apps/contacts/ajax/categories/categoriesfor.php
+++ b/apps/contacts/ajax/categories/categoriesfor.php
@@ -12,16 +12,23 @@ OCP\JSON::checkAppEnabled('contacts');
$id = isset($_GET['id'])?$_GET['id']:null;
if(is_null($id)) {
- OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('No ID provided'))));
+ OCP\JSON::error(array(
+ 'data' => array(
+ 'message' => OC_Contacts_App::$l10n->t('No ID provided'))));
exit();
}
$vcard = OC_Contacts_App::getContactVCard( $id );
foreach($vcard->children as $property){
- //OCP\Util::writeLog('contacts','ajax/categories/checksumfor.php: '.$property->name, OCP\Util::DEBUG);
if($property->name == 'CATEGORIES') {
$checksum = md5($property->serialize());
- OCP\JSON::success(array('data' => array('value'=>$property->value, 'checksum'=>$checksum)));
+ OCP\JSON::success(array(
+ 'data' => array(
+ 'value' => $property->value,
+ 'checksum' => $checksum,
+ )));
exit();
}
}
-OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));
+OCP\JSON::error(array(
+ 'data' => array(
+ 'message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));
diff --git a/apps/contacts/ajax/categories/delete.php b/apps/contacts/ajax/categories/delete.php
index 7c3261446bb..bc9f3e14e87 100644
--- a/apps/contacts/ajax/categories/delete.php
+++ b/apps/contacts/ajax/categories/delete.php
@@ -9,8 +9,9 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
+OCP\JSON::callCheck();
-require_once('../loghandler.php');
+require_once __DIR__.'/../loghandler.php';
$categories = isset($_POST['categories'])?$_POST['categories']:null;
diff --git a/apps/contacts/ajax/categories/rescan.php b/apps/contacts/ajax/categories/rescan.php
index fd875a965dc..a06e7803955 100644
--- a/apps/contacts/ajax/categories/rescan.php
+++ b/apps/contacts/ajax/categories/rescan.php
@@ -9,6 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
+OCP\JSON::callCheck();
OC_Contacts_App::scanCategories();
$categories = OC_Contacts_App::getCategories();
diff --git a/apps/contacts/ajax/contactdetails.php b/apps/contacts/ajax/contactdetails.php
index b697b1a8e5b..27d7611ade9 100644
--- a/apps/contacts/ajax/contactdetails.php
+++ b/apps/contacts/ajax/contactdetails.php
@@ -20,7 +20,7 @@
*
*/
-require_once('loghandler.php');
+require_once 'loghandler.php';
// Check if we are a user
OCP\JSON::checkLoggedIn();
@@ -30,6 +30,7 @@ $id = isset($_GET['id'])?$_GET['id']:null;
if(is_null($id)) {
bailOut(OC_Contacts_App::$l10n->t('Missing ID'));
}
+$card = OC_Contacts_VCard::find($id);
$vcard = OC_Contacts_App::getContactVCard( $id );
if(is_null($vcard)) {
bailOut(OC_Contacts_App::$l10n->t('Error parsing VCard for ID: "'.$id.'"'));
@@ -50,5 +51,7 @@ if(isset($details['PHOTO'])) {
$details['PHOTO'] = false;
}
$details['id'] = $id;
+$details['displayname'] = $card['fullname'];
+$details['addressbookid'] = $card['addressbookid'];
OC_Contacts_App::setLastModifiedHeader($vcard);
OCP\JSON::success(array('data' => $details));
diff --git a/apps/contacts/ajax/createaddressbook.php b/apps/contacts/ajax/createaddressbook.php
index 2ec5f542bb3..8dbd63f6425 100644
--- a/apps/contacts/ajax/createaddressbook.php
+++ b/apps/contacts/ajax/createaddressbook.php
@@ -12,7 +12,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
-require_once('loghandler.php');
+require_once 'loghandler.php';
$userid = OCP\USER::getUser();
$name = trim(strip_tags($_POST['name']));
diff --git a/apps/contacts/ajax/currentphoto.php b/apps/contacts/ajax/currentphoto.php
index 8f60eca08ec..96080e661ef 100644
--- a/apps/contacts/ajax/currentphoto.php
+++ b/apps/contacts/ajax/currentphoto.php
@@ -24,7 +24,7 @@
OCP\JSON::setContentTypeHeader('text/plain');
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
-require_once('loghandler.php');
+require_once 'loghandler.php';
if (!isset($_GET['id'])) {
bailOut(OC_Contacts_App::$l10n->t('No contact ID was submitted.'));
diff --git a/apps/contacts/ajax/deletecard.php b/apps/contacts/ajax/deletecard.php
index 1161c18abda..9777046fc82 100644
--- a/apps/contacts/ajax/deletecard.php
+++ b/apps/contacts/ajax/deletecard.php
@@ -23,17 +23,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
-require_once('loghandler.php');
-
-// foreach($_SERVER as $key=>$value) {
-// OCP\Util::writeLog('contacts','ajax/saveproperty.php: _SERVER: '.$key.'=>'.$value, OCP\Util::DEBUG);
-// }
-// foreach($_POST as $key=>$value) {
-// debug($key.'=>'.print_r($value, true));
-// }
-// foreach($_GET as $key=>$value) {
-// debug($key.'=>'.print_r($value, true));
-// }
+require_once 'loghandler.php';
$id = isset($_POST['id'])?$_POST['id']:null;
if(!$id) {
diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php
index 90e5e64903e..205df8bc184 100644
--- a/apps/contacts/ajax/deleteproperty.php
+++ b/apps/contacts/ajax/deleteproperty.php
@@ -24,22 +24,23 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
-require_once('loghandler.php');
+require_once 'loghandler.php';
$id = $_POST['id'];
$checksum = $_POST['checksum'];
+$l10n = OC_Contacts_App::$l10n;
$vcard = OC_Contacts_App::getContactVCard( $id );
$line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum);
-if(is_null($line)){
- bailOut(OC_Contacts_App::$l10n->t('Information about vCard is incorrect. Please reload the page.'));
+if(is_null($line)) {
+ bailOut($l10n->t('Information about vCard is incorrect. Please reload the page.'));
exit();
}
unset($vcard->children[$line]);
-if(!OC_Contacts_VCard::edit($id,$vcard)) {
- bailOut(OC_Contacts_App::$l10n->t('Error deleting contact property.'));
+if(!OC_Contacts_VCard::edit($id, $vcard)) {
+ bailOut($l10n->t('Error deleting contact property.'));
}
OCP\JSON::success(array('data' => array( 'id' => $id )));
diff --git a/apps/contacts/ajax/editaddress.php b/apps/contacts/ajax/editaddress.php
index 1eb9429d79c..b5e4b72ed57 100644
--- a/apps/contacts/ajax/editaddress.php
+++ b/apps/contacts/ajax/editaddress.php
@@ -34,8 +34,8 @@ if($checksum) {
$tmpl->assign('adr', $adr, false);
}
-$tmpl->assign('id',$id);
-$tmpl->assign('adr_types',$adr_types);
+$tmpl->assign('id', $id);
+$tmpl->assign('adr_types', $adr_types);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array('page'=>$page, 'checksum'=>$checksum)));
diff --git a/apps/contacts/ajax/editname.php b/apps/contacts/ajax/editname.php
index 9e7c090eeed..eb55634011d 100644
--- a/apps/contacts/ajax/editname.php
+++ b/apps/contacts/ajax/editname.php
@@ -9,7 +9,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
-require_once('loghandler.php');
+require_once 'loghandler.php';
$tmpl = new OCP\Template("contacts", "part.edit_name_dialog");
@@ -25,8 +25,8 @@ if($id) {
}
}
$name = array_map('htmlspecialchars', $name['value']);
- $tmpl->assign('name',$name, false);
- $tmpl->assign('id',$id, false);
+ $tmpl->assign('name', $name, false);
+ $tmpl->assign('id', $id, false);
} else {
bailOut(OC_Contacts_App::$l10n->t('Contact ID is missing.'));
}
diff --git a/apps/contacts/ajax/loadcard.php b/apps/contacts/ajax/loadcard.php
index 1309faaa7a2..75fe33ada6f 100644
--- a/apps/contacts/ajax/loadcard.php
+++ b/apps/contacts/ajax/loadcard.php
@@ -30,20 +30,20 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
$requesttoken = $_GET['requesttoken'];
$freeSpace=OC_Filesystem::free_space('/');
-$freeSpace=max($freeSpace,0);
-$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
+$freeSpace=max($freeSpace, 0);
+$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
$adr_types = OC_Contacts_App::getTypesOfProperty('ADR');
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
$email_types = OC_Contacts_App::getTypesOfProperty('EMAIL');
-$tmpl = new OCP\Template('contacts','part.contact');
+$tmpl = new OCP\Template('contacts', 'part.contact');
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
-$tmpl->assign('adr_types',$adr_types);
-$tmpl->assign('phone_types',$phone_types);
-$tmpl->assign('email_types',$email_types);
+$tmpl->assign('adr_types', $adr_types);
+$tmpl->assign('phone_types', $phone_types);
+$tmpl->assign('email_types', $email_types);
$tmpl->assign('requesttoken', $requesttoken);
-$tmpl->assign('id','');
+$tmpl->assign('id', '');
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array( 'page' => $page )));
diff --git a/apps/contacts/ajax/loadintro.php b/apps/contacts/ajax/loadintro.php
index 6e8fcc4b049..1da08950ca0 100644
--- a/apps/contacts/ajax/loadintro.php
+++ b/apps/contacts/ajax/loadintro.php
@@ -25,7 +25,7 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
-$tmpl = new OCP\Template('contacts','part.no_contacts');
+$tmpl = new OCP\Template('contacts', 'part.no_contacts');
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array( 'page' => $page )));
diff --git a/apps/contacts/ajax/loadphoto.php b/apps/contacts/ajax/loadphoto.php
index a35631055eb..be924b5db4d 100644
--- a/apps/contacts/ajax/loadphoto.php
+++ b/apps/contacts/ajax/loadphoto.php
@@ -24,7 +24,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
-require_once('loghandler.php');
+require_once 'loghandler.php';
$id = isset($_GET['id']) ? $_GET['id'] : '';
$refresh = isset($_GET['refresh']) ? true : false;
diff --git a/apps/contacts/ajax/loghandler.php b/apps/contacts/ajax/loghandler.php
index 831b2e50c1e..be4b98c1112 100644
--- a/apps/contacts/ajax/loghandler.php
+++ b/apps/contacts/ajax/loghandler.php
@@ -20,13 +20,15 @@
*
*/
-function bailOut($msg, $tracelevel=1, $debuglevel=OCP\Util::ERROR) {
+function bailOut($msg, $tracelevel=1, $debuglevel=OCP\Util::ERROR)
+{
OCP\JSON::error(array('data' => array('message' => $msg)));
debug($msg, $tracelevel, $debuglevel);
exit();
}
-function debug($msg, $tracelevel=0, $debuglevel=OCP\Util::DEBUG) {
+function debug($msg, $tracelevel=0, $debuglevel=OCP\Util::DEBUG)
+{
if(PHP_VERSION >= "5.4") {
$call = debug_backtrace(false, $tracelevel+1);
} else {
@@ -35,6 +37,8 @@ function debug($msg, $tracelevel=0, $debuglevel=OCP\Util::DEBUG) {
error_log('trace: '.print_r($call, true));
$call = $call[$tracelevel];
if($debuglevel !== false) {
- OCP\Util::writeLog('contacts', $call['file'].'. Line: '.$call['line'].': '.$msg, $debuglevel);
+ OCP\Util::writeLog('contacts',
+ $call['file'].'. Line: '.$call['line'].': '.$msg,
+ $debuglevel);
}
}
diff --git a/apps/contacts/ajax/oc_photo.php b/apps/contacts/ajax/oc_photo.php
index 710179fffcc..fe37b530f82 100644
--- a/apps/contacts/ajax/oc_photo.php
+++ b/apps/contacts/ajax/oc_photo.php
@@ -22,7 +22,7 @@
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
-require_once('loghandler.php');
+require_once 'loghandler.php';
if(!isset($_GET['id'])) {
bailOut(OC_Contacts_App::$l10n->t('No contact ID was submitted.'));
@@ -50,7 +50,9 @@ if($image->width() > 400 || $image->height() > 400) {
$image->resize(400); // Prettier resizing than with browser and saves bandwidth.
}
if(!$image->fixOrientation()) { // No fatal error so we don't bail out.
- OCP\Util::writeLog('contacts','ajax/oc_photo.php: Couldn\'t save correct image orientation: '.$localpath, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts',
+ 'ajax/oc_photo.php: Couldn\'t save correct image orientation: '.$localpath,
+ OCP\Util::DEBUG);
}
if(OC_Cache::set($tmpkey, $image->data(), 600)) {
OCP\JSON::success(array('data' => array('id'=>$_GET['id'], 'tmp'=>$tmpkey)));
diff --git a/apps/contacts/ajax/savecrop.php b/apps/contacts/ajax/savecrop.php
index adce6be3b39..8ee2e46bf0c 100644
--- a/apps/contacts/ajax/savecrop.php
+++ b/apps/contacts/ajax/savecrop.php
@@ -27,7 +27,7 @@ OCP\JSON::callCheck();
// Firefox and Konqueror tries to download application/json for me. --Arthur
OCP\JSON::setContentTypeHeader('text/plain');
-require_once('loghandler.php');
+require_once 'loghandler.php';
$image = null;
@@ -48,7 +48,7 @@ if($id == '') {
bailOut('Missing contact id.');
}
-OCP\Util::writeLog('contacts','savecrop.php: key: '.$tmpkey, OCP\Util::DEBUG);
+OCP\Util::writeLog('contacts', 'savecrop.php: key: '.$tmpkey, OCP\Util::DEBUG);
$data = OC_Cache::get($tmpkey);
if($data) {
@@ -56,7 +56,9 @@ if($data) {
if($image->loadFromdata($data)) {
$w = ($w != -1 ? $w : $image->width());
$h = ($h != -1 ? $h : $image->height());
- OCP\Util::writeLog('contacts','savecrop.php, x: '.$x1.' y: '.$y1.' w: '.$w.' h: '.$h, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts',
+ 'savecrop.php, x: '.$x1.' y: '.$y1.' w: '.$w.' h: '.$h,
+ OCP\Util::DEBUG);
if($image->crop($x1, $y1, $w, $h)) {
if(($image->width() <= 200 && $image->height() <= 200) || $image->resize(200)) {
$card = OC_Contacts_App::getContactVCard($id);
@@ -65,7 +67,9 @@ if($data) {
bailOut(OC_Contacts_App::$l10n->t('Error getting contact object.'));
}
if($card->__isset('PHOTO')) {
- OCP\Util::writeLog('contacts','savecrop.php: PHOTO property exists.', OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts',
+ 'savecrop.php: PHOTO property exists.',
+ OCP\Util::DEBUG);
$property = $card->__get('PHOTO');
if(!$property) {
OC_Cache::remove($tmpkey);
@@ -76,12 +80,16 @@ if($data) {
$property->parameters[] = new Sabre_VObject_Parameter('TYPE', $image->mimeType());
$card->__set('PHOTO', $property);
} else {
- OCP\Util::writeLog('contacts','savecrop.php: files: Adding PHOTO property.', OCP\Util::DEBUG);
- $card->addProperty('PHOTO', $image->__toString(), array('ENCODING' => 'b', 'TYPE' => $image->mimeType()));
+ OCP\Util::writeLog('contacts',
+ 'savecrop.php: files: Adding PHOTO property.',
+ OCP\Util::DEBUG);
+ $card->addProperty('PHOTO',
+ $image->__toString(), array('ENCODING' => 'b',
+ 'TYPE' => $image->mimeType()));
}
$now = new DateTime;
$card->setString('REV', $now->format(DateTime::W3C));
- if(!OC_Contacts_VCard::edit($id,$card)) {
+ if(!OC_Contacts_VCard::edit($id, $card)) {
bailOut(OC_Contacts_App::$l10n->t('Error saving contact.'));
}
$tmpl = new OCP\Template("contacts", "part.contactphoto");
diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php
index 34fc3cc5351..5d743c99df4 100644
--- a/apps/contacts/ajax/saveproperty.php
+++ b/apps/contacts/ajax/saveproperty.php
@@ -19,7 +19,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
-require_once('loghandler.php');
+require_once 'loghandler.php';
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
@@ -39,9 +39,11 @@ if(!$id) {
if(!$checksum) {
bailOut(OC_Contacts_App::$l10n->t('checksum is not set.'));
}
-if(is_array($value)){
+if(is_array($value)) {
$value = array_map('strip_tags', $value);
- ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
+ // NOTE: Important, otherwise the compound value will be
+ // set in the order the fields appear in the form!
+ ksort($value);
//if($name == 'CATEGORIES') {
// $value = OC_Contacts_VCard::escapeDelimiters($value, ',');
//} else {
@@ -66,8 +68,7 @@ if($element != $name) {
switch($element) {
case 'BDAY':
$date = New DateTime($value);
- //$vcard->setDateTime('BDAY', $date, Sabre_VObject_Element_DateTime::DATE);
- $value = $date->format(DateTime::ATOM);
+ $value = $date->format('Y-m-d');
break;
case 'FN':
if(!$value) {
@@ -89,6 +90,14 @@ if(!$value) {
} else {
/* setting value */
switch($element) {
+ case 'BDAY':
+ // I don't use setDateTime() because that formats it as YYYYMMDD instead of YYYY-MM-DD
+ // which is what the RFC recommends.
+ $vcard->children[$line]->setValue($value);
+ $vcard->children[$line]->parameters = array();
+ $vcard->children[$line]->add(new Sabre_VObject_Parameter('VALUE', 'DATE'));
+ debug('Setting value:'.$name.' '.$vcard->children[$line]);
+ break;
case 'CATEGORIES':
debug('Setting string:'.$name.' '.$value);
$vcard->children[$line]->setValue($value);
@@ -120,7 +129,7 @@ if(!$value) {
}
//debug('New checksum: '.$checksum);
-if(!OC_Contacts_VCard::edit($id,$vcard)) {
+if(!OC_Contacts_VCard::edit($id, $vcard)) {
bailOut(OC_Contacts_App::$l10n->t('Error updating contact property.'));
exit();
}
diff --git a/apps/contacts/ajax/updateaddressbook.php b/apps/contacts/ajax/updateaddressbook.php
index d3a772c727f..a14b2158431 100644
--- a/apps/contacts/ajax/updateaddressbook.php
+++ b/apps/contacts/ajax/updateaddressbook.php
@@ -11,7 +11,7 @@
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
-require_once('loghandler.php');
+require_once 'loghandler.php';
$bookid = $_POST['id'];
OC_Contacts_App::getAddressbook($bookid); // is owner access check
diff --git a/apps/contacts/ajax/uploadimport.php b/apps/contacts/ajax/uploadimport.php
index 3c5a2d750ed..87032b731a5 100644
--- a/apps/contacts/ajax/uploadimport.php
+++ b/apps/contacts/ajax/uploadimport.php
@@ -24,7 +24,9 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
-require_once('loghandler.php');
+require_once 'loghandler.php';
+
+$l10n = OC_Contacts_App::$l10n;
$view = OCP\Files::getStorage('contacts');
if(!$view->file_exists('imports')) {
@@ -39,25 +41,29 @@ if($fn) {
OCP\JSON::success(array('data' => array('file'=>$tmpfile, 'name'=>$fn)));
exit();
} else {
- bailOut(OC_Contacts_App::$l10n->t('Error uploading contacts to storage.'));
+ bailOut($l10n->t('Error uploading contacts to storage.'));
}
}
// File input transfers are handled here
if (!isset($_FILES['importfile'])) {
- OCP\Util::writeLog('contacts','ajax/uploadphoto.php: No file was uploaded. Unknown error.', OCP\Util::DEBUG);
- OCP\JSON::error(array('data' => array( 'message' => 'No file was uploaded. Unknown error' )));
+ OCP\Util::writeLog('contacts',
+ 'ajax/uploadphoto.php: No file was uploaded. Unknown error.',
+ OCP\Util::DEBUG);
+ OCP\JSON::error(array('
+ data' => array(
+ 'message' => 'No file was uploaded. Unknown error' )));
exit();
}
$error = $_FILES['importfile']['error'];
if($error !== UPLOAD_ERR_OK) {
$errors = array(
- 0=>OC_Contacts_App::$l10n->t("There is no error, the file uploaded with success"),
- 1=>OC_Contacts_App::$l10n->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'),
- 2=>OC_Contacts_App::$l10n->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"),
- 3=>OC_Contacts_App::$l10n->t("The uploaded file was only partially uploaded"),
- 4=>OC_Contacts_App::$l10n->t("No file was uploaded"),
- 6=>OC_Contacts_App::$l10n->t("Missing a temporary folder")
+ 0=>$l10n->t("There is no error, the file uploaded with success"),
+ 1=>$l10n->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'),
+ 2=>$l10n->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"),
+ 3=>$l10n->t("The uploaded file was only partially uploaded"),
+ 4=>$l10n->t("No file was uploaded"),
+ 6=>$l10n->t("Missing a temporary folder")
);
bailOut($errors[$error]);
}
@@ -67,7 +73,7 @@ if(file_exists($file['tmp_name'])) {
if($view->file_put_contents('/imports/'.$file['name'], file_get_contents($file['tmp_name']))) {
OCP\JSON::success(array('data' => array('file'=>$file['name'], 'name'=>$file['name'])));
} else {
- bailOut(OC_Contacts_App::$l10n->t('Error uploading contacts to storage.'));
+ bailOut($l10n->t('Error uploading contacts to storage.'));
}
} else {
bailOut('Temporary file: \''.$file['tmp_name'].'\' has gone AWOL?');
diff --git a/apps/contacts/ajax/uploadphoto.php b/apps/contacts/ajax/uploadphoto.php
index 6bb3fe8a5e0..4cd38db8c72 100644
--- a/apps/contacts/ajax/uploadphoto.php
+++ b/apps/contacts/ajax/uploadphoto.php
@@ -27,13 +27,13 @@ OCP\JSON::callCheck();
// Firefox and Konqueror tries to download application/json for me. --Arthur
OCP\JSON::setContentTypeHeader('text/plain');
-require_once('loghandler.php');
-
+require_once 'loghandler.php';
+$l10n = OC_Contacts_App::$l10n;
// If it is a Drag'n'Drop transfer it's handled here.
$fn = (isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : false);
if ($fn) {
if (!isset($_GET['id'])) {
- bailOut(OC_Contacts_App::$l10n->t('No contact ID was submitted.'));
+ bailOut($l10n->t('No contact ID was submitted.'));
}
$id = $_GET['id'];
$tmpkey = 'contact-photo-'.md5($fn);
@@ -48,33 +48,38 @@ if ($fn) {
debug('Couldn\'t save correct image orientation: '.$tmpkey);
}
if(OC_Cache::set($tmpkey, $image->data(), 600)) {
- OCP\JSON::success(array('data' => array('mime'=>$_SERVER['CONTENT_TYPE'], 'name'=>$fn, 'id'=>$id, 'tmp'=>$tmpkey)));
+ OCP\JSON::success(array(
+ 'data' => array(
+ 'mime'=>$_SERVER['CONTENT_TYPE'],
+ 'name'=>$fn,
+ 'id'=>$id,
+ 'tmp'=>$tmpkey)));
exit();
} else {
- bailOut(OC_Contacts_App::$l10n->t('Couldn\'t save temporary image: ').$tmpkey);
+ bailOut($l10n->t('Couldn\'t save temporary image: ').$tmpkey);
}
} else {
- bailOut(OC_Contacts_App::$l10n->t('Couldn\'t load temporary image: ').$tmpkey);
+ bailOut($l10n->t('Couldn\'t load temporary image: ').$tmpkey);
}
}
// Uploads from file dialog are handled here.
if (!isset($_POST['id'])) {
- bailOut(OC_Contacts_App::$l10n->t('No contact ID was submitted.'));
+ bailOut($l10n->t('No contact ID was submitted.'));
}
if (!isset($_FILES['imagefile'])) {
- bailOut(OC_Contacts_App::$l10n->t('No file was uploaded. Unknown error'));
+ bailOut($l10n->t('No file was uploaded. Unknown error'));
}
$error = $_FILES['imagefile']['error'];
if($error !== UPLOAD_ERR_OK) {
$errors = array(
- 0=>OC_Contacts_App::$l10n->t("There is no error, the file uploaded with success"),
- 1=>OC_Contacts_App::$l10n->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'),
- 2=>OC_Contacts_App::$l10n->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"),
- 3=>OC_Contacts_App::$l10n->t("The uploaded file was only partially uploaded"),
- 4=>OC_Contacts_App::$l10n->t("No file was uploaded"),
- 6=>OC_Contacts_App::$l10n->t("Missing a temporary folder")
+ 0=>$l10n->t("There is no error, the file uploaded with success"),
+ 1=>$l10n->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'),
+ 2=>$l10n->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"),
+ 3=>$l10n->t("The uploaded file was only partially uploaded"),
+ 4=>$l10n->t("No file was uploaded"),
+ 6=>$l10n->t("Missing a temporary folder")
);
bailOut($errors[$error]);
}
@@ -91,13 +96,20 @@ if(file_exists($file['tmp_name'])) {
debug('Couldn\'t save correct image orientation: '.$tmpkey);
}
if(OC_Cache::set($tmpkey, $image->data(), 600)) {
- OCP\JSON::success(array('data' => array('mime'=>$file['type'],'size'=>$file['size'],'name'=>$file['name'], 'id'=>$_POST['id'], 'tmp'=>$tmpkey)));
+ OCP\JSON::success(array(
+ 'data' => array(
+ 'mime'=>$file['type'],
+ 'size'=>$file['size'],
+ 'name'=>$file['name'],
+ 'id'=>$_POST['id'],
+ 'tmp'=>$tmpkey,
+ )));
exit();
} else {
- bailOut(OC_Contacts_App::$l10n->t('Couldn\'t save temporary image: ').$tmpkey);
+ bailOut($l10n->t('Couldn\'t save temporary image: ').$tmpkey);
}
} else {
- bailOut(OC_Contacts_App::$l10n->t('Couldn\'t load temporary image: ').$file['tmp_name']);
+ bailOut($l10n->t('Couldn\'t load temporary image: ').$file['tmp_name']);
}
} else {
bailOut('Temporary file: \''.$file['tmp_name'].'\' has gone AWOL?');
diff --git a/apps/contacts/appinfo/app.php b/apps/contacts/appinfo/app.php
index 33e89c3e9be..cbbbbc79e58 100644
--- a/apps/contacts/appinfo/app.php
+++ b/apps/contacts/appinfo/app.php
@@ -19,6 +19,6 @@ OCP\App::addNavigationEntry( array(
'name' => OC_L10N::get('contacts')->t('Contacts') ));
-OCP\App::registerPersonal('contacts','settings');
+OCP\App::registerPersonal('contacts', 'settings');
OCP\Util::addscript('contacts', 'loader');
OC_Search::registerProvider('OC_Search_Provider_Contacts');
diff --git a/apps/contacts/appinfo/database.xml b/apps/contacts/appinfo/database.xml
index 9b269d765dc..b814b0f1516 100644
--- a/apps/contacts/appinfo/database.xml
+++ b/apps/contacts/appinfo/database.xml
@@ -44,7 +44,7 @@
<type>text</type>
<default></default>
<notnull>false</notnull>
- <length>100</length>
+ <length>200</length>
</field>
<field>
@@ -118,7 +118,7 @@
<type>text</type>
<default></default>
<notnull>false</notnull>
- <length>100</length>
+ <length>200</length>
</field>
<field>
diff --git a/apps/contacts/appinfo/migrate.php b/apps/contacts/appinfo/migrate.php
index 02026c5979c..2559b4ea456 100644
--- a/apps/contacts/appinfo/migrate.php
+++ b/apps/contacts/appinfo/migrate.php
@@ -2,7 +2,7 @@
class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
// Create the xml for the user supplied
- function export( ){
+ function export( ) {
$options = array(
'table'=>'contacts_addressbooks',
'matchcol'=>'userid',
@@ -21,9 +21,8 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
$ids2 = $this->content->copyRows( $options );
// If both returned some ids then they worked
- if( is_array( $ids ) && is_array( $ids2 ) )
- {
- return true;
+ if(is_array($ids) && is_array($ids2)) {
+ return true;
} else {
return false;
}
@@ -31,14 +30,14 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
}
// Import function for contacts
- function import( ){
- switch( $this->appinfo->version ){
+ function import( ) {
+ switch( $this->appinfo->version ) {
default:
// All versions of the app have had the same db structure, so all can use the same import function
$query = $this->content->prepare( "SELECT * FROM contacts_addressbooks WHERE userid LIKE ?" );
$results = $query->execute( array( $this->olduid ) );
$idmap = array();
- while( $row = $results->fetchRow() ){
+ while( $row = $results->fetchRow() ) {
// Import each addressbook
$addressbookquery = OCP\DB::prepare( "INSERT INTO *PREFIX*contacts_addressbooks (`userid`, `displayname`, `uri`, `description`, `ctag`) VALUES (?, ?, ?, ?, ?)" );
$addressbookquery->execute( array( $this->uid, $row['displayname'], $row['uri'], $row['description'], $row['ctag'] ) );
@@ -48,7 +47,7 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
OC_Contacts_Addressbook::setActive($idmap[$row['id']], true);
}
// Now tags
- foreach($idmap as $oldid => $newid){
+ foreach($idmap as $oldid => $newid) {
$query = $this->content->prepare( "SELECT * FROM contacts_cards WHERE addressbookid LIKE ?" );
$results = $query->execute( array( $oldid ) );
diff --git a/apps/contacts/appinfo/remote.php b/apps/contacts/appinfo/remote.php
index 09c2de17990..fd5604aec6f 100644
--- a/apps/contacts/appinfo/remote.php
+++ b/apps/contacts/appinfo/remote.php
@@ -22,7 +22,7 @@
OCP\App::checkAppEnabled('contacts');
-if(substr($_SERVER["REQUEST_URI"],0,strlen(OC_App::getAppWebPath('contacts').'/carddav.php')) == OC_App::getAppWebPath('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';
}
@@ -45,7 +45,7 @@ $nodes = array(
$server = new Sabre_DAV_Server($nodes);
$server->setBaseUri($baseuri);
// Add plugins
-$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud'));
+$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, 'ownCloud'));
$server->addPlugin(new Sabre_CardDAV_Plugin());
$server->addPlugin(new Sabre_DAVACL_Plugin());
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
diff --git a/apps/contacts/appinfo/update.php b/apps/contacts/appinfo/update.php
index 873899f578b..21e736bb446 100644
--- a/apps/contacts/appinfo/update.php
+++ b/apps/contacts/appinfo/update.php
@@ -1,7 +1,7 @@
<?php
$installedVersion=OCP\Config::getAppValue('contacts', 'installed_version');
-if (version_compare($installedVersion, '0.2.90', '<')) {
+if (version_compare($installedVersion, '0.2.3', '<')) {
// First set all address books in-active.
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=0' );
$result = $stmt->execute(array());
diff --git a/apps/contacts/appinfo/version b/apps/contacts/appinfo/version
index 373f8c6f073..72f9fa82020 100644
--- a/apps/contacts/appinfo/version
+++ b/apps/contacts/appinfo/version
@@ -1 +1 @@
-0.2.3 \ No newline at end of file
+0.2.4 \ No newline at end of file
diff --git a/apps/contacts/carddav.php b/apps/contacts/carddav.php
index e0579e625d7..264eb30836b 100644
--- a/apps/contacts/carddav.php
+++ b/apps/contacts/carddav.php
@@ -1,6 +1,6 @@
<?php
-if(!file_exists('../../lib/base.php')){
+if(!file_exists('../../lib/base.php')) {
die('Please update the path to /lib/base.php in carddav.php or make use of /remote.php/carddav/');
}
-require_once('../../lib/base.php');
-require_once('appinfo/remote.php'); \ No newline at end of file
+require_once '../../lib/base.php';
+require_once 'appinfo/remote.php'; \ No newline at end of file
diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css
index de7950ecc61..927e7309807 100644
--- a/apps/contacts/css/contacts.css
+++ b/apps/contacts/css/contacts.css
@@ -5,18 +5,18 @@
#leftcontent a { padding: 0 0 0 25px; }
#rightcontent { top: 3.5em !important; padding-top: 5px; }
#leftcontent h3 { cursor: pointer; -moz-transition: background 300ms ease 0s; background: none no-repeat scroll 1em center #eee; border-bottom: 1px solid #ddd; border-top: 1px solid #fff; display: block; max-width: 100%; padding: 0.5em 0.8em; color: #666; text-shadow: 0 1px 0 #f8f8f8; font-size: 1.2em; }
-#leftcontent h3:hover,#leftcontent h3:active,#leftcontent h3.active { background-color: #DBDBDB; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #D4D4D4; color: #333333; }
+#leftcontent h3:hover,#leftcontent h3:active,#leftcontent h3.active { background-color: #DBDBDB; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #D4D4D4; color: #333333; font-weight: bold; }
#contacts { position: fixed; background: #fff; max-width: 100%; width: 20em; left: 12.5em; top: 3.7em; bottom: 3em; overflow: auto; padding: 0; margin: 0; }
.contacts a { height: 23px; display: block; left: 12.5em; margin: 0 0 0 0; padding: 0 0 0 25px; }
.contacts li.ui-draggable { height: 23px; }
-.ui-draggable-dragging { width: 16em; }
+.ui-draggable-dragging { width: 17em; cursor: move; }
.ui-state-hover { border: 1px solid dashed; }
#bottomcontrols { padding: 0; bottom:0px; height:2.8em; width: 20em; margin:0; background:#eee; border-top:1px solid #ccc; position:fixed; -moz-box-shadow: 0 -3px 3px -3px #000; -webkit-box-shadow: 0 -3px 3px -3px #000; box-shadow: 0 -3px 3px -3px #000;}
#bottomcontrols img { margin-top: 0.35em; }
#uploadprogressbar { display: none; padding: 0; bottom: 3em; height:2em; width: 20em; margin:0; background:#eee; border:1px solid #ccc; position:fixed; }
#contacts_newcontact, #contacts_import, #chooseaddressbook { float: left; margin: 0.2em 0 0 1em; border: 0 none; border-radius: 0; -moz-box-shadow: none; box-shadow: none; outline: 0 none; }
#chooseaddressbook { float: right; margin: 0.2em 1em 0 0; }
-#actionbar { position: relative; clear: both; height: 30px;}
+#actionbar { clear: both; height: 30px;}
#contacts_deletecard {position:relative; float:left; background:url('%webroot%/core/img/actions/delete.svg') no-repeat center; }
#contacts_downloadcard {position:relative; float:left; background:url('%webroot%/core/img/actions/download.svg') no-repeat center; }
#contacts_propertymenu { clear: left; float:left; max-width: 15em; margin: 2em; }
@@ -72,7 +72,7 @@ label:hover, dt:hover { color: #333; }
#identityprops { /*position: absolute; top: 2.5em; left: 0px;*/ }
/*#contact_photo { max-width: 250px; }*/
#contact_identity { min-width: 30em; }
-.contactsection { position: relative; float: left; /*max-width: 40em;*/ padding: 0.5em; height: auto: border: thin solid lightgray;/* -webkit-border-radius: 0.5em; -moz-border-radius: 0.5em; border-radius: 0.5em; background-color: #f8f8f8;*/ }
+.contactsection { position: relative; float: left; padding: 0.5em; height: auto; }
#cropbox { margin: auto; }
#contacts_details_photo_wrapper { width: 200px; }
diff --git a/apps/contacts/export.php b/apps/contacts/export.php
index eb506506c42..161ca8047ac 100644
--- a/apps/contacts/export.php
+++ b/apps/contacts/export.php
@@ -9,26 +9,30 @@
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
-$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : NULL;
-$contactid = isset($_GET['contactid']) ? $_GET['contactid'] : NULL;
+$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : null;
+$contactid = isset($_GET['contactid']) ? $_GET['contactid'] : null;
$nl = "\n";
-if(isset($bookid)){
+if(isset($bookid)) {
$addressbook = OC_Contacts_App::getAddressbook($bookid);
//$cardobjects = OC_Contacts_VCard::all($bookid);
header('Content-Type: text/directory');
- header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
+ header('Content-Disposition: inline; filename='
+ . str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
$start = 0;
- $batchsize = OCP\Config::getUserValue(OCP\User::getUser(), 'contacts', 'export_batch_size', 20);
+ $batchsize = OCP\Config::getUserValue(OCP\User::getUser(),
+ 'contacts',
+ 'export_batch_size', 20);
while($cardobjects = OC_Contacts_VCard::all($bookid, $start, $batchsize)){
foreach($cardobjects as $card) {
echo $card['carddata'] . $nl;
}
$start += $batchsize;
}
-}elseif(isset($contactid)){
+}elseif(isset($contactid)) {
$data = OC_Contacts_App::getContactObject($contactid);
header('Content-Type: text/vcard');
- header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf');
+ header('Content-Disposition: inline; filename='
+ . str_replace(' ', '_', $data['fullname']) . '.vcf');
echo $data['carddata'];
}
diff --git a/apps/contacts/import.php b/apps/contacts/import.php
index ed1b80e132a..1986d79f6d6 100644
--- a/apps/contacts/import.php
+++ b/apps/contacts/import.php
@@ -38,17 +38,29 @@ if(!$file) {
OCP\JSON::error(array('data' => array('message' => 'Import file was empty.')));
exit();
}
-if(isset($_POST['method']) && $_POST['method'] == 'new'){
- $id = OC_Contacts_Addressbook::add(OCP\USER::getUser(), $_POST['addressbookname']);
+if(isset($_POST['method']) && $_POST['method'] == 'new') {
+ $id = OC_Contacts_Addressbook::add(OCP\USER::getUser(),
+ $_POST['addressbookname']);
if(!$id) {
- OCP\JSON::error(array('data' => array('message' => 'Error creating address book.')));
+ OCP\JSON::error(
+ array(
+ 'data' => array('message' => 'Error creating address book.')
+ )
+ );
exit();
}
OC_Contacts_Addressbook::setActive($id, 1);
}else{
$id = $_POST['id'];
if(!$id) {
- OCP\JSON::error(array('data' => array('message' => 'Error getting the ID of the address book.', 'file'=>$_POST['file'])));
+ OCP\JSON::error(
+ array(
+ 'data' => array(
+ 'message' => 'Error getting the ID of the address book.',
+ 'file'=>$_POST['file']
+ )
+ )
+ );
exit();
}
OC_Contacts_App::getAddressbook($id); // is owner access check
@@ -62,7 +74,7 @@ $inelement = false;
$parts = array();
$card = array();
foreach($lines as $line){
- if(strtoupper(trim($line)) == 'BEGIN:VCARD'){
+ if(strtoupper(trim($line)) == 'BEGIN:VCARD') {
$inelement = true;
} elseif (strtoupper(trim($line)) == 'END:VCARD') {
$card[] = $line;
@@ -79,21 +91,40 @@ writeProgress('70');
$imported = 0;
$failed = 0;
if(!count($parts) > 0) {
- OCP\JSON::error(array('data' => array('message' => 'No contacts to import in '.$_POST['file'].'. Please check if the file is corrupted.', 'file'=>$_POST['file'])));
+ OCP\JSON::error(
+ array(
+ 'data' => array(
+ 'message' => 'No contacts to import in '
+ . $_POST['file'].'. Please check if the file is corrupted.',
+ 'file'=>$_POST['file']
+ )
+ )
+ );
+ if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
+ if(!$view->unlink('/imports/' . $_POST['file'])) {
+ OCP\Util::writeLog('contacts',
+ 'Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'],
+ OCP\Util::ERROR);
+ }
+ }
exit();
}
foreach($parts as $part){
$card = OC_VObject::parse($part);
if (!$card) {
$failed += 1;
- OCP\Util::writeLog('contacts','Import: skipping card. Error parsing VCard: '.$part, OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts',
+ 'Import: skipping card. Error parsing VCard: ' . $part,
+ OCP\Util::ERROR);
continue; // Ditch cards that can't be parsed by Sabre.
}
try {
OC_Contacts_VCard::add($id, $card);
$imported += 1;
} catch (Exception $e) {
- OCP\Util::writeLog('contacts', 'Error importing vcard: '.$e->getMessage().$nl.$card, OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts',
+ 'Error importing vcard: ' . $e->getMessage() . $nl . $card,
+ OCP\Util::ERROR);
$failed += 1;
}
}
@@ -103,7 +134,17 @@ sleep(3);
OC_Cache::remove($progresskey);
if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
if(!$view->unlink('/imports/' . $_POST['file'])) {
- OCP\Util::writeLog('contacts','Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'], OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts',
+ 'Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'],
+ OCP\Util::ERROR);
}
}
-OCP\JSON::success(array('data' => array('imported'=>$imported, 'failed'=>$failed, 'file'=>$_POST['file'])));
+OCP\JSON::success(
+ array(
+ 'data' => array(
+ 'imported'=>$imported,
+ 'failed'=>$failed,
+ 'file'=>$_POST['file'],
+ )
+ )
+);
diff --git a/apps/contacts/index.php b/apps/contacts/index.php
index 00b1b4f7a95..c35e1b85d4e 100644
--- a/apps/contacts/index.php
+++ b/apps/contacts/index.php
@@ -14,13 +14,17 @@ OCP\App::checkAppEnabled('contacts');
// Get active address books. This creates a default one if none exists.
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
-$has_contacts = (count(OC_Contacts_VCard::all($ids, 0, 1)) > 0 ? true : false); // just to check if there are any contacts.
+$has_contacts = (count(OC_Contacts_VCard::all($ids, 0, 1)) > 0
+ ? true
+ : false); // just to check if there are any contacts.
if($has_contacts === false) {
- OCP\Util::writeLog('contacts','index.html: No contacts found.',OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts',
+ 'index.html: No contacts found.',
+ OCP\Util::DEBUG);
}
// Load the files we need
-OCP\App::setActiveNavigationEntry( 'contacts_index' );
+OCP\App::setActiveNavigationEntry('contacts_index');
// Load a specific user?
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
@@ -34,30 +38,31 @@ $post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
$freeSpace=OC_Filesystem::free_space('/');
-$freeSpace=max($freeSpace,0);
-$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
-
-OCP\Util::addscript('','jquery.multiselect');
-OCP\Util::addscript('','oc-vcategories');
-OCP\Util::addscript('contacts','contacts');
-OCP\Util::addscript('contacts','expanding');
-OCP\Util::addscript('contacts','jquery.combobox');
+$freeSpace=max($freeSpace, 0);
+$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
+
+OCP\Util::addscript('', 'jquery.multiselect');
+OCP\Util::addscript('', 'oc-vcategories');
+OCP\Util::addscript('contacts', 'contacts');
+OCP\Util::addscript('contacts', 'expanding');
+OCP\Util::addscript('contacts', 'jquery.combobox');
OCP\Util::addscript('files', 'jquery.fileupload');
-OCP\Util::addscript('contacts','jquery.inview');
-OCP\Util::addscript('contacts','jquery.Jcrop');
-OCP\Util::addscript('contacts','jquery.multi-autocomplete');
-OCP\Util::addStyle('','jquery.multiselect');
-OCP\Util::addStyle('contacts','jquery.combobox');
-OCP\Util::addStyle('contacts','jquery.Jcrop');
-OCP\Util::addStyle('contacts','contacts');
+OCP\Util::addscript('contacts', 'jquery.inview');
+OCP\Util::addscript('contacts', 'jquery.Jcrop');
+OCP\Util::addscript('contacts', 'jquery.multi-autocomplete');
+OCP\Util::addStyle('', 'jquery.multiselect');
+OCP\Util::addStyle('contacts', 'jquery.combobox');
+OCP\Util::addStyle('contacts', 'jquery.Jcrop');
+OCP\Util::addStyle('contacts', 'contacts');
$tmpl = new OCP\Template( "contacts", "index", "user" );
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize, false);
-$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize), false);
+$tmpl->assign('uploadMaxHumanFilesize',
+ OCP\Util::humanFileSize($maxUploadFilesize), false);
$tmpl->assign('property_types', $property_types, false);
$tmpl->assign('phone_types', $phone_types, false);
$tmpl->assign('email_types', $email_types, false);
$tmpl->assign('categories', $categories, false);
$tmpl->assign('has_contacts', $has_contacts, false);
-$tmpl->assign('id',$id, false);
+$tmpl->assign('id', $id, false);
$tmpl->printPage();
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index b4e7cdba444..337f51839dc 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -12,10 +12,38 @@ String.prototype.strip_tags = function(){
Contacts={
UI:{
+ /**
+ * Arguments:
+ * message: The text message to show. The only mandatory parameter.
+ * timeout: The timeout in seconds before the notification disappears. Default 10.
+ * timeouthandler: A function to run on timeout.
+ * clickhandler: A function to run on click. If a timeouthandler is given it will be cancelled.
+ * data: An object that will be passed as argument to the timeouthandler and clickhandler functions.
+ */
notify:function(params) {
- $('#notification').text(params.message);
- $('#notification').fadeIn();
- setTimeout(function() {$('#notification').fadeOut();}, 10000);
+ var notifier = $('#notification');
+ notifier.text(params.message);
+ notifier.fadeIn();
+ var timer = setTimeout(function() {
+ notifier.fadeOut();
+ if(params.timeouthandler && $.isFunction(params.timeouthandler)) {
+ params.timeouthandler(notifier.data(dataid));
+ notifier.off('click');
+ notifier.data(dataid, null);
+ }
+ }, params.timeout && $.isNumeric(params.timeout) ? parseInt(params.timeout)*1000 : 10000);
+ var dataid = timer.toString();
+ if(params.data) {
+ notifier.data(dataid, params.data);
+ }
+ if(params.clickhandler && $.isFunction(params.clickhandler)) {
+ notifier.on('click', function() {
+ clearTimeout(timer);
+ notifier.off('click');
+ params.clickhandler(notifier.data(dataid));
+ notifier.data(dataid, null);
+ });
+ }
},
notImplemented:function() {
OC.dialogs.alert(t('contacts', 'Sorry, this functionality has not been implemented yet'), t('contacts', 'Not implemented'));
@@ -96,7 +124,7 @@ Contacts={
$('.addresscard,.propertylist li,.propertycontainer').hover(
function () {
$(this).find('.globe,.mail,.delete,.edit').animate({ opacity: 1.0 }, 200, function() {});
- },
+ },
function () {
$(this).find('.globe,.mail,.delete,.edit').animate({ opacity: 0.1 }, 200, function() {});
}
@@ -107,7 +135,7 @@ Contacts={
obj.tipsy('hide');
Contacts.UI.Card.deleteProperty(obj, 'single');
}
-
+
var goToUrl = function(obj) {
var url = Contacts.UI.propertyContainerFor(obj).find('#url').val();
if(url != '') {
@@ -115,7 +143,7 @@ Contacts={
newWindow.focus();
}
}
-
+
$('#identityprops a.delete').click( function() { deleteItem($(this)) });
$('#identityprops a.delete').keydown( function() { deleteItem($(this)) });
$('#categories_value a.edit').click( function() { $(this).tipsy('hide');OCCategories.edit(); } );
@@ -140,7 +168,7 @@ Contacts={
});
$('#edit_name').click(function(){Contacts.UI.Card.editName()});
$('#edit_name').keydown(function(){Contacts.UI.Card.editName()});
-
+
$('#phototools li a').click(function() {
$(this).tipsy('hide');
});
@@ -167,13 +195,13 @@ Contacts={
OC.dialogs.filepicker(t('contacts', 'Select photo'), Contacts.UI.Card.cloudPhotoSelected, false, 'image', true);
});
/* Initialize the photo edit dialog */
- $('#edit_photo_dialog').dialog({
+ $('#edit_photo_dialog').dialog({
autoOpen: false, modal: true, height: 'auto', width: 'auto'
});
$('#edit_photo_dialog' ).dialog( 'option', 'buttons', [
{
text: "Ok",
- click: function() {
+ click: function() {
Contacts.UI.Card.savePhoto(this);
$(this).dialog('close');
}
@@ -183,37 +211,31 @@ Contacts={
click: function() { $(this).dialog('close'); }
}
] );
-
+
// Name has changed. Update it and reorder.
$('#fn').change(function(){
var name = $('#fn').val().strip_tags();
- var item = $('.contacts li[data-id="'+Contacts.UI.Card.id+'"]');
+ var item = $('.contacts li[data-id="'+Contacts.UI.Card.id+'"]').detach();
$(item).find('a').html(name);
Contacts.UI.Card.fn = name;
- var added = false;
- $('.contacts li[data-bookid="'+Contacts.UI.Card.bookid+'"]').each(function(){
- if ($(this).text().toLowerCase() > name.toLowerCase()) {
- $(this).before(item).fadeIn('fast');
- added = true;
- return false;
- }
+ Contacts.UI.Contacts.insertContact({
+ contactlist:$('#contacts ul[data-id="'+Contacts.UI.Card.bookid+'"]'),
+ contacts:$('#contacts ul[data-id="'+Contacts.UI.Card.bookid+'"] li'),
+ contact:item,
});
- if(!added) {
- $('#contacts ul[data-id="'+Contacts.UI.Card.bookid+'"]').append(item);
- }
Contacts.UI.Contacts.scrollTo(Contacts.UI.Card.id);
});
- $('#contacts_deletecard').click( function() { Contacts.UI.Card.doDelete();return false;} );
- $('#contacts_deletecard').keydown( function(event) {
+ $('#contacts_deletecard').click( function() { Contacts.UI.Card.delayedDelete();return false;} );
+ $('#contacts_deletecard').keydown( function(event) {
if(event.which == 13 || event.which == 32) {
- Contacts.UI.Card.doDelete();
+ Contacts.UI.Card.delayedDelete();
}
return false;
});
$('#contacts_downloadcard').click( function() { Contacts.UI.Card.doExport();return false;} );
- $('#contacts_downloadcard').keydown( function(event) {
+ $('#contacts_downloadcard').keydown( function(event) {
if(event.which == 13 || event.which == 32) {
Contacts.UI.Card.doExport();
}
@@ -228,12 +250,12 @@ Contacts={
$('#contacts_details_photo_wrapper').bind('dragover',function(event){
$(event.target).addClass('droppable');
event.stopPropagation();
- event.preventDefault();
+ event.preventDefault();
});
$('#contacts_details_photo_wrapper').bind('dragleave',function(event){
$(event.target).removeClass('droppable');
//event.stopPropagation();
- //event.preventDefault();
+ //event.preventDefault();
});
$('#contacts_details_photo_wrapper').bind('drop',function(event){
event.stopPropagation();
@@ -285,7 +307,7 @@ Contacts={
data:undefined,
update:function(params) { // params {cid:int, aid:int}
if(!params) { params = {}; }
- $('#contacts li').removeClass('active');
+ $('#contacts li,#contacts h3').removeClass('active');
console.log('Card, cid: ' + params.cid + ' aid: ' + params.aid);
var newid, bookid, firstitem;
if(!parseInt(params.cid) && !parseInt(params.aid)) {
@@ -299,7 +321,13 @@ Contacts={
newid = parseInt($('#contacts').find('li[data-bookid="'+bookid+'"]').first().data('id'));
} else if(parseInt(params.cid) && !parseInt(params.aid)) {
newid = parseInt(params.cid);
- bookid = parseInt($('#contacts li[data-id="'+newid+'"]').data('bookid'));
+ var listitem = $('#contacts li[data-id="'+newid+'"]');
+ console.log('Is contact in list? ' + listitem.length);
+ if(listitem.length) {
+ bookid = parseInt($('#contacts li[data-id="'+newid+'"]').data('bookid'));
+ } else { // contact isn't in list yet.
+ bookid = 'unknown';
+ }
} else {
newid = parseInt(params.cid);
bookid = parseInt(params.aid);
@@ -311,18 +339,26 @@ Contacts={
console.log('newid: ' + newid + ' bookid: ' +bookid);
var localLoadContact = function(newid, bookid) {
if($('.contacts li').length > 0) {
- $('#contacts li[data-id="'+newid+'"]').addClass('active');
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':newid},function(jsondata){
if(jsondata.status == 'success'){
+ if(bookid == 'unknown') {
+ bookid = jsondata.data.addressbookid;
+ var contact = Contacts.UI.Contacts.insertContact({
+ contactlist:$('#contacts ul[data-id="'+bookid+'"]'),
+ data:jsondata.data
+ });
+ }
+ $('#contacts li[data-id="'+newid+'"],#contacts h3[data-id="'+bookid+'"]').addClass('active');
$('#contacts ul[data-id="'+bookid+'"]').slideDown(300);
Contacts.UI.Card.loadContact(jsondata.data, bookid);
+ Contacts.UI.Contacts.scrollTo(newid);
} else {
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
}
}
-
+
// Make sure proper DOM is loaded.
if(!$('#card').length && newid) {
console.log('Loading card DOM');
@@ -363,9 +399,6 @@ Contacts={
Contacts.UI.Card.add(';;;;;', '', '', true);
return false;
},
- createEntry:function(data) {
- return $('<li data-id="'+data.id+'" data-bookid="'+data.addressbookid+'" role="button"><a href="'+OC.linkTo('contacts', 'index.php')+'&id='+data.id+'" style="background: url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+data.id+') no-repeat scroll 0% 0% transparent;">'+data.displayname+'</a></li>');
- },
add:function(n, fn, aid, isnew){ // add a new contact
console.log('Adding ' + fn);
aid = aid?aid:$('#contacts h3.active').first().data('id');
@@ -410,7 +443,7 @@ Contacts={
}
});
}
-
+
if(!$('#card').length) {
console.log('Loading card DOM');
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{'requesttoken': requesttoken},function(jsondata){
@@ -427,47 +460,56 @@ Contacts={
localAddcontact(n, fn, aid, isnew);
}
},
- doDelete:function() {
+ delayedDelete:function() {
$('#contacts_deletecard').tipsy('hide');
- OC.dialogs.confirm(t('contacts', 'Are you sure you want to delete this contact?'), t('contacts', 'Warning'), function(answer) {
- if(answer == true) {
- $.post(OC.filePath('contacts', 'ajax', 'deletecard.php'),{'id':Contacts.UI.Card.id},function(jsondata){
- if(jsondata.status == 'success'){
- var newid = '', bookid;
- var curlistitem = $('#contacts li[data-id="'+jsondata.data.id+'"]');
- var newlistitem = curlistitem.prev('li');
- if(!newlistitem) {
- newlistitem = curlistitem.next('li');
- }
- curlistitem.remove();
- if($(newlistitem).is('li')) {
- newid = newlistitem.data('id');
- bookid = newlistitem.data('bookid');
- }
- $('#rightcontent').data('id',newid);
- this.id = this.fn = this.fullname = this.shortname = this.famname = this.givname = this.addname = this.honpre = this.honsuf = '';
- this.data = undefined;
-
- if($('.contacts li').length > 0) { // Load first in list.
- Contacts.UI.Card.update({cid:newid, aid:bookid});
- } else {
- // load intro page
- $.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){
- if(jsondata.status == 'success'){
- id = '';
- $('#rightcontent').data('id','');
- $('#rightcontent').html(jsondata.data.page);
- }
- else{
- OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
- }
- });
- }
- }
- else{
- OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
- }
- });
+ var newid = '', bookid;
+ var curlistitem = $('#contacts li[data-id="'+Contacts.UI.Card.id+'"]');
+ curlistitem.removeClass('active');
+ var newlistitem = curlistitem.prev('li');
+ if(!newlistitem) {
+ newlistitem = curlistitem.next('li');
+ }
+ curlistitem.detach();
+ if($(newlistitem).is('li')) {
+ newid = newlistitem.data('id');
+ bookid = newlistitem.data('bookid');
+ }
+ $('#rightcontent').data('id',newid);
+ this.id = this.fn = this.fullname = this.shortname = this.famname = this.givname = this.addname = this.honpre = this.honsuf = '';
+ this.data = undefined;
+
+ if($('.contacts li').length > 0) { // Load first in list.
+ Contacts.UI.Card.update({cid:newid, aid:bookid});
+ } else {
+ // load intro page
+ $.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){
+ if(jsondata.status == 'success'){
+ id = '';
+ $('#rightcontent').data('id','');
+ $('#rightcontent').html(jsondata.data.page);
+ }
+ else{
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
+ }
+ });
+ }
+ Contacts.UI.notify({
+ data:curlistitem,
+ message:t('contacts','Click to undo deletion of "') + curlistitem.find('a').text() + '"',
+ timeouthandler:function(contact) {
+ Contacts.UI.Card.doDelete(contact.data('id'));
+ delete contact;
+ },
+ clickhandler:function(contact) {
+ Contacts.UI.Contacts.insertContact({contact:contact});
+ Contacts.UI.notify({message:t('contacts', 'Cancelled deletion of: "') + curlistitem.find('a').text() + '"'});
+ }
+ });
+ },
+ doDelete:function(id) {
+ $.post(OC.filePath('contacts', 'ajax', 'deletecard.php'),{'id':id},function(jsondata) {
+ if(jsondata.status == 'error'){
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
return false;
@@ -519,7 +561,7 @@ Contacts={
$('#contacts_propertymenu_dropdown a[data-type="'+propname+'"]').parent().hide();
var property = this.data[propname][0];
var value = property['value'], checksum = property['checksum'];
-
+
if(propname == 'BDAY') {
var val = $.datepicker.parseDate('yy-mm-dd', value.substring(0, 10));
value = $.datepicker.formatDate('dd-mm-yy', val);
@@ -584,7 +626,7 @@ Contacts={
$.each(names, function(key, value) {
$('#fn_select')
.append($('<option></option>')
- .text(value));
+ .text(value));
});
$('#fn_select').combobox('value', this.fn);
$('#contact_identity').find('*[data-element="N"]').data('checksum', this.data.N[0]['checksum']);
@@ -835,7 +877,7 @@ Contacts={
title: t('contacts', 'Edit name'),
height: 'auto', width: 'auto',
buttons: {
- 'Ok':function() {
+ 'Ok':function() {
Contacts.UI.Card.saveName(this);
$(this).dialog('close');
},
@@ -886,9 +928,9 @@ Contacts={
$.each(names, function(key, value) {
$('#fn_select')
.append($('<option></option>')
- .text(value));
+ .text(value));
});
-
+
if(this.id == '') {
var aid = $(dlg).find('#aid').val();
Contacts.UI.Card.add(n.join(';'), $('#short').text(), aid);
@@ -952,7 +994,7 @@ Contacts={
container = $('#addressdisplay dl').last();
container.removeClass('template').addClass('propertycontainer');
} else {
- params['checksum'] = Contacts.UI.checksumFor(obj);
+ params['checksum'] = Contacts.UI.checksumFor(obj);
}
/* Initialize the address edit dialog */
if($('#edit_address_dialog').dialog('isOpen') == true){
@@ -1168,7 +1210,7 @@ Contacts={
$('#phototools li a').tipsy('hide');
var wrapper = $('#contacts_details_photo_wrapper');
wrapper.addClass('loading').addClass('wait');
-
+
var img = new Image();
$(img).load(function () {
$('img.contacts_details_photo').remove()
@@ -1177,9 +1219,9 @@ Contacts={
$(this).insertAfter($('#phototools')).fadeIn();
}).error(function () {
// notify the user that the image could not be loaded
- $(t('contacts','something went wrong.')).insertAfter($('#phototools'));
+ Contacts.UI.notify({message:t('contacts','Error loading profile picture.')});
}).attr('src', OC.linkTo('contacts', 'photo.php')+'?id='+self.id+refreshstr);
-
+
$.getJSON(OC.filePath('contacts', 'ajax', 'loadphoto.php'),{'id':this.id, 'refresh': refresh},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details_photo_wrapper').data('checksum', jsondata.data.checksum);
@@ -1334,8 +1376,6 @@ Contacts={
},
},
Addressbooks:{
- droptarget:undefined,
- droptext:t('contacts', 'Drop a VCF file<br />to import contacts.'),
overview:function(){
if($('#chooseaddressbook_dialog').dialog('isOpen') == true){
$('#chooseaddressbook_dialog').dialog('moveToTop');
@@ -1427,7 +1467,7 @@ Contacts={
var displayname = $("#displayname_"+bookid).val().trim();
var active = $("#edit_active_"+bookid+":checked").length;
var description = $("#description_"+bookid).val();
-
+
if(displayname.length == 0) {
OC.dialogs.alert(t('contacts', 'Displayname cannot be empty.'), t('contacts', 'Error'));
return false;
@@ -1456,12 +1496,18 @@ Contacts={
batchnum:50,
drop:function(event, ui) {
var dragitem = ui.draggable, droptarget = $(this);
- //console.log('Drop ' + dragitem.data('id') +' on: ' + droptarget.data('id'));
+ if(dragitem.is('li')) {
+ Contacts.UI.Contacts.dropContact(event, dragitem, droptarget);
+ } else {
+ Contacts.UI.Contacts.dropAddressbook(event, dragitem, droptarget);
+ }
+ },
+ dropContact:function(event, dragitem, droptarget) {
if(dragitem.data('bookid') == droptarget.data('id')) {
return false;
}
var droplist = (droptarget.is('ul'))?droptarget:droptarget.next();
- $.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: $(this).data('id') },
+ $.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: droptarget.data('id') },
function(jsondata){
if(jsondata.status == 'success'){
// Do some inserting/removing/sorting magic
@@ -1485,6 +1531,44 @@ Contacts={
}
});
},
+ dropAddressbook:function(event, dragitem, droptarget) {
+ alert('Dropping address books not implemented yet');
+ },
+ /**
+ * @params params An object with the properties 'contactlist':a jquery object of the ul to insert into,
+ * 'contacts':a jquery object of all items in the list and either 'data': an object with the properties
+ * id, addressbookid and displayname or 'contact': a listitem to be inserted directly.
+ * If 'contactlist' or 'contacts' aren't defined they will be search for based in the properties in 'data'.
+ */
+ insertContact:function(params) {
+ if(!params.contactlist) {
+ // FIXME: Check if contact really exists.
+ var bookid = params.data ? params.data.addressbookid : params.contact.data('bookid');
+ params.contactlist = $('#contacts ul[data-id="'+bookid+'"]');
+ }
+ if(!params.contacts) {
+ var bookid = params.data ? params.data.addressbookid : params.contact.data('bookid');
+ params.contacts = $('#contacts ul[data-id="'+bookid+'"] li');
+ }
+ var contact = params.data
+ ? $('<li data-id="'+params.data.id+'" data-bookid="'+params.data.addressbookid+'" role="button"><a href="'+OC.linkTo('contacts', 'index.php')+'&id='+params.data.id+'" style="background: url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+params.data.id+') no-repeat scroll 0% 0% transparent;">'+params.data.displayname+'</a></li>')
+ : params.contact;
+ var added = false;
+ var name = params.data ? params.data.displayname.toLowerCase() : contact.find('a').text().toLowerCase();
+ if(params.contacts) {
+ params.contacts.each(function() {
+ if ($(this).text().toLowerCase() > name) {
+ $(this).before(contact);
+ added = true;
+ return false;
+ }
+ });
+ }
+ if(!added || !params.contacts) {
+ params.contactlist.append(contact);
+ }
+ return contact;
+ },
// Reload the contacts list.
update:function(params){
if(!params) { params = {}; }
@@ -1506,7 +1590,7 @@ Contacts={
$.getJSON(OC.filePath('contacts', 'ajax', 'contacts.php'),opts,function(jsondata){
if(jsondata.status == 'success'){
var books = jsondata.data.entries;
- $.each(books, function(b, book) {
+ $.each(books, function(b, book) {
if($('#contacts h3[data-id="'+b+'"]').length == 0) {
firstrun = true;
if($('#contacts h3').length == 0) {
@@ -1525,7 +1609,7 @@ Contacts={
if(!added) {
$('#contacts').append(item);
}
-
+
}
}
$('#contacts h3[data-id="'+b+'"]').on('click', function(event) {
@@ -1534,7 +1618,7 @@ Contacts={
$('#contacts ul[data-id="'+b+'"]').slideToggle(300);
return false;
});
- var accept = 'li:not([data-bookid="'+b+'"])';
+ var accept = 'li:not([data-bookid="'+b+'"]),h3:not([data-id="'+b+'"])';
$('#contacts h3[data-id="'+b+'"],#contacts ul[data-id="'+b+'"]').droppable({
drop: Contacts.UI.Contacts.drop,
activeClass: 'ui-state-hover',
@@ -1542,11 +1626,12 @@ Contacts={
});
}
var contactlist = $('#contacts ul[data-id="'+b+'"]');
+ var contacts = $('#contacts ul[data-id="'+b+'"] li');
for(var c in book.contacts) {
if(book.contacts[c].id == undefined) { continue; }
- if($('#contacts li[data-id="'+book.contacts[c]['id']+'"][data-id="'+book.contacts[c]['bookid']+'"]').length == 0) {
- var contact = Contacts.UI.Card.createEntry(book.contacts[c]);
- if(c == self.batchnum-5) {
+ if(!$('#contacts li[data-id="'+book.contacts[c]['id']+'"]').length) {
+ var contact = Contacts.UI.Contacts.insertContact({contactlist:contactlist, contacts:contacts, data:book.contacts[c]});
+ if(c == self.batchnum-10) {
contact.bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
$(this).unbind(event);
var bookid = $(this).data('bookid');
@@ -1557,15 +1642,15 @@ Contacts={
}
});
}
- contactlist.append(contact);
}
}
});
if($('#contacts h3').length > 1) {
- $('#contacts li').draggable({
+ $('#contacts li,#contacts h3').draggable({
+ distance: 10,
revert: 'invalid',
axis: 'y', containment: '#contacts',
- scroll: true, scrollSensitivity: 100,
+ scroll: true, scrollSensitivity: 40,
opacity: 0.7, helper: 'clone'
});
} else {
@@ -1587,9 +1672,10 @@ Contacts={
},
scrollTo:function(id){
var item = $('#contacts li[data-id="'+id+'"]');
+ console.log('scrollTo, found item '+id+'? ' + item.length);
if(item) {
- $('.contacts').animate({
- scrollTop: $('#contacts li[data-id="'+id+'"]').offset().top-20}, 'slow','swing');
+ $('#contacts').animate({
+ scrollTop: item.offset().top-40}, 'slow','swing');
}
}
}
@@ -1603,13 +1689,13 @@ $(document).ready(function(){
$('#notification').click(function(){
$('#notification').fadeOut();
});
-
+
$('#chooseaddressbook').click(Contacts.UI.Addressbooks.overview);
$('#chooseaddressbook').keydown(Contacts.UI.Addressbooks.overview);
$('#contacts_newcontact').click(Contacts.UI.Card.editNew);
$('#contacts_newcontact').keydown(Contacts.UI.Card.editNew);
-
+
// Load a contact.
$('.contacts').keydown(function(event) {
if(event.which == 13 || event.which == 32) {
@@ -1625,7 +1711,13 @@ $(document).ready(function(){
item.addClass('active');
var oldid = $('#rightcontent').data('id');
if(oldid != 0){
- $('.contacts li[data-id="'+oldid+'"]').removeClass('active');
+ var olditem = $('.contacts li[data-id="'+oldid+'"]');
+ var oldbookid = olditem.data('bookid');
+ olditem.removeClass('active');
+ if(oldbookid != bookid) {
+ $('#contacts h3[data-id="'+oldbookid+'"]').removeClass('active');
+ $('#contacts h3[data-id="'+bookid+'"]').addClass('active');
+ }
}
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':id},function(jsondata){
if(jsondata.status == 'success'){
@@ -1643,53 +1735,55 @@ $(document).ready(function(){
Contacts.UI.Card.saveProperty(this);
});
- // Upload function for dropped contact photos files. Should go in the Contacts class/object.
- $.fileUpload = function(files){
- var file = files[0];
- if(file.size > $('#max_upload').val()){
- OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts','Upload too large'));
- return;
- }
- if (file.type.indexOf("image") != 0) {
- OC.dialogs.alert(t('contacts','Only image files can be used as profile picture.'), t('contacts','Wrong file type'));
- return;
- }
- var xhr = new XMLHttpRequest();
+ $(function() {
+ // Upload function for dropped contact photos files. Should go in the Contacts class/object.
+ $.fileUpload = function(files){
+ var file = files[0];
+ if(file.size > $('#max_upload').val()){
+ OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts','Upload too large'));
+ return;
+ }
+ if (file.type.indexOf("image") != 0) {
+ OC.dialogs.alert(t('contacts','Only image files can be used as profile picture.'), t('contacts','Wrong file type'));
+ return;
+ }
+ var xhr = new XMLHttpRequest();
- if (!xhr.upload) {
- OC.dialogs.alert(t('contacts', 'Your browser doesn\'t support AJAX upload. Please click on the profile picture to select a photo to upload.'), t('contacts', 'Error'))
- }
- fileUpload = xhr.upload,
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4){
- response = $.parseJSON(xhr.responseText);
- if(response.status == 'success') {
- if(xhr.status == 200) {
- Contacts.UI.Card.editPhoto(response.data.id, response.data.tmp);
+ if (!xhr.upload) {
+ OC.dialogs.alert(t('contacts', 'Your browser doesn\'t support AJAX upload. Please click on the profile picture to select a photo to upload.'), t('contacts', 'Error'))
+ }
+ fileUpload = xhr.upload,
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4){
+ response = $.parseJSON(xhr.responseText);
+ if(response.status == 'success') {
+ if(xhr.status == 200) {
+ Contacts.UI.Card.editPhoto(response.data.id, response.data.tmp);
+ } else {
+ OC.dialogs.alert(xhr.status + ': ' + xhr.responseText, t('contacts', 'Error'));
+ }
} else {
- OC.dialogs.alert(xhr.status + ': ' + xhr.responseText, t('contacts', 'Error'));
+ OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
}
- } else {
- OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
}
- }
- };
-
- fileUpload.onprogress = function(e){
- if (e.lengthComputable){
- var _progress = Math.round((e.loaded * 100) / e.total);
- //if (_progress != 100){
- //}
- }
- };
- xhr.open('POST', OC.filePath('contacts', 'ajax', 'uploadphoto.php')+'?id='+Contacts.UI.Card.id+'&requesttoken='+requesttoken+'&imagefile='+encodeURIComponent(file.name), true);
- xhr.setRequestHeader('Cache-Control', 'no-cache');
- xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
- xhr.setRequestHeader('X_FILE_NAME', encodeURIComponent(file.name));
- xhr.setRequestHeader('X-File-Size', file.size);
- xhr.setRequestHeader('Content-Type', file.type);
- xhr.send(file);
- }
+ };
+
+ fileUpload.onprogress = function(e){
+ if (e.lengthComputable){
+ var _progress = Math.round((e.loaded * 100) / e.total);
+ //if (_progress != 100){
+ //}
+ }
+ };
+ xhr.open('POST', OC.filePath('contacts', 'ajax', 'uploadphoto.php')+'?id='+Contacts.UI.Card.id+'&requesttoken='+requesttoken+'&imagefile='+encodeURIComponent(file.name), true);
+ xhr.setRequestHeader('Cache-Control', 'no-cache');
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ xhr.setRequestHeader('X_FILE_NAME', encodeURIComponent(file.name));
+ xhr.setRequestHeader('X-File-Size', file.size);
+ xhr.setRequestHeader('Content-Type', file.type);
+ xhr.send(file);
+ }
+ });
$(document).bind('drop dragover', function (e) {
e.preventDefault(); // prevent browser from doing anything, if file isn't dropped in dropZone
@@ -1703,7 +1797,7 @@ $(document).ready(function(){
$(function() {
var uploadingFiles = {}, numfiles = 0, uploadedfiles = 0, retries = 0;
var aid;
-
+
$('#import_upload_start').fileupload({
dropZone: $('#contacts'), // restrict dropZone to contacts list.
acceptFileTypes: /^text\/(directory|vcard|x-vcard)$/i,
@@ -1803,9 +1897,10 @@ $(document).ready(function(){
if(numfiles != uploadedfiles) {
Contacts.UI.notify({message:t('contacts', 'Not all files uploaded. Retrying...')});
retries += 1;
- if(retries > 0) {
+ if(retries > 3) {
numfiles = uploadedfiles = retries = aid = 0;
uploadingFiles = {};
+ $('#uploadprogressbar').fadeOut();
OC.dialogs.alert(t('contacts', 'Something went wrong with the upload, please retry.'), t('contacts', 'Error'));
return;
}
@@ -1864,7 +1959,7 @@ $(document).ready(function(){
$(this).dialog('close');
}
},
- 'Cancel':function() {
+ 'Cancel':function() {
$(this).dialog('close');
numfiles = uploadedfiles = retries = aid = 0;
uploadingFiles = {};
@@ -1879,6 +1974,7 @@ $(document).ready(function(){
});
}
} else {
+ $('#uploadprogressbar').fadeOut();
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
@@ -1890,11 +1986,11 @@ $(document).ready(function(){
}
if(data.dataType != 'iframe ') {
$('#upload input.stop').hide();
- }
+ }
}
})
});
-
+
Contacts.UI.loadHandlers();
Contacts.UI.Contacts.update({cid:id});
});
diff --git a/apps/contacts/lib/VCFExportPlugin.php b/apps/contacts/lib/VCFExportPlugin.php
index 6554cb258e8..9a64c964b06 100644
--- a/apps/contacts/lib/VCFExportPlugin.php
+++ b/apps/contacts/lib/VCFExportPlugin.php
@@ -31,7 +31,7 @@ class Sabre_CardDAV_VCFExportPlugin extends Sabre_DAV_ServerPlugin {
public function initialize(Sabre_DAV_Server $server) {
$this->server = $server;
- $this->server->subscribeEvent('beforeMethod',array($this,'beforeMethod'), 90);
+ $this->server->subscribeEvent('beforeMethod', array($this,'beforeMethod'), 90);
}
@@ -49,7 +49,7 @@ class Sabre_CardDAV_VCFExportPlugin extends Sabre_DAV_ServerPlugin {
if ($this->server->httpRequest->getQueryString()!='export') return;
// splitting uri
- list($uri) = explode('?',$uri,2);
+ list($uri) = explode('?', $uri, 2);
$node = $this->server->tree->getNodeForPath($uri);
@@ -60,12 +60,12 @@ class Sabre_CardDAV_VCFExportPlugin extends Sabre_DAV_ServerPlugin {
$aclPlugin->checkPrivileges($uri, '{DAV:}read');
}
- $this->server->httpResponse->setHeader('Content-Type','text/directory');
+ $this->server->httpResponse->setHeader('Content-Type', 'text/directory');
$this->server->httpResponse->sendStatus(200);
$nodes = $this->server->getPropertiesForPath($uri, array(
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}address-data',
- ),1);
+ ), 1);
$this->server->httpResponse->sendBody($this->generateVCF($nodes));
diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php
index 9d584ff6d61..eb61b6dbced 100644
--- a/apps/contacts/lib/addressbook.php
+++ b/apps/contacts/lib/addressbook.php
@@ -37,17 +37,17 @@
/**
* This class manages our addressbooks.
*/
-class OC_Contacts_Addressbook{
+class OC_Contacts_Addressbook {
/**
* @brief Returns the list of addressbooks for a specific user.
* @param string $uid
* @param boolean $active Only return addressbooks with this $active state, default(=false) is don't care
* @return array or false.
*/
- public static function all($uid, $active=false){
+ public static function all($uid, $active=false) {
$values = array($uid);
$active_where = '';
- if ($active){
+ if ($active) {
$active_where = ' AND active = ?';
$values[] = 1;
}
@@ -55,13 +55,13 @@ class OC_Contacts_Addressbook{
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE userid = ? ' . $active_where . ' ORDER BY displayname' );
$result = $stmt->execute($values);
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.' exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.' uid: '.$uid,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.' exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.' uid: '.$uid, OCP\Util::DEBUG);
return false;
}
$addressbooks = array();
- while( $row = $result->fetchRow()){
+ while( $row = $result->fetchRow()) {
$addressbooks[] = $row;
}
if(!$active && !count($addressbooks)) {
@@ -76,8 +76,8 @@ class OC_Contacts_Addressbook{
* @param integer $uid User id. If null current user will be used.
* @return array
*/
- public static function activeIds($uid = null){
- if(is_null($uid)){
+ public static function activeIds($uid = null) {
+ if(is_null($uid)) {
$uid = OCP\USER::getUser();
}
$activeaddressbooks = self::all($uid, true);
@@ -93,7 +93,7 @@ class OC_Contacts_Addressbook{
* @param string $uid
* @return array
*/
- public static function active($uid){
+ public static function active($uid) {
return self::all($uid, true);
}
@@ -112,13 +112,13 @@ class OC_Contacts_Addressbook{
* @param integer $id
* @return associative array or false.
*/
- public static function find($id){
+ public static function find($id) {
try {
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
$result = $stmt->execute(array($id));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', id: '.$id,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', id: '.$id, OCP\Util::DEBUG);
return false;
}
@@ -129,11 +129,11 @@ class OC_Contacts_Addressbook{
* @brief Adds default address book
* @return $id ID of the newly created addressbook or false on error.
*/
- public static function addDefault($uid = null){
+ public static function addDefault($uid = null) {
if(is_null($uid)) {
$uid = OCP\USER::getUser();
}
- $id = self::add($uid,'Contacts','Default Address Book');
+ $id = self::add($uid, 'Contacts', 'Default Address Book');
if($id !== false) {
self::setActive($id, true);
}
@@ -147,13 +147,13 @@ class OC_Contacts_Addressbook{
* @param string $description
* @return insertid
*/
- public static function add($uid,$name,$description=''){
+ public static function add($uid,$name,$description='') {
try {
$stmt = OCP\DB::prepare( 'SELECT uri FROM *PREFIX*contacts_addressbooks WHERE userid = ? ' );
$result = $stmt->execute(array($uid));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.' exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.' uid: '.$uid,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.' exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.' uid: '.$uid, OCP\Util::DEBUG);
return false;
}
$uris = array();
@@ -166,8 +166,8 @@ class OC_Contacts_Addressbook{
$stmt = OCP\DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($uid,$name,$uri,$description,1));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', uid: '.$uid,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', uid: '.$uid, OCP\Util::DEBUG);
return false;
}
@@ -182,16 +182,16 @@ class OC_Contacts_Addressbook{
* @param string $description
* @return insertid or false
*/
- public static function addFromDAVData($principaluri,$uri,$name,$description){
+ public static function addFromDAVData($principaluri,$uri,$name,$description) {
$uid = self::extractUserID($principaluri);
try {
$stmt = OCP\DB::prepare('INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)');
$result = $stmt->execute(array($uid,$name,$uri,$description,1));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', uid: '.$uid,OCP\Util::DEBUG);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', uri: '.$uri,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', uid: '.$uid, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', uri: '.$uri, OCP\Util::DEBUG);
return false;
}
@@ -205,14 +205,14 @@ class OC_Contacts_Addressbook{
* @param string $description
* @return boolean
*/
- public static function edit($id,$name,$description){
+ public static function edit($id,$name,$description) {
// Need these ones for checking uri
$addressbook = self::find($id);
- if(is_null($name)){
+ if(is_null($name)) {
$name = $addressbook['name'];
}
- if(is_null($description)){
+ if(is_null($description)) {
$description = $addressbook['description'];
}
@@ -220,8 +220,8 @@ class OC_Contacts_Addressbook{
$stmt = OCP\DB::prepare('UPDATE *PREFIX*contacts_addressbooks SET displayname=?,description=?, ctag=ctag+1 WHERE id=?');
$result = $stmt->execute(array($name,$description,$id));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', id: '.$id,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', id: '.$id, OCP\Util::DEBUG);
return false;
}
@@ -234,15 +234,15 @@ class OC_Contacts_Addressbook{
* @param boolean $active
* @return boolean
*/
- public static function setActive($id,$active){
+ public static function setActive($id,$active) {
$sql = 'UPDATE *PREFIX*contacts_addressbooks SET active = ? WHERE id = ?';
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', id: '.$id.', active: '.intval($active),OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', id: '.$id.', active: '.intval($active), OCP\Util::ERROR);
try {
$stmt = OCP\DB::prepare($sql);
$stmt->execute(array(intval($active), $id));
return true;
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception for '.$id.': '.$e->getMessage(),OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception for '.$id.': '.$e->getMessage(), OCP\Util::ERROR);
return false;
}
}
@@ -252,7 +252,7 @@ class OC_Contacts_Addressbook{
* @param integer $id ID of the address book.
* @return boolean
*/
- public static function isActive($id){
+ public static function isActive($id) {
$sql = 'SELECT active FROM *PREFIX*contacts_addressbooks WHERE id = ?';
try {
$stmt = OCP\DB::prepare( $sql );
@@ -260,7 +260,7 @@ class OC_Contacts_Addressbook{
$row = $result->fetchRow();
return (bool)$row['active'];
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
}
}
@@ -269,13 +269,13 @@ class OC_Contacts_Addressbook{
* @param integer $id
* @return boolean
*/
- public static function delete($id){
+ public static function delete($id) {
self::setActive($id, false);
try {
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
$stmt->execute(array($id));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception for '.$id.': '.$e->getMessage(),OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception for '.$id.': '.$e->getMessage(), OCP\Util::ERROR);
return false;
}
@@ -292,7 +292,7 @@ class OC_Contacts_Addressbook{
* @param integer $id
* @return boolean
*/
- public static function touch($id){
+ public static function touch($id) {
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET ctag = ctag + 1 WHERE id = ?' );
$stmt->execute(array($id));
@@ -305,11 +305,11 @@ class OC_Contacts_Addressbook{
* @param array $existing existing addressbook URIs
* @return string new name
*/
- public static function createURI($name,$existing){
+ public static function createURI($name,$existing) {
$name = str_replace(' ', '_', strtolower($name));
$newname = $name;
$i = 1;
- while(in_array($newname,$existing)){
+ while(in_array($newname, $existing)) {
$newname = $name.$i;
$i = $i + 1;
}
@@ -320,8 +320,8 @@ class OC_Contacts_Addressbook{
* @brief gets the userid from a principal path
* @return string
*/
- public static function extractUserID($principaluri){
- list($prefix,$userid) = Sabre_DAV_URLUtil::splitPath($principaluri);
+ public static function extractUserID($principaluri) {
+ list($prefix, $userid) = Sabre_DAV_URLUtil::splitPath($principaluri);
return $userid;
}
}
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index 046ceb0bf00..689149367fa 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -61,11 +61,11 @@ class OC_Contacts_App {
if(!is_null($vcard) && !$vcard->__isset('N')) {
$version = OCP\App::getAppVersion('contacts');
if($version >= 5) {
- OCP\Util::writeLog('contacts','OC_Contacts_App::getContactVCard. Deprecated check for missing N field', OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'OC_Contacts_App::getContactVCard. Deprecated check for missing N field', OCP\Util::DEBUG);
}
- OCP\Util::writeLog('contacts','getContactVCard, Missing N field', OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'getContactVCard, Missing N field', OCP\Util::DEBUG);
if($vcard->__isset('FN')) {
- OCP\Util::writeLog('contacts','getContactVCard, found FN field: '.$vcard->__get('FN'), OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'getContactVCard, found FN field: '.$vcard->__get('FN'), OCP\Util::DEBUG);
$n = implode(';', array_reverse(array_slice(explode(' ', $vcard->__get('FN')), 0, 2))).';;;';
$vcard->setString('N', $n);
OC_Contacts_VCard::edit( $id, $vcard);
@@ -203,9 +203,9 @@ class OC_Contacts_App {
foreach($vccontacts as $vccontact) {
$cards[] = $vccontact['carddata'];
}
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', scanning: '.$batchsize.' starting from '.$start,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', scanning: '.$batchsize.' starting from '.$start, OCP\Util::DEBUG);
// only reset on first batch.
- self::getVCategories()->rescan($cards, true, ($start==0?true:false));
+ self::getVCategories()->rescan($cards, true, ($start == 0 ? true : false));
$start += $batchsize;
}
}
diff --git a/apps/contacts/lib/connector_sabre.php b/apps/contacts/lib/connector_sabre.php
index 99b94fc767e..9fcfff08fa8 100644
--- a/apps/contacts/lib/connector_sabre.php
+++ b/apps/contacts/lib/connector_sabre.php
@@ -79,7 +79,7 @@ class OC_Connector_Sabre_CardDAV extends Sabre_CardDAV_Backend_Abstract {
}
}
- OC_Contacts_Addressbook::edit($addressbookid,$name,$description);
+ OC_Contacts_Addressbook::edit($addressbookid, $name, $description);
return true;
@@ -113,7 +113,7 @@ class OC_Connector_Sabre_CardDAV extends Sabre_CardDAV_Backend_Abstract {
}
- OC_Contacts_Addressbook::addFromDAVData($principaluri,$url,$name,$description);
+ OC_Contacts_Addressbook::addFromDAVData($principaluri, $url, $name, $description);
}
/**
@@ -156,7 +156,7 @@ class OC_Connector_Sabre_CardDAV extends Sabre_CardDAV_Backend_Abstract {
* @return array
*/
public function getCard($addressbookid, $carduri) {
- return OC_Contacts_VCard::findWhereDAVDataIs($addressbookid,$carduri);
+ return OC_Contacts_VCard::findWhereDAVDataIs($addressbookid, $carduri);
}
diff --git a/apps/contacts/lib/hooks.php b/apps/contacts/lib/hooks.php
index d91d3c565b5..3344e3d6939 100644
--- a/apps/contacts/lib/hooks.php
+++ b/apps/contacts/lib/hooks.php
@@ -34,12 +34,12 @@
*/
class OC_Contacts_Hooks{
/**
- * @brief Add default Addressbooks of a certain user
- * @param paramters parameters from postDeleteUser-Hook
+ * @brief Add default Addressbook for a certain user
+ * @param paramters parameters from postCreateUser-Hook
* @return array
*/
static public function createUser($parameters) {
- OC_Contacts_Addressbook::addDefault($parameters['uid'],'default','Default Address Book');
+ OC_Contacts_Addressbook::addDefault($parameters['uid']);
return true;
}
@@ -61,8 +61,8 @@ class OC_Contacts_Hooks{
static public function getCalenderSources($parameters) {
$base_url = OCP\Util::linkTo('calendar', 'ajax/events.php').'?calendar_id=';
foreach(OC_Contacts_Addressbook::all(OCP\USER::getUser()) as $addressbook) {
- $parameters['sources'][] =
- array(
+ $parameters['sources'][]
+ = array(
'url' => $base_url.'birthday_'. $addressbook['id'],
'backgroundColor' => '#cccccc',
'borderColor' => '#888',
@@ -91,18 +91,24 @@ class OC_Contacts_Hooks{
$date = new DateTime($birthday);
$vevent = new OC_VObject('VEVENT');
//$vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV));
- $vevent->setDateTime('DTSTART', $date, Sabre_VObject_Element_DateTime::DATE);
+ $vevent->setDateTime('DTSTART', $date,
+ Sabre_VObject_Element_DateTime::DATE);
$vevent->setString('DURATION', 'P1D');
- $vevent->setString('UID', substr(md5(rand().time()),0,10));
+ $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'));
+ $title = str_replace('{name}',
+ $vcard->getAsString('FN'),
+ OC_Contacts_App::$l10n->t('{name}\'s Birthday'));
$parameters['events'][] = array(
'id' => 0,//$card['id'],
'vevent' => $vevent,
'repeating' => true,
'summary' => $title,
- 'calendardata' => "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Contacts " . OCP\App::getAppVersion('contacts') . "\n" . $vevent->serialize() . "END:VCALENDAR"
+ 'calendardata' => "BEGIN:VCALENDAR\nVERSION:2.0\n"
+ . "PRODID:ownCloud Contacts "
+ . OCP\App::getAppVersion('contacts') . "\n"
+ . $vevent->serialize() . "END:VCALENDAR"
);
}
}
diff --git a/apps/contacts/lib/search.php b/apps/contacts/lib/search.php
index 5d9ca97e761..53aa2b48496 100644
--- a/apps/contacts/lib/search.php
+++ b/apps/contacts/lib/search.php
@@ -2,7 +2,7 @@
class OC_Search_Provider_Contacts extends OC_Search_Provider{
function search($query){
$addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser(), 1);
- if(count($addressbooks)==0 || !OCP\App::isEnabled('contacts')){
+ if(count($addressbooks)==0 || !OCP\App::isEnabled('contacts')) {
return array();
}
$results=array();
@@ -10,9 +10,9 @@ class OC_Search_Provider_Contacts extends OC_Search_Provider{
foreach($addressbooks as $addressbook){
$vcards = OC_Contacts_VCard::all($addressbook['id']);
foreach($vcards as $vcard){
- if(substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0){
+ if(substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0) {
$link = OCP\Util::linkTo('contacts', 'index.php').'&id='.urlencode($vcard['id']);
- $results[]=new OC_Search_Result($vcard['fullname'],'', $link,(string)$l->t('Contact'));//$name,$text,$link,$type
+ $results[]=new OC_Search_Result($vcard['fullname'], '', $link, (string)$l->t('Contact'));//$name,$text,$link,$type
}
}
}
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index e3b65605624..ca171e792fc 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -63,9 +63,9 @@ class OC_Contacts_VCard{
$stmt = OCP\DB::prepare( $prep );
$result = $stmt->execute($id);
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', ids: '.join(',', $id),OCP\Util::DEBUG);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.'SQL:'.$prep,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', ids: '.join(',', $id), OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.'SQL:'.$prep, OCP\Util::DEBUG);
return false;
}
} elseif(is_int($id) || is_string($id)) {
@@ -74,12 +74,12 @@ class OC_Contacts_VCard{
$stmt = OCP\DB::prepare( $sql );
$result = $stmt->execute(array($id));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', ids: '. $id,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', ids: '. $id, OCP\Util::DEBUG);
return false;
}
} else {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.'. Addressbook id(s) argument is empty: '. $id,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.'. Addressbook id(s) argument is empty: '. $id, OCP\Util::DEBUG);
return false;
}
$cards = array();
@@ -102,8 +102,8 @@ class OC_Contacts_VCard{
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE id = ?' );
$result = $stmt->execute(array($id));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', id: '. $id,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', id: '. $id, OCP\Util::DEBUG);
return false;
}
@@ -121,8 +121,8 @@ class OC_Contacts_VCard{
$stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri = ?' );
$result = $stmt->execute(array($aid,$uri));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', aid: '.$aid.' uri'.$uri, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', aid: '.$aid.' uri'.$uri, OCP\Util::DEBUG);
return false;
}
@@ -177,16 +177,16 @@ class OC_Contacts_VCard{
try {
$result = $stmt->execute(array($aid,$uri));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', aid: '.$aid.' uid'.$uid, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', aid: '.$aid.' uid'.$uid, OCP\Util::DEBUG);
return false;
}
- if($result->numRows() > 0){
+ if($result->numRows() > 0) {
while(true) {
- $tmpuid = substr(md5(rand().time()),0,10);
+ $tmpuid = substr(md5(rand().time()), 0, 10);
$uri = $tmpuid.'.vcf';
- $result = $stmt->execute(array($aid,$uri));
- if($result->numRows() > 0){
+ $result = $stmt->execute(array($aid, $uri));
+ if($result->numRows() > 0) {
continue;
} else {
$uid = $tmpuid;
@@ -212,7 +212,7 @@ class OC_Contacts_VCard{
// Add version if needed
if($version && $version < '3.0') {
$upgrade = true;
- OCP\Util::writeLog('contacts','OC_Contacts_VCard::updateValuesFromAdd. Updating from version: '.$version,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::updateValuesFromAdd. Updating from version: '.$version, OCP\Util::DEBUG);
}
foreach($vcard->children as &$property){
// Decode string properties and remove obsolete properties.
@@ -225,29 +225,29 @@ class OC_Contacts_VCard{
}
// Fix format of type parameters.
if($upgrade && in_array($property->name, $typeprops)) {
- OCP\Util::writeLog('contacts','OC_Contacts_VCard::updateValuesFromAdd. before: '.$property->serialize(),OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::updateValuesFromAdd. before: '.$property->serialize(), OCP\Util::DEBUG);
self::formatPropertyTypes($property);
- OCP\Util::writeLog('contacts','OC_Contacts_VCard::updateValuesFromAdd. after: '.$property->serialize(),OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::updateValuesFromAdd. after: '.$property->serialize(), OCP\Util::DEBUG);
}
- if($property->name == 'FN'){
+ if($property->name == 'FN') {
$fn = $property->value;
}
- if($property->name == 'N'){
+ if($property->name == 'N') {
$n = $property->value;
}
- if($property->name == 'UID'){
+ if($property->name == 'UID') {
$uid = $property->value;
}
- if($property->name == 'ORG'){
+ if($property->name == 'ORG') {
$org = $property->value;
}
- if($property->name == 'EMAIL' && is_null($email)){ // only use the first email as substitute for missing N or FN.
+ if($property->name == 'EMAIL' && is_null($email)) { // only use the first email as substitute for missing N or FN.
$email = $property->value;
}
}
// Check for missing 'N', 'FN' and 'UID' properties
if(!$fn) {
- if($n && $n != ';;;;'){
+ if($n && $n != ';;;;') {
$fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2)));
} elseif($email) {
$fn = $email;
@@ -257,21 +257,21 @@ class OC_Contacts_VCard{
$fn = 'Unknown Name';
}
$vcard->setString('FN', $fn);
- OCP\Util::writeLog('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'FN\' field: '.$fn,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::updateValuesFromAdd. Added missing \'FN\' field: '.$fn, OCP\Util::DEBUG);
}
- if(!$n || $n == ';;;;'){ // Fix missing 'N' field. Ugly hack ahead ;-)
+ if(!$n || $n == ';;;;') { // Fix missing 'N' field. Ugly hack ahead ;-)
$slice = array_reverse(array_slice(explode(' ', $fn), 0, 2)); // Take 2 first name parts of 'FN' and reverse.
if(count($slice) < 2) { // If not enought, add one more...
$slice[] = "";
}
$n = implode(';', $slice).';;;';
$vcard->setString('N', $n);
- OCP\Util::writeLog('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'N\' field: '.$n,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::updateValuesFromAdd. Added missing \'N\' field: '.$n, OCP\Util::DEBUG);
}
if(!$uid) {
$vcard->setUID();
$uid = $vcard->getAsString('UID');
- OCP\Util::writeLog('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'UID\' field: '.$uid,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::updateValuesFromAdd. Added missing \'UID\' field: '.$uid, OCP\Util::DEBUG);
}
if(self::trueUID($aid, $uid)) {
$vcard->setString('UID', $uid);
@@ -288,8 +288,8 @@ class OC_Contacts_VCard{
* @return insertid on success or false.
*/
public static function add($aid, OC_VObject $card, $uri=null, $isnew=false){
- if(is_null($card)){
- OCP\Util::writeLog('contacts','OC_Contacts_VCard::add. No vCard supplied', OCP\Util::ERROR);
+ if(is_null($card)) {
+ OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::add. No vCard supplied', OCP\Util::ERROR);
return null;
};
@@ -298,7 +298,7 @@ class OC_Contacts_VCard{
self::updateValuesFromAdd($aid, $card);
}
- $card->setString('VERSION','3.0');
+ $card->setString('VERSION', '3.0');
// Add product ID is missing.
$prodid = trim($card->getAsString('PRODID'));
if(!$prodid) {
@@ -323,8 +323,8 @@ class OC_Contacts_VCard{
try {
$result = $stmt->execute(array($aid,$fn,$data,$uri,time()));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', aid: '.$aid.' uri'.$uri, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', aid: '.$aid.' uri'.$uri, OCP\Util::DEBUG);
return false;
}
$newid = OCP\DB::insertid('*PREFIX*contacts_cards');
@@ -355,15 +355,15 @@ class OC_Contacts_VCard{
$now = new DateTime;
foreach($objects as $object) {
$vcard = OC_VObject::parse($object[1]);
- if(!is_null($vcard)){
+ if(!is_null($vcard)) {
$vcard->setString('REV', $now->format(DateTime::W3C));
$data = $vcard->serialize();
try {
$result = $stmt->execute(array($data,time(),$object[0]));
//OCP\Util::writeLog('contacts','OC_Contacts_VCard::updateDataByID, id: '.$object[0].': '.$object[1],OCP\Util::DEBUG);
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', id: '.$object[0],OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', id: '.$object[0], OCP\Util::DEBUG);
}
}
}
@@ -397,8 +397,8 @@ class OC_Contacts_VCard{
try {
$result = $stmt->execute(array($fn,$data,time(),$id));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', id'.$id, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', id'.$id, OCP\Util::DEBUG);
return false;
}
@@ -414,11 +414,11 @@ class OC_Contacts_VCard{
* @param string $data vCard file
* @return boolean
*/
- public static function editFromDAVData($aid,$uri,$data){
- $oldcard = self::findWhereDAVDataIs($aid,$uri);
+ public static function editFromDAVData($aid, $uri, $data){
+ $oldcard = self::findWhereDAVDataIs($aid, $uri);
$card = OC_VObject::parse($data);
if(!$card) {
- OCP\Util::writeLog('contacts','OC_Contacts_VCard::editFromDAVData. Unable to parse VCARD, uri: '.$uri,OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', Unable to parse VCARD, uri: '.$uri, OCP\Util::ERROR);
return false;
}
return self::edit($oldcard['id'], $card);
@@ -430,14 +430,13 @@ class OC_Contacts_VCard{
* @return boolean
*/
public static function delete($id){
- // FIXME: Add error checking.
OC_Hook::emit('OC_Contacts_VCard', 'pre_deleteVCard', array('aid' => null, 'id' => $id, 'uri' => null));
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
try {
$stmt->execute(array($id));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', id: '.$id, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', id: '.$id, OCP\Util::DEBUG);
return false;
}
@@ -451,14 +450,13 @@ class OC_Contacts_VCard{
* @return boolean
*/
public static function deleteFromDAVData($aid,$uri){
- // FIXME: Add error checking. Deleting a card gives an Kontact/Akonadi error.
OC_Hook::emit('OC_Contacts_VCard', 'pre_deleteVCard', array('aid' => $aid, 'id' => null, 'uri' => $uri));
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
try {
$stmt->execute(array($aid,$uri));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', aid: '.$aid.' uri: '.$uri, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', aid: '.$aid.' uri: '.$uri, OCP\Util::DEBUG);
return false;
}
OC_Contacts_Addressbook::touch($aid);
@@ -487,14 +485,14 @@ class OC_Contacts_VCard{
* @return array
*/
public static function unescapeDelimiters($value, $delimiter=';') {
- $array = explode($delimiter,$value);
+ $array = explode($delimiter, $value);
for($i=0;$i<count($array);$i++) {
- if(substr($array[$i],-1,1)=="\\") {
+ if(substr($array[$i], -1, 1)=="\\") {
if(isset($array[$i+1])) {
- $array[$i] = substr($array[$i],0,count($array[$i])-2).$delimiter.$array[$i+1];
+ $array[$i] = substr($array[$i], 0, count($array[$i])-2).$delimiter.$array[$i+1];
unset($array[$i+1]);
} else {
- $array[$i] = substr($array[$i],0,count($array[$i])-2).$delimiter;
+ $array[$i] = substr($array[$i], 0, count($array[$i])-2).$delimiter;
}
$i = $i - 1;
}
@@ -510,12 +508,12 @@ class OC_Contacts_VCard{
*
* look at code ...
*/
- public static function structureContact($object){
+ public static function structureContact($object) {
$details = array();
foreach($object->children as $property){
$temp = self::structureProperty($property);
if(!is_null($temp)) {
- if(array_key_exists($property->name,$details)){
+ if(array_key_exists($property->name, $details)) {
$details[$property->name][] = $temp;
}
else{
@@ -539,10 +537,10 @@ class OC_Contacts_VCard{
* NOTE: $value is not escaped anymore. It shouldn't make any difference
* but we should look out for any problems.
*/
- public static function structureProperty($property){
+ public static function structureProperty($property) {
$value = $property->value;
//$value = htmlspecialchars($value);
- if($property->name == 'ADR' || $property->name == 'N'){
+ if($property->name == 'ADR' || $property->name == 'N') {
$value = self::unescapeDelimiters($value);
} elseif($property->name == 'BDAY') {
if(strpos($value, '-') === false) {
@@ -562,17 +560,17 @@ class OC_Contacts_VCard{
// Faulty entries by kaddressbook
// Actually TYPE=PREF is correct according to RFC 2426
// but this way is more handy in the UI. Tanghus.
- if($parameter->name == 'TYPE' && $parameter->value == 'PREF'){
+ if($parameter->name == 'TYPE' && $parameter->value == 'PREF') {
$parameter->name = 'PREF';
$parameter->value = '1';
}
// NOTE: Apparently Sabre_VObject_Reader can't always deal with value list parameters
// like TYPE=HOME,CELL,VOICE. Tanghus.
- if (in_array($property->name, array('TEL', 'EMAIL')) && $parameter->name == 'TYPE'){
- if (isset($temp['parameters'][$parameter->name])){
+ if (in_array($property->name, array('TEL', 'EMAIL')) && $parameter->name == 'TYPE') {
+ if (isset($temp['parameters'][$parameter->name])) {
$temp['parameters'][$parameter->name][] = $parameter->value;
}
- else{
+ else {
$temp['parameters'][$parameter->name] = array($parameter->value);
}
}
@@ -590,7 +588,7 @@ class OC_Contacts_VCard{
* @return boolean
*
*/
- public static function moveToAddressBook($aid, $id){
+ public static function moveToAddressBook($aid, $id) {
OC_Contacts_App::getAddressbook($aid); // check for user ownership.
if(is_array($id)) {
$id_sql = join(',', array_fill(0, count($id), '?'));
@@ -601,9 +599,9 @@ class OC_Contacts_VCard{
$vals = array_merge((array)$aid, $id);
$result = $stmt->execute($vals);
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::ERROR);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', ids: '.join(',', $vals),OCP\Util::DEBUG);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', SQL:'.$prep,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', ids: '.join(',', $vals), OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', SQL:'.$prep, OCP\Util::DEBUG);
return false;
}
} else {
@@ -611,8 +609,8 @@ class OC_Contacts_VCard{
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_cards SET addressbookid = ? WHERE id = ?' );
$result = $stmt->execute(array($aid, $id));
} catch(Exception $e) {
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(),OCP\Util::DEBUG);
- OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.' id: '.$id,OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', exception: '.$e->getMessage(), OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.' id: '.$id, OCP\Util::DEBUG);
return false;
}
}
diff --git a/apps/contacts/photo.php b/apps/contacts/photo.php
index 4660d61f618..efdf157cd95 100644
--- a/apps/contacts/photo.php
+++ b/apps/contacts/photo.php
@@ -13,7 +13,7 @@
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
-function getStandardImage(){
+function getStandardImage() {
//OCP\Response::setExpiresHeader('P10D');
OCP\Response::enableCaching();
OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person_large.png'));
@@ -27,37 +27,39 @@ if(is_null($id)) {
}
if(!extension_loaded('gd') || !function_exists('gd_info')) {
- OCP\Util::writeLog('contacts','photo.php. GD module not installed',OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts',
+ 'photo.php. GD module not installed', OCP\Util::DEBUG);
getStandardImage();
}
$contact = OC_Contacts_App::getContactVCard($id);
$image = new OC_Image();
-if(!$image) {
+if (!$image) {
getStandardImage();
}
// invalid vcard
-if( is_null($contact)) {
- OCP\Util::writeLog('contacts','photo.php. The VCard for ID '.$id.' is not RFC compatible',OCP\Util::ERROR);
+if (is_null($contact)) {
+ OCP\Util::writeLog('contacts',
+ 'photo.php. The VCard for ID ' . $id . ' is not RFC compatible',
+ OCP\Util::ERROR);
} else {
OCP\Response::enableCaching($caching);
OC_Contacts_App::setLastModifiedHeader($contact);
// Photo :-)
- if($image->loadFromBase64($contact->getAsString('PHOTO'))) {
+ if ($image->loadFromBase64($contact->getAsString('PHOTO'))) {
// OK
OCP\Response::setETagHeader(md5($contact->getAsString('PHOTO')));
}
else
// Logo :-/
- if($image->loadFromBase64($contact->getAsString('LOGO'))) {
+ if ($image->loadFromBase64($contact->getAsString('LOGO'))) {
// OK
OCP\Response::setETagHeader(md5($contact->getAsString('LOGO')));
}
if ($image->valid()) {
$max_size = 200;
- if($image->width() > $max_size ||
- $image->height() > $max_size) {
+ if ($image->width() > $max_size || $image->height() > $max_size) {
$image->resize($max_size);
}
}
@@ -65,8 +67,7 @@ if( is_null($contact)) {
if (!$image->valid()) {
// Not found :-(
getStandardImage();
- //$image->loadFromFile('img/person_large.png');
}
header('Content-Type: '.$image->mimeType());
$image->show();
-//echo OC_Contacts_App::$l10n->t('This card does not contain a photo.');
+
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index 98cb67a26e7..1bc4a195534 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -25,7 +25,7 @@
</div>
<div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
<?php
- if($_['has_contacts']){
+ if($_['has_contacts']) {
echo $this->inc('part.contact');
}
else{
diff --git a/apps/contacts/templates/part.cropphoto.php b/apps/contacts/templates/part.cropphoto.php
index 6d7b1e44777..3f5817622b2 100644
--- a/apps/contacts/templates/part.cropphoto.php
+++ b/apps/contacts/templates/part.cropphoto.php
@@ -2,7 +2,6 @@
$id = $_['id'];
$tmpkey = $_['tmpkey'];
$requesttoken = $_['requesttoken'];
-OCP\Util::writeLog('contacts','templates/part.cropphoto.php: tmpkey: '.$tmpkey, OCP\Util::DEBUG);
?>
<script type="text/javascript">
jQuery(function($) {
diff --git a/apps/contacts/templates/part.edit_categories_dialog.php b/apps/contacts/templates/part.edit_categories_dialog.php
deleted file mode 100644
index 8997fa586bd..00000000000
--- a/apps/contacts/templates/part.edit_categories_dialog.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-$categories = isset($_['categories'])?$_['categories']:array();
-?>
-<div id="edit_categories_dialog" title="<?php echo $l->t('Edit categories'); ?>">
-<!-- ?php print_r($types); ? -->
- <form method="post" id="categoryform">
- <div class="scrollarea">
- <ul id="categorylist">
- <?php foreach($categories as $category) { ?>
- <li><input type="checkbox" name="categories[]" value="<?php echo $category; ?>" /><?php echo $category; ?></li>
- <?php } ?>
- </ul>
- </div>
- <div class="bottombuttons"><input type="text" id="category_addinput" name="category" /><button id="category_addbutton" disabled="disabled"><?php echo $l->t('Add'); ?></button></div>
- </form>
-</div>
diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php
index a69e9c74f72..6deb5ca379e 100644
--- a/apps/contacts/thumbnail.php
+++ b/apps/contacts/thumbnail.php
@@ -25,14 +25,15 @@ OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
session_write_close();
-function getStandardImage(){
+function getStandardImage() {
//OCP\Response::setExpiresHeader('P10D');
OCP\Response::enableCaching();
OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person.png'));
}
if(!extension_loaded('gd') || !function_exists('gd_info')) {
- OCP\Util::writeLog('contacts','thumbnail.php. GD module not installed',OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts',
+ 'thumbnail.php. GD module not installed', OCP\Util::DEBUG);
getStandardImage();
exit();
}
@@ -43,8 +44,10 @@ $caching = isset($_GET['refresh']) ? 0 : null;
$contact = OC_Contacts_App::getContactVCard($id);
// invalid vcard
-if(is_null($contact)){
- OCP\Util::writeLog('contacts','thumbnail.php. The VCard for ID '.$id.' is not RFC compatible',OCP\Util::ERROR);
+if(is_null($contact)) {
+ OCP\Util::writeLog('contacts',
+ 'thumbnail.php. The VCard for ID ' . $id . ' is not RFC compatible',
+ OCP\Util::ERROR);
getStandardImage();
exit();
}
@@ -64,16 +67,24 @@ if($photo) {
if($image->show()) {
exit();
} else {
- OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t display thumbnail for ID '.$id,OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts',
+ 'thumbnail.php. Couldn\'t display thumbnail for ID ' . $id,
+ OCP\Util::ERROR);
}
} else {
- OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t resize thumbnail for ID '.$id,OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts',
+ 'thumbnail.php. Couldn\'t resize thumbnail for ID ' . $id,
+ OCP\Util::ERROR);
}
}else{
- OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t crop thumbnail for ID '.$id,OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts',
+ 'thumbnail.php. Couldn\'t crop thumbnail for ID ' . $id,
+ OCP\Util::ERROR);
}
} else {
- OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t load image string for ID '.$id,OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts',
+ 'thumbnail.php. Couldn\'t load image string for ID ' . $id,
+ OCP\Util::ERROR);
}
}
getStandardImage();
diff --git a/apps/contacts/tmpphoto.php b/apps/contacts/tmpphoto.php
index 5fde8de9977..156d5c80308 100644
--- a/apps/contacts/tmpphoto.php
+++ b/apps/contacts/tmpphoto.php
@@ -24,7 +24,7 @@ $tmpkey = $_GET['tmpkey'];
$maxsize = isset($_GET['maxsize']) ? $_GET['maxsize'] : -1;
header("Cache-Control: no-cache, no-store, must-revalidate");
-OCP\Util::writeLog('contacts','tmpphoto.php: tmpkey: '.$tmpkey, OCP\Util::DEBUG);
+OCP\Util::writeLog('contacts', 'tmpphoto.php: tmpkey: '.$tmpkey, OCP\Util::DEBUG);
$image = new OC_Image();
$image->loadFromData(OC_Cache::get($tmpkey));
diff --git a/apps/files_encryption/lib/cryptstream.php b/apps/files_encryption/lib/cryptstream.php
index e0020537563..46471911d94 100644
--- a/apps/files_encryption/lib/cryptstream.php
+++ b/apps/files_encryption/lib/cryptstream.php
@@ -31,9 +31,7 @@ class OC_CryptStream{
public static $sourceStreams=array();
private $source;
private $path;
- private $readBuffer;//for streams that dont support seeking
private $meta=array();//header/meta for source stream
- private $count;
private $writeCache;
private $size;
private static $rootView;
@@ -100,7 +98,6 @@ class OC_CryptStream{
public function stream_write($data){
$length=strlen($data);
- $written=0;
$currentPos=ftell($this->source);
if($this->writeCache){
$data=$this->writeCache.$data;
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php
index 35663d431f8..c849db38433 100755
--- a/apps/files_external/lib/dropbox.php
+++ b/apps/files_external/lib/dropbox.php
@@ -208,7 +208,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
if (isset(self::$tempFiles[$tmpFile])) {
$handle = fopen($tmpFile, 'r');
try {
- $response = $this->dropbox->putFile(self::$tempFiles[$tmpFile], $handle);
+ $this->dropbox->putFile(self::$tempFiles[$tmpFile], $handle);
unlink($tmpFile);
} catch (Exception $exception) {
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index 41b560ae84e..2ad85d09d5f 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -178,7 +178,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
if ($collection == '/' || $collection == '\.' || $collection == '.') {
$uri = 'https://docs.google.com/feeds/default/private/full';
// Get parent content link
- } else if ($dom = $this->getResource(basename($dir))) {
+ } else if ($dom = $this->getResource(basename($collection))) {
$uri = $dom->getElementsByTagName('content')->item(0)->getAttribute('src');
}
if (isset($uri)) {
@@ -341,7 +341,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
break;
}
}
- $title = basename($path);
+ $title = basename($path2);
// Construct post data
$postData = '<?xml version="1.0" encoding="UTF-8"?>';
$postData .= '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:docs="http://schemas.google.com/docs/2007" xmlns:gd="http://schemas.google.com/g/2005" gd:etag='.$etag.'>';
@@ -352,13 +352,13 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
} else {
// Move to different collection
if ($collectionEntry = $this->getResource($collection)) {
- $feedUri = $colelctionEntry->getElementsByTagName('content')->item(0)->getAttribute('src');
+ $feedUri = $collectionEntry->getElementsByTagName('content')->item(0)->getAttribute('src');
// Construct post data
$postData = '<?xml version="1.0" encoding="UTF-8"?>';
$postData .= '<entry xmlns="http://www.w3.org/2005/Atom">';
$postData .= '<id>'.$entry->getElementsByTagName('id')->item(0).'</id>';
$postData .= '</entry>';
- $this->sendRequest($uri, 'POST', $postData);
+ $this->sendRequest($feedUri, 'POST', $postData);
return true;
}
}
@@ -424,7 +424,6 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
}
}
if (!isset($uploadUri) && $entry) {
- $etag = $entry->getAttribute('gd:etag');
$links = $entry->getElementsByTagName('link');
foreach ($links as $link) {
if ($link->getAttribute('rel') == 'http://schemas.google.com/g/2005#resumable-create-media') {
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index 5e34deb2337..8a5e993b1d0 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -15,8 +15,6 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
private $root;
private $share;
- private static $tempFiles=array();
-
public function __construct($params){
$this->host=$params['host'];
$this->user=$params['user'];
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 3d13518f57b..84d64b65193 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -77,16 +77,11 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$path=$this->cleanPath($path);
try{
$response=$this->client->propfind($path, array(),1);
- $stripLength=strlen($this->root)+strlen($path);
$id=md5('webdav'.$this->root.$path);
OC_FakeDirStream::$dirs[$id]=array();
- $skip = true;
- foreach($response as $file=>$data){
- // Skip the first file, because it is the current directory
- if ($skip) {
- $skip = false;
- continue;
- }
+ $files=array_keys($response);
+ array_shift($files);//the first entry is the current directory
+ foreach($files as $file){
$file = urldecode(basename($file));
OC_FakeDirStream::$dirs[$id][]=$file;
}
@@ -120,7 +115,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
public function file_exists($path){
$path=$this->cleanPath($path);
try{
- $response=$this->client->propfind($path, array('{DAV:}resourcetype'));
+ $this->client->propfind($path, array('{DAV:}resourcetype'));
return true;//no 404 exception
}catch(Exception $e){
return false;
@@ -201,7 +196,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$mtime=time();
}
$path=$this->cleanPath($path);
- $this->client->proppatch($path, array('{DAV:}lastmodified' => $mtime,));
+ $this->client->proppatch($path, array('{DAV:}lastmodified' => $mtime));
}
public function getFile($path,$target){
diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php
index 68481b4e66b..97796bca128 100644
--- a/apps/files_external/tests/ftp.php
+++ b/apps/files_external/tests/ftp.php
@@ -13,7 +13,6 @@ if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']){
}else{
class Test_Filestorage_FTP extends Test_FileStorage {
private $config;
- private $id;
public function setUp(){
$id=uniqid();
diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php
index 08116f0e748..806db5a6aaa 100644
--- a/apps/files_external/tests/google.php
+++ b/apps/files_external/tests/google.php
@@ -28,7 +28,6 @@ if(!is_array($config) or !isset($config['google']) or !$config['google']['run'])
class Test_Filestorage_Google extends Test_FileStorage {
private $config;
- private $id;
public function setUp(){
$id=uniqid();
diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php
index e1495b7480d..001ef842276 100644
--- a/apps/files_external/tests/smb.php
+++ b/apps/files_external/tests/smb.php
@@ -14,7 +14,6 @@ if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']){
}else{
class Test_Filestorage_SMB extends Test_FileStorage {
private $config;
- private $id;
public function setUp(){
$id=uniqid();
diff --git a/apps/files_external/tests/swift.php b/apps/files_external/tests/swift.php
index f0bde6ed605..1520c9473d3 100644
--- a/apps/files_external/tests/swift.php
+++ b/apps/files_external/tests/swift.php
@@ -13,7 +13,6 @@ if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']){
}else{
class Test_Filestorage_SWIFT extends Test_FileStorage {
private $config;
- private $id;
public function setUp(){
$id=uniqid();
diff --git a/apps/files_external/tests/webdav.php b/apps/files_external/tests/webdav.php
index 144659819b6..14abbef2cbf 100644
--- a/apps/files_external/tests/webdav.php
+++ b/apps/files_external/tests/webdav.php
@@ -13,7 +13,6 @@ if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run'])
}else{
class Test_Filestorage_DAV extends Test_FileStorage {
private $config;
- private $id;
public function setUp(){
$id=uniqid();
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index 4138fc2b399..32fd2124429 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -67,7 +67,6 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
public function rmdir($path) {
// The folder will be removed from the database, but won't be deleted from the owner's filesystem
OC_Share::unshareFromMySelf($this->datadir.$path);
- $this->clearFolderSizeCache($path);
}
public function opendir($path) {
@@ -190,7 +189,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
public function filesize($path) {
if ($path == "" || $path == "/" || $this->is_dir($path)) {
- return $this->getFolderSize($path);
+ return 0;
} else {
$source = $this->getSource($path);
if ($source) {
@@ -200,55 +199,6 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
}
}
- public function getFolderSize($path) {
- return 0; //depricated
- }
-
- private function calculateFolderSize($path) {
- if ($this->is_file($path)) {
- $path = dirname($path);
- }
- $size = 0;
- if ($dh = $this->opendir($path)) {
- while (($filename = readdir($dh)) !== false) {
- if ($filename != "." && $filename != "..") {
- $subFile = $path."/".$filename;
- if ($this->is_file($subFile)) {
- $size += $this->filesize($subFile);
- } else {
- $size += $this->getFolderSize($subFile);
- }
- }
- }
- if ($size > 0) {
- $dbpath = rtrim($this->datadir.$path, "/");
-// $query = OCP\DB::prepare("INSERT INTO *PREFIX*foldersize VALUES(?,?)");
-// $result = $query->execute(array($dbpath, $size));
- }
- }
- return $size;
- }
-
- private function clearFolderSizeCache($path) {
- $path = rtrim($path, "/");
- $path = preg_replace('{(/)\1+}', "/", $path);
- if ($this->is_file($path)) {
- $path = dirname($path);
- }
- $dbpath = rtrim($this->datadir.$path, "/");
-// $query = OCP\DB::prepare("DELETE FROM *PREFIX*/*foldersize*/ WHERE path = ?");
-// $result = $query->execute(array($dbpath));
- if ($path != "/" && $path != "") {
- $parts = explode("/", $path);
- $part = array_pop($parts);
- if (empty($part)) {
- array_pop($parts);
- }
- $parent = implode("/", $parts);
- $this->clearFolderSizeCache($parent);
- }
- }
-
public function is_readable($path) {
return true;
}
@@ -341,9 +291,6 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
OCP\Util::emitHook('OC_Filestorage_Shared', 'file_put_contents', $info);
$storage = OC_Filesystem::getStorage($source);
$result = $storage->file_put_contents($this->getInternalPath($source), $data);
- if ($result) {
- $this->clearFolderSizeCache($path);
- }
return $result;
}
}
@@ -365,7 +312,6 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
} else {
OC_Share::unshareFromMySelf($target);
}
- $this->clearFolderSizeCache($this->getInternalPath($target));
return true;
}
@@ -401,8 +347,6 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
} else {
OC_Share::setTarget($oldTarget, $newTarget);
}
- $this->clearFolderSizeCache($this->getInternalPath($oldTarget));
- $this->clearFolderSizeCache($this->getInternalPath($newTarget));
return true;
}
@@ -413,9 +357,6 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($this->is_writable($path2)) {
$tmpFile = $this->toTmpFile($path1);
$result = $this->fromTmpFile($tmpFile, $path2);
- if ($result) {
- $this->clearFolderSizeCache($path2);
- }
return $result;
} else {
return false;
@@ -451,9 +392,6 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($source) {
$storage = OC_Filesystem::getStorage($source);
$result = $storage->fromTmpFile($tmpFile, $this->getInternalPath($source));
- if ($result) {
- $this->clearFolderSizeCache($path);
- }
return $result;
}
} else {
@@ -520,7 +458,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
$source = $this->getSource($path);
if ($source) {
$storage = OC_Filesystem::getStorage($source);
- return $storage->touch($this->getInternalPath($source),$time);
+ return $storage->touch($this->getInternalPath($source),$mtime);
}
}
diff --git a/apps/files_sharing_log/appinfo/database.xml b/apps/files_sharing_log/appinfo/database.xml
index 92e5f0125bd..dae811f87fa 100644
--- a/apps/files_sharing_log/appinfo/database.xml
+++ b/apps/files_sharing_log/appinfo/database.xml
@@ -3,7 +3,7 @@
<name>*dbname*</name>
<create>true</create>
<overwrite>false</overwrite>
- <charset>latin1</charset>
+ <charset>utf8</charset>
<table>
<name>*dbprefix*sharing_log</name>
<declaration>
diff --git a/apps/files_versions/ajax/expireAll.php b/apps/files_versions/ajax/expireAll.php
index 4f165be0ae9..2a678c7f0a5 100644
--- a/apps/files_versions/ajax/expireAll.php
+++ b/apps/files_versions/ajax/expireAll.php
@@ -27,6 +27,7 @@
// Check user and app status
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('files_versions');
+OCP\JSON::callCheck();
$versions = new OCA_Versions\Storage();
diff --git a/apps/files_versions/ajax/rollbackVersion.php b/apps/files_versions/ajax/rollbackVersion.php
index 8d1092f8b8e..24d71a914a4 100644
--- a/apps/files_versions/ajax/rollbackVersion.php
+++ b/apps/files_versions/ajax/rollbackVersion.php
@@ -1,6 +1,7 @@
<?php
OCP\JSON::checkAppEnabled('files_versions');
+OCP\JSON::callCheck();
$userDirectory = "/".OCP\USER::getUser()."/files";
diff --git a/apps/files_versions/ajax/togglesettings.php b/apps/files_versions/ajax/togglesettings.php
index 86f614c5c89..546b37ae1aa 100644
--- a/apps/files_versions/ajax/togglesettings.php
+++ b/apps/files_versions/ajax/togglesettings.php
@@ -2,6 +2,7 @@
OCP\JSON::checkAppEnabled('files_versions');
OCP\JSON::checkAdminUser();
+OCP\JSON::callCheck();
if (OCP\Config::getSystemValue('versions', 'true')=='true') {
OCP\Config::setSystemValue('versions', 'false');
} else {
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 0ce884c3ea0..f146676757d 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -227,13 +227,13 @@ class Storage {
}
$versions = array_reverse( $versions );
-
+
foreach( $versions as $key => $value ) {
// flag the first matched file in array (which will have latest modification date) as current version
- if ( $versions[$key]['fileMatch'] ) {
+ if ( $value['fileMatch'] ) {
- $versions[$key]['cur'] = 1;
+ $value['cur'] = 1;
break;
}
diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php
index 39d6d3aded1..701949d4d80 100644
--- a/apps/gallery/lib/album.php
+++ b/apps/gallery/lib/album.php
@@ -58,7 +58,7 @@ class OC_Gallery_Album {
return $stmt->execute($args);
}
- public static function removeByName($owner, $name) { self::remove($ownmer, $name); }
+ public static function removeByName($owner, $name) { self::remove($owner, $name); }
public static function removeByPath($owner, $path) { self::remove($owner, null, $path); }
public static function removeByParentPath($owner, $parent) { self::remove($owner, null, null, $parent); }
diff --git a/apps/gallery/lib/managers.php b/apps/gallery/lib/managers.php
index b6ade3d1b1e..575d962dbe3 100644
--- a/apps/gallery/lib/managers.php
+++ b/apps/gallery/lib/managers.php
@@ -29,7 +29,6 @@ class DatabaseManager {
$stmt = \OCP\DB::prepare('INSERT INTO *PREFIX*pictures_images_cache (uid_owner, path, width, height) VALUES (?, ?, ?, ?)');
$stmt->execute(array(\OCP\USER::getUser(), $path, $width, $height));
$ret = array('path' => $path, 'width' => $width, 'height' => $height);
- unset($image);
$dir = dirname($path);
$this->cache[$dir][$path] = $ret;
return $ret;
diff --git a/apps/gallery/lib/tiles.php b/apps/gallery/lib/tiles.php
index 754734e609e..e36d26d3191 100644
--- a/apps/gallery/lib/tiles.php
+++ b/apps/gallery/lib/tiles.php
@@ -33,7 +33,7 @@ class TilesLine {
}
public function setAvailableSpace($space) {
- $available_space = $space;
+ $this->available_space = $space;
}
public function getTilesCount() {
diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php
index d35cca150b2..d5a093338cc 100644
--- a/apps/media/lib_ampache.php
+++ b/apps/media/lib_ampache.php
@@ -271,7 +271,6 @@ class OC_MEDIA_AMPACHE{
</root>");
return;
}
- global $SITEROOT;
$filter=$params['filter'];
$albums=OC_MEDIA_COLLECTION::getAlbums($filter);
$artist=OC_MEDIA_COLLECTION::getArtistName($filter);
diff --git a/apps/media/lib_collection.php b/apps/media/lib_collection.php
index e65930f551d..cacab8e959f 100644
--- a/apps/media/lib_collection.php
+++ b/apps/media/lib_collection.php
@@ -27,7 +27,6 @@ class OC_MEDIA_COLLECTION{
public static $uid;
private static $artistIdCache=array();
private static $albumIdCache=array();
- private static $songIdCache=array();
private static $queries=array();
/**
@@ -152,7 +151,7 @@ class OC_MEDIA_COLLECTION{
return $artistId;
}else{
$query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_artists` (`artist_name`) VALUES (?)");
- $result=$query->execute(array($name));
+ $query->execute(array($name));
return self::getArtistId($name);;
}
}
diff --git a/apps/media/lib_media.php b/apps/media/lib_media.php
index 9e687a4af2c..54502f42575 100644
--- a/apps/media/lib_media.php
+++ b/apps/media/lib_media.php
@@ -27,12 +27,12 @@ class OC_MEDIA{
* @param array $params, parameters passed from OC_Hook
*/
public static function loginListener($params){
- if(isset($_POST['user']) and $_POST['password']){
- $name=$_POST['user'];
+ if(isset($params['uid']) and $params['password']){
+ $name=$params['uid'];
$query=OCP\DB::prepare("SELECT user_id from *PREFIX*media_users WHERE user_id LIKE ?");
$uid=$query->execute(array($name))->fetchAll();
if(count($uid)==0){
- $password=hash('sha256',$_POST['password']);
+ $password=hash('sha256',$params['password']);
$query=OCP\DB::prepare("INSERT INTO *PREFIX*media_users (user_id, user_password_sha256) VALUES (?, ?);");
$query->execute(array($name,$password));
}
diff --git a/apps/remoteStorage/appinfo/info.xml b/apps/remoteStorage/appinfo/info.xml
index fa878762a05..1388ad9c316 100644
--- a/apps/remoteStorage/appinfo/info.xml
+++ b/apps/remoteStorage/appinfo/info.xml
@@ -7,4 +7,7 @@
<author>Michiel de Jong</author>
<require>4</require>
<shipped>true</shipped>
+ <remote>
+ <remoteStorage>webdav.php</remoteStorage>
+ </remote>
</info>
diff --git a/apps/remoteStorage/appinfo/version b/apps/remoteStorage/appinfo/version
index 490f510fc27..0e2c93950bb 100644
--- a/apps/remoteStorage/appinfo/version
+++ b/apps/remoteStorage/appinfo/version
@@ -1 +1 @@
-0.6 \ No newline at end of file
+0.7 \ No newline at end of file
diff --git a/apps/remoteStorage/appinfo/webfinger.php b/apps/remoteStorage/appinfo/webfinger.php
index 5d481f315f8..e8b237628c4 100644
--- a/apps/remoteStorage/appinfo/webfinger.php
+++ b/apps/remoteStorage/appinfo/webfinger.php
@@ -1,8 +1,8 @@
-<?php if(OC_User::userExists(WF_USER)) { ?>
+<?php if(OC_User::userExists(WF_USER)): ?>
{
"rel":"remoteStorage",
- "template":"<?php echo WF_BASEURL; ?>/apps/remoteStorage/WebDAV.php/<?php echo WF_USER; ?>/remoteStorage/{category}/",
+ "template":"<?php echo WF_BASEURL; ?>/remote.php/remoteStorage/<?php echo WF_USER; ?>/remoteStorage/{category}/",
"api":"WebDAV",
"auth":"<?php echo WF_BASEURL; ?>/?app=remoteStorage&getfile=auth.php&userid=<?php echo WF_USER; ?>"
}
-<?php } ?>
+<?php endif ?>
diff --git a/apps/remoteStorage/lib_remoteStorage.php b/apps/remoteStorage/lib_remoteStorage.php
index 42cd9c90f64..c1765640c5d 100644
--- a/apps/remoteStorage/lib_remoteStorage.php
+++ b/apps/remoteStorage/lib_remoteStorage.php
@@ -17,12 +17,11 @@ class OC_remoteStorage {
$user=OCP\USER::getUser();
$query=OCP\DB::prepare("SELECT token FROM *PREFIX*authtoken WHERE user=? AND appUrl=? AND category=? LIMIT 1");
$result=$query->execute(array($user, $appUrl, $categories));
- $ret = array();
if($row=$result->fetchRow()) {
- return base64_encode('remoteStorage:'.$row['token']);
- } else {
- return false;
- }
+ return base64_encode('remoteStorage:'.$row['token']);
+ } else {
+ return false;
+ }
}
public static function getAllTokens() {
@@ -42,13 +41,13 @@ class OC_remoteStorage {
public static function deleteToken($token) {
$user=OCP\USER::getUser();
$query=OCP\DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?");
- $result=$query->execute(array($token,$user));
+ $query->execute(array($token,$user));
return 'unknown';//how can we see if any rows were affected?
}
private static function addToken($token, $appUrl, $categories){
$user=OCP\USER::getUser();
$query=OCP\DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`category`) VALUES(?,?,?,?)");
- $result=$query->execute(array($token,$appUrl,$user,$categories));
+ $query->execute(array($token,$appUrl,$user,$categories));
}
public static function createCategories($appUrl, $categories) {
$token=uniqid();
diff --git a/apps/remoteStorage/oauth_ro_auth.php b/apps/remoteStorage/oauth_ro_auth.php
index 12d02d1cf5d..bed3093c3b3 100644
--- a/apps/remoteStorage/oauth_ro_auth.php
+++ b/apps/remoteStorage/oauth_ro_auth.php
@@ -9,10 +9,10 @@
class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBasic {
private $validTokens;
- private $category;
+ private $category;
public function __construct($validTokensArg, $categoryArg) {
$this->validTokens = $validTokensArg;
- $this->category = $categoryArg;
+ $this->category = $categoryArg;
}
/**
@@ -25,16 +25,16 @@ class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBa
*/
protected function validateUserPass($username, $password){
//always give read-only:
- if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
+ if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
|| (isset($this->validTokens[$password]))
- || (($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
- ) {
+ || (($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
+ ) {
OC_Util::setUpFS();
return true;
} else {
- //var_export($_SERVER);
- //var_export($this->validTokens);
- //die('not getting in with "'.$username.'"/"'.$password.'"!');
+ //var_export($_SERVER);
+ //var_export($this->validTokens);
+ //die('not getting in with "'.$username.'"/"'.$password.'"!');
return false;
}
}
@@ -48,8 +48,8 @@ class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBa
$userpass = $auth->getUserPass();
if (!$userpass) {
if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
- ||(($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
- ) {
+ ||(($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
+ ) {
$userpass = array('', '');
} else {
$auth->requireLogin();
diff --git a/apps/remoteStorage/WebDAV.php b/apps/remoteStorage/webdav.php
index 7a81c18e0af..8d8ec6a45a1 100644
--- a/apps/remoteStorage/WebDAV.php
+++ b/apps/remoteStorage/webdav.php
@@ -25,22 +25,7 @@
*
*/
-
-// Do not load FS ...
-$RUNTIME_NOSETUPFS = true;
-
-
-require_once('../../lib/base.php');
-
-require_once('../../lib/user.php');
-require_once('../../lib/public/user.php');
-
-require_once('../../lib/app.php');
-require_once('../../lib/public/app.php');
-
-require_once('../../3rdparty/Sabre/DAV/Auth/IBackend.php');
-require_once('../../3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php');
-require_once('../../lib/connector/sabre/auth.php');
+OC_App::loadApps(array('filesystem','authentication'));
OCP\App::checkAppEnabled('remoteStorage');
require_once('lib_remoteStorage.php');
@@ -61,14 +46,15 @@ if(isset($_SERVER['HTTP_ORIGIN'])) {
header('Access-Control-Allow-Origin: *');
}
-$path = substr($_SERVER["REQUEST_URI"], strlen($_SERVER["SCRIPT_NAME"]));
+$path = substr($_SERVER["REQUEST_URI"], strlen($baseuri));
+
$pathParts = explode('/', $path);
// for webdav:
-// 0/ 1 / 2 / 3...
-// /$ownCloudUser/remoteStorage/$category/
+// 0 / 1 / 2...
+// $ownCloudUser/remoteStorage/$category/
-if(count($pathParts) >= 3 && $pathParts[0] == '') {
- list($dummy, $ownCloudUser, $dummy2, $category) = $pathParts;
+if(count($pathParts) >= 2) {
+ list($ownCloudUser, $dummy2, $category) = $pathParts;
OC_Util::setupFS($ownCloudUser);
@@ -77,13 +63,13 @@ if(count($pathParts) >= 3 && $pathParts[0] == '') {
$server = new Sabre_DAV_Server($publicDir);
// Path to our script
- $server->setBaseUri(OC::$WEBROOT."/apps/remoteStorage/WebDAV.php/$ownCloudUser");
+ $server->setBaseUri($baseuri.$ownCloudUser);
// Auth backend
$authBackend = new OC_Connector_Sabre_Auth_ro_oauth(
- OC_remoteStorage::getValidTokens($ownCloudUser, $category),
- $category
- );
+ OC_remoteStorage::getValidTokens($ownCloudUser, $category),
+ $category
+ );
$authPlugin = new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud');//should use $validTokens here
$server->addPlugin($authPlugin);
diff --git a/apps/tasks/ajax/addtask.php b/apps/tasks/ajax/addtask.php
index 9f35e7f21ec..d98fdbf3888 100644
--- a/apps/tasks/ajax/addtask.php
+++ b/apps/tasks/ajax/addtask.php
@@ -3,6 +3,7 @@
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
+OCP\JSON::callCheck();
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
$first_calendar = reset($calendars);
@@ -21,7 +22,7 @@ $request['description'] = null;
$vcalendar = OC_Task_App::createVCalendarFromRequest($request);
$id = OC_Calendar_Object::add($cid, $vcalendar->serialize());
-$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$user_timezone = OC_Calendar_App::getTimezone();
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
OCP\JSON::success(array('task' => $task));
diff --git a/apps/tasks/ajax/addtaskform.php b/apps/tasks/ajax/addtaskform.php
deleted file mode 100644
index d86232e2da5..00000000000
--- a/apps/tasks/ajax/addtaskform.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-// Init owncloud
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('tasks');
-
-$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
-$category_options = OC_Calendar_App::getCategoryOptions();
-$percent_options = range(0, 100, 10);
-$priority_options = OC_Task_App::getPriorityOptions();
-$tmpl = new OCP\Template('tasks','part.addtaskform');
-$tmpl->assign('calendars',$calendars);
-$tmpl->assign('category_options', $category_options);
-$tmpl->assign('percent_options', $percent_options);
-$tmpl->assign('priority_options', $priority_options);
-$tmpl->assign('details', new OC_VObject('VTODO'));
-$tmpl->assign('categories', '');
-$page = $tmpl->fetchPage();
-
-OCP\JSON::success(array('data' => array( 'page' => $page )));
diff --git a/apps/tasks/ajax/delete.php b/apps/tasks/ajax/delete.php
index e29add9b556..cc22c3e3873 100644
--- a/apps/tasks/ajax/delete.php
+++ b/apps/tasks/ajax/delete.php
@@ -23,6 +23,7 @@
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
+OCP\JSON::callCheck();
$id = $_POST['id'];
$task = OC_Calendar_App::getEventObject( $id );
diff --git a/apps/tasks/ajax/edittask.php b/apps/tasks/ajax/edittask.php
deleted file mode 100644
index edcc8a7cdcd..00000000000
--- a/apps/tasks/ajax/edittask.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-// Init owncloud
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('tasks');
-
-$l10n = new OC_L10N('tasks');
-
-$id = $_POST['id'];
-$vcalendar = OC_Calendar_App::getVCalendar($id);
-
-$errors = OC_Task_App::validateRequest($_POST);
-if (!empty($errors)) {
- OCP\JSON::error(array('data' => array( 'errors' => $errors )));
- exit();
-}
-
-OC_Task_App::updateVCalendarFromRequest($_POST, $vcalendar);
-OC_Calendar_Object::edit($id, $vcalendar->serialize());
-
-$priority_options = OC_Task_App::getPriorityOptions();
-$tmpl = new OCP\Template('tasks','part.details');
-$tmpl->assign('priority_options', $priority_options);
-$tmpl->assign('details', $vcalendar->VTODO);
-$tmpl->assign('id', $id);
-$page = $tmpl->fetchPage();
-
-$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
-$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
-
-OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));
diff --git a/apps/tasks/ajax/edittaskform.php b/apps/tasks/ajax/edittaskform.php
deleted file mode 100644
index e5a0a7297c5..00000000000
--- a/apps/tasks/ajax/edittaskform.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-// Init owncloud
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('tasks');
-
-$id = $_GET['id'];
-$details = OC_Calendar_App::getVCalendar($id)->VTODO;
-$categories = $details->getAsString('CATEGORIES');
-
-$category_options = OC_Calendar_App::getCategoryOptions();
-$percent_options = range(0, 100, 10);
-$priority_options = OC_Task_App::getPriorityOptions();
-
-$tmpl = new OCP\Template('tasks','part.edittaskform');
-$tmpl->assign('category_options', $category_options);
-$tmpl->assign('percent_options', $percent_options);
-$tmpl->assign('priority_options', $priority_options);
-$tmpl->assign('id',$id);
-$tmpl->assign('details',$details);
-$tmpl->assign('categories', $categories);
-$page = $tmpl->fetchPage();
-
-OCP\JSON::success(array('data' => array( 'page' => $page )));
diff --git a/apps/tasks/ajax/getdetails.php b/apps/tasks/ajax/getdetails.php
deleted file mode 100644
index 4ce469e0c9c..00000000000
--- a/apps/tasks/ajax/getdetails.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-// Init owncloud
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('tasks');
-
-$l10n = new OC_L10N('tasks');
-
-$id = $_GET['id'];
-$task = OC_Calendar_Object::find($id);
-$details = OC_VObject::parse($task['calendardata']);
-if (!$details){
- OCP\JSON::error();
- exit;
-}
-
-$priority_options = OC_Task_App::getPriorityOptions();
-$tmpl = new OCP\Template('tasks','part.details');
-$tmpl->assign('priority_options', $priority_options);
-$tmpl->assign('details',$details->VTODO);
-$tmpl->assign('id',$id);
-$page = $tmpl->fetchPage();
-
-OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
diff --git a/apps/tasks/ajax/gettasks.php b/apps/tasks/ajax/gettasks.php
index 011730d0a13..b6183d9cb65 100644
--- a/apps/tasks/ajax/gettasks.php
+++ b/apps/tasks/ajax/gettasks.php
@@ -11,7 +11,7 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
-$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$user_timezone = OC_Calendar_App::getTimezone();
$tasks = array();
foreach( $calendars as $calendar ){
diff --git a/apps/tasks/ajax/update_property.php b/apps/tasks/ajax/update_property.php
index 46521cf6c58..679cfdefe48 100644
--- a/apps/tasks/ajax/update_property.php
+++ b/apps/tasks/ajax/update_property.php
@@ -9,6 +9,7 @@
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
+OCP\JSON::callCheck();
$id = $_POST['id'];
$property = $_POST['type'];
@@ -38,7 +39,7 @@ switch($property) {
$type = null;
if ($due != 'false') {
try {
- $timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $timezone = OC_Calendar_App::getTimezone();
$timezone = new DateTimeZone($timezone);
$due = new DateTime('@'.$due);
$due->setTimezone($timezone);
@@ -63,6 +64,6 @@ switch($property) {
}
OC_Calendar_Object::edit($id, $vcalendar->serialize());
-$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$user_timezone = OC_Calendar_App::getTimezone();
$task_info = OC_Task_App::arrayForJSON($id, $vtodo, $user_timezone);
OCP\JSON::success(array('data' => $task_info));
diff --git a/apps/tasks/index.php b/apps/tasks/index.php
index 4ff304a5607..f1c4d1e765c 100644
--- a/apps/tasks/index.php
+++ b/apps/tasks/index.php
@@ -21,8 +21,8 @@ OCP\Util::addScript('3rdparty/timepicker', 'jquery.ui.timepicker');
OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
OCP\Util::addScript('tasks', 'tasks');
OCP\Util::addStyle('tasks', 'style');
-OCP\Util::addScript('contacts','jquery.multi-autocomplete');
-OCP\Util::addScript('','oc-vcategories');
+OCP\Util::addScript('contacts', 'jquery.multi-autocomplete');
+OCP\Util::addScript('', 'oc-vcategories');
OCP\App::setActiveNavigationEntry('tasks_index');
$categories = OC_Calendar_App::getCategoryOptions();
diff --git a/apps/tasks/js/tasks.js b/apps/tasks/js/tasks.js
index bc92965bb0b..de627927507 100644
--- a/apps/tasks/js/tasks.js
+++ b/apps/tasks/js/tasks.js
@@ -469,67 +469,5 @@ $(document).ready(function(){
return false;
});
- $('#tasks_addtaskform input[type="submit"]').live('click',function(){
- $.post('ajax/addtask.php',$('#tasks_addtaskform').serialize(),function(jsondata){
- if(jsondata.status == 'success'){
- $('#task_details').data('id',jsondata.data.id);
- $('#task_details').html(jsondata.data.page);
- $('#tasks_list').append(OC.Tasks.create_task_div(jsondata.data.task));
- }
- else{
- alert(jsondata.data.message);
- }
- }, 'json');
- return false;
- });
-
- $('#tasks_edit').live('click',function(){
- var id = $('#task_details').data('id');
- $.getJSON('ajax/edittaskform.php',{'id':id},function(jsondata){
- if(jsondata.status == 'success'){
- $('#task_details').html(jsondata.data.page);
- $('#task_details #categories').multiple_autocomplete({source: categories});
- }
- else{
- alert(jsondata.data.message);
- }
- });
- return false;
- });
-
- $('#tasks_edittaskform #percent_complete').live('change',function(event){
- if ($(event.target).val() == 100){
- $('#tasks_edittaskform #complete').show();
- }else{
- $('#tasks_edittaskform #complete').hide();
- }
- });
-
- $('#tasks_edittaskform input[type="submit"]').live('click',function(){
- $.post('ajax/edittask.php',$('#tasks_edittaskform').serialize(),function(jsondata){
- $('.error_msg').remove();
- $('.error').removeClass('error');
- if(jsondata.status == 'success'){
- var id = jsondata.data.id;
- $('#task_details').data('id',id);
- $('#task_details').html(jsondata.data.page);
- var task = jsondata.data.task;
- $('#tasks .task[data-id='+id+']')
- .data('task', task)
- .html(OC.Tasks.create_task_div(task).html());
- }
- else{
- var errors = jsondata.data.errors;
- for (k in errors){
- $('#'+k).addClass('error')
- .after('<span class="error_msg">'+errors[k]+'</span>');
- }
- $('.error_msg').effect('highlight', {}, 3000);
- $('.error').effect('highlight', {}, 3000);
- }
- }, 'json');
- return false;
- });
-
OCCategories.app = 'calendar';
});
diff --git a/apps/tasks/lib/app.php b/apps/tasks/lib/app.php
index 1b42968f0be..a97c6b95d1d 100644
--- a/apps/tasks/lib/app.php
+++ b/apps/tasks/lib/app.php
@@ -77,24 +77,24 @@ class OC_Task_App {
public static function validateRequest($request)
{
$errors = array();
- if($request['summary'] == ''){
+ if($request['summary'] == '') {
$errors['summary'] = self::$l10n->t('Empty Summary');
}
try {
- $timezone = OCP\Config::getUserValue(OCP\User::getUser(), "calendar", "timezone", "Europe/London");
+ $timezone = OC_Calendar_App::getTimezone();
$timezone = new DateTimeZone($timezone);
new DateTime($request['due'], $timezone);
} catch (Exception $e) {
$errors['due'] = self::$l10n->t('Invalid date/time');
}
- if ($request['percent_complete'] < 0 || $request['percent_complete'] > 100){
+ if ($request['percent_complete'] < 0 || $request['percent_complete'] > 100) {
$errors['percent_complete'] = self::$l10n->t('Invalid percent complete');
}
- if ($request['percent_complete'] == 100 && !empty($request['completed'])){
+ if ($request['percent_complete'] == 100 && !empty($request['completed'])) {
try {
- $timezone = OCP\Config::getUserValue(OCP\User::getUser(), "calendar", "timezone", "Europe/London");
+ $timezone = OC_Calendar_App::getTimezone();
$timezone = new DateTimeZone($timezone);
new DateTime($request['completed'], $timezone);
} catch (Exception $e) {
@@ -147,7 +147,7 @@ class OC_Task_App {
$vtodo->setString('PRIORITY', $priority);
if ($due) {
- $timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $timezone = OC_Calendar_App::getTimezone();
$timezone = new DateTimeZone($timezone);
$due = new DateTime($due, $timezone);
$vtodo->setDateTime('DUE', $due);
@@ -168,15 +168,15 @@ class OC_Task_App {
$vtodo->__unset('PERCENT-COMPLETE');
}
- if ($percent_complete == 100){
- if (!$completed){
+ if ($percent_complete == 100) {
+ if (!$completed) {
$completed = 'now';
}
} else {
$completed = null;
}
if ($completed) {
- $timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $timezone = OC_Calendar_App::getTimezone();
$timezone = new DateTimeZone($timezone);
$completed = new DateTime($completed, $timezone);
$vtodo->setDateTime('COMPLETED', $completed);
diff --git a/apps/tasks/templates/part.addtaskform.php b/apps/tasks/templates/part.addtaskform.php
deleted file mode 100644
index 0fad5592aa7..00000000000
--- a/apps/tasks/templates/part.addtaskform.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<form id="tasks_addtaskform">
- <?php if(count($_['calendars'])==1): ?>
- <input type="hidden" name="id" value="<?php echo $_['calendars'][0]['id']; ?>">
- <?php else: ?>
- <label for="id"><?php echo $l->t('Calendar'); ?></label>
- <select name="id" size="1">
- <?php foreach($_['calendars'] as $calendar): ?>
- <option value="<?php echo $calendar['id']; ?>"><?php echo $calendar['displayname']; ?></option>
- <?php endforeach; ?>
- </select>
- <br>
- <?php endif; ?>
- <?php echo $this->inc('part.taskform'); ?>
- <input type="submit" name="submit" value="<?php echo $l->t('Create Task'); ?>">
-</form>
diff --git a/apps/tasks/templates/part.details.php b/apps/tasks/templates/part.details.php
deleted file mode 100644
index 89636b6e762..00000000000
--- a/apps/tasks/templates/part.details.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php if(isset($_['details']->SUMMARY)): ?>
-<table>
-<?php
-echo $this->inc('part.property', array('label' => $l->t('Summary'), 'property' => $_['details']->SUMMARY));
-if(isset($_['details']->LOCATION)):
- echo $this->inc('part.property', array('label' => $l->t('Location'), 'property' => $_['details']->LOCATION));
-endif;
-if(isset($_['details']->CATEGORIES)):
- echo $this->inc('part.property', array('label' => $l->t('Categories'), 'property' => $_['details']->CATEGORIES));
-endif;
-if(isset($_['details']->DUE)):
- echo $this->inc('part.property', array('label' => $l->t('Due'), 'property' => $_['details']->DUE[0]));
-endif;
-if(isset($_['details']->PRIORITY)):
- echo $this->inc('part.property', array('label' => $l->t('Priority'), 'property' => $_['details']->PRIORITY[0], 'options' => $_['priority_options']));
-endif;
-if($_['details']->__isset('PERCENT-COMPLETE') || isset($_['details']->COMPLETED)):
-?>
-<tr>
- <th>
- <?php echo $l->t('Complete') ?>
- </th>
- <td>
-<?php if($_['details']->__isset('PERCENT-COMPLETE')):
- echo $_['details']->__get('PERCENT-COMPLETE')->value.' % ';
- endif;
- if(isset($_['details']->COMPLETED)):
- echo $l->t('on '). $l->l('datetime', $_['details']->COMPLETED[0]->getDateTime());
- endif;
- echo '</tr>';
-endif;
-if(isset($_['details']->DESCRIPTION)):
- echo $this->inc('part.property', array('label' => $l->t('Description'), 'property' => $_['details']->DESCRIPTION));
-endif; ?>
-</table>
-<form>
- <input type="button" id="tasks_delete" value="<?php echo $l->t('Delete');?>">
- <input type="button" id="tasks_edit" value="<?php echo $l->t('Edit');?>">
-</form>
-<?php else: ?>
-<?php //var_dump($_['details']); ?>
-<?php endif ?>
diff --git a/apps/tasks/templates/part.edittaskform.php b/apps/tasks/templates/part.edittaskform.php
deleted file mode 100644
index fe123f07ac6..00000000000
--- a/apps/tasks/templates/part.edittaskform.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<form id="tasks_edittaskform">
- <input type="hidden" name="id" value="<?php echo $_['id']; ?>">
- <?php echo $this->inc('part.taskform'); ?>
- <input type="submit" name="submit" value="<?php echo $l->t('Update Task'); ?>">
-</form>
diff --git a/apps/tasks/templates/part.property.php b/apps/tasks/templates/part.property.php
deleted file mode 100644
index 591fd363e6f..00000000000
--- a/apps/tasks/templates/part.property.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<tr>
- <th>
- <?php echo $_['label'] ?>
- </th>
- <td>
- <?php
- switch (get_class($_['property']))
- {
- case 'Sabre_VObject_Element_DateTime':
- echo $l->l('datetime', $_['property']->getDateTime());
- break;
- default:
- $value = $_['property']->value;
- if (isset($_['options']))
- {
- $value = $_['options'][$value];
- }
- echo nl2br($value);
- }
- ?>
- </td>
-</tr>
diff --git a/apps/tasks/templates/part.taskform.php b/apps/tasks/templates/part.taskform.php
deleted file mode 100644
index 0a25ed33c91..00000000000
--- a/apps/tasks/templates/part.taskform.php
+++ /dev/null
@@ -1,36 +0,0 @@
- <label for="summary"><?php echo $l->t('Summary'); ?></label>
- <input type="text" id="summary" name="summary" placeholder="<?php echo $l->t('Summary of the task');?>" value="<?php echo isset($_['details']->SUMMARY) ? $_['details']->SUMMARY[0]->value : '' ?>">
- <br>
- <label for="location"><?php echo $l->t('Location'); ?></label>
- <input type="text" id="location" name="location" placeholder="<?php echo $l->t('Location of the task');?>" value="<?php echo isset($_['details']->LOCATION) ? $_['details']->LOCATION[0]->value : '' ?>">
- <br>
- <label for="categories"><?php echo $l->t('Categories'); ?></label>
- <input id="categories" name="categories" type="text" placeholder="<?php echo $l->t('Separate categories with commas'); ?>" value="<?php echo isset($_['categories']) ? $_['categories'] : '' ?>">
- <a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"><img alt="<?php echo $l->t('Edit categories'); ?>" src="<?php echo OCP\image_path('core','actions/rename.svg')?>" class="svg action" style="width: 16px; height: 16px;"></a>
- <br>
- <label for="due"><?php echo $l->t('Due'); ?></label>
- <input type="text" id="due" name="due" placeholder="<?php echo $l->t('Due date') ?>" value="<?php echo isset($_['details']->DUE) ? $l->l('datetime', $_['details']->DUE[0]->getDateTime()) : '' ?>">
- <br>
- <select name="percent_complete" id="percent_complete">
- <?php
- foreach($_['percent_options'] as $percent){
- echo '<option value="' . $percent . '"' . (($_['details']->__get('PERCENT-COMPLETE') && $percent == $_['details']->__get('PERCENT-COMPLETE')->value) ? ' selected="selected"' : '') . '>' . $percent . ' %</option>';
- }
- ?>
- </select>
- <label for="percent_complete"><?php echo $l->t('Complete'); ?></label>
- <span id="complete"<?php echo ($_['details']->__get('PERCENT-COMPLETE') && $_['details']->__get('PERCENT-COMPLETE')->value == 100) ? '' : ' style="display:none;"' ?>><label for="completed"><?php echo $l->t('completed on'); ?></label>
- <input type="text" id="completed" name="completed" value="<?php echo isset($_['details']->COMPLETED) ? $l->l('datetime', $_['details']->COMPLETED[0]->getDateTime()) : '' ?>"></span>
- <br>
- <label for="priority"><?php echo $l->t('Priority'); ?></label>
- <select name="priority">
- <?php
- foreach($_['priority_options'] as $priority => $label){
- echo '<option value="' . $priority . '"' . ((isset($_['details']->PRIORITY) && $priority == $_['details']->PRIORITY->value) ? ' selected="selected"' : '') . '>' . $label . '</option>';
- }
- ?>
- </select>
- <br>
- <label for="description"><?php echo $l->t('Description'); ?></label><br>
- <textarea placeholder="<?php echo $l->t('Description of the task');?>" name="description"><?php echo isset($_['details']->DESCRIPTION) ? $_['details']->DESCRIPTION[0]->value : '' ?></textarea>
- <br>
diff --git a/apps/tasks/templates/part.tasks.php b/apps/tasks/templates/part.tasks.php
deleted file mode 100644
index 50be1cd6bed..00000000000
--- a/apps/tasks/templates/part.tasks.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php foreach( $_['tasks'] as $task ): ?>
- <li data-id="<?php echo $task['id']; ?>"><a href="index.php?id=<?php echo $task['id']; ?>"><?php echo $task['name']; ?></a> </li>
-<?php endforeach; ?>
diff --git a/apps/user_external/appinfo/app.php b/apps/user_external/appinfo/app.php
new file mode 100644
index 00000000000..c7408ec30d9
--- /dev/null
+++ b/apps/user_external/appinfo/app.php
@@ -0,0 +1,4 @@
+<?php
+OC::$CLASSPATH['OC_User_IMAP']='apps/user_external/lib/imap.php';
+OC::$CLASSPATH['OC_User_SMB']='apps/user_external/lib/smb.php';
+OC::$CLASSPATH['OC_User_FTP']='apps/user_external/lib/ftp.php';
diff --git a/apps/user_external/appinfo/info.xml b/apps/user_external/appinfo/info.xml
new file mode 100644
index 00000000000..1d1dcee5401
--- /dev/null
+++ b/apps/user_external/appinfo/info.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<info>
+ <id>user_external</id>
+ <name>External user support</name>
+ <description>Use external user authentication methods</description>
+ <licence>AGPL</licence>
+ <author>Robin Appelman</author>
+ <require>4</require>
+ <shipped>true</shipped>
+ <types>
+ <authentication/>
+ </types>
+</info>
diff --git a/apps/user_external/appinfo/version b/apps/user_external/appinfo/version
new file mode 100644
index 00000000000..ceab6e11ece
--- /dev/null
+++ b/apps/user_external/appinfo/version
@@ -0,0 +1 @@
+0.1 \ No newline at end of file
diff --git a/apps/user_external/lib/ftp.php b/apps/user_external/lib/ftp.php
new file mode 100644
index 00000000000..e03e17d2b6a
--- /dev/null
+++ b/apps/user_external/lib/ftp.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class OC_User_FTP extends OC_User_Backend{
+ private $host;
+ private $secure;
+ private $protocol;
+
+ public function __construct($host,$secure=false){
+ $this->host=$host;
+ $this->secure=$secure;
+ $this->protocol='ftp';
+ if($this->secure){
+ $this->protocol.='s';
+ }
+ $this->protocol.='://';
+ }
+
+ /**
+ * @brief Check if the password is correct
+ * @param $uid The username
+ * @param $password The password
+ * @returns true/false
+ *
+ * Check if the password is correct without logging in the user
+ */
+ public function checkPassword($uid, $password){
+ $url=$this->protocol.$uid.':'.$password.'@'.$this->host.'/';
+ $result=@opendir($url);
+ if(is_resource($result)){
+ return $uid;
+ }else{
+ return false;
+ }
+ }
+
+ public function userExists($uid){
+ return true;
+ }
+}
diff --git a/apps/user_external/lib/imap.php b/apps/user_external/lib/imap.php
new file mode 100644
index 00000000000..584e9804b18
--- /dev/null
+++ b/apps/user_external/lib/imap.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class OC_User_IMAP extends OC_User_Backend{
+ private $mailbox;
+
+ public function __construct($mailbox){
+ $this->mailbox=$mailbox;
+ }
+
+ /**
+ * @brief Check if the password is correct
+ * @param $uid The username
+ * @param $password The password
+ * @returns true/false
+ *
+ * Check if the password is correct without logging in the user
+ */
+ public function checkPassword($uid, $password){
+ $mbox = @imap_open($this->mailbox, $uid, $password);
+ imap_errors();
+ imap_alerts();
+ if($mbox){
+ imap_close($mbox);
+ return $uid;
+ }else{
+ return false;
+ }
+ }
+
+ public function userExists($uid){
+ return true;
+ }
+}
+
diff --git a/apps/user_external/lib/smb.php b/apps/user_external/lib/smb.php
new file mode 100644
index 00000000000..44d2b7903d8
--- /dev/null
+++ b/apps/user_external/lib/smb.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class OC_User_SMB extends OC_User_Backend{
+ private $host;
+
+ const smbclient='smbclient';
+ const loginError='NT_STATUS_LOGON_FAILURE';
+
+ public function __construct($host){
+ $this->host=$host;
+ }
+
+ /**
+ * @brief Check if the password is correct
+ * @param $uid The username
+ * @param $password The password
+ * @returns true/false
+ *
+ * Check if the password is correct without logging in the user
+ */
+ public function checkPassword($uid, $password){
+ $uidEscaped=escapeshellarg($uid);
+ $password=escapeshellarg($password);
+ $result=array();
+ $command=self::smbclient.' //'.$this->host.'/dummy -U'.$uidEscaped.'%'.$password;
+ $result=exec($command,$result);
+ if(substr($result,-strlen(self::loginError))==self::loginError){
+ return false;
+ }else{
+ return $uid;
+ }
+ }
+
+ public function userExists($uid){
+ return true;
+ }
+} \ No newline at end of file
diff --git a/apps/user_external/tests/config.php b/apps/user_external/tests/config.php
new file mode 100644
index 00000000000..64ee141d32d
--- /dev/null
+++ b/apps/user_external/tests/config.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+return array(
+ 'imap'=>array(
+ 'run'=>false,
+ 'mailbox'=>'{imap.gmail.com:993/imap/ssl}INBOX', //see http://php.net/manual/en/function.imap-open.php
+ 'user'=>'foo',//valid username/password combination
+ 'password'=>'bar',
+ ),
+ 'smb'=>array(
+ 'run'=>false,
+ 'host'=>'localhost',
+ 'user'=>'test',//valid username/password combination
+ 'password'=>'test',
+ ),
+ 'ftp'=>array(
+ 'run'=>false,
+ 'host'=>'localhost',
+ 'user'=>'test',//valid username/password combination
+ 'password'=>'test',
+ ),
+);
diff --git a/apps/user_external/tests/ftp.php b/apps/user_external/tests/ftp.php
new file mode 100644
index 00000000000..0cf7565f9c6
--- /dev/null
+++ b/apps/user_external/tests/ftp.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class Test_User_FTP extends UnitTestCase{
+ /**
+ * @var OC_User_IMAP $instance
+ */
+ private $instance;
+
+ private function getConfig(){
+ return include(__DIR__.'/config.php');
+ }
+
+ function skip(){
+ $config=$this->getConfig();
+ $this->skipUnless($config['ftp']['run']);
+ }
+
+ function setUp(){
+ $config=$this->getConfig();
+ $this->instance=new OC_User_FTP($config['ftp']['host']);
+ }
+
+ function testLogin(){
+ $config=$this->getConfig();
+ $this->assertEqual($config['ftp']['user'],$this->instance->checkPassword($config['ftp']['user'],$config['ftp']['password']));
+ $this->assertFalse($this->instance->checkPassword($config['ftp']['user'],$config['ftp']['password'].'foo'));
+ }
+}
diff --git a/apps/user_external/tests/imap.php b/apps/user_external/tests/imap.php
new file mode 100644
index 00000000000..c703b32107f
--- /dev/null
+++ b/apps/user_external/tests/imap.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class Test_User_Imap extends UnitTestCase{
+ /**
+ * @var OC_User_IMAP $instance
+ */
+ private $instance;
+
+ private function getConfig(){
+ return include(__DIR__.'/config.php');
+ }
+
+ function skip(){
+ $config=$this->getConfig();
+ $this->skipUnless($config['imap']['run']);
+ }
+
+ function setUp(){
+ $config=$this->getConfig();
+ $this->instance=new OC_User_IMAP($config['imap']['mailbox']);
+ }
+
+ function testLogin(){
+ $config=$this->getConfig();
+ $this->assertEqual($config['imap']['user'],$this->instance->checkPassword($config['imap']['user'],$config['imap']['password']));
+ $this->assertFalse($this->instance->checkPassword($config['imap']['user'],$config['imap']['password'].'foo'));
+ }
+}
diff --git a/apps/user_external/tests/smb.php b/apps/user_external/tests/smb.php
new file mode 100644
index 00000000000..1ed7eb934be
--- /dev/null
+++ b/apps/user_external/tests/smb.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class Test_User_SMB extends UnitTestCase{
+ /**
+ * @var OC_User_IMAP $instance
+ */
+ private $instance;
+
+ private function getConfig(){
+ return include(__DIR__.'/config.php');
+ }
+
+ function skip(){
+ $config=$this->getConfig();
+ $this->skipUnless($config['smb']['run']);
+ }
+
+ function setUp(){
+ $config=$this->getConfig();
+ $this->instance=new OC_User_SMB($config['smb']['host']);
+ }
+
+ function testLogin(){
+ $config=$this->getConfig();
+ $this->assertEqual($config['smb']['user'],$this->instance->checkPassword($config['smb']['user'],$config['smb']['password']));
+ $this->assertFalse($this->instance->checkPassword($config['smb']['user'],$config['smb']['password'].'foo'));
+ }
+}
diff --git a/apps/user_webfinger/.htaccess b/apps/user_webfinger/.htaccess
new file mode 100644
index 00000000000..1b13cf788ff
--- /dev/null
+++ b/apps/user_webfinger/.htaccess
@@ -0,0 +1,5 @@
+<IfModule mod_rewrite.c>
+RewriteEngine on
+RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+RewriteRule ^host-meta host-meta.php [QSA,L]
+</IfModule>
diff --git a/apps/user_webfinger/host-meta.php b/apps/user_webfinger/host-meta.php
index 32ffb512057..4ac37b1ea09 100644
--- a/apps/user_webfinger/host-meta.php
+++ b/apps/user_webfinger/host-meta.php
@@ -1,10 +1,27 @@
<?php
+
+if(class_exists('OC')){
+ $WEBROOT=OC::$WEBROOT;
+}else{//not called trough remote.php try to guess the webroot the best we can from here
+ // calculate the root directories
+ $SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-strlen('apps/user_webfinger/host-meta.php')));
+ $WEBROOT=substr($SERVERROOT,strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
+
+ if($WEBROOT!='' and $WEBROOT[0]!=='/'){
+ $WEBROOT='/'.$WEBROOT;
+ }
+}
+
+if(substr($WEBROOT,-1)==='/'){
+ $WEBROOT=substr($WEBROOT,0,-1);
+}
+
$hostMetaHeader = array(
'Access-Control-Allow-Origin' => '*',
'Content-Type' => 'application/xrd+json'
);
$serverName = $_SERVER['SERVER_NAME'];
-$hostMetaContents = '{"links":[{"rel":"lrdd","template":"http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$serverName.'/public.php?service=webfinger&q={uri}"}]}';
+$hostMetaContents = '{"links":[{"rel":"lrdd","template":"http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$serverName.$WEBROOT.'/public.php?service=webfinger&q={uri}"}]}';
foreach($hostMetaHeader as $header => $value) {
header($header . ": " . $value);
}
diff --git a/autotest.sh b/autotest.sh
index 06605687d1d..a42c6ab059e 100755
--- a/autotest.sh
+++ b/autotest.sh
@@ -1,53 +1,36 @@
+#!/bin/bash
#
-# sqlite testing now
+# ownCloud
#
-echo "Setup environment for sqlite testing ..."
+# @author Thomas Müller
+# @copyright 2012 Thomas Müller thomas.mueller@tmit.eu
+#
+
DATADIR=data-autotest
-rm -rf $DATADIR
-mkdir $DATADIR
-rm -rf config/config.php
-#cp autotest/config.sqlite.php config/autoconfig.php
-cat > ./config/autoconfig.php <<DELIM
+BASEDIR=$PWD
+
+# create autoconfig for sqlite, mysql and (soon) postgresql
+cat > ./tests/autoconfig-sqlite.php <<DELIM
<?php
\$AUTOCONFIG = array (
'installed' => false,
'dbtype' => 'sqlite',
'dbtableprefix' => 'oc_',
- 'datadirectory' => 'data',
'adminlogin' => 'admin',
'adminpass' => 'admin',
- 'directory' => '$PWD/$DATADIR',
+ 'directory' => '$BASEDIR/$DATADIR',
);
DELIM
-php -f index.php
-
-#test execution
-echo 'Testing with sqlite ...'
-cd tests
-php -f index.php -- xml > autotest-results-sqlite.xml
-
-#
-# mysql testing now
-#
-# NOTES:
-# - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
-#
-echo "Setup environment for MySql testing ..."
-DATADIR=data-autotest
-rm -rf $DATADIR
-mkdir $DATADIR
-rm -rf config/config.php
-cat > ./config/autoconfig.php <<DELIM
+cat > ./tests/autoconfig-mysql.php <<DELIM
<?php
\$AUTOCONFIG = array (
'installed' => false,
'dbtype' => 'mysql',
'dbtableprefix' => 'oc_',
- 'datadirectory' => 'data',
'adminlogin' => 'admin',
'adminpass' => 'admin',
- 'directory' => '$PWD/$DATADIR',
+ 'directory' => '$BASEDIR/$DATADIR',
'dbuser' => 'oc_autotest',
'dbname' => 'oc_autotest',
'dbhost' => 'localhost',
@@ -55,18 +38,73 @@ cat > ./config/autoconfig.php <<DELIM
);
DELIM
-#drop the database
-mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"
+cat > ./tests/autoconfig-pgsql.php <<DELIM
+<?php
+\$AUTOCONFIG = array (
+ 'installed' => false,
+ 'dbtype' => 'pgsql',
+ 'dbtableprefix' => 'oc_',
+ 'adminlogin' => 'admin',
+ 'adminpass' => 'admin',
+ 'directory' => '$BASEDIR/$DATADIR',
+ 'dbuser' => 'oc_autotest',
+ 'dbname' => 'oc_autotest',
+ 'dbhost' => 'localhost',
+ 'dbpass' => 'owncloud',
+);
+DELIM
+
+function execute_tests {
+ echo "Setup environment for $1 testing ..."
+ # back to root folder
+ cd $BASEDIR
+
+ # revert changes to tests/data
+ git checkout tests/data/*
+
+ # reset data directory
+ rm -rf $DATADIR
+ mkdir $DATADIR
-#setup
-php -f index.php
+ # remove the old config file
+ rm -rf config/config.php
-#test execution
-echo 'Testing with MySql ...'
-cd tests
-php -f index.php -- xml > autotest-results-MySql.xml
+ # drop database
+ if [ "$1" == "mysql" ] ; then
+ mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"
+ fi
+ if [ "$1" == "pgsql" ] ; then
+ dropdb -U oc_autotest oc_autotest
+ fi
+ # copy autoconfig
+ cp $BASEDIR/tests/autoconfig-$1.php $BASEDIR/config/autoconfig.php
+
+ # trigger installation
+ php -f index.php
+
+ #test execution
+ echo "Testing with $1 ..."
+ cd tests
+ php -f index.php -- xml $1 > autotest-results-$1.xml
+}
+
+#
+# start test execution
+#
+execute_tests "sqlite"
+execute_tests 'mysql'
+execute_tests 'pgsql'
+
+#
+# NOTES on mysql:
+# - CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud';
+# - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
#
-# TODO: create config for postgres
+# NOTES on pgsql:
+# - su - postgres
+# - createuser -P (enter username and password and enable superuser)
+# - to enable dropdb I decided to add following line to pg_hba.conf (this is not the safest way but I don't care for the testing machine):
+# local all all trust
#
diff --git a/core/templates/login.php b/core/templates/login.php
index 985cf90c2a2..b35c4a33be8 100644
--- a/core/templates/login.php
+++ b/core/templates/login.php
@@ -7,7 +7,7 @@
<?php endif; ?>
<p class="infield">
<label for="user" class="infield"><?php echo $l->t( 'Username' ); ?></label>
- <input type="text" name="user" id="user" value="<?php echo !empty($_POST['user'])?OC_Util::sanitizeHTML($_POST['user'],ENT_COMPAT,'utf-8').'"':'" autofocus'; ?> autocomplete="off" required />
+ <input type="text" name="user" id="user" value="<?php echo !empty($_POST['user'])?OC_Util::sanitizeHTML($_POST['user'],ENT_COMPAT,'utf-8').'"':'" autofocus'; ?> autocomplete="on" required />
</p>
<p class="infield">
<label for="password" class="infield"><?php echo $l->t( 'Password' ); ?></label>
diff --git a/lib/MDB2/Driver/sqlite3.php b/lib/MDB2/Driver/sqlite3.php
index 25927aff637..6bfccadad9a 100644
--- a/lib/MDB2/Driver/sqlite3.php
+++ b/lib/MDB2/Driver/sqlite3.php
@@ -1221,7 +1221,7 @@ class MDB2_Statement_sqlite3 extends MDB2_Statement_Common
return $affected_rows;
}
- $result =& $this->db->_wrapResult($result, $this->result_types,
+ $result = $this->db->_wrapResult($result, $this->result_types,
$result_class, $result_wrap_class, $this->limit, $this->offset);
$this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
return $result;
diff --git a/lib/app.php b/lib/app.php
index caf8bd82521..2b975de9ef0 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -27,7 +27,6 @@
* upgrading and removing apps.
*/
class OC_App{
- static private $init = false;
static private $activeapp = '';
static private $navigation = array();
static private $settingsForms = array();
diff --git a/lib/archive/zip.php b/lib/archive/zip.php
index 6631a649b16..b2d6674d639 100644
--- a/lib/archive/zip.php
+++ b/lib/archive/zip.php
@@ -11,7 +11,6 @@ class OC_Archive_ZIP extends OC_Archive{
* @var ZipArchive zip
*/
private $zip=null;
- private $success=false;
private $path;
function __construct($source){
@@ -74,8 +73,7 @@ class OC_Archive_ZIP extends OC_Archive{
* @return int
*/
function mtime($path){
- $stat=$this->zip->statName($path);
- return $stat['mtime'];
+ return filemtime($this->path);
}
/**
* get the files in a folder
diff --git a/lib/base.php b/lib/base.php
index fe69ad70c0f..631ed4fcce6 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -345,7 +345,7 @@ class OC{
$_SESSION['user_id'] = '';
}
- OC_User::useBackend( OC_Config::getValue( "userbackend", "database" ));
+ OC_User::useBackend(new OC_User_Database());
OC_Group::useBackend(new OC_Group_Database());
// Load Apps
diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php
index ee680391626..99f696e3a07 100644
--- a/lib/connector/sabre/auth.php
+++ b/lib/connector/sabre/auth.php
@@ -31,13 +31,18 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
* @return bool
*/
protected function validateUserPass($username, $password){
- OC_Util::setUpFS();//login hooks may need early access to the filesystem
- if(OC_User::login($username,$password)){
- OC_Util::setUpFS($username);
+ if (OC_User::isLoggedIn()) {
+ OC_Util::setupFS($username);
return true;
- }
- else{
- return false;
+ } else {
+ OC_Util::setUpFS();//login hooks may need early access to the filesystem
+ if(OC_User::login($username,$password)){
+ OC_Util::setUpFS($username);
+ return true;
+ }
+ else{
+ return false;
+ }
}
}
}
diff --git a/lib/connector/sabre/client.php b/lib/connector/sabre/client.php
index 87f9d59b3ae..7e8f21264f9 100644
--- a/lib/connector/sabre/client.php
+++ b/lib/connector/sabre/client.php
@@ -68,18 +68,13 @@ class OC_Connector_Sabre_Client extends Sabre_DAV_Client {
// Automatically follow redirects
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 5,
- CURLOPT_SSL_VERIFYPEER => true,
- //CURLOPT_SSL_VERIFYPEER => false,
);
-
+
if($this->trustedCertificates) {
$curlSettings[CURLOPT_CAINFO] = $this->trustedCertificates;
}
-
+
switch ($method) {
- case 'PUT':
- $curlSettings[CURLOPT_PUT] = true;
- break;
case 'HEAD' :
// do not read body with HEAD requests (this is neccessary because cURL does not ignore the body with HEAD
@@ -110,8 +105,15 @@ class OC_Connector_Sabre_Client extends Sabre_DAV_Client {
$curlSettings[CURLOPT_PROXY] = $this->proxy;
}
- if ($this->userName) {
- $curlSettings[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC | CURLAUTH_DIGEST;
+ if ($this->userName && $this->authType) {
+ $curlType = 0;
+ if ($this->authType & self::AUTH_BASIC) {
+ $curlType |= CURLAUTH_BASIC;
+ }
+ if ($this->authType & self::AUTH_DIGEST) {
+ $curlType |= CURLAUTH_DIGEST;
+ }
+ $curlSettings[CURLOPT_HTTPAUTH] = $curlType;
$curlSettings[CURLOPT_USERPWD] = $this->userName . ':' . $this->password;
}
@@ -167,5 +169,5 @@ class OC_Connector_Sabre_Client extends Sabre_DAV_Client {
return $response;
- }
+ }
} \ No newline at end of file
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php
index b75bb5c50f5..0842fc4fc65 100644
--- a/lib/connector/sabre/directory.php
+++ b/lib/connector/sabre/directory.php
@@ -26,17 +26,33 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
/**
* Creates a new file in the directory
*
- * data is a readable stream resource
+ * Data will either be supplied as a stream resource, or in certain cases
+ * as a string. Keep in mind that you may have to support either.
+ *
+ * After succesful creation of the file, you may choose to return the ETag
+ * of the new file here.
+ *
+ * The returned ETag must be surrounded by double-quotes (The quotes should
+ * be part of the actual string).
+ *
+ * If you cannot accurately determine the ETag, you should not return it.
+ * If you don't store the file exactly as-is (you're transforming it
+ * somehow) you should also not return an ETag.
+ *
+ * This means that if a subsequent GET to this new file does not exactly
+ * return the same contents of what was submitted here, you are strongly
+ * recommended to omit the ETag.
*
* @param string $name Name of the file
- * @param resource $data Initial payload
- * @return void
+ * @param resource|string $data Initial payload
+ * @return null|string
*/
public function createFile($name, $data = null) {
$newPath = $this->path . '/' . $name;
OC_Filesystem::file_put_contents($newPath,$data);
+ return OC_Connector_Sabre_Node::getETagPropertyForFile($newPath);
}
/**
@@ -146,7 +162,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
* @return array
*/
public function getQuotaInfo() {
- $rootInfo=OC_FileCache::get('');
+ $rootInfo=OC_FileCache_Cached::get('');
return array(
$rootInfo['size'],
OC_Filesystem::free_space()
diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php
index e4dc8c93445..80f0a0ab4d8 100644
--- a/lib/connector/sabre/file.php
+++ b/lib/connector/sabre/file.php
@@ -26,13 +26,28 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
/**
* Updates the data
*
+ * The data argument is a readable stream resource.
+ *
+ * After a succesful put operation, you may choose to return an ETag. The
+ * etag must always be surrounded by double-quotes. These quotes must
+ * appear in the actual string you're returning.
+ *
+ * Clients may use the ETag from a PUT request to later on make sure that
+ * when they update the file, the contents haven't changed in the mean
+ * time.
+ *
+ * If you don't plan to store the file byte-by-byte, and you return a
+ * different object on a subsequent GET you are strongly recommended to not
+ * return an ETag, and just return null.
+ *
* @param resource $data
- * @return void
+ * @return string|null
*/
public function put($data) {
OC_Filesystem::file_put_contents($this->path,$data);
+ return OC_Connector_Sabre_Node::getETagPropertyForFile($this->path);
}
/**
@@ -42,7 +57,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
*/
public function get() {
- return OC_Filesystem::readfile($this->path);
+ return OC_Filesystem::fopen($this->path,'rb');
}
@@ -79,9 +94,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
* @return mixed
*/
public function getETag() {
-
- return null;
-
+ $properties = $this->getProperties(array(self::GETETAG_PROPERTYNAME));
+ if (isset($properties[self::GETETAG_PROPERTYNAME])) {
+ return $properties[self::GETETAG_PROPERTYNAME];
+ }
+ return $this->getETagPropertyForFile($this->path);
}
/**
diff --git a/lib/connector/sabre/locks.php b/lib/connector/sabre/locks.php
index 94382e68a1a..e95dcf02d27 100644
--- a/lib/connector/sabre/locks.php
+++ b/lib/connector/sabre/locks.php
@@ -108,7 +108,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
$locks = $this->getLocks($uri,false);
$exists = false;
- foreach($locks as $k=>$lock) {
+ foreach($locks as $lock) {
if ($lock->token == $lockInfo->token) $exists = true;
}
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index be315a0ffd9..3cb5412f09f 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -22,6 +22,7 @@
*/
abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IProperties {
+ const GETETAG_PROPERTYNAME = '{DAV:}getetag';
/**
* The path to the current node
@@ -178,7 +179,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* @param array $properties
* @return void
*/
- function getProperties($properties) {
+ public function getProperties($properties) {
if (is_null($this->property_cache)) {
$query = OC_DB::prepare( 'SELECT * FROM *PREFIX*properties WHERE userid = ? AND propertypath = ?' );
$result = $query->execute( array( OC_User::getUser(), $this->path ));
@@ -200,4 +201,29 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
}
return $props;
}
+
+ /**
+ * Returns the ETag surrounded by double-quotes for this path.
+ * @param string $path Path of the file
+ * @return string|null Returns null if the ETag can not effectively be determined
+ */
+ static public function getETagPropertyForFile($path) {
+ $tag = OC_Filesystem::hash('md5', $path);
+ if (empty($tag)) {
+ return null;
+ }
+ $etag = '"'.$tag.'"';
+ $query = OC_DB::prepare( 'INSERT INTO *PREFIX*properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)' );
+ $query->execute( array( OC_User::getUser(), $path, self::GETETAG_PROPERTYNAME, $etag ));
+ return $etag;
+ }
+
+ /**
+ * Remove the ETag from the cache.
+ * @param string $path Path of the file
+ */
+ static public function removeETagPropertyForFile($path) {
+ $query = OC_DB::prepare( 'DELETE FROM *PREFIX*properties WHERE userid = ? AND propertypath = ? AND propertyname = ?' );
+ $query->execute( array( OC_User::getUser(), $path, self::GETETAG_PROPERTYNAME ));
+ }
}
diff --git a/lib/db.php b/lib/db.php
index 2a06d72ea32..6f083d17cfb 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -33,8 +33,6 @@ class OC_DB {
static private $MDB2=false;
static private $PDO=false;
static private $schema=false;
- static private $affected=0;
- static private $result=false;
static private $inTransaction=false;
static private $prefix=null;
static private $type=null;
@@ -222,7 +220,7 @@ class OC_DB {
echo( '<b>can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')</center>');
OC_Log::write('core',self::$MDB2->getUserInfo(),OC_Log::FATAL);
OC_Log::write('core',self::$MDB2->getMessage(),OC_Log::FATAL);
- die( $error );
+ die();
}
// We always, really always want associative arrays
@@ -519,8 +517,9 @@ class OC_DB {
// Delete our temporary file
unlink( $file2 );
- foreach($definition['tables'] as $name=>$table){
- self::dropTable($name);
+ $tables=array_keys($definition['tables']);
+ foreach($tables as $table){
+ self::dropTable($table);
}
}
diff --git a/lib/eventsource.php b/lib/eventsource.php
index cf10660b94c..2a8c6b92902 100644
--- a/lib/eventsource.php
+++ b/lib/eventsource.php
@@ -36,7 +36,7 @@ class OC_EventSource{
header('Cache-Control: no-cache');
$this->fallback=isset($_GET['fallback']) and $_GET['fallback']=='true';
if($this->fallback){
- $fallBackId=$_GET['fallback_id'];
+ $this->fallBackId=$_GET['fallback_id'];
header("Content-Type: text/html");
echo str_repeat('<span></span>'.PHP_EOL,10); //dummy data to keep IE happy
}else{
diff --git a/lib/filecache.php b/lib/filecache.php
index d956f34dc48..4b1774925c3 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -126,7 +126,7 @@ class OC_FileCache{
$query=OC_DB::prepare($sql);
$result=$query->execute($arguments);
if(OC_DB::isError($result)){
- OC_Log::write('files','error while updating file('.$path.') in cache',OC_Log::ERROR);
+ OC_Log::write('files','error while updating file('.$id.') in cache',OC_Log::ERROR);
}
}
@@ -303,7 +303,7 @@ class OC_FileCache{
*/
public static function increaseSize($path,$sizeDiff, $root=false){
if($sizeDiff==0) return;
- $id=self::getId($path,'');
+ $id=self::getId($path,$root);
while($id!=-1){//walk up the filetree increasing the size of all parent folders
$query=OC_DB::prepare('UPDATE *PREFIX*fscache SET size=size+? WHERE id=?');
$query->execute(array($sizeDiff,$id));
diff --git a/lib/filecache/update.php b/lib/filecache/update.php
index dd77f491ca0..93b632acb4e 100644
--- a/lib/filecache/update.php
+++ b/lib/filecache/update.php
@@ -207,7 +207,6 @@ class OC_FileCache_Update{
$cached=OC_FileCache_Cached::get($oldPath,$root);
$oldSize=$cached['size'];
- $size=$view->filesize($newPath);
OC_FileCache::increaseSize(dirname($oldPath),-$oldSize,$root);
OC_FileCache::increaseSize(dirname($newPath),$oldSize,$root);
OC_FileCache::move($oldPath,$newPath);
diff --git a/lib/filestorage.php b/lib/filestorage.php
index 71ef4aed00b..e786127d525 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -24,7 +24,7 @@
* Provde a common interface to all different storage options
*/
abstract class OC_Filestorage{
- public function __construct($parameters){}
+ abstract public function __construct($parameters);
abstract public function mkdir($path);
abstract public function rmdir($path);
abstract public function opendir($path);
diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php
index ba78fca80e5..fd389d3e2d7 100644
--- a/lib/filestorage/common.php
+++ b/lib/filestorage/common.php
@@ -220,7 +220,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
}
$tmpFile=OC_Helper::tmpFile($extension);
$target=fopen($tmpFile,'w');
- $count=OC_Helper::streamCopy($source,$target);
+ OC_Helper::streamCopy($source,$target);
return $tmpFile;
}
// abstract public function touch($path, $mtime=null);
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php
index b2eba051515..d60f32b15be 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -4,7 +4,6 @@
*/
class OC_Filestorage_Local extends OC_Filestorage_Common{
protected $datadir;
- private static $mimetypes=null;
public function __construct($arguments){
$this->datadir=$arguments['datadir'];
if(substr($this->datadir,-1)!=='/'){
@@ -41,7 +40,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
}
public function filesize($path){
if($this->is_dir($path)){
- return $this->getFolderSize($path);
+ return 0;
}else{
return filesize($this->datadir.$path);
}
@@ -157,7 +156,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
return $return;
}
- public function hash($type,$path,$raw){
+ public function hash($path,$type,$raw=false){
return hash_file($type,$this->datadir.$path,$raw);
}
@@ -187,15 +186,6 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
}
/**
- * @brief get the size of folder and it's content
- * @param string $path file path
- * @return int size of folder and it's content
- */
- public function getFolderSize($path){
- return 0;//depricated, use OC_FileCach instead
- }
-
- /**
* check if a file or folder has been updated since $time
* @param int $time
* @return bool
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 65318fa3ab6..ec30ffb8f4c 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -46,9 +46,10 @@
class OC_Filesystem{
static private $storages=array();
static private $mounts=array();
- static private $storageTypes=array();
public static $loaded=false;
- private $fakeRoot='';
+ /**
+ * @var OC_Filestorage $defaultInstance
+ */
static private $defaultInstance;
@@ -155,7 +156,8 @@ class OC_Filesystem{
}
$path=str_replace('//', '/',$path);
$foundMountPoint='';
- foreach(OC_Filesystem::$mounts as $mountpoint=>$storage){
+ $mountPoints=array_keys(OC_Filesystem::$mounts);
+ foreach($mountPoints as $mountpoint){
if($mountpoint==$path){
return $mountpoint;
}
@@ -260,10 +262,7 @@ class OC_Filesystem{
* tear down the filesystem, removing all storage providers
*/
static public function tearDown(){
- foreach(self::$storages as $mountpoint=>$storage){
- unset(self::$storages[$mountpoint]);
- }
- $fakeRoot='';
+ self::$storages=array();
}
/**
@@ -287,7 +286,7 @@ class OC_Filesystem{
* @return bool
*/
static public function chroot($fakeRoot){
- return self::$defaultInstance->chroot($path);
+ return self::$defaultInstance->chroot($fakeRoot);
}
/**
@@ -320,22 +319,8 @@ class OC_Filesystem{
if(substr($mountpoint,-1)!=='/'){
$mountpoint=$mountpoint.'/';
}
- if (self::getView() != null && $mountpoint != '/' && !self::is_dir(basename($mountpoint))) {
- self::mkdir(basename($mountpoint));
- }
self::$mounts[$mountpoint]=array('class'=>$class,'arguments'=>$arguments);
}
-
- /**
- * create all storage backends mounted in the filesystem
- */
- static private function mountAll(){
- foreach(self::$mounts as $mountPoint=>$mount){
- if(!isset(self::$storages[$mountPoint])){
- self::$storages[$mountPoint]=self::createStorage($mount['type'],$mount['arguments']);
- }
- }
- }
/**
* return the path to a local version of the file
@@ -485,9 +470,17 @@ class OC_Filesystem{
* @return bool
*/
static public function hasUpdated($path,$time){
- return self::$defaultInstance->hasUpdated($path);
+ return self::$defaultInstance->hasUpdated($path,$time);
+ }
+
+ static public function removeETagHook($params) {
+ $path=$params['path'];
+ OC_Connector_Sabre_Node::removeETagPropertyForFile($path);
}
}
+OC_Hook::connect('OC_Filesystem','post_write', 'OC_Filesystem','removeETagHook');
+OC_Hook::connect('OC_Filesystem','post_delete','OC_Filesystem','removeETagHook');
+OC_Hook::connect('OC_Filesystem','post_rename','OC_Filesystem','removeETagHook');
OC_Util::setupFS();
require_once('filecache.php');
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 448663bb081..a23d7bbe7fd 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -393,7 +393,7 @@ class OC_FilesystemView {
return $this->basicOperation('getMimeType',$path);
}
public function hash($type,$path){
- return $this->basicOperation('hash',$path,array('read'));
+ return $this->basicOperation('hash',$path,array('read'),$type);
}
public function free_space($path='/'){
diff --git a/lib/group/database.php b/lib/group/database.php
index fb173665eb8..2770ec185c4 100644
--- a/lib/group/database.php
+++ b/lib/group/database.php
@@ -41,7 +41,6 @@
* Class for group management in a SQL Database (e.g. MySQL, SQLite)
*/
class OC_Group_Database extends OC_Group_Backend {
- private $userGroupCache=array();
/**
* @brief Try to create a new group
@@ -116,7 +115,7 @@ class OC_Group_Database extends OC_Group_Backend {
// No duplicate entries!
if( !$this->inGroup( $uid, $gid )){
$query = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" );
- $result = $query->execute( array( $uid, $gid ));
+ $query->execute( array( $uid, $gid ));
return true;
}else{
return false;
@@ -133,7 +132,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public function removeFromGroup( $uid, $gid ){
$query = OC_DB::prepare( "DELETE FROM *PREFIX*group_user WHERE uid = ? AND gid = ?" );
- $result = $query->execute( array( $uid, $gid ));
+ $query->execute( array( $uid, $gid ));
return true;
}
diff --git a/lib/group/dummy.php b/lib/group/dummy.php
index 0825b10708a..1243891023f 100644
--- a/lib/group/dummy.php
+++ b/lib/group/dummy.php
@@ -126,7 +126,8 @@ class OC_Group_Dummy extends OC_Group_Backend {
*/
public function getUserGroups($uid){
$groups=array();
- foreach($this->groups as $group=>$user){
+ $allGroups=array_keys($this->groups);
+ foreach($allGroups as $group){
if($this->inGroup($uid,$group)){
$groups[]=$group;
}
diff --git a/lib/group/example.php b/lib/group/example.php
index c18562db7a4..9c9ece5ac77 100644
--- a/lib/group/example.php
+++ b/lib/group/example.php
@@ -34,7 +34,7 @@ abstract class OC_Group_Example {
* Trys to create a new group. If the group name already exists, false will
* be returned.
*/
- public static function createGroup($gid){}
+ abstract public static function createGroup($gid);
/**
* @brief delete a group
@@ -43,7 +43,7 @@ abstract class OC_Group_Example {
*
* Deletes a group and removes it from the group_user-table
*/
- public static function deleteGroup($gid){}
+ abstract public static function deleteGroup($gid);
/**
* @brief is user in group?
@@ -53,7 +53,7 @@ abstract class OC_Group_Example {
*
* Checks whether the user is member of a group or not.
*/
- public static function inGroup($uid, $gid){}
+ abstract public static function inGroup($uid, $gid);
/**
* @brief Add a user to a group
@@ -63,7 +63,7 @@ abstract class OC_Group_Example {
*
* Adds a user to a group.
*/
- public static function addToGroup($uid, $gid){}
+ abstract public static function addToGroup($uid, $gid);
/**
* @brief Removes a user from a group
@@ -73,7 +73,7 @@ abstract class OC_Group_Example {
*
* removes the user from a group.
*/
- public static function removeFromGroup($uid,$gid){}
+ abstract public static function removeFromGroup($uid,$gid);
/**
* @brief Get all groups a user belongs to
@@ -83,7 +83,7 @@ abstract class OC_Group_Example {
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
*/
- public static function getUserGroups($uid){}
+ abstract public static function getUserGroups($uid);
/**
* @brief get a list of all groups
@@ -91,19 +91,19 @@ abstract class OC_Group_Example {
*
* Returns a list with all groups
*/
- public static function getGroups(){}
+ abstract public static function getGroups();
/**
* check if a group exists
* @param string $gid
* @return bool
*/
- public function groupExists($gid){}
+ abstract public function groupExists($gid);
/**
* @brief get a list of all users in a group
* @returns array with user ids
*/
- public static function usersInGroup($gid){}
+ abstract public static function usersInGroup($gid);
}
diff --git a/lib/helper.php b/lib/helper.php
index 0d18098a4e7..c4f7e8b2e19 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -676,10 +676,10 @@ class OC_Helper {
*/
public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {
$offset = -1;
- $length = mb_strlen($search, 'UTF-8');
- while(($i = mb_strrpos($subject, $search, $offset, 'UTF-8'))) {
+ $length = mb_strlen($search, $encoding);
+ while(($i = mb_strrpos($subject, $search, $offset, $encoding))) {
$subject = OC_Helper::mb_substr_replace($subject, $replace, $i, $length);
- $offset = $i - mb_strlen($subject, 'UTF-8') - 1;
+ $offset = $i - mb_strlen($subject, $encoding) - 1;
$count++;
}
return $subject;
diff --git a/lib/image.php b/lib/image.php
index 01e843d8316..c438b3d67f6 100644
--- a/lib/image.php
+++ b/lib/image.php
@@ -24,8 +24,8 @@
//From user comments at http://dk2.php.net/manual/en/function.exif-imagetype.php
if ( ! function_exists( 'exif_imagetype' ) ) {
function exif_imagetype ( $filename ) {
- if ( ( list($width, $height, $type, $attr) = getimagesize( $filename ) ) !== false ) {
- return $type;
+ if ( ( $info = getimagesize( $filename ) ) !== false ) {
+ return $info[2];
}
return false;
}
@@ -364,7 +364,7 @@ class OC_Image {
public function load($imageref) {
if(is_resource($imageref)) {
if(get_resource_type($imageref) == 'gd') {
- $this->resource = $res;
+ $this->resource = $imageref;
return $this->resource;
} elseif(in_array(get_resource_type($imageref), array('file','stream'))) {
return $this->loadFromFileHandle($imageref);
@@ -650,9 +650,6 @@ class OC_Image {
OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
- $width_orig=imageSX($this->resource);
- $height_orig=imageSY($this->resource);
- //OC_Log::write('core',__METHOD__.'(): Original size: '.$width_orig.'x'.$height_orig, OC_Log::DEBUG);
$process = imagecreatetruecolor($w, $h);
if ($process == false) {
OC_Log::write('core',__METHOD__.'(): Error creating true color image',OC_Log::ERROR);
diff --git a/lib/l10n.php b/lib/l10n.php
index de8514573d3..e7f5ffea0e4 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -154,8 +154,15 @@ class OC_L10N{
*
* Returns the translation. If no translation is found, $textArray will be
* returned.
+ *
+ *
+ * @deprecated deprecated since ownCloud version 5.0
+ * This method will probably be removed with ownCloud 6.0
+ *
+ *
*/
public function tA($textArray){
+ OC_Log::write('core', 'DEPRECATED: the method tA is deprecated and will be removed soon.',OC_Log::WARN);
$result = array();
foreach($textArray as $key => $text){
$result[$key] = (string)$this->t($text);
diff --git a/lib/migrate.php b/lib/migrate.php
index f788a637d3c..1b6367ed6ec 100644
--- a/lib/migrate.php
+++ b/lib/migrate.php
@@ -91,7 +91,7 @@ class OC_Migrate{
if( self::$exporttype == 'user' ){
// Check user exists
if( !is_null($uid) ){
- $db = new OC_User_Database;
+ $db = new OC_User_Database;
if( !$db->userExists( $uid ) ){
OC_Log::write('migration', 'User: '.$uid.' is not in the database and so cannot be exported.', OC_Log::ERROR);
return json_encode( array( 'success' => false ) );
diff --git a/lib/ocs.php b/lib/ocs.php
index 1be41202d78..77dd437d6c6 100644
--- a/lib/ocs.php
+++ b/lib/ocs.php
@@ -88,7 +88,6 @@ class OC_OCS {
$method='get';
}elseif($_SERVER['REQUEST_METHOD'] == 'PUT') {
$method='put';
- parse_str(file_get_contents("php://input"),$put_vars);
}elseif($_SERVER['REQUEST_METHOD'] == 'POST') {
$method='post';
}else{
@@ -356,9 +355,6 @@ class OC_OCS {
* @return string xml/json
*/
private static function apiConfig($format) {
- $user=OC_OCS::checkpassword(false);
- $url=substr(OCP\Util::getServerHost().$_SERVER['SCRIPT_NAME'],0,-11).'';
-
$xml['version']='1.5';
$xml['website']='ownCloud';
$xml['host']=OCP\Util::getServerHost();
@@ -416,7 +412,7 @@ class OC_OCS {
*/
private static function activityPut($format,$message) {
// not implemented in ownCloud
- $user=OC_OCS::checkpassword();
+ OC_OCS::checkpassword();
echo(OC_OCS::generatexml($format,'ok',100,''));
}
diff --git a/lib/ocsclient.php b/lib/ocsclient.php
index 951d761d7e6..ae35470cff6 100644
--- a/lib/ocsclient.php
+++ b/lib/ocsclient.php
@@ -71,7 +71,7 @@ class OC_OCSClient{
$tmp=$data->data;
$cats=array();
- foreach($tmp->category as $key=>$value) {
+ foreach($tmp->category as $value) {
$id= (int) $value->id;
$name= (string) $value->name;
diff --git a/lib/preferences.php b/lib/preferences.php
index f72378ce94f..c91423e69bc 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -165,7 +165,7 @@ class OC_Preferences{
public static function deleteKey( $user, $app, $key ){
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' );
- $result = $query->execute( array( $user, $app, $key ));
+ $query->execute( array( $user, $app, $key ));
return true;
}
@@ -181,7 +181,7 @@ class OC_Preferences{
public static function deleteApp( $user, $app ){
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' );
- $result = $query->execute( array( $user, $app ));
+ $query->execute( array( $user, $app ));
return true;
}
@@ -196,7 +196,7 @@ class OC_Preferences{
public static function deleteUser( $user ){
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ?' );
- $result = $query->execute( array( $user ));
+ $query->execute( array( $user ));
return true;
}
@@ -211,7 +211,7 @@ class OC_Preferences{
public static function deleteAppFromAllUsers( $app ){
// No need for more comments
$query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid = ?' );
- $result = $query->execute( array( $app ));
+ $query->execute( array( $app ));
return true;
}
diff --git a/lib/public/app.php b/lib/public/app.php
index 38c51af9cdb..28411933beb 100644
--- a/lib/public/app.php
+++ b/lib/public/app.php
@@ -34,28 +34,6 @@ namespace OCP;
* This class provides functions to manage apps in ownCloud
*/
class App {
-
- /**
- * @brief Makes owncloud aware of this app
- * @brief This call is deprecated and not necessary to use.
- * @param $data array with all information
- * @returns true/false
- *
- * This function registers the application. $data is an associative array.
- * The following keys are required:
- * - id: id of the application, has to be unique ('addressbook')
- * - name: Human readable name ('Addressbook')
- * - version: array with Version (major, minor, bugfix) ( array(1, 0, 2))
- *
- * The following keys are optional:
- * - order: integer, that influences the position of your application in
- * a list of applications. Lower values come first.
- *
- */
- public static function register( $data ){
- }
-
-
/**
* @brief adds an entry to the navigation
* @param $data array containing the data
diff --git a/lib/public/json.php b/lib/public/json.php
index 1bc1e3ab4d5..99df79173eb 100644
--- a/lib/public/json.php
+++ b/lib/public/json.php
@@ -35,70 +35,137 @@ namespace OCP;
*/
class JSON {
-
/**
* @brief Encode and print $data in JSON format
* @param array $data The data to use
* @param string $setContentType the optional content type
+ * @return string json formatted string.
*/
public static function encodedPrint( $data, $setContentType=true ){
return(\OC_JSON::encodedPrint( $data, $setContentType ));
}
-
/**
- * @brief Check if the user is logged in, send json error msg if not
+ * Check if the user is logged in, send json error msg if not.
+ *
+ * This method checks if a user is logged in. If not, a json error
+ * response will be return and the method will exit from execution
+ * of the script.
+ * The returned json will be in the format:
+ *
+ * {"status":"error","data":{"message":"Authentication error."}}
+ *
+ * Add this call to the start of all ajax method files that requires
+ * an authenticated user.
+ *
+ * @return string json formatted error string if not authenticated.
*/
public static function checkLoggedIn(){
return(\OC_JSON::checkLoggedIn());
}
/**
- * @brief Check an ajax get/post call if the request token is valid.
- * @return json Error msg if not valid.
- */
+ * Check an ajax get/post call if the request token is valid.
+ *
+ * This method checks for a valid variable 'requesttoken' in $_GET,
+ * $_POST and $_SERVER. If a valid token is not found, a json error
+ * response will be return and the method will exit from execution
+ * of the script.
+ * The returned json will be in the format:
+ *
+ * {"status":"error","data":{"message":"Token expired. Please reload page."}}
+ *
+ * Add this call to the start of all ajax method files that creates,
+ * updates or deletes anything.
+ * In cases where you e.g. use an ajax call to load a dialog containing
+ * a submittable form, you will need to add the requesttoken first as a
+ * parameter to the ajax call, then assign it to the template and finally
+ * add a hidden input field also named 'requesttoken' containing the value.
+ *
+ * @return string json formatted error string if not valid.
+ */
public static function callCheck(){
return(\OC_JSON::callCheck());
}
/**
- * @brief Send json success msg
+ * Send json success msg
+ *
+ * Return a json success message with optional extra data.
+ * @see OCP\JSON::error() for the format to use.
+ *
* @param array $data The data to use
+ * @return string json formatted string.
*/
public static function success( $data = array() ){
return(\OC_JSON::success( $data ));
}
-
/**
- * @brief Send json error msg
+ * Send json error msg
+ *
+ * Return a json error message with optional extra data for
+ * error message or app specific data.
+ *
+ * Example use:
+ *
+ * $id = [some value]
+ * OCP\JSON::error(array('data':array('message':'An error happened', 'id': $id)));
+ *
+ * Will return the json formatted string:
+ *
+ * {"status":"error","data":{"message":"An error happened", "id":[some value]}}
+ *
* @param array $data The data to use
+ * @return string json formatted error string.
*/
public static function error( $data = array() ){
return(\OC_JSON::error( $data ));
}
-
/**
- * @brief set Content-Type header to jsonrequest
- * @param array $type The contwnt type header
- */
+ * @brief set Content-Type header to jsonrequest
+ * @param array $type The contwnt type header
+ * @return string json formatted string.
+ */
public static function setContentTypeHeader( $type='application/json' ){
return(\OC_JSON::setContentTypeHeader( $type ));
}
-
/**
- * @brief Check if the App is enabled and send JSON error message instead
- * @param string $app The app to check
- */
+ * Check if the App is enabled and send JSON error message instead
+ *
+ * This method checks if a specific app is enabled. If not, a json error
+ * response will be return and the method will exit from execution
+ * of the script.
+ * The returned json will be in the format:
+ *
+ * {"status":"error","data":{"message":"Application is not enabled."}}
+ *
+ * Add this call to the start of all ajax method files that requires
+ * a specific app to be enabled.
+ *
+ * @param string $app The app to check
+ * @return string json formatted string if not enabled.
+ */
public static function checkAppEnabled( $app ){
return(\OC_JSON::checkAppEnabled( $app ));
}
-
/**
- * @brief Check if the user is a admin, send json error msg if not
+ * Check if the user is a admin, send json error msg if not
+ *
+ * This method checks if the current user has admin rights. If not, a json error
+ * response will be return and the method will exit from execution
+ * of the script.
+ * The returned json will be in the format:
+ *
+ * {"status":"error","data":{"message":"Authentication error."}}
+ *
+ * Add this call to the start of all ajax method files that requires
+ * administrative rights.
+ *
+ * @return string json formatted string if not admin user.
*/
public static function checkAdminUser(){
return(\OC_JSON::checkAdminUser());
diff --git a/lib/search/provider.php b/lib/search/provider.php
index 838ab696d04..b3ee79b4770 100644
--- a/lib/search/provider.php
+++ b/lib/search/provider.php
@@ -2,13 +2,17 @@
/**
* provides search functionalty
*/
-class OC_Search_Provider {
- public function __construct($options){}
+abstract class OC_Search_Provider {
+ private $options;
+
+ public function __construct($options){
+ $this->options=$options;
+ }
/**
* search for $query
* @param string $query
* @return array An array of OC_Search_Result's
*/
- public function search($query){}
+ abstract public function search($query);
}
diff --git a/lib/setup.php b/lib/setup.php
index 027c84db092..4d71bed86e2 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -102,7 +102,6 @@ class OC_Setup {
}
else {
$oldUser=OC_Config::getValue('dbuser', false);
- $oldPassword=OC_Config::getValue('dbpassword', false);
$query="SELECT user FROM mysql.user WHERE user='$dbuser'"; //this should be enough to check for admin rights in mysql
if(mysql_query($query, $connection)) {
diff --git a/lib/streamwrappers.php b/lib/streamwrappers.php
index f1e0fa0e1d9..f502c6170bd 100644
--- a/lib/streamwrappers.php
+++ b/lib/streamwrappers.php
@@ -1,6 +1,4 @@
<?php
-global $FAKEDIRS;
-$FAKEDIRS=array();
class OC_FakeDirStream{
public static $dirs=array();
@@ -8,8 +6,6 @@ class OC_FakeDirStream{
private $index;
public function dir_opendir($path,$options){
- global $FAKEDIRS;
- $url=parse_url($path);
$this->name=substr($path,strlen('fakedir://'));
$this->index=0;
if(!isset(self::$dirs[$this->name])){
@@ -161,7 +157,6 @@ class OC_StaticStreamWrapper {
public function stream_write($data) {
if (!$this->writable) return 0;
$size = strlen($data);
- $len = strlen(self::$data[$this->path]);
if ($this->stream_eof()) {
self::$data[$this->path] .= $data;
} else {
diff --git a/lib/template.php b/lib/template.php
index 3b48c27b9b4..5b6999af533 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -82,7 +82,6 @@ function relative_modified_date($timestamp) {
$diffhours = round($diffminutes/60);
$diffdays = round($diffhours/24);
$diffmonths = round($diffdays/31);
- $diffyears = round($diffdays/365);
if($timediff < 60) { return $l->t('seconds ago'); }
else if($timediff < 120) { return $l->t('1 minute ago'); }
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index d33a87e9e4c..588a7845997 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -123,7 +123,7 @@ class OC_TemplateLayout extends OC_Template {
elseif(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style.css")) { $append =true; break; }
}
if(! $append) {
- echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
+ echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
die();
}
}
diff --git a/lib/user.php b/lib/user.php
index f1903093d6d..356be4decf9 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -50,8 +50,8 @@ class OC_User {
*
* Makes a list of backends that can be used by other modules
*/
- public static function registerBackend( $name ){
- self::$_backends[] = $name;
+ public static function registerBackend( $backend ){
+ self::$_backends[] = $backend;
return true;
}
@@ -83,22 +83,26 @@ class OC_User {
* Set the User Authentication Module
*/
public static function useBackend( $backend = 'database' ){
- // You'll never know what happens
- if( null === $backend OR !is_string( $backend )){
- $backend = 'database';
- }
+ if($backend instanceof OC_User_Backend){
+ self::$_usedBackends[get_class($backend)]=$backend;
+ }else{
+ // You'll never know what happens
+ if( null === $backend OR !is_string( $backend )){
+ $backend = 'database';
+ }
- // Load backend
- switch( $backend ){
- case 'database':
- case 'mysql':
- case 'sqlite':
- self::$_usedBackends[$backend] = new OC_User_Database();
- break;
- default:
- $className = 'OC_USER_' . strToUpper($backend);
- self::$_usedBackends[$backend] = new $className();
- break;
+ // Load backend
+ switch( $backend ){
+ case 'database':
+ case 'mysql':
+ case 'sqlite':
+ self::$_usedBackends[$backend] = new OC_User_Database();
+ break;
+ default:
+ $className = 'OC_USER_' . strToUpper($backend);
+ self::$_usedBackends[$backend] = new $className();
+ break;
+ }
}
true;
@@ -200,7 +204,7 @@ class OC_User {
if( $run ){
$uid=self::checkPassword( $uid, $password );
if($uid){
- session_regenerate_id();
+ session_regenerate_id(true);
self::setUserId($uid);
OC_Hook::emit( "OC_User", "post_login", array( "uid" => $uid, 'password'=>$password ));
return true;
diff --git a/lib/user/database.php b/lib/user/database.php
index a48b8357d64..cc27b3ddbfd 100644
--- a/lib/user/database.php
+++ b/lib/user/database.php
@@ -39,7 +39,6 @@ require_once 'phpass/PasswordHash.php';
* Class for user management in a SQL Database (e.g. MySQL, SQLite)
*/
class OC_User_Database extends OC_User_Backend {
- static private $userGroupCache=array();
/**
* @var PasswordHash
*/
@@ -87,7 +86,7 @@ class OC_User_Database extends OC_User_Backend {
public function deleteUser( $uid ){
// Delete user-group-relation
$query = OC_DB::prepare( "DELETE FROM `*PREFIX*users` WHERE uid = ?" );
- $result = $query->execute( array( $uid ));
+ $query->execute( array( $uid ));
return true;
}
@@ -104,11 +103,10 @@ class OC_User_Database extends OC_User_Backend {
$hasher=$this->getHasher();
$hash = $hasher->HashPassword($password.OC_Config::getValue('passwordsalt', ''));
$query = OC_DB::prepare( "UPDATE *PREFIX*users SET password = ? WHERE uid = ?" );
- $result = $query->execute( array( $hash, $uid ));
+ $query->execute( array( $hash, $uid ));
return true;
- }
- else{
+ }else{
return false;
}
}
diff --git a/lib/user/example.php b/lib/user/example.php
index 7f3fd1b8578..77246d8136c 100644
--- a/lib/user/example.php
+++ b/lib/user/example.php
@@ -35,9 +35,7 @@ abstract class OC_User_Example extends OC_User_Backend {
* Creates a new user. Basic checking of username is done in OC_User
* itself, not in its subclasses.
*/
- public function createUser($uid, $password){
- return OC_USER_BACKEND_NOT_IMPLEMENTED;
- }
+ abstract public function createUser($uid, $password);
/**
* @brief Set password
@@ -47,9 +45,7 @@ abstract class OC_User_Example extends OC_User_Backend {
*
* Change the password of a user
*/
- public function setPassword($uid, $password){
- return OC_USER_BACKEND_NOT_IMPLEMENTED;
- }
+ abstract public function setPassword($uid, $password);
/**
* @brief Check if the password is correct
@@ -60,7 +56,5 @@ abstract class OC_User_Example extends OC_User_Backend {
* Check if the password is correct without logging in the user
* returns the user id or false
*/
- public function checkPassword($uid, $password){
- return OC_USER_BACKEND_NOT_IMPLEMENTED;
- }
+ abstract public function checkPassword($uid, $password);
}
diff --git a/lib/util.php b/lib/util.php
index 2a7b8a922f9..f35e5a18e42 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -189,8 +189,6 @@ class OC_Util {
if(!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect')){
$errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>','hint'=>'');//TODO: sane hint
}
- $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
- $CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" );
//common hint for all file permissons error messages
$permissionsHint="Permissions can usually be fixed by giving the webserver write access to the ownCloud directory";
diff --git a/tests/index.php b/tests/index.php
index e91b3f0da56..0be27ee3fd7 100644
--- a/tests/index.php
+++ b/tests/index.php
@@ -26,23 +26,28 @@ require_once 'simpletest/mock_objects.php';
require_once 'simpletest/collector.php';
require_once 'simpletest/default_reporter.php';
-// test suite instance
-$testSuite=new TestSuite("ownCloud Unit Test Suite");
+$testSuiteName="ownCloud Unit Test Suite";
// prepare the reporter
if(OC::$CLI){
$reporter=new TextReporter;
$test=isset($_SERVER['argv'][1])?$_SERVER['argv'][1]:false;
- if($test=='xml')
- {
+ if($test=='xml'){
$reporter= new XmlReporter;
$test=false;
+
+ if(isset($_SERVER['argv'][2])){
+ $testSuiteName=$testSuiteName." (".$_SERVER['argv'][2].")";
+ }
}
}else{
- $reporter='HtmlReporter';
+ $reporter=new HtmlReporter;
$test=isset($_GET['test'])?$_GET['test']:false;
}
+// test suite instance
+$testSuite=new TestSuite($testSuiteName);
+
//load core test cases
loadTests(dirname(__FILE__), $testSuite, $test);
@@ -75,10 +80,10 @@ function loadTests($dir,$testSuite, $test){
}elseif(substr($file,-4)=='.php' and $file!=__FILE__){
$name=getTestName($file);
if($test===false or $test==$name or substr($name,0,strlen($test))==$test){
- $extractor = new SimpleFileLoader();
+ $extractor = new SimpleFileLoader();
$loadedSuite=$extractor->load($file);
if ($loadedSuite->getSize() > 0)
- $testSuite->add($loadedSuite);
+ $testSuite->add($loadedSuite);
}
}
}
diff --git a/tests/lib/cache/file.php b/tests/lib/cache/file.php
index 54e60e6569d..c33c513fcff 100644
--- a/tests/lib/cache/file.php
+++ b/tests/lib/cache/file.php
@@ -30,8 +30,10 @@ class Test_Cache_File extends Test_Cache {
OC_FileProxy::clearProxies();
OC_Hook::clear('OC_Filesystem');
- //enable only the encryption hook
- OC_FileProxy::register(new OC_FileProxy_Encryption());
+ //enable only the encryption hook if needed
+ if(OC_App::isEnabled('files_encryption')){
+ OC_FileProxy::register(new OC_FileProxy_Encryption());
+ }
//set up temporary storage
OC_Filesystem::clearMounts();
diff --git a/tests/lib/user/database.php b/tests/lib/user/database.php
index b2fcce93c5b..f484ffa78f7 100644
--- a/tests/lib/user/database.php
+++ b/tests/lib/user/database.php
@@ -21,7 +21,6 @@
*/
class Test_User_Database extends Test_User_Backend {
- private $user=array();
/**
* get a new unique user name
* test cases can override this in order to clean up created user